Nastran-backend#

Reads the mesh and mesh tags of Nastran bulk data files (.bdf, .nas) through the Gmsh Python API (pip install io4dolfinx[nastran]), reusing dolfinx.io.gmsh. The cells are the elements of the highest topological dimension. Meshes with several cell types, such as the hexahedra, pyramids and tetrahedra of a “hexcore” mesh, are read as mixed meshes, which have no UFL domain. Mesh tags are the property IDs (PID) of the PSOLID (cells) or PSHELL (facets) elements, and must be of one entity type. GRID IDs need not be contiguous: input node i is the node with the i-th smallest GRID ID. On meshes with one cell type, the GRID IDs can be read as point data, a function on the geometry nodes, and as vertex tags, both called "GRID". All file access happens on rank 0.

Note

The Nastran backend requires DOLFINx 0.11 or later, and raises a NotImplementedError with older versions, whose dolfinx.io.gmsh.extract_topology_and_markers() reads only one element type per property ID.

mesh = io4dolfinx.read_mesh("model.bdf", MPI.COMM_WORLD, backend="nastran")
cell_tags = io4dolfinx.read_meshtags("model.bdf", mesh, "PSOLID", backend="nastran")
grid_ids = io4dolfinx.read_point_data("model.bdf", "GRID", mesh, backend="nastran")
vertex_tags = io4dolfinx.read_meshtags("model.bdf", mesh, "GRID", backend="nastran")

Nastran interface to io4dolfinx.

Reads the mesh and mesh tags of Nastran bulk data files (.bdf, .nas) through the Gmsh Python API, reusing dolfinx.io.gmsh for the geometry, the topology and the node ordering. All file access happens on rank 0.

  • The cells are the elements of the highest topological dimension. Meshes with several cell types, such as hexahedra, pyramids and tetrahedra, are read as mixed meshes.

  • Mesh tags are the property IDs (PID) of the elements, see read_meshtags_data().

  • Node i is the node with the i-th smallest GRID ID. The GRID IDs can be read as point data and as vertex tags, both called "GRID", on meshes with one cell type.

SPDX License identifier: MIT

io4dolfinx.backends.nastran.backend.read_mesh_data(filename: Path | str, comm: Comm, time: str | float | None = None, read_from_partition: bool = False, backend_args: dict[str, Any] | None = None) → ReadMeshData | ReadMixedMeshData[source]#

Read mesh data from a Nastran file.

The cells are the elements of the highest topological dimension. If they are of several types, e.g. hexahedra, pyramids and tetrahedra, the mesh is read as a mixed mesh. All data is read on rank 0.

Parameters:
  • filename – Path to file to read from

  • comm – MPI communicator used in storage

  • time – Time stamp associated with the mesh to read

  • read_from_partition – Whether to read partition information

  • backend_args – Arguments to backend, see get_default_backend_args()

Returns:

Internal data structure for the mesh data read from file

io4dolfinx.backends.nastran.backend.read_meshtags_data(filename: Path | str, comm: Comm, name: str, backend_args: dict[str, Any] | None = None) → MeshTagsData[source]#

Read mesh tags from a Nastran file.

Parameters:
  • filename – Path to the Nastran file

  • comm – MPI communicator

  • name –

    One of:

    • "PSOLID": the 3D solid elements, tagged with their property ID (PID)

    • "PSHELL": the 2D shell elements (often used for boundary conditions), tagged with their PID

    • "GRID": the vertices, tagged with their GRID ID. Only supported on meshes with one cell type.

  • backend_args – Arguments to backend, unused

Returns:

Internal data structure for the mesh tags read from file, on rank 0

Raises:

NotImplementedError – If the tagged entities are of several types, or for "GRID" on a mesh with several cell types.

io4dolfinx.backends.nastran.backend.read_point_data(filename: Path | str, name: str, comm: Comm, time: float | str | None, backend_args: dict[str, Any] | None) → tuple[ndarray, int][source]#

Read the GRID IDs of the nodes of a mesh with one cell type.

Note

The function holding the GRID IDs has the precision of the mesh. In single precision, IDs above \(2^{24}\) are not exact; read them as vertex tags with read_meshtags_data() instead.

Parameters:
  • filename – Path to file

  • name – Name of point data, "GRID"

  • comm – Communicator to launch IO on.

  • time – Ignored, as a Nastran file holds no time series

  • backend_args – The backend arguments

Returns:

  • The GRID ID of each node, of shape (num_nodes, 1), on rank 0

  • The global start of the data on this process, 0

Return type:

Tuple containing

Raises: