YAML Schema for Material Definitionο
This document defines the schema for material definition YAML files in materforge v0.5.5.
Schema Overviewο
A valid pure metal definition must include:ο
name: String identifier for the materialcomposition: Map of element symbols to their mass fractionsmelting_temperature: Numeric value in Kelvinboiling_temperature: Numeric value in Kelvinproperties: Map of property names to their definitions
A valid alloy definition must include:ο
name: String identifier for the materialcomposition: Map of element symbols to their mass fractionssolidus_temperature: Numeric value in Kelvinliquidus_temperature: Numeric value in Kelvininitial_boiling_temperature: Numeric value in Kelvinfinal_boiling_temperature: Numeric value in Kelvinproperties: Map of property names to their definitions
π§ Property Definition Typesο
Properties can be defined in six different ways:
1. Constant Valueο
Simple numeric values, for properties that donβt vary with any dependency:
thermal_expansion_coefficient: 16.3e-6 # Single numeric value
2. Step Functionο
Phase transitions with before/after values:
latent_heat_of_fusion:
dependency: melting_temperature - 10
value: [0.0, 10790.0]
bounds: [constant, constant]
3. File Importο
Import data from Excel, CSV, or text files:
heat_capacity:
file_path: ./data.xlsx
dependency_column: T (K)
property_column: Cp (J/kgΒ·K)
bounds: [constant, constant]
4. Tabular Dataο
Explicit dependency-property pairs:
thermal_expansion_coefficient:
dependency: [300, 400, 500, 600]
value: [1.2e-5, 1.4e-5, 1.6e-5, 1.8e-5]
bounds: [constant, constant]
5. Piecewise Equationο
Multiple equations for different dependency ranges:
heat_conductivity:
dependency: [500, 1700, 3000]
equation: ["0.012*T + 13", "0.015*T + 5"]
bounds: [constant, constant]
6. Computed Propertyο
Properties calculated from other properties:
thermal_diffusivity:
dependency: (300, 3000, 5.0)
equation: heat_conductivity / (density * heat_capacity)
bounds: [extrapolate, extrapolate]
π Dependency Definition Formatsο
Explicit Listsο
dependency: [300, 400, 500, 600] # Explicit values
Tuple Formatsο
# (start, increment) - requires matching value list length
dependency: (300, 50) # 300, 350, 400, ... (length from values)
# (start, stop, step) - step size
dependency: (300, 1000, 10.0) # 300, 310, 320, ..., 1000
# (start, stop, points) - number of points
dependency: (300, 1000, 71) # 71 evenly spaced points
# Decreasing dependency
dependency: (1000, 300, -5.0) # 1000, 995, 990, ..., 300
Temperature Referencesο
# Direct references
temperature: melting_temperature
temperature: solidus_temperature
# Arithmetic expressions
temperature: melting_temperature + 50
temperature: liquidus_temperature - 10
π― Advanced Featuresο
Regression Configurationο
Control data simplification and memory usage:
regression:
simplify: pre # Apply before symbolic processing
degree: 1 # Linear regression
segments: 3 # Number of piecewise segments
simplify: pre: Apply regression to raw data before processingsimplify: post: Apply regression after symbolic expressions are evaluateddegree: Polynomial degree (1=linear, 2=quadratic, etc.)segments: Number of segments for piecewise functions
Boundary Behaviorο
Control extrapolation outside data range:
bounds: [constant, extrapolate]
constant: Use boundary values as constants outside rangeextrapolate: Linear extrapolation outside range
Dependency Resolutionο
Properties are automatically processed in correct order:
# These will be processed in dependency order automatically
specific_enthalpy:
equation: Integral(heat_capacity, T)
energy_density:
equation: density * specific_enthalpy # Depends on specific_enthalpy
thermal_diffusivity:
equation: heat_conductivity / (density * heat_capacity) # Multiple dependencies
π Visualizationο
Automatic plot generation when using symbolic temperature:
import sympy as sp
from materforge.parsing.api import create_material
T = sp.Symbol('T')
material = create_material('1.4301.yaml', T, enable_plotting=True)
# Plots automatically saved to 'materforge_plots/' directory
π§ͺ Energy-Temperature Inversionο
For applications requiring temperature from energy density:
import sympy as sp
from materforge.parsing.api import create_material
from materforge.algorithms.piecewise_inverter import PiecewiseInverter
# Create inverse function T = f_inv(E)
T = sp.Symbol('T')
E = sp.Symbol('E')
material = create_material('1.4301.yaml', T)
# Create inverse (only for linear piecewise functions)
inverse_func = PiecewiseInverter.create_energy_density_inverse(material, 'E')
# Use inverse function
energy_value = 1.5e9 # J/mΒ³
temperature = float(inverse_func.subs(E, energy_value))
π Supported Propertiesο
from materforge.parsing.api import get_supported_properties
print(get_supported_properties())
Validation Rulesο
All required top-level fields must be present
Material type must be βpure_metalβ or βalloyβ
Composition fractions must sum to approximately 1.0
Pure metals must have exactly one element with composition 1.0
Alloys must have at least 2 elements with non-zero composition
Liquidus temperature must be greater than or equal to solidus temperature
Properties cannot be defined in multiple ways or multiple times
Required dependencies for computed properties must be present
Dependency arrays must be monotonic
Energy density arrays must be monotonic with respect to the dependency
File paths must be valid and files must exist
For tabular data, dependency and value arrays must have the same length
When using tuple notation for dependency arrays, the increment must be non-zero
Important Notesο
All numerical values must use period (.) as decimal separator, not comma
Interpolation between data points is performed automatically for file-import and tabular data properties
Properties will be computed in the correct order regardless of their position in the file
To retrieve temperature from energy_density, use the interpolation methods from the generated InterpolationArrayContainer class
The new architecture provides enhanced error messages and validation compared to previous versions