cratepy.clustering.adaptivity.crve_adaptivity.AdaptivityManager

class AdaptivityManager(strain_formulation, problem_type, adapt_material_phases, phase_clusters, adaptivity_control_feature, adapt_criterion_data, clust_adapt_freq)[source]

Bases: object

CRVE clustering adaptivity manager.

_n_dim

Problem number of spatial dimensions.

Type:

int

_comp_order_sym

Strain/Stress components symmetric order.

Type:

list[str]

_comp_order_nsym

Strain/Stress components nonsymmetric order.

Type:

list[str]

_adapt_phase_criterions

Clustering adaptivity criterion instance (item, AdaptivityCriterion) associated with each material phase (key, str).

Type:

dict

_inc_adaptive_steps

For each macroscale loading increment (key, str), store the performed number of clustering adaptive steps (item, int).

Type:

dict

_adapt_ref_init_inc

Clustering adaptivity reference initial increment (item, int) associated with each material phase (key, str).

Type:

dict

_adapt_feature_min_trigger

Clustering adaptivity feature minimum significant value surpassed status (item, bool) associated with each material phase (key, str).

Type:

dict

max_inc_adaptive_steps

Maximum number of clustering adaptive steps per macroscale loading increment.

Type:

int

adaptive_evaluation_time

Total amount of time (s) spent in selecting target clusters for clustering adaptivity.

Type:

float

adaptive_time

Total amount of time (s) spent in clustering adaptivity procedures.

Type:

float

get_adaptivity_criterions()[source]

Get available clustering adaptivity criterions.

get_target_clusters(self, phase_clusters, voxels_clusters, clusters_state, clusters_def_gradient_mf, clusters_def_gradient_old_mf, clusters_state_old, clusters_sct_mf, clusters_sct_old_mf, clusters_residuals_mf, inc=None, verbose=False)[source]

Get adaptive clustering target clusters.

_get_adaptivity_data_matrix(self, target_phase, adapt_control_feature, phase_clusters, clusters_def_gradient_mf, clusters_def_gradient_old_mf, clusters_state, clusters_state_old, clusters_sct_mf, clusters_sct_old_mf, clusters_residuals_mf)[source]

Build adaptivity feature data matrix for target material phase.

adaptive_refinement(self, crve, material_state, target_clusters, target_clusters_data, inc, improved_init_guess=None, verbose=False)[source]

Perform CRVE adaptive clustering refinement.

check_inc_adaptive_steps(self, inc)[source]

Check number of adaptive steps performed in loading increment.

clear_inc_adaptive_steps(self, inc_threshold)[source]

Reset number of adaptive steps performed after threshold increment.

is_adapt_phase_activated(self, mat_phase, inc)[source]

Check if material phase adaptivity procedures are activated.

reset_adapt_activation_parameters(self)[source]

Reset parameters associated with clustering adaptivity activation.

get_adapt_vtk_array(self, voxels_clusters)[source]

Get regular grid array with the adaptive level of each cluster.

Constructor.

Parameters:
  • strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.

  • problem_type (int) – Problem type identifier (1 - Plain strain (2D), 4- Tridimensional)

  • adapt_material_phases (list[str]) – RVE adaptive material phases labels (str).

  • phase_clusters (dict) – Clusters labels (item, list[int]) associated with each material phase (key, str).

  • adaptivity_control_feature (dict) – Clustering adaptivity control feature (item, str) associated with each material phase (key, str).

  • adapt_criterion_data (dict) – Clustering adaptivity criterion (item, dict) associated with each material phase (key, str). This dictionary contains the adaptivity criterion to be used and the required parameters.

  • clust_adapt_freq (dict) – Clustering adaptivity frequency (relative to the macroscale loading) (item, int, default=1) associated with each adaptive cluster-reduced material phase (key, str).

List of Public Methods

adaptive_refinement

Perform CRVE adaptive clustering refinement.

check_inc_adaptive_steps

Check number of adaptive steps performed in loading increment.

clear_inc_adaptive_steps

