src.spyice.postprocess.analysis#
- class src.spyice.postprocess.analysis.Analysis[source]#
Bases:
objectRepresents an analysis object that performs error analysis on temperature differences.
- Parameters:
t_k_diff (float) – The temperature difference in Kelvin.
t_stefan_diff (float) – The temperature difference in Stefan-Boltzmann units.
- __init__(t_k_diff, t_stefan_diff)[source]#
- Parameters:
t_k_diff (float) – The temperature difference in Kelvin.
t_stefan_diff (float) – The temperature difference in Stefan-Boltzmann units.
- calculate_errors(field_array, error_norms_object)[source]#
Calculates the errors of a given field array using the provided error norms object.
- Parameters:
field_array (numpy.ndarray) – The field array to calculate the errors for.
error_norms_object (ErrorNorms) – The error norms object used to calculate the errors.
- Returns:
A tuple containing the one-norm error, infinity-norm error, and two-norm error.
- Return type:
tuple
- error_analytical_numerical()[source]#
Calculates the errors of Numerical and Analytical using error norms one, two and infinity.
- Parameters:
None
- Returns:
- A tuple containing the errors calculated using different error norms:
T_k_Stefan_diff_L1norm (float): L1 norm of the difference between T_k_list and T_Stefan_list.
T_k_Stefan_diff_infnorm (float): Infinity norm of the difference between T_k_list and T_Stefan_list.
T_k_Stefan_diff_L2norm (float): L2 norm of the difference between T_k_list and T_Stefan_list.
T_Stefan_diff_L1norm (float): L1 norm of the difference between consecutive T_Stefan values.
T_Stefan_diff_infnorm (float): Infinity norm of the difference between consecutive T_Stefan values.
T_Stefan_diff_L2norm (float): L2 norm of the difference between consecutive T_Stefan values.
T_k_diff_infnorm (float): Infinity norm of the difference between consecutive T_k values.
T_k_diff_L2norm (float): L2 norm of the difference between consecutive T_k values.
T_k_diff_L1norm (float): L1 norm of the difference between consecutive T_k values.
- Return type:
tuple
- export_residuals(residuals, temperature_mushy, phi_mushy, salinity_mushy, output_dir)[source]#
Exports the residuals to a file.
- Parameters:
residuals (np.array) – The residuals to export.
output_dir (str) – The output directory to save the residuals to.
- Returns:
None
- classmethod get_error_results(t_k_diff, t_stefan_diff, residual, temperature_mushy, phi_mushy, salinity_mushy, output_dir)[source]#
Runs error analysis on the given temperature differences.
- Parameters:
cls – The class object.
t_k_diff (ndarray) – The temperature difference for k.
t_stefan_diff (ndarray) – The temperature difference for Stefan.
residual (ndarray)
temperature_mushy (ndarray)
phi_mushy (ndarray)
salinity_mushy (ndarray)
output_dir (Path | str)
- Returns:
An instance of the AnalysisData class containing the error analysis results.
- Return type:
- set_analysis()[source]#
Sets up the analysis for the current object.
This method initializes the error_norms_object attribute with an instance of the ErrorNorms class, passing the t_k_diff and t_stefan_diff attributes as arguments. It then calculates the numerical analytical difference using the numerical_analytical_diff method of the error_norms_object.
- Parameters:
None
- Returns:
None
- static set_dataclass(data_to_be_converted, dataclass)[source]#
Sets the values of a dataclass object using a dictionary.
- Parameters:
data_to_be_converted (dict) – A dictionary containing the values to be set.
dataclass (dataclass) – The dataclass object to be updated.
- Returns:
The updated dataclass object.
- Return type:
dataclass
- store_field_errors(T_k_Stefan_diff_L1norm, T_k_Stefan_diff_infnorm, T_k_Stefan_diff_L2norm, T_Stefan_diff_infnorm, T_Stefan_diff_L2norm, T_Stefan_diff_L1norm, T_k_diff_infnorm, T_k_diff_L2norm, T_k_diff_L1norm)[source]#
Stores the field errors.
- Parameters:
T_k_Stefan_diff_L1norm (float) – The L1 norm of the temperature and concentration difference.
T_k_Stefan_diff_infnorm (float) – The infinity norm of the temperature and concentration difference.
T_k_Stefan_diff_L2norm (float) – The L2 norm of the temperature and concentration difference.
T_Stefan_diff_infnorm (float) – The infinity norm of the temperature difference.
T_Stefan_diff_L2norm (float) – The L2 norm of the temperature difference.
T_Stefan_diff_L1norm (float) – The L1 norm of the temperature difference.
T_k_diff_infnorm (float) – The infinity norm of the temperature and concentration difference.
T_k_diff_L2norm (float) – The L2 norm of the temperature and concentration difference.
T_k_diff_L1norm (float) – The L1 norm of the temperature and concentration difference.