# Composite Fe spaces

**URL:** <https://community.freefem.org/t/composite-fe-spaces/2596>\
**Category:** General Discussion\
**Created:** [July 11, 2023, 10:29am UTC](https://community.freefem.org/t/composite-fe-spaces/2596 "2023-07-11T10:29:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhg](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mhg](https://community.freefem.org/u/mhg)\
**Post date:** [July 11, 2023, 10:29am UTC](https://community.freefem.org/t/composite-fe-spaces/2596/1 "2023-07-11T10:29:39Z")

</div>

Thank you for including composite FE spaces in version 4.13 as announced in [https://community.freefem.org/t/equations-involve-different-mesh-spaces/2453/2](https://community.freefem.org/t/equations-involve-different-mesh-spaces/2453/2).  
Is there also a documentation available for this feature?

I noted that with standard FreeFEM++ the example [stokes\_composite.edp](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/examples/stokes_composite.edp) runs without problems. However, using the mpi version gives a compilation error.

---

<div class="post-metadata">

**Author:** ![phtournier](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@phtournier](https://community.freefem.org/u/phtournier)\
**Post date:** [July 11, 2023, 9:17pm UTC](https://community.freefem.org/t/composite-fe-spaces/2596/2 "2023-07-11T21:17:42Z")

</div>

Hello,

the documentation is in progress but unfortunately it is not available yet.  
If you want to run the sequential examples such as [stokes\_composite.edp](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/examples/stokes_composite.edp) in parallel, for now you first need to add

```auto
load "bem"
load "MUMPS"

```

at the beginning, then add `solver=sparsesolver, master=-1` in problem/solve to enable the parallel assembly and solution, like this:

```auto
solve Stokes ( <[u1,u2],[p]>, <[v1,v2],[q]>, solver=sparsesolver, master=-1) = ...

```

---

<div class="post-metadata">

**Author:** ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)\
**Post date:** [July 12, 2023, 5:05pm UTC](https://community.freefem.org/t/composite-fe-spaces/2596/3 "2023-07-12T17:05:31Z")

</div>

Does this feature work with PETSc?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [July 12, 2023, 6:09pm UTC](https://community.freefem.org/t/composite-fe-spaces/2596/4 "2023-07-12T18:09:20Z")

</div>

I think so (see [https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/Helmholtz-2d-FEM-BEM-coupling-PETSc-composite.edp#L95](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/Helmholtz-2d-FEM-BEM-coupling-PETSc-composite.edp#L95)), but it’s better if you are able to expose the `MatNest` yourself since this allows you to set custom preconditioners for each field. If you use the `< >` notation, you (currently) cannot set specific solver for each field (appart from the `sparams`), e.g., you cannot set the rigid body modes if you do elasticity. Also, you have to keep the full mesh on all processes (currently). Both of these limitations may be lifted in the future.
