def test_material(): mat = c.Material(1) str(mat) mat = c.Material(1, 2, 3, metadata={"short_name": "test_material"}) str(mat) assert math.isclose(mat.longitudinal_vel, 1) assert math.isclose(mat.transverse_vel, 2) assert math.isclose(mat.density, 3) assert mat.state_of_matter is None assert mat.metadata["short_name"] == "test_material" mat = c.Material( 1, 2, state_of_matter=c.StateMatter.liquid, metadata={"short_name": "test_material"}, ) assert mat.state_of_matter is c.StateMatter.liquid mat = c.Material(1, 2, state_of_matter="liquid", metadata={"short_name": "test_material"}) assert mat.state_of_matter is c.StateMatter.liquid # test method 'velocity': assert math.isclose(mat.velocity("longitudinal"), mat.longitudinal_vel) assert math.isclose(mat.velocity(c.Mode.L), mat.longitudinal_vel) assert math.isclose(mat.velocity("transverse"), mat.transverse_vel) assert math.isclose(mat.velocity(c.Mode.T), mat.transverse_vel)
def water(): return c.Material( 1400.0, density=1000.0, state_of_matter="liquid", metadata={"long_name": "Water"}, )
def aluminium(): v_longi = 6320.0 v_transverse = 3130.0 return c.Material( v_longi, v_transverse, density=2700.0, state_of_matter="solid", metadata={"long_name": "Aluminium"}, )
def examination_object(): material = c.Material(6300, 3100, 2700, metadata=dict(long_name="Aluminium")) return c.ExaminationObject(material)