Q. of multi-componet system and data from input file

Matthew Knepley knepley at gmail.com
Mon May 12 14:33:27 CDT 2008

2008/5/12 tsjb00 <tsjb00 at hotmail.com>:
>  Hi, there! I am a beginner of PETSc and I have some questions about using PETSc to solve for a multi-componet system. The code is supposed to be applicable to different systems, where number of components, properties of components ,etc. would be input for the program.
>  Say I define DA with dof=number of components = nc, number of grid in x,y,z = nx,ny,nz respectively. When I use DA related functions, it seems that by default the data objects (vectors, arrays, etc.) would be of nx*ny*nz*nc. However, some physical variables are independent of specific components, which means I need to handle data objects of nx*ny*nz*integral. My questions are:
>  Does PETSc include tools or examples to deal with such problems?

Make a new DA for those vectors. DA are extremely small since they
store O(1) data.

>  If not, how can I make sure the 'nx*ny*nz*any integral' data objects are distributed over the nodes in a way defined by DA? I am using PETSc_Decide for partitioning right now. I would prefer that at least the number of processors be flexible.
>  I need to read in a property f(x,y,z) from a data file and then distribute the data across different processors. Any suggestions on this would be appreciated. My concern is that if I use MPI_Send/Receive, the data to be transferred might correspond to discontinuous indices due to the partitioning.

If you store that data in PETSc Vec format, you can just use VecLoad()
and we will distribute everything for you. A
simple way to do this, is to read it in on 1 process, put it in a Vec,
and VecView(). Then you can read it back in on
multiple processes after that.


>  Many thanks in advance!
>  BJ
>  >
>  _________________________________________________________________
>  MSN 中文网,最新时尚生活资讯,白领聚集门户。
>  http://cn.msn.com

What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener

More information about the petsc-users mailing list