# V0.6.0 container subdomain multiple variable

**URL:** <https://fenicsproject.discourse.group/t/v0-6-0-container-subdomain-multiple-variable/12291>\
**Category:** General\
**Created:** [September 25, 2023, 8:44pm UTC](https://fenicsproject.discourse.group/t/v0-6-0-container-subdomain-multiple-variable/12291 "2023-09-25T20:44:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaoqigit](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/shaoqigit/32/5608_2.png) [@Shaoqigit](https://fenicsproject.discourse.group/u/Shaoqigit)\
**Post date:** [September 25, 2023, 8:44pm UTC](https://fenicsproject.discourse.group/t/v0-6-0-container-subdomain-multiple-variable/12291/1 "2023-09-25T20:44:35Z")

</div>

Dear Fenicx Community,

I am work on a coupling problem which contain two different governing equations on different subdomains. The stable fenicx docker image is used.  
My problem can be stated simply as: (FEM variable) p is defined on whole domain (subdomain 1+2), (vector variable) u, v defined only on subdomain 2.  
I am struggling on several questions and did not get working/update answer after looking through relevant topic. Here is my question and minimul code example:

1. should I use mixed element for u, v and p on subdomain 2.
2. cause I am only interested the assembled matrix on each subdomain, so the integration on subdomain or define the FE space on sub mesh is preferable, But how, seems like the meshView is not available in 0.6.0. BTW, my geometry is quite complex that is defined by gmsh with different physical tag to differ the subdomain. it’s better that we have a straightforward way to define subdomain with this tag.  
Following is my code:

```python
import ufl
from dolfinx import geometry, mesh
from dolfinx.fem import Function, FunctionSpace, assemble_matrix, form, VectorFunctionSpace 
from dolfinx.io import XDMFFile, gmshio
from ufl import dx, grad, inner, outer, Measure, as_matrix

parameters, msh, cell_tags, facet_tags = create_mesh(xxx,xxx) # my own function to create mesh and other parameters
# Test and trial function space
P = FunctionSpace(msh, ("CG", deg))
V = FunctionSpace(msh, ("CG", deg))
U = VectorFunctionSpace(msh, ("CG", deg))
p, u, v = ufl.TrialFunction(P), ufl.TrialFunction(U), ufl.TrialFunction(V)
q, u_t, v_t = ufl.TestFunction(P), ufl.TestFunction(U), ufl.TestFunction(V)  
dx = Measure("dx", domain=msh, subdomain_data=cell_tags, metadata={"quadrature_degree": 3*deg})

# construct the matrices, I only care about the assembled matrix, here is example:
ka = inner(grad(p), grad(q)) * dx(1)
Ka = assemble_matrix(form(ka))
Ka.finalize()

Ma = inner(p, q) * dx(1)
Ma = assemble_matrix(form(Ma))
Ma.finalize()

k12 = tau*gamma_bar*inner(v, q) * dx(2)
K12 = assemble_matrix(form(k12))
K12.finalize()

d22 = inner(u, u_t) * dx(2) # du/dt
D22 = assemble_matrix(form(d22))
D22.finalize()

```

for such code, firstly, I got a error when assembly the D22, which is ‘block size is not suppoeted’  
secondly, such definition is not proprely, cause here all the variable are defined on whole domain, and not mixed elements is defined, I can imagine that the total number of dofs is not correct, etc.  
Can anyone take it look, please, Thank you in advance.

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [September 26, 2023, 4:54am UTC](https://fenicsproject.discourse.group/t/v0-6-0-container-subdomain-multiple-variable/12291/2 "2023-09-26T04:54:59Z")

</div>

> [@Shaoqigit](#):
>
> `from dolfinx.fem import Function, FunctionSpace, assemble_matrix, form`

The block size comment is related to using the DOLFINx native assembled and not `dolfinx.fem.petsc.assemble_matrix`.

> [@Shaoqigit](#):
>
> cause I am only interested the assembled matrix on each subdomain, so the integration on subdomain or define the FE space on sub mesh is preferable, But how, seems like the meshView is not available in 0.6.0. BTW, my geometry is quite complex that is defined by gmsh with different physical tag to differ the subdomain. it’s better that we have a straightforward way to define subdomain with this tag.

Maybe @jpdean could update you on his progress with Mixed assemblers.
