sdynpy.fem.sdynpy_exodus.Exodus

class Exodus(filename, mode='r', title=None, num_dims=None, num_nodes=None, num_elem=None, num_blocks=None, num_node_sets=None, num_side_sets=None, clobber=False)[source]

Bases: object

Read or write exodus files.

This class creates functionality to read or write exodus files using the netCDF4 python module.

Parameters
  • filename (str) – The path string to the file that will be opened

  • mode (str) – Mode with which the file is opened, ‘r’ - Read, ‘w’ - Write, ‘a’ - Append. Default is ‘r’.

  • title (str) – Title of the exodus file, only required if mode=’w’.

  • num_dims (int) – Number of dimensions in the exodus file, only required if mode=’w’.

  • num_nodes (int) – Number of nodes in the exodus file, only required if mode=’w’.

  • num_elem (int) – Number of elements in the exodus file, only required if mode=’w’.

  • num_blocks (int) – Number of blocks in the exodus file, only required if mode=’w’.

  • num_node_sets (int) – Number of node sets in the exodus file, only required if mode = ‘w’.

  • num_side_sets (int) – Number of side sets in the exodus file, only required if mode=’w’.

__init__(filename, mode='r', title=None, num_dims=None, num_nodes=None, num_elem=None, num_blocks=None, num_node_sets=None, num_side_sets=None, clobber=False)[source]

Methods

__init__(filename[, mode, title, num_dims, ...])

close()

extract_sharp_edges(*args, **kwargs)

get_block_surface(block_id[, ...])

Gets the node indices and element connectivity of surface elements

get_coord(index)

Retrieve the coordinates of the specified node in the exodus file.

get_coord_names()

Retrieve the coordinate names in the exodus file.

get_coords()

Retrieve the coordinates of the nodes in the exodus file.

get_displacements([displacement_name, ...])

get_elem_attr(id)

Gets the element attributes for a given block

get_elem_blk_ids()

Gets a list of the element block ID numbers in the exodus file

get_elem_blk_info(id)

Gets the element block information for the specified element block ID

get_elem_connectivity(id)

Gets the element connectivity matrix for a given block

get_elem_num_map()

Retrieve the list of local element IDs from the exodus file.

get_elem_type(id)

Gets the element type for a given block

get_elem_variable_names()

Gets a tuple of element variable names from the exodus file

get_elem_variable_table()

Gets the element variable table

get_elem_variable_value(block_id, ...[, step])

Gets an element's variable value for the specified timestep

get_elem_variable_values(block_id, name_or_index)

Gets a block's element variable values for the specified timestep

get_element_property_names()

get_element_property_value()

get_global_variable_names()

Gets a tuple of global variable names from the exodus file

get_global_variable_values(name_or_index[, step])

Gets the global variable value for the specified timesteps

get_info_records()

Get the information records in the exodus file

get_node_num_map()

Retrieve the list of local node IDs from the exodus file.

get_node_set_dist_factors(id)

Get the distribution factors of the specified node set

get_node_set_ids()

Gets a list of the node set ID numbers in the exodus file

get_node_set_names()

Retrieve the node set names in the exodus file.

get_node_set_nodes(id)

Get the nodes in the specified node set

get_node_set_num_nodes(id)

Get the number of nodes in the specified node set

get_node_variable_names()

Gets a tuple of nodal variable names from the exodus file

get_node_variable_value(name_or_index, ...)

Gets a node variable value for the specified timestep

get_node_variable_values(name_or_index[, step])

Gets the node variable values for the specified timestep

get_qa_records()

Get the quality assurance records in the exodus file

get_side_set_dist_factors(id)

Get the distribution factors of the specified side set

get_side_set_faces(id)

Get the faces in the specified side set

get_side_set_ids()

Gets a list of the side set ID numbers in the exodus file

get_side_set_names()

Retrieve the side set names in the exouds file.

get_side_set_node_list(id)

get_side_set_num_faces(id)

Get the number of faces in the specified side set

get_times([indices])

Gets the time values from the exodus file

load_into_memory([close, variables, ...])

Loads the exodus file into an ExodusInMemory object

num_attr(id)