Reset number of adaptive steps performed after threshold increment.

get_adapt_vtk_array

Get regular grid array with the adaptive level of each cluster.

get_adaptivity_criterions

Get available clustering adaptivity criterions.

get_target_clusters

Get adaptive clustering target clusters.

is_adapt_phase_activated

Check if material phase adaptivity procedures are activated.

reset_adapt_activation_parameters

Reset parameters associated with clustering adaptivity activation.

Methods

__init__(strain_formulation, problem_type, adapt_material_phases, phase_clusters, adaptivity_control_feature, adapt_criterion_data, clust_adapt_freq)[source]

Constructor.

Parameters:
  • strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.

  • problem_type (int) – Problem type identifier (1 - Plain strain (2D), 4- Tridimensional)

  • adapt_material_phases (list[str]) – RVE adaptive material phases labels (str).

  • phase_clusters (dict) – Clusters labels (item, list[int]) associated with each material phase (key, str).

  • adaptivity_control_feature (dict) – Clustering adaptivity control feature (item, str) associated with each material phase (key, str).

  • adapt_criterion_data (dict) – Clustering adaptivity criterion (item, dict) associated with each material phase (key, str). This dictionary contains the adaptivity criterion to be used and the required parameters.

  • clust_adapt_freq (dict) – Clustering adaptivity frequency (relative to the macroscale loading) (item, int, default=1) associated with each adaptive cluster-reduced material phase (key, str).

_get_adaptivity_data_matrix(target_phase, adapt_control_feature, phase_clusters, clusters_def_gradient_mf, clusters_def_gradient_old_mf, clusters_state, clusters_state_old, clusters_sct_mf, clusters_sct_old_mf, clusters_residuals_mf)[source]

Build adaptivity feature data matrix for target material phase.

Parameters:
  • target_phase (str) – Target adaptive material phase whose clusters adaptive feature data is collected or computed.

  • adapt_control_feature (str) – Scalar adaptivity feature available directly or indirectly from clusters state variables.

  • phase_clusters (dict) – Clusters labels (item, list[int]) associated with each material phase (key, str).

  • clusters_def_gradient_mf (dict) – Deformation gradient (item, numpy.ndarray (1d)) associated with each material cluster (key, str), stored in matricial form.

  • clusters_def_gradient_old_mf (dict) – Last converged deformation gradient (item, numpy.ndarray (1d)) associated with each material cluster (key, str), stored in matricial form.

  • clusters_state (dict) – Material constitutive model state variables (item, dict) associated with each material cluster (key, str).

  • clusters_state_old (dict) – Last increment converged material constitutive model state variables (item, dict) associated with each material cluster (key, str).

  • clusters_sct_mf (dict) – Fourth-order strain concentration tensor (matricial form) (item, numpy.ndarray (2d)) associated with each material cluster (key, str).

  • clusters_sct_old_mf (dict) – Last increment converged fourth-order strain concentration tensor (matricial form) (item, numpy.ndarray (2d)) associated with each material cluster (key, str).

  • clusters_residuals_mf (dict) – Equilibrium residual second-order tensor (matricial form) (item, numpy.ndarray (1d)) associated with each material cluster (key, str).

Returns:

adapt_data_matrix – Adaptivity feature data matrix (numpy.ndarray of shape (adapt_phase_n_clusters, 2)) that, for the i-th cluster of the adaptive material phase, contains the cluster label in adapt_data_matrix[i, 0] and the associated adaptive feature value in adapt_data_matrix[i, 1].

Return type:

numpy.ndarray (2d)

adaptive_refinement(crve, material_state, target_clusters, target_clusters_data, inc, improved_init_guess=None, verbose=False)[source]

Perform CRVE adaptive clustering refinement.

