[petsc-users] user defined grids

Barry Smith bsmith at mcs.anl.gov
Thu Mar 3 23:35:06 CST 2016


> On Mar 3, 2016, at 11:19 PM, praveen kumar <praveenpetsc at gmail.com> wrote:
> 
> Thanks Barry. I think I didn’t put the question properly.
> 
> I want to generate a 3D non uniform grid. I went through the archieves and read about DMSetCoordinates. As I have large No. of grid points, it is difficult to assign coordinates manually.

  Is it a grid that is just stretched in the x, y, and z directions (so that the actual amount of data is just the nx, ny, and nz coordinate values) or is the grid twisted so that the amount of data in your file is nx*ny*nz (that is each grid point must be defined in the file)?

   If it is just stretched then have process zero read the x, y, and z spaces and send them all to all the processes (this is just nx + ny + nz data so small). Then have each process fill up its coordinate values using the part of the sent values that it needs. It can determine that part it needs by using DMDAGetCorners() to tell the start and end in each coordinate direction of the values.

   Barry

> 
> 
> Thanks,
> 
> Praveen
> 
> 
> On Thu, Mar 3, 2016 at 12:21 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
> > On Mar 2, 2016, at 9:01 AM, praveen kumar <praveenpetsc at gmail.com> wrote:
> >
> > Dear all,
> >
> > I am employing PETSc for DD in a serial fortran code and I would be using the solver from serial code itself. In my programme there is subroutine which reads an input file for the grids.  I have two questions:
> >
> >
> >
> > 1.  The input file contains : No. of segments in each direction, Length of each segment, Grid expansion ratio for each segment, dx(min) and dx(max) (min and max size of sub-division for each segment),
> 
>    I don't understand what this grid expansion ratio means.
> 
> > No. of uniform sub-divisions in each segment. Will I be able to include all these details in DMDAcreate3D?
> 
>    The DMDACreate3d() only defines the topology of the mesh (number of mesh points in each direction etc), not the geometry. If you want to provide geometry information (i.e. length of grid segments) then you use DMDAGetCoordinateArray() to set the local values. See DMDAVecGetArray for the form of the "coordinates" array.
> 
> >  Is there any example? If no, then is there any way to retain the input file section and still use PETSc?
> 
>    Should be possible but you will need to do a little programming and poking around to use all the information.
> 
>   Barry
> 
> >
> >
> >
> > 2. Moreover application requires that, I call the Grid subroutine after some fixed number of iterations.
> >
> >
> >
> > Would you suggest how to fix the above two?
> >
> >
> >
> > Thanks,
> >
> > Praveen
> >
> 
> 



More information about the petsc-users mailing list