visualdynamics.io.exodus¶
exodus
¶
Read and write Exodus finite element files (.exo, .e, .exo2, .g, .gen).
Exodus is netCDF, and both directions go through netCDF4. Reading
gives the nodes, the element blocks, the file's coordinate frames (as
coordinate systems), the node sets that record which node is placed or
measured in which frame, and the results. Writing (save) gives a
geometry as named blocks, its coordinate systems as frames and its
assignments as node sets, and mode shapes or data records on that
geometry as nodal and global variables. Damping and modal mass are
written as the global variables Damping and ModalMass, and the
imaginary part of a complex value as <name>_IM beside the real part,
so a modal model reads back with all of them. A drawn line is a block
of two-node line elements and is written as beam elements. The format
has no units: length_unit declares the unit of the positions on
import, and without it the geometry is unit-less.
Beyond the mesh, an Exodus file holds results: time_whole is a step
axis, nodal variables are (steps x nodes) records, and global variables
are one value per step. The file cannot say what the step axis means.
A modal run stores one mode per step with the frequency as the time, a
transient stores time, and spectral results store frequency, so
load(steps=...) declares it, in the same way units are declared.
Functions:
| Name | Description |
|---|---|
load |
Read an Exodus file: the mesh, and the results it holds. |
save |
Write a geometry, mode shapes, or a time history or spectrum, as |
result_summary |
The names and counts of the file's results, read without the |
node_set_nodes |
The node ids in one node set, in the form |
Classes¶
Functions:¶
load
¶
load(path: str | PathLike, length_unit: str | None = None, blocks: dict[int, str] | None = None, steps: str | None = None, nodes: Any | None = None) -> Any
Read an Exodus file: the mesh, and the results it holds.
length_unit declares the unit of the positions; without it the
geometry is unit-less. blocks keeps only the element blocks whose
ids are among its keys (and then numbers the elements from 1).
steps declares what the file's step axis means, because the file
cannot say. 'modes' (the default) reads the displacement and
rotation variables as one mode per step with the step's time as the
frequency, and returns the geometry alone, or a dict keyed
'geometry' and 'shapes' when there are modes. 'time' reads every
nodal and global variable as a TimeHistory, returned in a dict
keyed 'geometry', 'time' and 'global'. 'frequency' reads them as a
Spectrum, with _RE/_IM variable pairs merged into complex
records, keyed 'geometry', 'spectra' and 'global spectra'. A key is
left out when there is nothing for it.
nodes limits the result records to those node ids, since a large
transient is a record for every node and direction, which for a
200,000-node mesh is far more channels than anyone wants.
node_set_nodes gives the ids of a node set.
Raises ValueError for an unknown steps, an element type with no
match, a node in nodes the file does not have, or, with 'time'
or 'frequency', a file with no step axis or no variables.
Source code in src/visualdynamics/io/exodus.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
save
¶
save(obj: Any, path: str | PathLike, title: str = 'visualdynamics geometry', geometry: Geometry | None = None, unit_system: UnitSystem | None = None) -> None
Write a geometry, mode shapes, or a time history or spectrum, as Exodus.
Shapes and data need geometry, the mesh they are written on, and
are refused without it. Each mode is written as one time step with
its frequency as the time, and each data record as a nodal variable
over time_whole (or a global variable when it has no DOF). Values
at a node with a local displacement system are rotated into the
global frame, because an Exodus nodal variable is always global.
Positions and values are written in unit_system (its coherent form)
where their units are defined, and as stored otherwise. title is
the file's title.
Source code in src/visualdynamics/io/exodus.py
result_summary
¶
The names and counts of the file's results, read without the values, for the import dialog.
Returns {'nodal': [names], 'global': [names], 'steps': n, 'nodes': n, 'node_sets': [(id, name, count)]}. For a mesh with no results the lists are empty and the step count is zero. The node sets that record coordinate system assignments are not listed.
Source code in src/visualdynamics/io/exodus.py
node_set_nodes
¶
The node ids in one node set, in the form load(nodes=...)
takes.
Exodus stores set members as 1-based local indices; they are mapped
through node_num_map to node ids. Raises ValueError when the file
has no node set set_id.