[petsc-users] DMPlex with AMR

Matthew Knepley knepley at gmail.com
Sun Nov 5 13:04:16 CST 2017

On Sun, Nov 5, 2017 at 1:45 PM, Yann Jobic <yann.jobic at univ-amu.fr> wrote:

> Dear PETSc expert,
> I first correctly solve the advection/diffusion equation, with the
> advection/diffusion of a gaussian, in a rotate field.
> I'm using finit element, with PetscFE and the velocity field is in an
> auxillary one, in order to correctly set the residual and the jacobian.
> Then, i would like to use p4est, with AMR. To do that, I re-use the
> example : "petsc/examples/src/dm/impls/forest/examples/tests/ex2.c"
> I create a "base" DM, which has everything : PetscFE, PetscDS, the
> boundaries, ... Then, i correctly adapt the mesh, by using :
> ierr = DMForestTemplate(base,comm,&postForest);CHKERRQ(ierr);
> ierr = DMForestSetAdaptivityLabel(postForest,adaptLabel);CHKERRQ(ierr);
> My problem is that nothing happens when i'm solving the system, i.e. my
> initial solution does not move, or diffuse.
> That would mean that i didn't correctly transfer the problem definition. I
> tried to attach everything to the adapted mesh, without succes.
> What is the correct way to transfer the problem definition (PetscFE and
> PetscDS) from one DM to another ?

One way to do it is just

 DMGetDS(dm, &prob);
 DMSetDS(newdm, prob);

I think I have this working automatically now in


Check out the test in SNES ex12

  make -f ./gmakefile test
EXTRA_OPTIONS="-dm_adapt_view hdf5:$PWD/adapt.h5"
  ./bin/petsc_gen_xdmf.py adapt.h5

and then look at adapt.xmf in Paraview. This also works if you try it with
simplicial meshes and Pragmatic, see tri_p1_adapt_1.



> Many thanks in advance,
> Regards,
> Yann

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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171105/7929ffd9/attachment-0001.html>

More information about the petsc-users mailing list