hookeai.material_model_finder.data.specimen_data.StructureMesh¶
- class StructureMesh(nodes_coords_mesh_init, elements_type, connectivities, dirichlet_bool_mesh)[source]¶
Bases:
objectFETorch structure finite element mesh.
- _elements_type¶
FETorch element type (item, ElementType) of each finite element mesh element (str[int]). Elements are labeled from 1 to n_elem.
- Type:
- _connectivities¶
Nodes (item, tuple[int]) of each finite element mesh element (key, str[int]). Nodes are labeled from 1 to n_node_mesh. Elements are labeled from 1 to n_elem.
- Type:
- _nodes_coords_mesh_init¶
Initial coordinates of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
- Type:
torch.Tensor(2d)
- _nodes_coords_mesh¶
Coordinates of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
- Type:
torch.Tensor(2d)
- _nodes_coords_mesh_old¶
Last converged coordinates of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
- Type:
torch.Tensor(2d)
- _nodes_disps_mesh¶
Displacements of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
- Type:
torch.Tensor(2d)
- _nodes_disps_mesh_old¶
Last converged displacements of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
- Type:
torch.Tensor(2d)
- _dirichlet_bool_mesh¶
Degrees of freedom of finite element mesh subject to Dirichlet boundary conditions. Stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim) where constrained degrees of freedom are labeled 1, otherwise 0.
- Type:
torch.Tensor(2d)
- get_connectivities_tensor(self)[source]¶
Get finite element mesh elements connectivities stored (tensor).
- get_dirichlet_bool_mesh(self)[source]¶
Get degrees of freedom subject to Dirichlet boundary conditions.
- get_n_dirichlet_dof(self)[source]¶
Get number of degrees of freedom subject to Dirichlet conditions.
- get_element_configuration(self, element_id, time='current')[source]¶
Get element nodes coordinates and displacements.
- update_mesh_configuration(self, nodes_disps_mesh, nodes_disps_mesh_old=None, is_update_coords=True)[source]¶
- element_assembler(self, elements_array)[source]¶
Assemble element level arrays into mesh level counterparts.
- _element_assembler_1d(self, elements_array_1d)[source]¶
Assemble element level 1D array into mesh level counterpart.
- element_extractor(self, mesh_array, element_id)[source]¶
Extract element level array from mesh level counterpart.
- _element_extractor_1d(self, mesh_array, element_id)[source]¶
Extract element level 1D array from mesh level counterpart.
- build_elements_mesh_indexing(self, n_dof_node)[source]¶
Build elements nodes degrees of freedom mesh indexes.
- build_element_mesh_indexing(cls, element_nodes, n_dof_node)[source]¶
Get element nodes degrees of freedom mesh indexes.
- _check_mesh_initialization(self, nodes_coords_mesh_init, elements_type,
connectivities)
Check finite element mesh initialization.
Constructor.
- Parameters:
nodes_coords_mesh_init (torch.Tensor(2d)) – Initial coordinates of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
elements_type (dict) – FETorch element type (item, ElementType) of each finite element mesh element (str[int]). Elements labels must be within the range of 1 to n_elem (included).
connectivities (dict) – Nodes (item, tuple[int]) of each finite element mesh element (key, str[int]). Nodes are labeled from 1 to n_node_mesh. Elements are labeled from 1 to n_elem.
dirichlet_bool_mesh (torch.Tensor(2d)) – Degrees of freedom of finite element mesh subject to Dirichlet boundary conditions. Stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim) where constrained degrees of freedom are labeled 1, otherwise 0.
List of Public Methods
Get element nodes degrees of freedom mesh indexes.
Build elements nodes degrees of freedom mesh indexes.
Assemble element level arrays into mesh level counterparts.
Extract element level array from mesh level counterpart.
Get finite element mesh elements connectivities.
Get finite element mesh elements connectivities (tensor).
Get degrees of freedom subject to Dirichlet boundary conditions.
Get element nodes coordinates and displacements.
Get type of elements of finite element mesh.
Get finite element mesh configuration.
Get number of spatial dimensions.
Get number of degrees of freedom subject to Dirichlet conditions.
Number of elements of finite element mesh.
Get the number of elements types of finite element mesh.
Get number of nodes of finite element mesh.
Update finite element mesh configuration from nodes displacements.
Methods
- __init__(nodes_coords_mesh_init, elements_type, connectivities, dirichlet_bool_mesh)[source]¶
Constructor.
- Parameters:
nodes_coords_mesh_init (torch.Tensor(2d)) – Initial coordinates of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
elements_type (dict) – FETorch element type (item, ElementType) of each finite element mesh element (str[int]). Elements labels must be within the range of 1 to n_elem (included).
connectivities (dict) – Nodes (item, tuple[int]) of each finite element mesh element (key, str[int]). Nodes are labeled from 1 to n_node_mesh. Elements are labeled from 1 to n_elem.
dirichlet_bool_mesh (torch.Tensor(2d)) – Degrees of freedom of finite element mesh subject to Dirichlet boundary conditions. Stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim) where constrained degrees of freedom are labeled 1, otherwise 0.
- _check_mesh_initialization(nodes_coords_mesh_init, elements_type, connectivities)[source]¶
Check finite element mesh initialization.
- Parameters:
nodes_coords_mesh_init (torch.Tensor(2d)) – Initial coordinates of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
elements_type (dict) – FETorch element type (item, ElementType) of each finite element mesh element (str[int]). Elements are labeled from 1 to n_elem.
connectivities (dict) – Nodes (item, tuple[int]) of each finite element mesh element (key, str[int]). Elements are labeled from 1 to n_elem.
- _element_assembler_1d(elements_array_1d)[source]¶
Assemble element level 1D array into mesh level counterpart.
Assumes similar number of dimensions per node in the whole finite element mesh.
- Parameters:
elements_arrays_1d (dict) – Generic array (item, torch.Tensor(1d)) associated with given finite element mesh element (key, str[int]). Elements labels must be within the range of 1 to n_elem (included).
- Returns:
mesh_array – Mesh level array resulting from the assembly of the corresponding element level arrays. Mesh level array is always sorted and dimensioned accounting for the total number of nodes in the finite element mesh.
- Return type:
torch.Tensor(1d)
- _element_extractor_1d(mesh_array, element_id)[source]¶
Extract element level 1D array from mesh level counterpart.
Assumes similar number of dimensions per node in the whole finite element mesh.
- Parameters:
mesh_array (torch.Tensor(1d)) – Mesh level array resulting from the assembly of the corresponding element level arrays. Mesh level array is always sorted and dimensioned accounting for the total number of nodes in the finite element mesh.
element_id (int) – Element label. Elements labels must be within the range of 1 to n_elem (included).
- Returns:
element_array – Generic element array.
- Return type:
torch.Tensor(1d)
- classmethod build_element_mesh_indexing(element_nodes, n_dof_node)[source]¶
Get element nodes degrees of freedom mesh indexes.
- Parameters:
element_nodes (torch.Tensor(1d)) – Finite element mesh element connectitivities stored as torch.Tensor(1d) of shape (n_node,). Nodes are labeled from 1 to n_node_mesh.
n_dof_node (int) – Number of degrees of freedom per element node.
- Returns:
element_mesh_indexes – Element nodes degrees of freedom mesh indexes stored as torch.Tensor(1d) of shape (n_node*n_dof_node,).
- Return type:
torch.Tensor(1d)
- build_elements_mesh_indexing(n_dof_node)[source]¶
Build elements nodes degrees of freedom mesh indexes.
- Parameters:
n_dof_node (int) – Number of degrees of freedom per element node.
- Returns:
elements_mesh_indexes – Elements nodes degrees of freedom mesh indexes stored as torch.Tensor(2d) of shape (n_elem, n_node*n_dof_node).
- Return type:
torch.Tensor(2d)
- element_assembler(elements_array)[source]¶
Assemble element level arrays into mesh level counterparts.
Assumes similar number of dimensions per node in the whole finite element mesh.
- Parameters:
elements_array (dict) – Generic array (item, torch.Tensor) associated with given finite element mesh element (key, str[int]). Elements labels must be within the range of 1 to n_elem (included).
- Returns:
mesh_array – Mesh level array resulting from the assembly of the corresponding element level arrays. Mesh level array is always sorted and dimensioned accounting for the total number of nodes in the finite element mesh.
- Return type:
torch.Tensor
- element_extractor(mesh_array, element_id)[source]¶
Extract element level array from mesh level counterpart.
Assumes similar number of dimensions per node in the whole finite element mesh.
- Parameters:
mesh_array (torch.Tensor) – Mesh level array resulting from the assembly of the corresponding element level arrays. Mesh level array is always sorted and dimensioned accounting for the total number of nodes in the finite element mesh.
element_id (int) – Element label. Elements labels must be within the range of 1 to n_elem (included).
- Returns:
element_array – Generic element array.
- Return type:
torch.Tensor
- get_connectivities()[source]¶
Get finite element mesh elements connectivities.
- Returns:
connectivities – Nodes (item, tuple[int]) of each finite element mesh element (key, str[int]). Nodes are labeled from 1 to n_node_mesh. Elements are labeled from 1 to n_elem.
- Return type:
- get_connectivities_tensor()[source]¶
Get finite element mesh elements connectivities (tensor).
Storage of finite element mesh elements connectivities in tensor, i.e., batching over the element dimension, requires that all finite element mesh elements have the same number of nodes.
- Returns:
connectivities_tensor – Finite element mesh elements connectitivities stored as torch.Tensor(2d) of shape (n_elem, n_node). Elements are sorted according with their labels (1 to n_elem). Nodes are labeled from 1 to n_node_mesh.
- Return type:
torch.Tensor(2d)
- get_dirichlet_bool_mesh()[source]¶
Get degrees of freedom subject to Dirichlet boundary conditions.
- Returns:
dirichlet_bool_mesh – Degrees of freedom of finite element mesh subject to Dirichlet boundary conditions. Stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim) where constrained degrees of freedom are labeled 1, otherwise 0.
- Return type:
torch.Tensor(2d)
- get_element_configuration(element_id, time='current')[source]¶
Get element nodes coordinates and displacements.
- Parameters:
element_id (int) – Element label. Elements labels must be within the range of 1 to n_elem (included).
time ({'init', 'last', 'current'}, default='current') – Time where element configuration is returned: initial configuration (‘init’), last converged configuration (‘last’), or current configuration (‘current’).
- Returns:
nodes_coords (torch.Tensor(2d)) – Nodes coordinates stored as torch.Tensor(2d) of shape (n_node, n_dof_node).
nodes_disps (torch.Tensor(2d)) – Nodes displacements stored as torch.Tensor(2d) of shape (n_node, n_dof_node).
- get_elements_type()[source]¶
Get type of elements of finite element mesh.
- Returns:
elements_type – FETorch element type (item, ElementType) of each finite element mesh element (str[int]). Elements are labeled from 1 to n_elem.
- Return type:
- get_mesh_configuration(time='current')[source]¶
Get finite element mesh configuration.
- Parameters:
time ({'init', 'last', 'current'}, default='current') – Time where element configuration is returned: initial configuration (‘init’), last converged configuration (‘last’), or current configuration (‘current’).
- Returns:
nodes_coords_mesh (torch.Tensor(2d)) – Coordinates of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
nodes_disps_mesh (torch.Tensor(2d)) – Displacements of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
- get_n_dim()[source]¶
Get number of spatial dimensions.
- Returns:
n_dim – Number of spatial dimensions.
- Return type:
- get_n_dirichlet_dof()[source]¶
Get number of degrees of freedom subject to Dirichlet conditions.
- Returns:
n_dof_dirichlet – Number of degrees of freedom subject to Dirichlet boundary conditions.
- Return type:
- get_n_elem()[source]¶
Number of elements of finite element mesh.
- Returns:
n_elem – Number of elements of finite element mesh.
- Return type:
- get_n_element_type()[source]¶
Get the number of elements types of finite element mesh.
- Returns:
n_element_type – Number of element types of finite element mesh.
- Return type:
- get_n_node_mesh()[source]¶
Get number of nodes of finite element mesh.
- Returns:
n_node_mesh – Number of nodes of finite element mesh.
- Return type:
- update_mesh_configuration(nodes_disps_mesh, time='current', is_update_coords=True)[source]¶
Update finite element mesh configuration from nodes displacements.
- Parameters:
nodes_disps_mesh (torch.Tensor(2d)) – Displacements of finite element mesh nodes stored as torch.Tensor(2d) of shape (n_node_mesh, n_dim).
time ({'last', 'current'}, default='current') – Time where update of element state variables is performed: last converged state variables (‘last’) or current state variables (‘current’).
is_update_coords (bool, default=True) – If False, then only updates the displacements of the finite element mesh nodes, leaving the nodes coordinates unchanged. If True, then update both coordinates and displacements of finite element mesh nodes.