nastran#

Nastran geometry, discovered OP2 results, card metadata, and original inputs.

Raw result arrays retain their axes, IDs, precision, and component headers. Unambiguous GRID/element tables also become mesh fields. Original cells remain in global data alongside a native simplicial projection; source bytes provide recovery of content not interpreted by the backend.

Classes#

NastranSource

Read Nastran decks and optional OP2 files into meshes with a result archive.

Module Contents#

class physicsnemo_curator.domains.mesh.sources.nastran.NastranSource(
input_path: str,
file_pattern: str = '**/*',
op2_pattern: str = '',
read_results: bool = True,
encoding: str = 'latin1',
punch: bool = False,
result_patterns: str = '*',
preserve_source_files: bool = True,
)#

Bases: physicsnemo_curator.core.base.Source[physicsnemo.mesh.Mesh]

Read Nastran decks and optional OP2 files into meshes with a result archive.

Parameters:
  • input_path (str) – A deck file or a directory searched recursively for .bdf/.dat/.nas/.deck/.pch.

  • file_pattern (str) – Deck discovery glob relative to a directory, default "**/*". Use a main-deck pattern when INCLUDE files also use deck extensions; discovery treats every matched file as an independent input.

  • op2_pattern (str) – OP2 filename template relative to each deck’s directory, with {stem}. Empty selects a same-stem OP2, then a unique sibling OP2. Ambiguity is an error.

  • read_results (bool) – Read all paired OP2 tables exposed by pyNastran (default True).

  • result_patterns (str) – Comma-separated table-family globs, default "*". Exclusions remain explicit in the result catalog.

  • preserve_source_files (bool) – Embed the original deck, INCLUDE files, and paired OP2 bytes (default True). Disable to reduce storage at the cost of exact recovery of uninterpreted content.

  • encoding (str) – Deck encoding, default "latin1" (accepts arbitrary comment bytes).

  • punch (bool) – True for bulk-data-only files without executive/case control. .pch files always use this mode. Default False.

Notes

Yields one mesh per subcase and topological dimension (lines, surfaces, volumes). Common rod/beam, triangle/quad, tetra/hex/wedge/pyramid cells are supported. Unsupported topology raises explicitly. Native cells are piecewise linear; original connectivity and higher-order types are retained separately for VTK export.

Sparse floating results use NaN plus validity masks (integers use zero placeholders with masks). Layered/integration-point results stay in their original tables without averaging. Recognized nodal vectors are rotated from rectangular CD frames; other frames remain raw with a projection report. Units and solver normalization are unchanged. Complete real modes additionally expose modal aliases. Backend-unsupported content is recoverable from the embedded originals, but is not claimed as an interpreted mesh field.

Discover input decks; defer geometry and result reads until indexing.

classmethod params() → list[physicsnemo_curator.core.base.Param]#

Declare file discovery, pairing, and decoding parameters.

relative_path(index: int) → str#

Return the deck path relative to the source root for sink naming.

description: ClassVar[str] = 'Nastran geometry, discovered OP2 fields, complete card metadata, and source preservation'#

Short description shown in the interactive CLI.

name: ClassVar[str] = 'Nastran'#

Human-readable display name for the interactive CLI.

property root: pathlib.Path#

Return the directory used for relative output paths.