Hi all, Say if I had this mixed function space: parameters["matnest"] = False Q = FunctionSpace(mesh,"CG",1) W = Q*Q*Q u1,u2,u3 = TrialFunctions(W) v1,v2,v3 = TestFunctions(W) What will the corresponding global matrix format be? Will it be of type MATMPIBAIJ of block size 3? Or will it simply be a monolithic MATMPIAIJ matrix? Thanks, Justin
On 14 Jan 2016, at 07:34, Justin Chang <jychang48@gmail.com> wrote:
Hi all,
Say if I had this mixed function space:
parameters["matnest"] = False Q = FunctionSpace(mesh,"CG",1) W = Q*Q*Q u1,u2,u3 = TrialFunctions(W) v1,v2,v3 = TestFunctions(W)
What will the corresponding global matrix format be? Will it be of type MATMPIBAIJ of block size 3? Or will it simply be a monolithic MATMPIAIJ matrix?
It will be an mpiaij matrix. Due to how we build the dof maps, baij does not work here because successive dofs from the different fields in the mixed space do not live next to one another. Lawrence
Thanks, Justin _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
Ah I figured. Is it possible to one day add a feature where one could achieve BAIJ format if the fields all belong to same function space? I think there was a way to do this in DMPlex last I spoke with Matt Thanks, Justin On Thursday, January 14, 2016, Lawrence Mitchell < lawrence.mitchell@imperial.ac.uk> wrote:
On 14 Jan 2016, at 07:34, Justin Chang <jychang48@gmail.com <javascript:;>> wrote:
Hi all,
Say if I had this mixed function space:
parameters["matnest"] = False Q = FunctionSpace(mesh,"CG",1) W = Q*Q*Q u1,u2,u3 = TrialFunctions(W) v1,v2,v3 = TestFunctions(W)
What will the corresponding global matrix format be? Will it be of type MATMPIBAIJ of block size 3? Or will it simply be a monolithic MATMPIAIJ matrix?
It will be an mpiaij matrix. Due to how we build the dof maps, baij does not work here because successive dofs from the different fields in the mixed space do not live next to one another.
Lawrence
Thanks, Justin _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk <javascript:;> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk <javascript:;> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
On 14/01/16 08:24, Justin Chang wrote:
Ah I figured.
Is it possible to one day add a feature where one could achieve BAIJ format if the fields all belong to same function space? I think there was a way to do this in DMPlex last I spoke with Matt
Probably. So what we do is this: Build a dofmap for each of the individual spaces (via dmplex). The mixed space is then just a bag of individual spaces and dofmaps. When assembling into the matrices we use MatCreateLocalSubMatrix. See the comment here https://github.com/OP2/PyOP2/blob/master/pyop2/petsc_base.py#L157 describing the field ordering (for simplicity I use the /same/ field ordering for the monolithic and the nested matrices). If one wants a different field ordering for monolithic matrices, these lgmaps need changing. But, that's not all, a Function on a mixed space is actually just a bag of Functions on the subspaces, so the data is stored separately. When we pass a Vec over to petsc, we need to perform a (process-local) vecscatter (https://github.com/OP2/PyOP2/blob/master/pyop2/petsc_base.py#L271). This, obviously, uses the same field ordering as the matrices. So that would need changing. Finally, changing the field ordering will change the allocation pattern of the monolithic matrix (in particular the number of nonzeros on diagonal and offdiagonal blocks in parallel), so that code would need to be updated as well. FWIW, if you build a matrix on a single VectorFunctionSpace, then you do get a baij matrix. So if all your fields are the same, you may have luck reformulating your problem in that manner. Cheers, Lawrence
participants (2)
- 
                
                Justin Chang
- 
                
                Lawrence Mitchell