Geometry and Mesh (fedoo.mesh)
Mesh classes
|
Fedoo Mesh object. |
|
Fedoo mesh made of several ordered submeshes sharing one node table. |
Node and element selection
Use the selection methods to obtain node or element IDs without changing
mesh geometry. Pass name to find_nodes or find_elements to also
store the result in mesh.node_sets or mesh.element_sets. Node IDs
refer to the shared node table. For a MultiMesh, global element IDs follow
the concatenated submesh order.
|
Return a list of nodes from a given selection criterion |
|
Return a list of elements from a given selection criterion |
|
Return a list of elements that are build with the nodes given in node_set |
|
Find the nodes of the connected exterior patch containing a seed. |
|
Return node IDs along a connected exterior feature-edge chain. |
Coordinates and field expressions
find_nodes selects by node coordinates. find_elements tests element
centers by default; use select_by="nodes" with all_nodes=True or
False to require all nodes or at least one node to satisfy the criterion.
Both methods accept mathematical expressions, and data=results makes
result fields and components such as Stress_XX available. Fields are
converted to Node or Element values according to the selection method.
import fedoo as fd
nodes = mesh.find_nodes("X", 0, name="Left")
elements = mesh.find_elements("X > 0.5", name="Right")
loaded_nodes = mesh.find_nodes("Disp_X > 0.01 and Y > 0", data=results)
stressed_elements = mesh.find_elements("Stress_XX > 100", data=results)
Use mesh.get_elements_from_nodes(nodes) to select elements from node IDs.
See Fedoo interactive viewer for the corresponding interactive node/element set
managers and conversions.
Connected exterior surface selection
mesh.find_surface_nodes(seed, seed_type="Node", angle=30) returns sorted
node IDs on the connected exterior patch containing a node or global element
seed. It crosses neighboring faces when their normal-angle difference is at
most angle degrees: 0 joins flat faces; 30 stops at a right-angle edge.
The test is local, so a smoothly curved patch can wrap around the geometry.
nodes = mesh.find_surface_nodes(top_node_id, angle=30)
mesh.node_sets["selected_surface"] = nodes
surface = fd.mesh.extract_surface(mesh, node_set=nodes)
The same function is available as fd.mesh.find_surface_nodes(mesh, ...).
Solid internal faces are removed, including interfaces between MultiMesh
submeshes. Midside nodes are included; normals use corner geometry. For a
three-dimensional shell mesh, existing tri/quad faces are traversed instead;
use mesh.extract_elements(mesh.get_elements_from_nodes(nodes)) to extract
the selected shell patch. For two-dimensional meshes, the selection follows
exterior boundary edges. Non-manifold edges stop the selection.
A seed at a corner may belong to distinct patches. In this case
AmbiguousSurfaceSeed exposes candidate face_ids and normals;
repeat the call with seed_face set to the desired exterior face ID.
The viewer presents this choice in a dialog. Node Sets provides a seed ID,
a maximum normal angle, and Select surface nodes. Select activates
the single-node picker. All viewer surface/edge selection uses node seeds.
Interior nodes cannot seed a patch. For planar XYZ meshes use
Boundary edges (2D mesh);
the equivalent Python option is boundary_edges=True.
The resulting node selection can be saved as a named set and exported to FDH5.
Connected exterior edge selection
For a 3D mesh, Exterior edges (3D) selects nodes along creases and open shell boundaries. Sharpness is the minimum angle between adjacent exterior face normals that identifies a crease. Turn limit is the maximum direction change allowed while following that edge. Smooth surface tessellation lines are excluded; branches and sharp changes of direction stop traversal. The seed must lie on an eligible edge. A corner touching distinct edge chains offers a starting-edge choice. Midside nodes are included.
nodes = mesh.find_edge_nodes(edge_node_id, angle=30, feature_angle=30)
mesh.node_sets["selected_edge"] = nodes
The same function is available as fd.mesh.find_edge_nodes(mesh, ...).
AmbiguousEdgeSeed exposes candidate edge_ids, endpoints and
directions; repeat with seed_edge to choose one chain explicitly.
Mesh manipulation functions
|
Make the spatial stack of two mesh objects which have the same element shape. |
|
Build a volume or surface mesh from the extrusion of a surface or wire mesh. |
|
Create a solid by thickening a surface mesh along nodal normals. |
|
Build a mesh of the surface from a given 2D or 3D mesh. |
|
Extract edges from a given 2D or 3D mesh. |
|
Attempt to change the type of element of a mesh. |
|
Change the type of element of a mesh from 'quad4' to 'tri3'. |
Import and export meshes
Use fedoo.Mesh.read() to import mesh geometry and connectivity:
VTK and other PyVista formats
VTK formats are read through PyVista: legacy .vtk meshes, XML
unstructured grids (.vtu) and XML polygonal surfaces (.vtp).
The imported geometry must contain cell types supported by Fedoo.
import fedoo as fd
mesh = fd.Mesh.read("model.vtu", name="Domain")
# Legacy VTK meshes and polygonal surfaces:
# mesh = fd.Mesh.read("model.vtk")
# mesh = fd.Mesh.read("surface.vtp")
fedoo.Mesh.from_pyvista() also accepts existing PyVista
UnstructuredGrid and PolyData objects, including mixed cell types.
It imports geometry and Fedoo’s _nset_/_eset_ field-data conventions,
but not ordinary point/cell result arrays. Element sets are not imported
through the PyVista path for mixed meshes.
Abaqus import
Use fedoo.Mesh.read() to import the mesh from an Abaqus deck:
mesh = fd.Mesh.read("model.inp", name="Domain")
Abaqus .inp files use meshlane, with meshio as a fallback. Install the
recommended reader with pip install "fedoo[io]". Supported first- and
second-order element types are converted to Fedoo elements. *NSET and
*ELSET definitions become mesh.node_sets and mesh.element_sets.
Several element types produce a fedoo.MultiMesh, with element
sets stored on the corresponding submeshes. Unsupported cell types are
skipped with a warning; isolated vertex cells are ignored.
Importing an Abaqus deck does not create its materials, loads or analysis steps; define those in Fedoo after importing the mesh.
Importing with meshlane or meshio
To explicitly use meshlane for another supported format, such as Gmsh,
pass its mesh object to fedoo.Mesh.from_meshio():
import meshlane
mesh = fd.Mesh.from_meshio(meshlane.read("model.msh"))
fedoo.Mesh.from_meshio() accepts both meshlane and meshio objects
and preserves their point/cell sets. Multiple supported cell types return
a fedoo.MultiMesh.
Exporting mesh geometry
Export mesh geometry
with fedoo.Mesh.save(), for example mesh.save("model.vtk").
Use fedoo.read_data() for saved simulation results, including FDH5,
rather than fedoo.Mesh.read().
Legacy readers
The following legacy readers handle specific ASCII VTK/Gmsh formats.
Prefer fedoo.Mesh.read() or fedoo.Mesh.from_meshio()
for new workflows.
|
Import a mesh from a file. |
|
Import a mesh from a msh file (gmsh format). |
|
Import a mesh from a legacy ASCII VTK file. |
Mesh Creation Functions
Examples: Creating simple meshes and swept geometries (built-in generators, extrusion and swept geometries) and Nodal Hessian recovery on a fedoo mesh (nodal gradient and Hessian recovery on a mesh).
|
Create a rectangular Mesh |
|
Create the mesh of a box |
|
Create a surface mesh of a disk or an ellipse |
|
Create a mesh of a 2D plate with a hole |
|
Create a surface mesh of an hollow disk or an ellipse |
|
Create the mesh of a I. |
|
Create the Mesh of a straight line with corrdinates in 1D. |
|
Create the Mesh of a straight line |
|
Create the mesh of a curved line based on cylindrical coordinates |
|
Create the mesh of a cicle. |
|
Create a mesh as a regular grid in cylindrical coordinate |
|
Generate cylindrical local frames (er, etheta, ez) at each node. |
|
Create a 2D structured grid from 4 edges. |
|
Add regularly espaced nodes to an existing mesh between to existing nodes. |