Geometry and Mesh (fedoo.mesh)

Mesh classes

Mesh(nodes[, elements, elm_type, node_sets, ...])

Fedoo Mesh object.

MultiMesh(nodes[, elements_dict, node_sets, ...])

Fedoo mesh made of several ordered submeshes sharing one node table.

Mesh manipulation functions

stack(mesh1, mesh2[, name])

Make the spatial stack of two mesh objects which have the same element shape.

extrude(mesh, extrude_path[, n_nodes, ndim, ...])

Build a volume or surface mesh from the extrusion of a surface or wire mesh.

thicken(mesh, thickness[, n_nodes, normal, name])

Create a solid by thickening a surface mesh along nodal normals.

extract_surface(mesh[, reduce_order, ...])

Build a mesh of the surface from a given 2D or 3D mesh.

extract_edges(mesh[, reduce_order, ...])

Extract edges from a given 2D or 3D mesh.

change_elm_type(mesh, elm_type[, name])

Attempt to change the type of element of a mesh.

quad2tri(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_file(filename[, name])

Import a mesh from a file.

import_msh(filename[, name, mesh_type])

Import a mesh from a msh file (gmsh format).

import_vtk(filename[, name])

Import a mesh from a legacy ASCII VTK file.

Mesh Creation Functions

rectangle_mesh([nx, ny, x_min, x_max, ...])

Create a rectangular Mesh

box_mesh([nx, ny, nz, x_min, x_max, y_min, ...])

Create the mesh of a box

disk_mesh([radius, nr, nt, elm_type, ndim, name])

Create a surface mesh of a disk or an ellipse

hole_plate_mesh([nr, nt, length, height, ...])

Create a mesh of a 2D plate with a hole

hollow_disk_mesh([radius, thickness, nr, ...])

Create a surface mesh of an hollow disk or an ellipse

I_shape_mesh([height, width, web_thickness, ...])

Create the mesh of a I.

line_mesh_1D([n_nodes, x_min, x_max, ...])

Create the Mesh of a straight line with corrdinates in 1D.

line_mesh([n_nodes, x_min, x_max, elm_type, ...])

Create the Mesh of a straight line

line_mesh_cylindric([nt, r, theta_min, ...])

Create the mesh of a curved line based on cylindrical coordinates

circle_mesh([n, r, elm_type, ndim, name])

Create the mesh of a cicle.

grid_mesh_cylindric([nr, nt, r_min, r_max, ...])

Create a mesh as a regular grid in cylindrical coordinate

generate_cylindrical_local_frame(crd[, ...])

Generate cylindrical local frames (er, etheta, ez) at each node.

structured_mesh_2D(data, edge1, edge2, ...)

Create a 2D structured grid from 4 edges.

generate_nodes(mesh, N, data[, type_gen])

Add regularly espaced nodes to an existing mesh between to existing nodes.