hookeai.simulators.links.links.LinksSimulator¶
- class LinksSimulator(links_bin_path, strain_formulation, analysis_type)[source]¶
Bases:
objectFinite element method simulator: Links.
- _strain_formulation¶
Links strain formulation.
- Type:
{‘infinitesimal’, ‘finite’}
- _analysis_type¶
Links analysis type.
- Type:
{‘plane_stress’, ‘plane_strain’, ‘axisymmetric’, ‘tridimensional’}
- generate_input_data_file(self, filename, directory, patch, patch_material_data, links_input_params=None)[source]¶
Generate Links input data file.
- read_links_simulation_results(self, links_output_directory, results_keywords)[source]¶
Read Links simulation results.
- _write_links_input_data_file(self, links_file_path, input_params, node_coords, elements, elements_mat_phase, element_type, n_gauss_points, mesh_elem_material, mat_phases_descriptors, node_displacements)[source]¶
Write Links input data file.
- remove_mesh_elements(cls, remove_elements_labels, node_coords, elements, elements_mat_phase, node_disps=None, boundary_nodes_labels=None)[source]¶
Remove elements from finite element mesh.
Constructor.
- Parameters:
links_bin_path (str) – Links binary absolute path.
strain_formulation ({'infinitesimal', 'finite'}) – Links strain formulation.
analysis_type ({'plane_stress', 'plane_strain', 'axisymmetric', 'tridimensional'}) – Links analysis type.
List of Public Methods
Generate Links input data file.
Read Links simulation results.
Remove elements from finite element mesh.
Run Links simulation.
Methods
- __init__(links_bin_path, strain_formulation, analysis_type)[source]¶
Constructor.
- Parameters:
links_bin_path (str) – Links binary absolute path.
strain_formulation ({'infinitesimal', 'finite'}) – Links strain formulation.
analysis_type ({'plane_stress', 'plane_strain', 'axisymmetric', 'tridimensional'}) – Links analysis type.
- _get_links_default_input_params()[source]¶
Get Links default input data file parameters.
- Returns:
default_parameters – Links input data file default parameters.
- Return type:
- _get_links_elem_type_data(patch)[source]¶
Get Links finite element type data.
- Parameters:
patch (FiniteElementPatch) – Finite element patch.
- Returns:
element_type (str) – Finite element type.
n_gauss_points (int) – Number of Gauss integration points per element.
- _get_links_mesh_data(patch, mesh_elem_material)[source]¶
Get Links finite element mesh data.
- Parameters:
patch (FiniteElementPatch) – Finite element patch.
mesh_elem_material (numpy.ndarray(2d or 3d)) – Finite element mesh elements material matrix (numpy.ndarray[int](n_elems_per_dim) where each element corresponds to a given finite element position and whose value is the corresponding material phase (int).
- Returns:
node_coords (dict) – Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]).
elements (dict) – Nodes (item, tuple[int]) of each finite element (key, str[int]).
elements_mat_phase (dict) – Material phase (item, int) of each finite element (key, str).
- _get_n_dim()[source]¶
Get number of spatial dimensions from analysis type.
- Returns:
n_dim – Number of spatial dimensions.
- Return type:
- _write_links_input_data_file(links_file_path, input_params, node_coords, elements, elements_mat_phase, element_type, n_gauss_points, mesh_elem_material, mat_phases_descriptors, node_displacements, is_save_increm_file=False)[source]¶
Write Links input data file.
- Parameters:
links_file_path (str) – Links input data file path.
input_params (dict) – Links input data file parameters.
node_coords (dict) – Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]).
elements (dict) – Nodes (item, tuple[int]) of each finite element (key, str[int]).
elements_mat_phase (dict) – Material phase (item, int) of each finite element (key, str).
element_type (str) – Finite element type.
n_gauss_points (int) – Number of Gauss integration points per element.
mesh_elem_material (numpy.ndarray(2d or 3d)) – Finite element mesh elements material matrix (numpy.ndarray[int](n_elems_per_dim) where each element corresponds to a given finite element position and whose value is the corresponding material phase (int).
mat_phases_descriptors (dict) – Constitutive model descriptors (item, dict) for each material phase (key, str[int])).
node_displacements (dict) – Displacements (item, numpy.ndarray(n_dim)) prescribed on each finite element mesh node (key, str[int]). Free degrees of freedom must be set as None.
is_save_increm_file (bool, default=False) – If True, then save data file with Links input data file loading incrementation data.
- generate_input_data_file(filename, directory, patch, patch_material_data, remove_elements_labels=None, links_input_params=None, is_overwrite_file=False, is_save_increm_file=False, is_verbose=False)[source]¶
Generate Links input data file.
- Parameters:
filename (str) – Links input data file name.
directory (str) – Directory where Links input data file is stored.
patch (FiniteElementPatch) – Finite element patch. If is_admissible is False, then returns None.
patch_material_data (dict) – Finite element patch material data. Expecting ‘mesh_elem_material’: numpy.ndarray [int](n_elems_per_dim) (finite element mesh elements material matrix where each element corresponds to a given finite element position and whose value is the corresponding material phase (int)) and ‘mat_phases_descriptors’: dict (constitutive model descriptors (item, dict) for each material phase (key, str[int])).
remove_elements_labels (tuple[int], default=None) – Finite elements to be removed from finite element mesh.
links_input_params (dict, default=None) – Links input data file parameters. If None, default parameters are set.
is_overwrite_file (bool, default=False) – Overwrite existing Links input data file if True, otherwise generate non-existent file path by extending the original file path with an integer.
is_save_increm_file (bool, default=False) – If True, then save data file with Links input data file loading incrementation data.
is_verbose (bool, default=False) – If True, enable verbose output.
- Returns:
links_file_path – Links input data file path.
- Return type:
- read_links_simulation_results(links_output_directory, results_keywords, is_verbose=False)[source]¶
Read Links simulation results.
- Parameters:
links_output_directory (str) – Links simulation output directory.
results_keywords (tuple[str]) –
A list of results to be output among:
’node_data’ : numpy.ndarray(3d) of shape (n_nodes, n_data_dim, n_time_steps), where the i-th node output data at the k-th time step is stored in indexes [i, :, k].
’global_data’ : numpy.ndarray(3d) of shape (1, n_data_dim, n_time_steps) where the global output data at the k-th time step is stored in [0, :, k].
is_verbose (bool, default=False) – If True, enable verbose output.
- Returns:
results – Links simulation results for each requested results keyword (key, str).
- Return type:
- classmethod remove_mesh_elements(remove_elements_labels, node_coords, elements, elements_mat_phase, node_disps=None, boundary_nodes_labels=None)[source]¶
Remove elements from finite element mesh.
- Parameters:
remove_elements_labels (tuple[int]) – Finite elements to be removed from finite element mesh.
node_coords (dict) – Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]).
elements (dict) – Nodes (item, tuple[int]) of each finite element (key, str[int]).
elements_mat_phase (dict) – Material phase (item, int) of each finite element (key, str).
node_disps (dict, default=None) – Displacements (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]).
boundary_nodes_labels (tuple[int], default=None) – Finite element mesh boundary nodes labels. If provided, then removal of elements that would lead to the removal of a boundary node raises error.
- Returns:
node_coords (dict) – Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]).
elements (dict) – Nodes (item, tuple[int]) of each finite element (key, str[int]).
elements_mat_phase (dict) – Material phase (item, int) of each finite element (key, str).
node_disps (dict) – Displacements (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]). None if displacements are not provided.