Gets the number of attributes per element for an element block

num_elems_in_blk(id)

Gets the number of elements in an element block

num_nodes_per_elem(id)

Gets the number of nodes per element in an element block

put_coord_names(coord_names)

Puts the coordinate names into the exodus file

put_coords(coords)

Puts the coordinate values into the exodus file

put_elem_blk_ids(block_ids)

Puts a list of the element block ID numbers in the exodus file

put_elem_blk_info(id, elem_type, ...[, ...])

Puts the element block information for an element block ID into the exodus file

put_elem_num_map(elem_num_map)

Puts a list of local element IDs into the exodus file.

put_elem_variable_names(elem_var_names[, ...])

Puts the specified variable names in the exodus file

put_element_property_names()

put_element_property_value()

put_global_variable_names(global_var_names)

Puts the specified global variable names in the exodus file

put_info_records(records)

Puts the information records in the exodus file

put_node_num_map(node_num_map)

Puts a list of local node IDs into the exodus file.

put_node_set_ids(ns_ids)

Puts a list of the node set ID numbers in the exodus file

put_node_set_info(id, nodes[, dist_fact])

Puts the node set information for a node set ID into the exodus file

put_node_set_names(ns_names)

Puts the node set names into the exodus file

put_node_variable_names(node_var_names)

Puts the specified variable names in the exodus file

put_qa_records(records)

Puts the quality assurance records in the exodus file

put_side_set_ids(ss_ids)

Puts a list of the side set ID numbers in the exodus file

put_side_set_info(id, elements, sides[, ...])

Puts the side set information for a side set ID into the exodus file

put_side_set_names(ss_names)

Puts the side set names into the exodus file

reduce_to_surfaces(*args, **kwargs)

set_elem_attr(id, attributes)

Sets the element attributes for a given block

set_elem_connectivity(id, connectivity)

Sets the element connectivity matrix for a given block

set_elem_variable_value(block_id, ...)

Sets an element variable value for the specified timestep

set_elem_variable_values(block_id, ...)

Sets a block's element variable values for the specified timestep

set_global_variable_values(name_or_index, ...)

Sets the global variable values for the specified timestep

set_node_variable_value(name_or_index, ...)

Sets the node variable values for the specified timestep

set_node_variable_values(name_or_index, ...)

Sets the node variable values for the specified timestep

set_time(step, value)

Sets the time value of a given step in the exodus file

set_times(values)

Sets the time vector for the exodus file

triangulate_surface_mesh()

Triangulate a surface mesh for plotting patches

Attributes

num_blks

num_dimensions

num_elem_variables

num_elems

num_global_variables

num_node_sets

num_node_variables

num_nodes

num_side_sets

num_times

title

Get the title of the exodus file

close()[source]
extract_sharp_edges(*args, **kwargs)[source]
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

get_coord(index)[source]

Retrieve the coordinates of the specified node in the exodus file.

Parameters

index (int) – The global node index (not node number) of the node of which the coordinates are desired

Returns

coords – Returns an array with size num_dims

Return type

np.array

get_coord_names()[source]

Retrieve the coordinate names in the exodus file.

Returns

coord_names – Returns a tuple of strings containing the coordinate names in the exodus file.

Return type

tuple

get_coords()[source]

Retrieve the coordinates of the nodes in the exodus file.

Returns

coords – Returns a 2D array with size num_dims x num_nodes

Return type

np.array

get_displacements(displacement_name='Disp', capital_coordinates=True)[source]
get_elem_attr(id)[source]

Gets the element attributes for a given block

Parameters

id (int) – The block id for which the element connectivity matrix is desired.

Returns

attributes – The 2d attribute matrix for the block with dimensions num_elem x num_attributes

Return type

np.masked_array

get_elem_blk_ids()[source]

Gets a list of the element block ID numbers in the exodus file

Returns

block_ids – A tuple containing the block ID numbers

Return type

tuple

get_elem_blk_info(id)[source]

Gets the element block information for the specified element block ID

Parameters

id (int) – Element Block ID number

