[petsc-dev] finite element energy functions

Jed Brown jedbrown at mcs.anl.gov
Mon Dec 2 17:45:10 CST 2013


Matthew Knepley <knepley at gmail.com> writes:
>> DMPlexSNESSetFunctionFEM(), similar to DMDASNESSetFunctionLocal in
>> src/snes/examples/tutorials/ex5.c and ex19.c.
>>
>
> What exactly is the difference? 

You have this badly-namespaced, nebulous function called
DMPlexComputeResidualFEM that the user has to pass to
DMSNESSetFunctionLocal and that has to contain a PetscFEM as its first
element.  That is grotesque, and binding it from Fortran is needlessly
messy.

Meanwhile, the other function would have an interface something like

  DMPlexSNESSetFunctionFEM(DM,PetscFEM);


Note that I would like to get rid of the ugly public struct PetscFEM,
and replace it with a functional interface.  In that case, if you
unified the fs and gs, you could have

  DMPlexSNESSetFunctionFEM(DM,PetscErrorCode (*f)(...),void *ctx);

  DMPlexSNESSetJacobianFEM(DM,PetscErrorCode (*g)(...),void *ctx);

If we want to implicitly sum over multiple functions, the above can be
replaced by arrays of functions, each of which adds some group of terms.
If you do that, there could be a slot for functions computing
intermediate terms (material models), and so on.  Eventually, there will
probably need to be another object to manage the dispatch, because we
need the same thing for finite volume and non-Plex things, but I would
try to keep that object private.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131202/45b92162/attachment.sig>


More information about the petsc-dev mailing list