### Spatialcoordinates of a boundary of mesh

166

views

1

Hi there,

I am solving a nonlinear elasticity problem in which i must compute volume after deformation before proceeding to next time step. The way i am computing volume is:-

Some help / guidance is required please.

Regards

I am solving a nonlinear elasticity problem in which i must compute volume after deformation before proceeding to next time step. The way i am computing volume is:-

```
def Compute_Volume(u):
X = SpatialCoordinate(mesh)
#compute pressure (ml)
# u is the displacement calculated through solution of this problem
vol = 1e6*abs(assemble((-1.0/3.0)*dot(X + u, J*inv(F).T*n_mesh)*ds(30)))
return vol
```

Now i have changed the geometry to a mesh where there are two separate compartments i.e. now i must compute volume for the left and the right compartments (ventricles of heart) separately (mesh geometry attached below for ease of understanding) I dont know

**how to get spatial coordinates for the left and right boundary**(compartments or ventricles) of the mesh. I have seen an earlier post (here) that discusses about printing coordinates of the boundaries of mesh but that doesnt work for Spatialcoordinates. I am confused.Some help / guidance is required please.

Regards

Community: FEniCS Project

### 1 Answer

2

After some more search i have reached the following solution

```
from dolfin import*
mesh = Mesh('biv_mesh.xml')
mf = FacetFunction("size_t",mesh)
File("Facet_function.xml")>>mf
left_submesh = Submesh(mesh,mf,30)
X=SpatialCoordinate(left_submesh)
```

Please do add ,if there is some improvement possible to this solution. Thanks

Please login to add an answer/comment or follow this question.