From 8aa692465fae60722a0fa89774c3c300e2c74740 Mon Sep 17 00:00:00 2001 From: Rahil Doshi <rahil.doshi@fau.de> Date: Mon, 24 Mar 2025 17:12:31 +0100 Subject: [PATCH] Update tests --- tests/cpp/TestArrayContainer.py | 10 ++++++++-- tests/python/test_yaml_config.py | 5 ++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/cpp/TestArrayContainer.py b/tests/cpp/TestArrayContainer.py index fb9881d..31b960b 100644 --- a/tests/cpp/TestArrayContainer.py +++ b/tests/cpp/TestArrayContainer.py @@ -4,6 +4,7 @@ from importlib.resources import files from pystencilssfg import SourceFileGenerator from pymatlib.core.yaml_parser import create_alloy_from_yaml from pymatlib.core.codegen.interpolation_array_container import InterpolationArrayContainer +from pymatlib.core.property_array_extractor import PropertyArrayExtractor with SourceFileGenerator() as sfg: @@ -22,6 +23,11 @@ with SourceFileGenerator() as sfg: sfg.generate(custom_container) yaml_path = files('pymatlib.data.alloys.SS304L').joinpath('SS304L.yaml') - mat = create_alloy_from_yaml(yaml_path, u.center()) - arr_container = InterpolationArrayContainer.from_material("SS304L", mat) + mat, temp_array = create_alloy_from_yaml(yaml_path, u.center()) + array_extractor = PropertyArrayExtractor(mat, temp_array, u.center) + arr_container = InterpolationArrayContainer("SS304L", temp_array, array_extractor.energy_density_array) sfg.generate(arr_container) + print(f"extractor.temperature_array: {array_extractor.temperature_array}") + # print(f"extractor.density_array: {array_extractor.density_array}") + print(f"extractor.specific_enthalpy_array: {array_extractor.specific_enthalpy_array}") + print(f"extractor.energy_density_array: {array_extractor.energy_density_array}") diff --git a/tests/python/test_yaml_config.py b/tests/python/test_yaml_config.py index a699cd1..14d8c60 100644 --- a/tests/python/test_yaml_config.py +++ b/tests/python/test_yaml_config.py @@ -15,9 +15,9 @@ T = sp.Symbol('T') # Get the path to the YAML file current_file = Path(__file__) yaml_path = current_file.parent.parent.parent / "src" / "pymatlib" / "data" / "alloys" / "SS304L" / "SS304L.yaml" - +# yaml_path = current_file.parent.parent.parent / "src" / "pymatlib" / "data" / "alloys" / "SS304L" / "SS304L_comprehensive.yaml" # Create alloy from YAML -ss316l = create_alloy_from_yaml(yaml_path, T) +ss316l, temp = create_alloy_from_yaml(yaml_path, T) #ss316l_1 = create_alloy_from_yaml("SS304L_1.yaml", T) # Test various properties @@ -48,4 +48,3 @@ print(f"Latent heat: {ss316l.latent_heat_of_fusion.evalf(T, test_temp)}") # Test array generation for energy density if hasattr(ss316l, 'energy_density_array'): print(f"\nEnergy Density Array Shape: {ss316l.energy_density_array.shape}") - print(f"Energy Density Temperature Array Shape: {ss316l.energy_density_temperature_array.shape}") -- GitLab