Returns

  • element_type (str) – Name of the Element Type

  • elements_in_block (int) – Number of elements in the block

  • nodes_per_element (int) – Number of nodes per element in the block

  • attributes_per_element (int) – Number of attributes per element

get_elem_connectivity(id)[source]

Gets the element connectivity matrix for a given block

Parameters

id (int) – The block id for which the element connectivity matrix is desired.

Returns

connectivity – The 2d connectivity matrix for the block with dimensions num_elem x num_nodes_per_element. The returned value is converted from the 1-based Exodus indexing to 0-based Python/NumPy indexing.

Return type

np.masked_array

get_elem_num_map()[source]

Retrieve the list of local element IDs from the exodus file.

Returns

elem_num_map – Returns a 1D array with size num_elems, denoting the element number for the element in each index

Return type

np.array

Notes

If there is no elem_num_map in the exodus file, this function simply returns an array from 1 to self.num_elems

get_elem_type(id)[source]

Gets the element type for a given block

Parameters

id (int) – The block id for which the element connectivity matrix is desired.

Returns

type – The element type of the block

Return type

str

get_elem_variable_names()[source]

Gets a tuple of element variable names from the exodus file

Returns

elem_var_names – Returns a tuple containing the names of the element variables in the exodus file.

Return type

tuple of strings

get_elem_variable_table()[source]

Gets the element variable table

Gets the element variable table showing which elements are defined for which blocks.

Returns

elem_var_table – A 2D array with dimension num_blocks x num_element_variables. If the jth element variable is defined for the ith block, elem_var_table[i,j] == True

Return type

np.masked_array

get_elem_variable_value(block_id, name_or_index, element_index, step=None)[source]

Gets an element’s variable value for the specified timestep

Parameters
  • block_id (int) – Block id number for the block from which element variable value is desired.

  • name_or_index (str or int) – Name or Index of the element variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • element_index (int) – element index at which to recover the nodal variable

  • step (int) – Time step at which to recover the nodal variable

Returns

elem_variable_value – The variable values for the specified element at the specified time step.

Return type

float

get_elem_variable_values(block_id, name_or_index, step=None)[source]

Gets a block’s element variable values for the specified timestep

Parameters
  • block_id (int) – Block id number for the block from which element variable values are desired.

  • name_or_index (str or int) – Name or Index of the element variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • step (int) – Time step at which to recover the element variable

Returns

elem_variable_values – A 1d array consisting of the variable values for each element in the specified block at the specified time step.

Return type

maskedarray

get_element_property_names()[source]
get_element_property_value()[source]
get_global_variable_names()[source]

Gets a tuple of global variable names from the exodus file

Returns

global_var_names – Returns a tuple containing the names of the global variables in the exodus file.

Return type

tuple of strings

get_global_variable_values(name_or_index, step=None)[source]

Gets the global variable value for the specified timesteps

Parameters
  • name_or_index (str or int) – Name or Index of the global variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • step (int) – Time step at which to recover the nodal variable

Returns

global_variable_values – A 1d array or floating point number consisting of the variable values at the specified time steps.

Return type

maskedarray or float

get_info_records()[source]

Get the information records in the exodus file

Returns

info_records – Returns a tuple of strings where the index is the record number.

Return type

tuple

get_node_num_map()[source]

Retrieve the list of local node IDs from the exodus file.

Returns

node_num_map – Returns a 1D array with size num_nodes, denoting the node number for the node in each index

Return type

np.array

Notes

If there is no node_num_map in the exodus file, this function simply returns an array from 1 to self.num_nodes

get_node_set_dist_factors(id)[source]

Get the distribution factors of the specified node set

Parameters

id (int) – Node set ID (not index)

Returns

dist_factor – The distribution factors in the node set

Return type

np.array

get_node_set_ids()[source]

Gets a list of the node set ID numbers in the exodus file

Returns

ns_ids – A tuple containing the node set ID numbers

Return type

tuple

get_node_set_names()[source]

Retrieve the node set names in the exodus file.

Returns

ns_names – Returns a tuple of strings containing the node set names in the exodus file.

Return type

tuple

get_node_set_nodes(id)[source]

Get the nodes in the specified node set

Parameters

id (int) – Node set ID (not index)

