On 12 May 2010 13:17, Jed Brown <jed at 59a2.org> wrote: > On Wed, 12 May 2010 09:32:23 -0500, Chris Kees <christopher.e.kees at > usace.army.mil> wrote: >> Thanks a lot. Does PCFieldSplitSetFields() implicitly number the >> fields it creates or am I missing something more fundamental e.g. >> >> PCFieldSplitSetFields(pc,isPressure)// field 0 for pressure >> PCFieldSplitSetIS(pc,isVelocity)//field 1 for the 3 velocity components > > You use *either* PCFieldSplitSetFields() or PCFieldSplitSetIS(). ?If > your matrix has a "block size" (e.g. it's BAIJ or you called > MatSetBlockSize) then you can define the split at runtime: > > ?-pc_fieldsplit_0_fields 0 ? ? # pressure is in the first split > ?-pc_fieldsplit_1_fields 1,2,3 # velocity in the second split > > You can set this programmatically with, e.g. > > ?PCFieldSplitSetFields(pc,1,(PetscInt[]){0}); > ?PCFieldSplitSetFields(pc,3,(PetscInt[]){1,2,3}); > > If your spatial discretization does not have a natural block size, you > should call PCFieldSplitSetIS() for both fields. >
Chris is going to use this from Python, and I have to add support in petsc4py. I think I'll have to provide a better API, something like: pc.fieldSplitSetFields(0,[1,2,3],4) # (rho,[Ux,Uy,Uz],p) or pc.fieldSplitSetIS(is_rho, is_U, is_p) and implement then by calling PCFieldSplitSet{Fields|IS} multiple times. Does this API make sense? -- Lisandro Dalcin --------------- CIMEC (INTEC/CONICET-UNL) Predio CONICET-Santa Fe Colectora RN 168 Km 472, Paraje El Pozo Tel: +54-342-4511594 (ext 1011) Tel/Fax: +54-342-4511169