[petsc-users] Setting coordinates

Matthew Knepley knepley at gmail.com
Wed Sep 24 15:09:22 CDT 2014


On Wed, Sep 24, 2014 at 3:03 PM, Alletto, John M <john.m.alletto at lmco.com>
wrotAll,
>
>
> I am trying to inset coordinate data into my program line 160 below comes
> back with a NULL pointer for coordinates.
> I did not expect this - what do I do, what does it mean?
>

Coordinates are not created by default since they take up a lot of memory.
You either create the storage manually, or
use something like this:


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMDASetUniformCoordinates.html

  Thanks,

     Matt


>
> John
>
>
> 140   DM             coordDA;
> 141   Vec            coordinates;
> 142:   DMDACoor3d     ***coords;
> 143:   PetscScalar    u, ux, uy, uxx, uyy;
> 144:   PetscReal      D, K, hx, hy, hxdhy, hydhx;
> 145:   PetscInt       i,j, k;
>
>
> 150:   D      = user->D;
> 151:   K      = user->K;
> 152:   hx     = 1.0/(PetscReal)(info->mx-1);
> 153:   hy     = 1.0/(PetscReal)(info->my-1);
> 154:   hxdhy  = hx/hy;
> 155:   hydhx  = hy/hx;
> 156:   /*
> 157:      Compute function over the locally owned part of the grid
> 158:   */
> 159:   DMGetCoordinateDA(info->da, &coordDA);
> 160:   DMGetCoordinatesLocal(info->da, &coordinates);
> 161:   DMDAVecGetArray(coordDA, coordinates, &coords);
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140924/ea76fe1f/attachment.html>


More information about the petsc-users mailing list