Returns

nodes – The node indices of nodes in the node set. Note that while the Exodus file format uses 1-based indexing, the returned nodes array is converted so it is 0-based.

Return type

np.array

get_node_set_num_nodes(id)[source]

Get the number of nodes in the specified node set

Parameters

id (int) – Node set ID (not index)

Returns

num_nodes – The number of nodes in the node set.

Return type

int

get_node_variable_names()[source]

Gets a tuple of nodal variable names from the exodus file

Returns

node_var_names – Returns a tuple containing the names of the nodal variables in the exodus file.

Return type

tuple of strings

get_node_variable_value(name_or_index, node_index, step=None)[source]

Gets a node variable value for the specified timestep

Parameters
  • name_or_index (str or int) – Name or Index of the nodal variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • node_index (int) – Node index at which to recover the nodal variable

  • step (int) – Time step at which to recover the nodal variable

Returns

node_variable_value – The variable values for the specified node at the specified time step.

Return type

float

get_node_variable_values(name_or_index, step=None)[source]

Gets the node variable values for the specified timestep

Parameters
  • name_or_index (str or int) – Name or Index of the nodal variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • step (int) – Time step at which to recover the nodal variable

Returns

node_variable_values – A 1d array consisting of the variable values for each node at the specified time step.

Return type

maskedarray

get_qa_records()[source]

Get the quality assurance records in the exodus file

Returns

qa_records – Returns a nested tuple of strings where the first index is the record number, and the second is the line in the record.

Return type

tuple

get_side_set_dist_factors(id)[source]

Get the distribution factors of the specified side set

Parameters

id (int) – Side set ID (not index)

Returns

dist_factor – The distribution factors in the node set

Return type

np.array

get_side_set_faces(id)[source]

Get the faces in the specified side set

Parameters

id (int) – Side set ID (not index)

Returns

  • elements (np.array) – The element of each face in the sideset (converted from 1-based exodus indexing to 0-based python indexing)

  • sides (np.array) – The element side of each face in the sideset (converted from 1-based exodus indexing to 0-based python indexing)

get_side_set_ids()[source]

Gets a list of the side set ID numbers in the exodus file

Returns

ss_ids – A tuple containing the side set ID numbers

Return type

tuple

get_side_set_names()[source]

Retrieve the side set names in the exouds file.

Returns

ss_names – Returns a tuple of strings containing the side set names in the exodus file

Return type

tuple

get_side_set_node_list(id)[source]
get_side_set_num_faces(id)[source]

Get the number of faces in the specified side set

Parameters

id (int) – Side set ID (not index)

Returns

num_faces – The number of faces in the side set.

Return type

int

get_times(indices=None)[source]

Gets the time values from the exodus file

Returns

time_array – A masked_array containing the time values.

Return type

np.masked_array

load_into_memory(close=True, variables=None, timesteps=None, blocks=None)[source]

Loads the exodus file into an ExodusInMemory object

This function loads the exodus file into memory in an ExodusInMemory format. Not for use with large files.

Parameters
  • close (bool) – Close the netcdf file upon loading into memory. Optional argument, default is true.

  • 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.

Returns

fexo – The exodus file in an ExodusInMemory format

Return type

ExodusInMemory

num_attr(id)[source]

Gets the number of attributes per element for an element block

Parameters

d (int) – The block id for which the number of attributes is desired

Returns

attr_per_element – The number of attributes per element in a block

Return type

int

property num_blks
property num_dimensions
property num_elem_variables
property num_elems
num_elems_in_blk(id)[source]

Gets the number of elements in an element block

Parameters

d (int) – The block id for which the number of attributes is desired

Returns

elem_per_element – The number of elements in the block

Return type

int

property num_global_variables
property num_node_sets
property num_node_variables
property num_nodes
num_nodes_per_elem(id)[source]

Gets the number of nodes per element in an element block

Parameters

d (int) – The block id for which the number of attributes is desired

Returns

nodes_per_elem – The number of nodes per element in the block

Return type

int

property num_side_sets
property num_times
put_coord_names(coord_names)[source]

Puts the coordinate names into the exodus file

