hookeai.miscellaneous.dataset_processing.read_csv_response_dataset.MaterialResponseDatasetGenerator¶
- class MaterialResponseDatasetGenerator(strain_formulation, problem_type)[source]¶
Bases:
objectStrain-stress material response path data set generator.
- _strain_formulation¶
Strain formulation.
- Type:
{‘infinitesimal’, ‘finite’}
- _problem_type¶
Problem type: 2D plane strain (1), 2D plane stress (2), 2D axisymmetric (3) and 3D (4).
- Type:
- generate_response_dataset(self, n_path, strain_path_type,
strain_path_kwargs, model_name, model_parameters, state_features={}, is_in_memory_dataset=True, dataset_directory=None, dataset_basename=None, save_dir=None, is_save_fig=False, is_verbose=False)
Generate strain-stress material response path data set.
- compute_stress_path(self, strain_comps, time_hist, strain_path, constitutive_model)[source]¶
Compute material stress response for given strain path.
- build_tensor_from_comps(n_dim, comps, comps_array, is_symmetric=False)[source]¶
Build strain/stress tensor from given components.
- gen_response_dataset_from_csv(self, response_file_paths, is_in_memory_dataset=True, dataset_directory, save_dir=None, is_save_fig=False, is_verbose=False)[source]¶
- gen_response_dataset_from_strain_dataset(self, dataset_path, model_name, model_parameters, state_features={}, is_verbose=False)[source]¶
Generate material response data set from strain data set.
- plot_material_response_path(cls, strain_formulation, n_dim, strain_comps_order, strain_path, stress_comps_order, stress_path, time_hist, is_plot_strain_stress_paths=False, is_plot_eq_strain_stress=False, stress_units='', filename='response_path', save_dir=None, is_save_fig=False, is_stdout_display=False, is_latex=False)[source]¶
Plot strain-stress material response path.
- plot_stress_space_metrics(cls, strain_formulation, stress_comps_order, stress_path, time_hist, is_plot_principal_stress_path=False, is_plot_stress_invar_hist=False, is_plot_stress_invar_box=False, is_plot_stress_path_triax_lode=False, is_plot_stress_triax_lode_hist=False, is_plot_stress_triax_lode_box=False, stress_units='', filename='stress_path', save_dir=None, is_save_fig=False, is_stdout_display=False, is_latex=False)[source]¶
Plot strain-stress material response path in principal stress space.
Constructor.
- Parameters:
strain_formulation ({'infinitesimal', 'finite'}) – Strain formulation.
problem_type (int) – Problem type: 2D plane strain (1), 2D plane stress (2), 2D axisymmetric (3) and 3D (4).
List of Public Methods
Build strain/stress tensor from given components.
Compute stress invariants.
Compute material stress response for given strain path.
Generate strain-stress path data set from set of .csv files.
Generate material response data set from strain data set.
Generate strain-stress material response path data set.
Plot strain-stress material response path.
Plot constitutive state variable path.
Plot strain-stress material response path in principal stress space.
Store strain/stress tensor components in array.
Methods
- __init__(strain_formulation, problem_type)[source]¶
Constructor.
- Parameters:
strain_formulation ({'infinitesimal', 'finite'}) – Strain formulation.
problem_type (int) – Problem type: 2D plane strain (1), 2D plane stress (2), 2D axisymmetric (3) and 3D (4).
- classmethod build_tensor_from_comps(n_dim, comps, comps_array, is_symmetric=False)[source]¶
Build strain/stress tensor from given components.
- Parameters:
n_dim (int) – Problem number of spatial dimensions.
comps_array (numpy.ndarray(1d)) – Strain/Stress components array.
is_symmetric (bool, default=False) – If True, then assembles off-diagonal strain components from symmetric component.
- Returns:
tensor – Strain/Stress tensor.
- Return type:
numpy.ndarray(2d)
- static compute_stress_invariants(stress)[source]¶
Compute stress invariants.
- Parameters:
stress (np.ndarray(2d)) – Stress tensor.
- Returns:
stress_invar (np.ndarray(1d)) – Stress invariants.
stress_invar_dev (np.ndarray(1d)) – Deviatoric stress invariants
- compute_stress_path(strain_comps_order, time_hist, strain_path, constitutive_model, state_features={}, is_verbose=False)[source]¶
Compute material stress response for given strain path.
- Parameters:
time_hist (numpy.ndarray(1d)) – Discrete time history.
strain_path (numpy.ndarray(2d)) – Strain path history stored as numpy.ndarray(2d) of shape (sequence_length, n_strain_comps).
constitutive_model (ConstitutiveModel) – FETorch material constitutive model.
state_features (dict, default={}) – FETorch material constitutive model state variables (key, str) and corresponding dimensionality (item, int) for which the path history is additionally included in the data set. Tensorial state variables stored in matricial form are included in the data set without any matricial form coefficients (true components are extracted). Unavailable state variables are ignored.
is_verbose (bool, default=False) – If True, enable verbose output.
- Returns:
stress_comps_order (tuple) – Stress components order.
stress_path (numpy.ndarray(2d)) – Stress path history stored as numpy.ndarray(2d) of shape (sequence_length, n_stress_comps).
state_path (dict) – Store each requested constitutive model state variable (key, str) path history as numpy.ndarray(2d) of shape (sequence_length, n_features).
is_stress_path_fail (bool) – Stress response path failure flag.
- gen_response_dataset_from_csv(response_file_paths, is_in_memory_dataset=True, dataset_directory=None, save_dir=None, is_save_fig=False, is_verbose=False)[source]¶
Generate strain-stress path data set from set of .csv files.
- Parameters:
response_file_paths (tuple) – Strain-stress response paths data files paths (.csv).
is_in_memory_dataset (bool, default=True) – If True, then generate in-memory time series data set, otherwise time series data set samples are stored in local directory.
dataset_directory (str, default=None) – Directory where the time series data set is stored (all data set samples files). Required if is_in_memory_dataset=False.
dataset_basename (str, default=None) – Data set file base name. Required if is_in_memory_dataset=False.
save_dir (str, default=None) – Directory where figure is saved. If None, then figure is saved in current working directory.
is_save_fig (bool, default=False) – Save figure.
is_verbose (bool, default=False) – If True, enable verbose output.
- Returns:
dataset – Time series data set. Each sample is stored as a dictionary where each feature (key, str) data is a torch.Tensor(2d) of shape (sequence_length, n_features).
- Return type:
torch.utils.data.Dataset
- gen_response_dataset_from_strain_dataset(dataset_path, model_name, model_parameters, state_features={}, is_verbose=False)[source]¶
Generate material response data set from strain data set.
- Parameters:
dataset_file_path (str) – Data set file path.
model_name (str) – FETorch material constitutive model name.
model_parameters (dict) – FETorch material constitutive model parameters.
state_features (dict, default={}) – FETorch material constitutive model state variables (key, str) and corresponding dimensionality (item, int) for which the path history is additionally included in the data set. Tensorial state variables stored in matricial form are included in the data set without any matricial form coefficients (true components are extracted). Unavailable state variables are ignored.
is_verbose (bool, default=False) – If True, enable verbose output.
- Returns:
dataset – Time series data set. Each sample is stored as a dictionary where each feature (key, str) data is a torch.Tensor(2d) of shape (sequence_length, n_features).
- Return type:
torch.utils.data.Dataset
- generate_response_dataset(n_path, strain_path_type, strain_path_kwargs, model_name, model_parameters, state_features={}, is_in_memory_dataset=True, dataset_directory=None, dataset_basename=None, save_dir=None, is_save_fig=False, is_verbose=False)[source]¶
Generate strain-stress material response path data set.
- Parameters:
n_path (int) – Number of strain-stress paths.
strain_path_type ({'random', 'proportional'}) – Strain path type that sets the corresponding generator.
strain_path_kwargs (dict) – Parameters of strain path generator method set by strain_path_type.
model_name (str) – FETorch material constitutive model name.
model_parameters (dict) – FETorch material constitutive model parameters.
state_features (dict, default={}) – FETorch material constitutive model state variables (key, str) and corresponding dimensionality (item, int) for which the path history is additionally included in the data set. Tensorial state variables stored in matricial form are included in the data set without any matricial form coefficients (true components are extracted). Unavailable state variables are ignored.
is_in_memory_dataset (bool, default=True) – If True, then generate in-memory time series data set, otherwise time series data set samples are stored in local directory.
dataset_directory (str, default=None) – Directory where the time series data set is stored (all data set samples files). Required if is_in_memory_dataset=False.
dataset_basename (str, default=None) – Data set file base name. Required if is_in_memory_dataset=False.
save_dir (str, default=None) – Directory where figure is saved. If None, then figure is saved in current working directory.
is_save_fig (bool, default=False) – Save figure.
is_verbose (bool, default=False) – If True, enable verbose output.
- Returns:
dataset – Time series data set. Each sample is stored as a dictionary where each feature (key, str) data is a torch.Tensor(2d) of shape (sequence_length, n_features).
- Return type:
torch.utils.data.Dataset
- classmethod plot_material_response_path(strain_formulation, n_dim, strain_comps_order, strain_path, stress_comps_order, stress_path, time_hist, is_plot_strain_stress_paths=False, is_plot_eq_strain_stress=False, stress_units='', filename='response_path', save_dir=None, is_save_fig=False, is_stdout_display=False, is_latex=False)[source]¶
Plot strain-stress material response path.
- Parameters:
strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.
n_dim (int) – Problem number of spatial dimensions.
strain_path (numpy.ndarray(2d)) – Strain path history stored as numpy.ndarray(2d) of shape (sequence_length, n_strain_comps).
stress_comps_order (tuple) – Stress components order.
stress_path (numpy.ndarray(2d)) – Stress path history stored as numpy.ndarray(2d) of shape (sequence_length, n_stress_comps).
time_hist (numpy.ndarray(1d)) – Discrete time history.
is_plot_strain_stress_paths (bool, default=False) – Plot strain and stress components path (only available for single path).
is_plot_eq_strain_stress (bool, default=False) – Plot equivalent strain-stress path.
stress_units (str, default='') – Stress units label.
filename (str, default='response_path') – Figure name.
save_dir (str, default=None) – Directory where figure is saved. If None, then figure is saved in current working directory.
is_save_fig (bool, default=False) – Save figure.
is_stdout_display (bool, default=False) – True if displaying figure to standard output device, False otherwise.
is_latex (bool, default=False) – If True, then render all strings in LaTeX. If LaTex is not available, then this option is silently set to False and all input strings are processed to remove $(…)$ enclosure.
- classmethod plot_state_history(strain_formulation, strain_comps_order, stress_comps_order, state_variable_name, state_variable_label, state_path, time_hist, state_units='', filename='state_variable_path', save_dir=None, is_save_fig=False, is_stdout_display=False, is_latex=False)[source]¶
Plot constitutive state variable path.
- Parameters:
strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.
n_dim (int) – Problem number of spatial dimensions.
strain_comps_order (tuple) – Stress components order.
stress_comps_order (tuple) – Stress components order.
state_variable_name (str) – State variable name.
state_variable_label (str) – State variable label.
state_path ({numpy.ndarray(2d), list[numpy.ndarray(2d)]}) – State variable path history stored as numpy.ndarray(2d) of shape (sequence_length, n_features) or list of multiple state variable path histories.
time_hist ({numpy.ndarray(1d), list[numpy.ndarray(1d)]}) – Discrete time history or list of multiple discrete time histories.
state_units (str, default='') – State variable units label.
filename (str, default='state_variable_path') – Figure name.
save_dir (str, default=None) – Directory where figure is saved. If None, then figure is saved in current working directory.
is_save_fig (bool, default=False) – Save figure.
is_stdout_display (bool, default=False) – True if displaying figure to standard output device, False otherwise.
is_latex (bool, default=False) – If True, then render all strings in LaTeX. If LaTex is not available, then this option is silently set to False and all input strings are processed to remove $(…)$ enclosure.
- classmethod plot_stress_space_metrics(strain_formulation, stress_comps_order, stress_path, time_hist, is_plot_principal_stress_path=False, is_plot_pi_stress_path_pairs=False, is_plot_stress_invar_hist=False, is_plot_stress_invar_box=False, is_plot_stress_path_triax_lode=False, is_plot_stress_triax_lode_space=False, is_plot_stress_triax_lode_hist=False, is_plot_stress_triax_lode_box=False, stress_units='', filename='stress_path', save_dir=None, is_save_fig=False, is_stdout_display=False, is_latex=False)[source]¶
Plot strain-stress material response path in principal stress space.
- Parameters:
strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.
n_dim (int) – Problem number of spatial dimensions.
stress_comps_order (tuple) – Stress components order.
stress_path ({numpy.ndarray(2d), list[numpy.ndarray(2d)]}) – Stress path history stored as numpy.ndarray(2d) of shape (sequence_length, n_stress_comps) or list of multiple stress path histories.
time_hist ({numpy.ndarray(1d), list[numpy.ndarray(1d)]}) – Discrete time history or list of multiple discrete time histories.
is_plot_principal_stress_path (bool, default=False) – Plot stress path in the principal stress space.
is_plot_pi_stress_path_pairs (bool, default=False) – Plot the stress path for pairs of pi-stress components in the principal stress space.
is_plot_stress_invar_hist (bool, default=False) – Plot distribution of stress invariants.
is_plot_stress_invar_box (bool, default=False) – Plot box plot with stress invariants.
is_plot_stress_path_triax_lode (bool, default=False) – Plot stress triaxiality and Lode parameter paths.
is_plot_stress_triax_lode_space (bool, default=False) – Plot stress triaxiality and Lode parameter space.
is_plot_stress_triax_lode_hist (bool, default=False) – Plot stress triaxiality and Lode parameter distributions.
is_plot_stress_triax_lode_box (bool, default=False) – Plot box plot with stress triaxiality and Lodeb parameter.
stress_units (str, default='') – Stress units label.
filename (str, default='stress_path') – Figure name.
save_dir (str, default=None) – Directory where figure is saved. If None, then figure is saved in current working directory.
is_save_fig (bool, default=False) – Save figure.
is_stdout_display (bool, default=False) – True if displaying figure to standard output device, False otherwise.
is_latex (bool, default=False) – If True, then render all strings in LaTeX. If LaTex is not available, then this option is silently set to False and all input strings are processed to remove $(…)$ enclosure.
- classmethod store_tensor_comps(comps, tensor)[source]¶
Store strain/stress tensor components in array.
- Parameters:
tensor (numpy.ndarray(2d)) – Strain/Stress tensor.
- Returns:
comps_array – Strain/Stress components array.
- Return type:
numpy.ndarray(1d)