oxiphysics_materials/presets/
types.rs1#[allow(unused_imports)]
6use super::functions::*;
7#[allow(unused_imports)]
8use super::functions_2::*;
9use crate::Material;
10
11#[derive(Debug, Clone)]
13pub struct ExtendedMaterial {
14 pub base: Material,
16 pub young_modulus: f64,
18 pub poisson_ratio: f64,
20 pub yield_strength: f64,
22 pub uts: f64,
24 pub thermal_conductivity: f64,
26 pub specific_heat: f64,
28 pub thermal_expansion: f64,
30}
31impl ExtendedMaterial {
32 #[allow(clippy::too_many_arguments)]
34 pub fn new(
35 base: Material,
36 young_modulus: f64,
37 poisson_ratio: f64,
38 yield_strength: f64,
39 uts: f64,
40 thermal_conductivity: f64,
41 specific_heat: f64,
42 thermal_expansion: f64,
43 ) -> Self {
44 Self {
45 base,
46 young_modulus,
47 poisson_ratio,
48 yield_strength,
49 uts,
50 thermal_conductivity,
51 specific_heat,
52 thermal_expansion,
53 }
54 }
55 pub fn bulk_modulus(&self) -> f64 {
57 let nu = self.poisson_ratio;
58 self.young_modulus / (3.0 * (1.0 - 2.0 * nu))
59 }
60 pub fn shear_modulus(&self) -> f64 {
62 let nu = self.poisson_ratio;
63 self.young_modulus / (2.0 * (1.0 + nu))
64 }
65 pub fn specific_stiffness(&self) -> f64 {
67 self.young_modulus / self.base.density
68 }
69 pub fn specific_strength(&self) -> f64 {
71 self.yield_strength / self.base.density
72 }
73 pub fn thermal_diffusivity(&self) -> f64 {
75 self.thermal_conductivity / (self.base.density * self.specific_heat)
76 }
77}
78#[derive(Debug, Clone, Copy, PartialEq)]
80pub enum MaterialCategory {
81 Metal,
83 Polymer,
85 Ceramic,
87 Composite,
89 Biomaterial,
91 Building,
93 Fluid,
95 Sports,
97}
98pub struct CategorisedMaterial {
100 pub material: Material,
102 pub category: MaterialCategory,
104}