Many thanks for your help! ---------------------------------------- > From: bsmith at mcs.anl.gov > To: petsc-users at mcs.anl.gov > Subject: Re: Q. of multi-componet system and data from input file > Date: Mon, 12 May 2008 19:07:33 -0500 > > > On May 12, 2008, at 1:59 PM, tsjb00 wrote: > >> >> 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? >> >> 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 do not understand your question but here is a stab at it. For > each different nc you need in your code you simply create a different > DA. For example if you have > two fields you want together and also have three fields together you > would create one DA for the 2 dof and one for the 3 dof. Adding a > couple more DA's won't take > much memory or time. > > You can use DAVecGetArray() to access the values for a fixed dof, > if sometimes you want nc to be different for different runs within the > same > loops you can use DAVecGetArrayDOF(). You access values via x[k][j][i] > [l] where l goes from 0 to dof-1 for the dof that you used to create > the DA. > > Barry > >> >> >> 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. >> >> Many thanks in advance! >> >> BJ >> >>> >> >> _________________________________________________________________ >> MSN ???????????????????? >> http://cn.msn.com >> >> >
_________________________________________________________________ Windows Live Photo gallery ????????????????????????????? http://get.live.cn/product/photo.html
