Replies: 2 comments
-
I'm pretty sure you'd have to maintain some sort of "dual mesh" in parallel, e.g. a pointset with 6 * nx * ny * nz points. |
Beta Was this translation helpful? Give feedback.
-
What about using multi-component scalars? E.g. use cell data, but instead of a single value stored for each cell, store 6 values, one for each face. You can adopt a convention like The visualization isn't great, since you still have cubic cells showing even though the values are tied to faces, but this way you can filter values per-face, e.g. using import pyvista as pv
import numpy as np
Nx, Ny, Nz = 2,2, 2
x = np.linspace(0,1, Nx 1)
z = np.linspace(0,1, Ny 1)
y = np.linspace(0,1, Nz 1)
x, y, z = np.meshgrid(x, y, z)
grid = pv.StructuredGrid(x, y, z)
# Add a length-6 vector of cell data for each cell
grid.cell_data['data'] = np.reshape(range(grid.n_cells*6), (grid.n_cells,6))
# Extract cells which have a value between 0-25 for the negative x face
component = 0 # negative x component
x_neg = grid.extract_values(ranges=[0,25], component_mode=component)
x_neg.plot(opacity=0.5, show_edges=True, component=component) |
Beta Was this translation helpful? Give feedback.
-
First check
Commit to Help
Sample Code What is the problem, question, or error?
Write a short description telling me what you are doing, what you expect to happen, and what is currently happening.
If I have a structured grid of a unit cube, how can I "tag" each boundary face with a separate value so that I can use it for finite element analysis?
Description
I know you can add point data based on the point coordinates, but this becomes ambiguous for points that lie on the intersection of 2 faces of the unit cube. If I use cell data, it will apply to the entire 3D cell instead of the 2D face. This also has the problem of ambiguity when a cell is on the intersection of 2 faces of the unit cube.
System Information
Screenshots
No response
Beta Was this translation helpful? Give feedback.
All reactions