Parameters

coord_names (sequence of strings) – A sequence (list/tuple/etc.) containing the coordinate names.

put_coords(coords)[source]

Puts the coordinate values into the exodus file

Parameters

coords (np.ndarray) – A 2d array containing coordinate values.

put_elem_blk_ids(block_ids)[source]

Puts a list of the element block ID numbers in the exodus file

Parameters

block_ids (array-like) – A sequency of integers specifying the block id numbers

put_elem_blk_info(id, elem_type, num_elements, num_nodes_per_element, num_attrs_per_elem=0)[source]

Puts the element block information for an element block ID into the exodus file

Parameters
  • id (int) – The block ID (not index) that the information is being specified for

  • elem_type (str) – The element type (‘SHELL4’,’HEX8’, etc.) in the block

  • num_elements (int) – The number of elements in the block

  • num_nodes_per_element (int) – The number of nodes per element in the block

  • num_attrs_per_element (int) – The number of attributes per element in the block

put_elem_num_map(elem_num_map)[source]

Puts a list of local element IDs into the exodus file.

Parameters

elem_num_map (np.array) – A 1D array with size num_elems, denoting the element number for the element in each index

put_elem_variable_names(elem_var_names, elem_var_table=None)[source]

Puts the specified variable names in the exodus file

Parameters
  • elem_var_names (tuple of strings) – A tuple containing the names of the element variables in the exodus file

  • elem_var_table (2d array-like) – A 2d array of shape num_el_blk x num_elem_var defining which element variables are defined for which element blocks elem_var_table[i,j] should be True if the j-th element variable is defined for the i-th block (index, not id number) in the model. If not specified, it is assumed that all variables are defined for all blocks.

put_element_property_names()[source]
put_element_property_value()[source]
put_global_variable_names(global_var_names)[source]

Puts the specified global variable names in the exodus file

Parameters

global_var_names (tuple of strings) – A tuple containing the names of the global variables in the model

put_info_records(records)[source]

Puts the information records in the exodus file

Parameters

info_records (sequence of strings) – A sequence (list/tuple/etc.) containing the information records.

put_node_num_map(node_num_map)[source]

Puts a list of local node IDs into the exodus file.

Parameters

node_num_map (np.array) – A 1D array with size num_nodes, denoting the node number for the node in each index

put_node_set_ids(ns_ids)[source]

Puts a list of the node set ID numbers in the exodus file

Parameters

ns_ids (array-like) – A sequency of integers specifying the node set id numbers

put_node_set_info(id, nodes, dist_fact=None)[source]

Puts the node set information for a node set ID into the exodus file

Parameters
  • id (int) – The node set ID (not index)

  • nodes (array-like) – A 1d array containing the node indices. Note the array should be zero-based, it will be converted to one based when written to the exodus file.

  • dist_fact (array-like) – A 1d array containing the node set distribution factors. If not specified, the distribution factors will be assumed to be 1.

put_node_set_names(ns_names)[source]

Puts the node set names into the exodus file

Parameters

ns_names (sequence of strings) – A sequence (list/tuple/etc.) containing the node set names.

put_node_variable_names(node_var_names)[source]

Puts the specified variable names in the exodus file

Parameters

node_var_names (tuple of strings) – A tuple containing the names of the nodal variables in the model

put_qa_records(records)[source]

Puts the quality assurance records in the exodus file

Parameters

qa_records (sequence of sequence of strings) – A nested sequence (list/tuple/etc.) containing the quality assurance records.

Notes

Each index in qa_records should consist of a length-4 tuple of strings:

  1. Analysis Code Name

  2. Analysis Code Version

  3. Analysis Date

  4. Analysis Time

put_side_set_ids(ss_ids)[source]

Puts a list of the side set ID numbers in the exodus file

Parameters

ss_ids (array-like) – A sequency of integers specifying the side set id numbers

put_side_set_info(id, elements, sides, dist_fact=None)[source]

Puts the side set information for a side set ID into the exodus file

