I'm using the PETSc fieldsplit preconditioner to solve my problem, defining fields via pestc4py with a command like:
is0 = PETSc.IS().createGeneral(V.sub(0).dofmap().dofs())
is1 = PETSc.IS().createGeneral(V.sub(1).dofmap().dofs())
where
V = MixedFunctionSpace([V_s, V_vec])
That works fine, but when I go to use the project function on a variable 'c' for example:
project(c, V_s)
I get an error. I think the reason is that project is actually a solve command, and it is still trying to apply the fieldsplit pc despite the other field not being included. If I bracket the project command with
PETScOptions.set('pc_type','asm')
project(c,V_s)
PETScOptions.set('pc_type','fieldsplit')
it works but it is messy. Is there a simpler way?