hookeai.data_generation.spdg.patch_generator.FiniteElementPatch

class FiniteElementPatch(n_dim, patch_dims, elem_type, n_elems_per_dim, mesh_nodes_matrix, mesh_nodes_coords_ref, mesh_boundary_nodes_disps)[source]

Bases: object

Finite element material patch.

Material patch is assumed quadrilateral (2d) or parallelepipedic (3D) and discretized in a regular finite element mesh of quadrilateral (2d) / hexahedral (3d) finite elements.

_n_dim

Number of spatial dimensions.

Type:

int

_patch_dims

Patch size in each dimension.

Type:

tuple[float]

_elem_type

Finite element type.

Type:

str

_n_elems_per_dim

Number of finite elements per dimension.

Type:

tuple[int]

_mesh_nodes_matrix

Finite element mesh nodes matrix (numpy.ndarray[int](n_edge_nodes_per_dim) where each element corresponds to a given node position and whose value is set either as the global node label or zero (if the node does not exist). Nodes are labeled from 1 to n_nodes.

Type:

numpy.ndarray(2d or 3d)

_mesh_nodes_coords_ref

Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]) in the reference configuration. Nodes are labeled from 1 to n_nodes.

Type:

dict

_mesh_boundary_nodes_disps

Displacements (item, numpy.ndarray(n_dim)) prescribed on each finite element mesh boundary node (key, str[int]). Free degrees of freedom must be set as None.

Type:

dict

_n_edge_nodes_per_dim

Number of patch edge nodes along each dimension.

Type:

tuple[int]

get_n_dim(self)[source]

Get number of spatial dimensions.

get_elem_type(self)[source]

Get finite element type.

get_n_elems_per_dim(self)[source]

Get number of finite elements per dimension.

get_n_edge_nodes_per_dim(self)[source]

Get number of patch edge nodes along each dimension.

get_mesh_nodes_matrix(self)[source]

Get finite element mesh nodes matrix.

get_mesh_nodes_coords_ref(self)[source]

Get reference coordinates of each finite element mesh node.

get_mesh_boundary_nodes_disps(self)[source]

Get displacements prescribed on finite element mesh boundary nodes.

get_elem_size_dims(self)[source]

Get finite element size along each dimension.

get_mesh_connected_nodes(self)[source]

Get finite element mesh connected nodes pairs.

_set_n_edge_nodes_per_dim(self)[source]

Set number of patch edge nodes per dimension.

get_boundary_nodes_labels(self)[source]

Get finite element mesh boundary nodes labels.

get_boundary_edges_nodes_labels(self)[source]

Get finite element mesh boundary edges nodes labels.

get_patch_attributes(self)[source]

Get finite element material patch attributes.

plot_deformed_patch(self, is_hide_axes=False, is_show_fixed_dof=False,

is_hide_deformed_faces=True, is_show_plot=False, is_save_plot=False, save_directory=None, plot_name=None, is_overwrite_file=False)

Generate plot of material patch.

Constructor.

Parameters:
  • n_dim (int) – Number of spatial dimensions.

  • patch_dims (tuple[float]) – Patch size in each dimension.

  • elem_type (str) – Finite element type.

  • n_elems_per_dim (tuple[int]) – Number of finite elements per dimension.

  • mesh_nodes_matrix (numpy.ndarray(2d or 3d)) – Finite element mesh nodes matrix (numpy.ndarray[int](n_edge_nodes_per_dim) where each element corresponds to a given node position and whose value is set either as the global node label or zero (if the node does not exist). Nodes are labeled from 1 to n_nodes.

  • mesh_nodes_coords_ref (dict) – Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]) in the reference configuration. Nodes are labeled from 1 to n_nodes.

  • mesh_boundary_nodes_disps (dict) – Displacements (item, numpy.ndarray(n_dim)) prescribed on each finite element mesh boundary node (key, str[int]). Free degrees of freedom must be set as None.

List of Public Methods

get_boundary_edges_nodes_labels

Get finite element mesh boundary edges nodes labels.

get_boundary_nodes_labels

Get finite element mesh boundary nodes labels.

get_elem_size_dims

Get finite element size along each dimension.

get_elem_type

Get finite element type.

get_mesh_boundary_nodes_disps

Get displacements prescribed on finite element mesh boundary nodes.

get_mesh_connected_nodes

Get finite element mesh connected nodes pairs.

get_mesh_nodes_coords_ref

Get reference coordinates of each finite element mesh node.

get_mesh_nodes_matrix

Get finite element mesh nodes matrix.

get_n_dim

Get number of spatial dimensions.

get_n_edge_nodes_per_dim

Get number of patch edge nodes along each dimension.

get_n_elems_per_dim

Get number of finite elements per dimension.

get_patch_attributes

Get finite element material patch attributes.

plot_deformed_patch

Generate plot of finite element material patch.

Methods

__init__(n_dim, patch_dims, elem_type, n_elems_per_dim, mesh_nodes_matrix, mesh_nodes_coords_ref, mesh_boundary_nodes_disps)[source]

