sdynpy.fem.sdynpy_exodus.ExodusInMemory
- class ExodusInMemory(exo=None, variables=None, timesteps=None, blocks=None)[source]
Bases:
object
Read or write exodus files loaded into memory
This is a convenience class wrapped around the exodus class to enable easier manipulation of exodus files that fit entirely into memory
- Parameters
exo (exodus) – An exodus object, if you want to load an exodus file into memory, or None if you want to create an empty exodus file.
variables (iterable) – A list of variable names that are loaded into memory. Default is to load all variables
timesteps (iterable) – A list of timestep indices that are loaded into memory. Default is to load all timesteps.
blocks (iterable) – A list of block ids that are loaded into memory. Default is to load all blocks.
Methods
__init__
([exo, variables, timesteps, blocks])from_sdynpy
(geometry[, displacement_data])get_block_surface
(block_id[, ...])Gets the node indices and element connectivity of surface elements
load_from_exodus
(exo[, variables, ...])repack
(q[, modes])Repackages an exodus file as a linear combination of itself
Triangulate a surface mesh for plotting patches
write_to_file
(filename[, clobber])- get_block_surface(block_id, keep_midside_nodes=False, warn=True)[source]
Gets the node indices and element connectivity of surface elements
This function “skins” the element block, returning a list of node indices and a surface connectivity matrix.
- Parameters
block_id (int) – The ID number of the block that will be skinned.
keep_midside_nodes (bool) – Specifies whether or not to keep midside nodes in the surface mesh. Default is False.
warn (bool) – Specifies whether or not to warn the user if the block ID doesn’t have a skinning method defined for its element type. Default is True.
- Returns
element_block_information – A list of tuples of element information. These data are element_type, node_indices, block_surface_connectivity, and block_surface_original_elements. The element_type is a string representing the new block element type (‘quad4’,’tri3’,etc.). The node_indices can be used as an index into the coordinate or nodal variable arrays to select nodes corresponding to this block. The block_surface_connectivity represents the connectivity array of the surface faces of the block. Values in this array correspond to indices into the node_indices array. To recover the connectivity array in the original node indices of the exodus file, it can be passed through the node_indices as node_indices[block_surface_connectivity]. The block_surface_original_elements array shows the original element indices of the block that each surface came from. This can be used to map element variables to the new surface mesh. This list will normally be length 1 unless an element type is processed that has two different surface elements in it (e.g. wedges have tris and quads)
- Return type
list
- triangulate_surface_mesh()[source]
Triangulate a surface mesh for plotting patches
This function generates a triangle mesh for each block in the model if it can. If there are more than 3 nodes per element in a block, and the triangulation scheme hasn’t been defined in pyexodus.mesh_triangulation_array, it will be skipped.
- Parameters
None –
- Returns
triangulated_mesh_info – A list of tuples containing block id, node_indices, triangulated connectivity, and original block elements
- Return type
list