pub enum Error {
Show 14 variants
General(String),
ParameterOutOfRange {
param: &'static str,
value: f64,
min: f64,
max: f64,
},
MissingProperty(&'static str),
NumericalDivergence {
solver: &'static str,
iterations: usize,
residual: f64,
},
Singularity {
context: &'static str,
detail: String,
},
InadmissibleState(String),
UnphysicalEosPressure {
eos: &'static str,
pressure: f64,
density: f64,
},
PhaseTransformConvergence {
model: &'static str,
detail: String,
},
TableOutOfRange {
table: &'static str,
variable: &'static str,
value: f64,
lo: f64,
hi: f64,
},
FatigueModel {
model: &'static str,
detail: String,
},
FractureMechanics(String),
DimensionMismatch {
expected: String,
actual: String,
},
Io {
path: String,
message: String,
},
Parse {
context: String,
message: String,
},
}Expand description
Main error type for the materials module.
Variants§
General(String)
Generic error message.
ParameterOutOfRange
A required material parameter is out of its physical range.
param is the parameter name, value is what was supplied,
min / max are the valid bounds (use ±f64::INFINITY for open ends).
Fields
MissingProperty(&'static str)
A required material property was not set.
NumericalDivergence
Numerical divergence during an iterative algorithm.
Typically triggered when an implicit solver does not converge.
Fields
Singularity
Singularity encountered (e.g. zero determinant, zero density).
InadmissibleState(String)
The requested deformation state is physically inadmissible (e.g. negative volume, compressive stretch beyond locking).
UnphysicalEosPressure
An equation of state returned an unphysical pressure.
Fields
PhaseTransformConvergence
Phase-transformation model failed to converge.
Fields
TableOutOfRange
Table look-up out of bounds (e.g. tabulated EOS, TTT diagram).
Fields
FatigueModel
Fatigue model error (e.g. invalid cycle count, negative stress amplitude).
FractureMechanics(String)
Fracture mechanics error (e.g. stress intensity factor not finite).
DimensionMismatch
Incompatible units or dimension mismatch.
Io
I/O error when loading material data from a file.
Parse
Parse error when decoding material data.
Implementations§
Source§impl Error
impl Error
Sourcepub fn below_minimum(param: &'static str, value: f64, min: f64) -> Self
pub fn below_minimum(param: &'static str, value: f64, min: f64) -> Self
Create a Error::ParameterOutOfRange for a lower-bound violation.
Sourcepub fn above_maximum(param: &'static str, value: f64, max: f64) -> Self
pub fn above_maximum(param: &'static str, value: f64, max: f64) -> Self
Create a Error::ParameterOutOfRange for an upper-bound violation.
Sourcepub fn diverged(solver: &'static str, iterations: usize, residual: f64) -> Self
pub fn diverged(solver: &'static str, iterations: usize, residual: f64) -> Self
Create a Error::NumericalDivergence with a simple description.
Sourcepub fn singular(context: &'static str, detail: impl Into<String>) -> Self
pub fn singular(context: &'static str, detail: impl Into<String>) -> Self
Create a Error::Singularity error.
Sourcepub fn inadmissible(detail: impl Into<String>) -> Self
pub fn inadmissible(detail: impl Into<String>) -> Self
Create an Error::InadmissibleState error.
Sourcepub fn table_out_of_range(
table: &'static str,
variable: &'static str,
value: f64,
lo: f64,
hi: f64,
) -> Self
pub fn table_out_of_range( table: &'static str, variable: &'static str, value: f64, lo: f64, hi: f64, ) -> Self
Create a Error::TableOutOfRange error.
Sourcepub fn fatigue(model: &'static str, detail: impl Into<String>) -> Self
pub fn fatigue(model: &'static str, detail: impl Into<String>) -> Self
Create a Error::FatigueModel error.
Sourcepub fn unphysical_pressure(
eos: &'static str,
pressure: f64,
density: f64,
) -> Self
pub fn unphysical_pressure( eos: &'static str, pressure: f64, density: f64, ) -> Self
Create an Error::UnphysicalEosPressure error.
Sourcepub fn is_numerical(&self) -> bool
pub fn is_numerical(&self) -> bool
Returns true if this is a numerical issue (divergence or singularity).
Sourcepub fn is_parameter_error(&self) -> bool
pub fn is_parameter_error(&self) -> bool
Returns true if this is a parameter validation error.
Sourcepub fn is_eos_error(&self) -> bool
pub fn is_eos_error(&self) -> bool
Returns true if this is an EOS-specific error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()