Constructor.

Parameters:
  • n_dim (int) – Number of spatial dimensions.

  • patch_dims (tuple[float]) – Patch size in each dimension.

  • elem_type (str) – Finite element type.

  • n_elems_per_dim (tuple[int]) – Number of finite elements per dimension.

  • mesh_nodes_matrix (numpy.ndarray(2d or 3d)) – Finite element mesh nodes matrix (numpy.ndarray[int](n_edge_nodes_per_dim) where each element corresponds to a given node position and whose value is set either as the global node label or zero (if the node does not exist). Nodes are labeled from 1 to n_nodes.

  • mesh_nodes_coords_ref (dict) – Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]) in the reference configuration. Nodes are labeled from 1 to n_nodes.

  • mesh_boundary_nodes_disps (dict) – Displacements (item, numpy.ndarray(n_dim)) prescribed on each finite element mesh boundary node (key, str[int]). Free degrees of freedom must be set as None.

_set_n_edge_nodes_per_dim()[source]

Set number of patch edge nodes per dimension.

get_boundary_edges_nodes_labels()[source]

Get finite element mesh boundary edges nodes labels.

Returns:

boundary_edges_nodes_labels – Finite element mesh boundary edges nodes labels.

Return type:

tuple[int]

get_boundary_nodes_labels()[source]

Get finite element mesh boundary nodes labels.

Returns:

boundary_nodes_labels – Finite element mesh boundary nodes labels.

Return type:

tuple[int]

get_elem_size_dims()[source]

Get finite element size along each dimension.

Returns:

elem_size_dims – Finite element size along each dimension.

Return type:

tuple

get_elem_type()[source]

Get finite element type.

Returns:

elem_type – Finite element type.

Return type:

str

get_mesh_boundary_nodes_disps()[source]

Get displacements prescribed on finite element mesh boundary nodes.

Returns:

mesh_boundary_nodes_disps – Displacements (item, numpy.ndarray(n_dim)) prescribed on each finite element mesh boundary node (key, str[int]). Free degrees of freedom must be set as None.

Return type:

dict

get_mesh_connected_nodes()[source]

Get finite element mesh connected nodes pairs.

Returns:

connected_nodes – A set containing all pairs of nodes that are connected by a finite element edge. Each connection is stored a single time as a tuple(node[int], node[int]) and is independent of the corresponding nodes storage order.

Return type:

tuple[tuple(2)]

get_mesh_nodes_coords_ref()[source]

Get reference coordinates of each finite element mesh node.

Returns:

mesh_nodes_coords_ref – Coordinates (item, numpy.ndarray(n_dim)) of each finite element mesh node (key, str[int]) in the reference configuration. Nodes are labeled from 1 to n_nodes.

Return type:

dict

get_mesh_nodes_matrix()[source]

Get finite element mesh nodes matrix.

Returns:

mesh_nodes_matrix – Finite element mesh nodes matrix (numpy.ndarray[int](n_edge_nodes_per_dim)) where each element corresponds to a given node position and whose value is set either as the global node label or zero (if the node does not exist). Nodes are labeled from 1 to n_nodes.

Return type:

numpy.ndarray(2d or 3d)

get_n_dim()[source]

Get number of spatial dimensions.

Returns:

n_dim – Number of spatial dimensions.

Return type:

int

get_n_edge_nodes_per_dim()[source]

Get number of patch edge nodes along each dimension.

Returns:

n_edge_nodes_per_dim – Number of patch edge nodes along each dimension.

Return type:

tuple[int]

get_n_elems_per_dim()[source]

Get number of finite elements per dimension.

Returns:

n_elems_per_dim – Number of finite elements per dimension.

Return type:

tuple[int]

get_patch_attributes()[source]

Get finite element material patch attributes.

Returns:

patch_attributes – Material patch attributes.

Return type:

dict

plot_deformed_patch(is_hide_axes=False, is_show_fixed_dof=False, is_hide_deformed_faces=True, is_show_plot=False, is_save_plot=False, save_directory=None, plot_name=None, is_overwrite_file=False)[source]

Generate plot of finite element material patch.

Deformed configuration is only plotted if all boundary degrees of freedom displacements are prescribed.

Parameters:
  • is_hide_axes (bool, default=False) – If True, then hide all visual components of axes.

  • is_show_fixed_dof (bool, default=False) – If True, then signal fixed boundary degrees of freedom.

  • is_hide_deformed_faces (bool, default=True) – If True, then hide boundary faces nodes deformed configuration when available. Only effective for three-dimensional patch.

  • is_show_plot (bool, default=False) – Display plot of finite element material patch if True.

  • is_save_plot (bool, default=False) – Save plot of finite element material patch. Plot is only saved if save_directory is provided and exists.

  • save_directory (str, default=None) – Directory where plot of finite element material patch is stored.

  • plot_name (str, default=None) – Filename of finite element material patch plot.

  • is_overwrite_file (bool, default=False) – Overwrite plot of finite element material patch if True, otherwise generate non-existent file path by extending the original file path with an integer.