Question on how to display selected faces of few cells #954
Replies: 1 comment 1 reply
-
I'm afraid we don't have anything that will improve the visualization. Visualization of My recommendation, though, is to use Gmsh to define the boundary explicitly, akin to what's shown in the |
Beta Was this translation helpful? Give feedback.
-
Hello fipyTeam,
I am working on a problem in which I need to apply flux boundary conditions on few internal cells. I am able to select the cells. But now I want to select their exterior faces and also would like to see in Viewer, if I did select the correct cells and Faces. Can someone please help me with this.
This is the sample code.
`
from fipy import CellVariable, Grid3D, Viewer, numerix, FaceVariable
mesh = Grid3D(.1,.1,.1, 40, 40, 10)
mesh = mesh + ((-2,), (-2,), (-1,))
alp = CellVariable(mesh, value = 0.)
X, Y, Z = mesh.cellCenters
radius = 0.5
selected = X2 + Y2 < radius**2
alp.setValue(1., where = selected)
viewer = Viewer(vars = alp)`
I was able to check that I selected the correct cells. but how to visualize the selected faces.
I tried something like this..
`
allFaces = mesh.cellFaceIDs.data
selectedCellFaces = numerix.unique(allFaces[:, selected]).flatten()
unselectedCellFaces = numerix.unique(allFaces[:, numerix.invert(selected)]).flatten()
selectedExteriorFaces = numerix.intersect1d(selectedCellFaces, unselectedCellFaces)
SelectFaces = numerix.zeros(mesh.numberOfFaces, dtype = bool)
SelectFaces[selectedExteriorFaces] = True
beta = FaceVariable(mesh, value = 0.)
beta.setValue(10, where = SelectFaces)
viewer = Viewer(vars = beta)`
But its showing cellcenters of mesh and face values as points. Is there any better way of doing this?
Beta Was this translation helpful? Give feedback.
All reactions