Parameters:
  • crve (CRVE) – Cluster-Reduced Representative Volume Element.

  • material_state (MaterialState) – CRVE material constitutive state at rewind state.

  • target_clusters (list[int]) – List containing the labels (int) of clusters to be refined.

  • target_clusters_data (dict) – For each target cluster (key, str), store dictionary (item, dict) containing cluster associated parameters required for the adaptive procedures.

  • inc (int) – Macroscale loading increment.

  • improved_init_guess (list, default=None) – List that allows an improved initial iterative guess for the clusters incremental strain global vector (matricial form) after the clustering adaptivity is carried out. Index 0 contains a flag which is True if an improved initial iterative guess is to be computed, False otherwise. Index 1 contains the improved incremental strain global vector (matricial form) if computation flag is True, otherwise is None.

  • verbose (bool, default=False) – Enable verbose output.

check_inc_adaptive_steps(inc)[source]

Check number of adaptive steps performed in loading increment.

Parameters:

inc (int) – Macroscale loading increment.

Returns:

True if maximum number of clustering adaptive steps has not been reached, False otherwise.

Return type:

bool

clear_inc_adaptive_steps(inc_threshold)[source]

Reset number of adaptive steps performed after threshold increment.

Parameters:

inc_threshold (int) – Macroscale loading increment.

get_adapt_vtk_array(voxels_clusters)[source]

Get regular grid array with the adaptive level of each cluster.

A cluster adaptive level of 0 is associated with the base clustering and is increased by one whenever the cluster is refined.


Parameters:

voxels_clusters (numpy.ndarray (2d or 3d)) – Regular grid of voxels (spatial discretization of the RVE), where each entry contains the cluster label (int) assigned to the corresponding pixel/voxel.

static get_adaptivity_criterions()[source]

Get available clustering adaptivity criterions.

Returns:

available_adapt_criterions – Available clustering adaptivity criterions (item, AdaptivityCriterion) and associated identifiers (key, str).

Return type:

dict

get_target_clusters(phase_clusters, voxels_clusters, clusters_state, clusters_def_gradient_mf, clusters_def_gradient_old_mf, clusters_state_old, clusters_sct_mf, clusters_sct_old_mf, clusters_residuals_mf, inc=None, verbose=False)[source]

Get adaptive clustering target clusters.

Parameters:
  • phase_clusters (dict) – Clusters labels (item, list[int]) associated with each material phase (key, str).

  • clusters_def_gradient_mf (dict) – Deformation gradient (item, numpy.ndarray (1d)) associated with each material cluster (key, str), stored in matricial form.

  • clusters_def_gradient_old_mf (dict) – Last converged deformation gradient (item, numpy.ndarray (1d)) associated with each material cluster (key, str), stored in matricial form.

  • clusters_state (dict) – Material constitutive model state variables (item, dict) associated with each material cluster (key, str).

  • clusters_state_old (dict) – Last increment converged material constitutive model state variables (item, dict) associated with each material cluster (key, str).

  • clusters_sct_mf (dict) – Fourth-order strain concentration tensor (matricial form) (item, numpy.ndarray) associated with each material cluster (key, str).

  • clusters_sct_old_mf (dict) – Last increment converged fourth-order strain concentration tensor (matricial form) (item, numpy.ndarray) associated with each material cluster (key, str).

  • clusters_residuals_mf (dict) – Equilibrium residual second-order tensor (matricial form) (item, numpy.ndarray) associated with each material cluster (key, str).

  • inc (int, default=None) – Incremental counter serving as a reference basis for the clustering adaptivity frequency control.

  • verbose (bool, default=False) – Enable verbose output.

Returns:

  • is_trigger (bool) – True if clustering adaptivity is triggered, False otherwise.

  • target_clusters (list[int]) – List containing the labels (int) of clusters to be adapted.

is_adapt_phase_activated(mat_phase, inc)[source]

Check if material phase adaptivity procedures are activated.

Parameters:
  • mat_phase (str) – Material phase label.

  • inc (int) – Incremental counter serving as a reference basis for the clustering adaptivity frequency control.

Returns:

is_activated – True if material phase adaptivity procedures are activated, False otherwise.

Return type:

bool

reset_adapt_activation_parameters()[source]

Reset parameters associated with clustering adaptivity activation.