#[allow(unused_imports)]
use super::functions::*;
#[allow(unused_imports)]
use super::functions_2::*;
use crate::Material;
#[derive(Debug, Clone)]
pub struct ExtendedMaterial {
pub base: Material,
pub young_modulus: f64,
pub poisson_ratio: f64,
pub yield_strength: f64,
pub uts: f64,
pub thermal_conductivity: f64,
pub specific_heat: f64,
pub thermal_expansion: f64,
}
impl ExtendedMaterial {
#[allow(clippy::too_many_arguments)]
pub fn new(
base: Material,
young_modulus: f64,
poisson_ratio: f64,
yield_strength: f64,
uts: f64,
thermal_conductivity: f64,
specific_heat: f64,
thermal_expansion: f64,
) -> Self {
Self {
base,
young_modulus,
poisson_ratio,
yield_strength,
uts,
thermal_conductivity,
specific_heat,
thermal_expansion,
}
}
pub fn bulk_modulus(&self) -> f64 {
let nu = self.poisson_ratio;
self.young_modulus / (3.0 * (1.0 - 2.0 * nu))
}
pub fn shear_modulus(&self) -> f64 {
let nu = self.poisson_ratio;
self.young_modulus / (2.0 * (1.0 + nu))
}
pub fn specific_stiffness(&self) -> f64 {
self.young_modulus / self.base.density
}
pub fn specific_strength(&self) -> f64 {
self.yield_strength / self.base.density
}
pub fn thermal_diffusivity(&self) -> f64 {
self.thermal_conductivity / (self.base.density * self.specific_heat)
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum MaterialCategory {
Metal,
Polymer,
Ceramic,
Composite,
Biomaterial,
Building,
Fluid,
Sports,
}
pub struct CategorisedMaterial {
pub material: Material,
pub category: MaterialCategory,
}