Parameters
  • id (int) – The side set ID (not index)

  • elements (np.array) – The element of each face in the sideset (converted from 1-based exodus indexing to 0-based python indexing)

  • sides (np.array) – The element side of each face in the sideset (converted from 1-based exodus indexing to 0-based python indexing)

  • dist_fact (array-like) – A 1d array containing the node set distribution factors. If not specified, the distribution factors will be assumed to be 1.

put_side_set_names(ss_names)[source]

Puts the side set names into the exodus file

Parameters

ss_names (sequence of strings) – A sequence (list/tuple/etc.) containing the side set names.

reduce_to_surfaces(*args, **kwargs)[source]
set_elem_attr(id, attributes)[source]

Sets the element attributes for a given block

Parameters
  • id (int) – The block id for which the element connectivity matrix is desired.

  • attributes (2D array-like) – The 2d attribute matrix for the block with dimensions num_elem x num_attributes

set_elem_connectivity(id, connectivity)[source]

Sets the element connectivity matrix for a given block

Parameters
  • id (int) – The block id for which the element connectivity is being assigned

  • connectivity (2D array-like) – A 2D array of dimension num_elements x num_nodes_per_element defining the element connectivity. Note that the connectivity matrix should be 0-based (first node index is zero) per Python conventions. It will be converted to one-based when it is written to the Exodus file.

set_elem_variable_value(block_id, name_or_index, element_index, step, value)[source]

Sets an element variable value for the specified timestep

Parameters
  • block_id (int) – Block id number for the block from which element variable values are desired.

  • name_or_index (str or int) – Name or Index of the element variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • step (int) – Time step at which to recover the element variable

  • value (float) – The variable values for the specified element in the specified block at the specified time step.

Notes

If step is not a valid index for the time vector, the time vector will be expanded so that it is.

set_elem_variable_values(block_id, name_or_index, step, values)[source]

Sets a block’s element variable values for the specified timestep

Parameters
  • block_id (int) – Block id number for the block from which element variable values are desired.

  • name_or_index (str or int) – Name or Index of the element variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • step (int) – Time step at which to recover the element variable

  • values (array-like) – A 1d array consisting of the variable values for each element in the specified block at the specified time step.

Notes

If step is not a valid index for the time vector, the time vector will be expanded so that it is.

set_global_variable_values(name_or_index, step, value)[source]

Sets the global variable values for the specified timestep

Parameters
  • name_or_index (str or int) – Name or Index of the nodal variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • step (int) – Time step at which to recover the nodal variable

  • value (array-like) – A 1d array consisting of the variable values for each node at the specified time step.

Notes

If step is not a valid index for the time vector, the time vector will be expanded so that it is.

set_node_variable_value(name_or_index, node_index, step, value)[source]

Sets the node variable values for the specified timestep

Parameters
  • name_or_index (str or int) – Name or Index of the nodal variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • node_index (int) – Node index at which to recover the nodal variable

  • step (int) – Time step at which to recover the nodal variable

  • value (float) – The variable value for the specified node at the specified time step.

Notes

If step is not a valid index for the time vector, the time vector will be expanded so that it is.

set_node_variable_values(name_or_index, step, values)[source]

Sets the node variable values for the specified timestep

Parameters
  • name_or_index (str or int) – Name or Index of the nodal variable that is desired. If type(name_or_index) == str, then it is assumed to be the name. If type(name_or_index) == int, then it is assumed to be the index.

  • step (int) – Time step at which to recover the nodal variable

  • values (array-like) – A 1d array consisting of the variable values for each node at the specified time step.

Notes

If step is not a valid index for the time vector, the time vector will be expanded so that it is.

set_time(step, value)[source]

Sets the time value of a given step in the exodus file

Parameters
  • step (int) – The index in the time vector to set to value

  • value (float) – A real number to set the value of the specified index in the time vector to.

Notes

If step is not a valid index for the time vector, the time vector will be expanded so that it is.

set_times(values)[source]

Sets the time vector for the exodus file

Parameters

values (array-like) – A 1-dimensional array that has the time step values as it’s entries

Notes

If the vector is longer than the current time step vector, it will be expanded. If the vector is shorter than the current time step vector, only the first len(values) entries of the time vector will be assigned.

property title

Get the title of the exodus file

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