On Wed, Apr 2, 2014 at 8:14 AM, Michael Lange <[email protected]>wrote:
> Hi Matt, > > We are trying to implement fieldsplit for mixed function spaces in > Firedrake. For this we want to compose a set of sections with one field > each into one section with several fields. The is to add a > PetscSectionSetField() function and then use this to build a container > section with something like: > > sec_offset = 0 > msec = PETSc.Section().create() > for i, s in enumerate(spaces): > sec = shift_offsets(s.clone(), sec_offset) > msec.setField(i, sec) > sec_offset += s.getStorageSize() > > We have tried setting this as the DefaultSection in our DM and then > passing this to SNES via SNESSetDM(), but the problem we encountered is > that we get an empty global section, because PetscSectionCreateGlobalSection() > can currently not handle multiple fields. > Global section handles multiple fields, for instance SNES ex62. I am guessing the problem here is that you increment the offsets in the section, but fail to increment the aggregate sizes for each point when you add a field. I personally would not do it this way, although there is nothing wrong with it. I would make descriptions of each discrezation and build the unified Section once. This is what currently happens in ex12 and ex62: - Build PetscFE for each field and call DMAddBoundary() - PetscFE makes numDof[] and DMBoundary gives a set of (field, IS) pairs - Call DMPlexCreateSection() This cannot constrain individual field components, like y-velocity, but we could write a more specific version of DMPlexCreateSection() and upgrade DMAddBoundary() to take field component as well. I will do this myself when PyLith switches over if it does not happen before that. Matt > Do you agree with this approach? And if so, can we make > PetscSectionCreateGlobalSection() aware of fields? > > Thanks, > > Michael > -- 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
