On Sun, Jan 19, 2014 at 1:26 PM, Jed Brown <[email protected]> wrote: > Geoffrey Irving <[email protected]> writes: > >> After a brief delay, I'm back to needing finite element energy >> functions for optimization problems. The original thread is >> >> http://lists.mcs.anl.gov/pipermail/petsc-dev/2013-December/014161.html >> >> That thread veered off into some more general discussions of the >> PetscFE API, and I don't think came to a specific conclusion as to the >> best way to add said energy functions. In terms of API, what is >> missing is a function to integrate a function over a space, where the >> functions takes various field arguments and produces one or more >> scalars. The quadrature rule is important: in my case there will be >> only one non-auxiliary field, and the integration function needs to >> use the same quadrature rule. > > I would define a number of quantities and a reducer (MPI_SUM, MPI_MAX).
For anything other than MPI_SUM, the evaluation points would likely want to be different, so the structure of the code would be significantly changed. For example, MPI_MAX probably wants evaluation points at the vertices, which can't be optimally coded using the same code structure used for MPI_SUM (since different elements share vertices). >> I apologize if I failed to read through the previous discussion >> correctly, and/or the required function has already been written. If >> not, I'm happy to mock something up, ideally with function signature >> suggestions from others first. > > What is different from integrating a residual, apart from the result > being a set of scalars instead of a vector? The main difference is that the quadrature rule has to be specified independent of the PetscFE objects, since the PetscFE elements for the different fields might have incompatible quadrature rules. Geoffrey
