This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Project function while using PETScOptions.set('pc_type', 'fieldsplit')

0 votes

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?

asked Dec 5, 2014 by mwelland FEniCS User (8,410 points)

1 Answer

0 votes
 
Best answer

One option may be to use prefixed option and set KrylovSolver's petsc_prefix parameter. But it is tedious to debug.

Cleaner way is to avoid using PETSc options at all and configure your Krylov solver using petsc4py.

answered Dec 5, 2014 by Jan Blechta FEniCS Expert (51,420 points)
selected Dec 5, 2014 by mwelland

Thanks Jan, I tried using petsc4py to configure my main snes solver but found it buggy / not fully capable of doing what I wanted, especially with fieldsplit.

I see what you mean re: the prefix parameter although it looks even less elegant that bracketing the 'project' function. I guess I was hoping for something akin to 'interpolate(c,V_s)' where it would just give me a Function with the local 'c' value at those coordinates.

...