Reputation: 25
I would like to calculate the shell surface of any mesh imported into fipy via gmsh similar to cell Volumes:
sum(mesh.cellVolumes)
So far i have located the outside Faces with:
f = FaceVariable(mesh=mesh,value=False, name='Aussen')
f.value[where(mesh.exteriorFaces == True)] = True
I would like to sum the faceVolumes if those exist in fipy somewhere, is this the way to go?
Upvotes: 0
Views: 303
Reputation: 1068
This should do it,
import numpy as np
from fipy import Grid2D
mesh = Grid2D(nx=2, ny=2)
np.sum(mesh._faceAreas[mesh.exteriorFaces.value])
The above seems to require .value
for the "take" on face areas to work correctly.
It's worth doing mesh._
and then hitting tab in ipython to see all the extra attributes available for meshes. There are a lot of hidden ones.
Edited to make the code a full working example.
Upvotes: 1