Skip to content
Snippets Groups Projects
Commit 8aa69246 authored by Rahil Doshi's avatar Rahil Doshi
Browse files

Update tests

parent c6233b0f
No related merge requests found
Pipeline #77224 passed with stage
in 47 seconds
...@@ -4,6 +4,7 @@ from importlib.resources import files ...@@ -4,6 +4,7 @@ from importlib.resources import files
from pystencilssfg import SourceFileGenerator from pystencilssfg import SourceFileGenerator
from pymatlib.core.yaml_parser import create_alloy_from_yaml from pymatlib.core.yaml_parser import create_alloy_from_yaml
from pymatlib.core.codegen.interpolation_array_container import InterpolationArrayContainer from pymatlib.core.codegen.interpolation_array_container import InterpolationArrayContainer
from pymatlib.core.property_array_extractor import PropertyArrayExtractor
with SourceFileGenerator() as sfg: with SourceFileGenerator() as sfg:
...@@ -22,6 +23,11 @@ with SourceFileGenerator() as sfg: ...@@ -22,6 +23,11 @@ with SourceFileGenerator() as sfg:
sfg.generate(custom_container) sfg.generate(custom_container)
yaml_path = files('pymatlib.data.alloys.SS304L').joinpath('SS304L.yaml') yaml_path = files('pymatlib.data.alloys.SS304L').joinpath('SS304L.yaml')
mat = create_alloy_from_yaml(yaml_path, u.center()) mat, temp_array = create_alloy_from_yaml(yaml_path, u.center())
arr_container = InterpolationArrayContainer.from_material("SS304L", mat) array_extractor = PropertyArrayExtractor(mat, temp_array, u.center)
arr_container = InterpolationArrayContainer("SS304L", temp_array, array_extractor.energy_density_array)
sfg.generate(arr_container) 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}")
...@@ -15,9 +15,9 @@ T = sp.Symbol('T') ...@@ -15,9 +15,9 @@ T = sp.Symbol('T')
# Get the path to the YAML file # Get the path to the YAML file
current_file = Path(__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.yaml"
# yaml_path = current_file.parent.parent.parent / "src" / "pymatlib" / "data" / "alloys" / "SS304L" / "SS304L_comprehensive.yaml"
# Create alloy from 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) #ss316l_1 = create_alloy_from_yaml("SS304L_1.yaml", T)
# Test various properties # Test various properties
...@@ -48,4 +48,3 @@ print(f"Latent heat: {ss316l.latent_heat_of_fusion.evalf(T, test_temp)}") ...@@ -48,4 +48,3 @@ print(f"Latent heat: {ss316l.latent_heat_of_fusion.evalf(T, test_temp)}")
# Test array generation for energy density # Test array generation for energy density
if hasattr(ss316l, 'energy_density_array'): if hasattr(ss316l, 'energy_density_array'):
print(f"\nEnergy Density Array Shape: {ss316l.energy_density_array.shape}") print(f"\nEnergy Density Array Shape: {ss316l.energy_density_array.shape}")
print(f"Energy Density Temperature Array Shape: {ss316l.energy_density_temperature_array.shape}")
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment