[petsc-users] DM coordinates interpolations

Matthew Knepley knepley at gmail.com
Fri Jun 26 13:06:44 CDT 2015


On Fri, Jun 26, 2015 at 12:27 PM, Gianluca Meneghello <gianmail at gmail.com>
wrote:

> Dear all,
>
> I would like to solve a PDE discretized on a nonuniform --- but
> rectangular --- grid and I wanted to use the DM coordinates vector to
> compute the metric terms by finite difference. The only alternative I see
> is to recompute the coordinates (and then the metric terms) at every
> function and jacobian evaluation call.
>
> My question is what is the best (or even correct) way to provide the
> coordinates to the newly created da objects. Is there anything like a
> DMDASetNonUniformCoordinates to which to pass a function computing the
> coordinates? As far as I can tell the fine grid coordinates are currently
> linearly interpolated from the coarse grid ones.
>

We do not have that function, however you can operate on the coordinate
vector the same as you would any other vector, namely
you call DMDAVecGetArrayDOF() on the coordinate vector, write your nested
loops over the vertices, and set coords[k][j][i][d] to
the d-th coordinate of the point.

You can ask for the interpolator from the coordinate DM to project these to
coarse levels, or just set them directly.

Does this make sense?

  Thanks,

    Matt


> Please also let me thank you for your great work: it has been and it
> currently is of enormous help.
>
> Best
>
> Gianluca
>



-- 
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/20150626/66cb4861/attachment.html>


More information about the petsc-users mailing list