Open
0 of 1 issue completedDescription
📝 Description of the feature
Currently PyMaterials-Manager does not have the concept of Material Model e.g. IsotropicElasticity.
The models defined within the material class (material.models) are just a collection typically of Constant classes.
For representing a Variable property though we need the explicit definition of the specific model class.
we propose the following changes:
class InterpolationOptions:
algorithm_type: str
normalized: bool
quantized: bool
cached: bool
extrapolation_type: str
class MaterialModel(_BaseModel):
name: str
behaviour: str
definition: str
localized_name: str
source: str
type: str
format: str
dependant_parameters: list[DependentParameters]
independat_parameters: list[IndependentParameters]
interpolation: InterpolationOptions
class DependentParameters:
name: str
values: list[float]
class IndependentParameters:
name: str
values: list[float]
default_value: float
units: str
resolution: str
upper_limit: str
lower_limit: str
class Material:
models: list[MaterialModel]
id: str
name: str
uuid: str
def __init__(
self, material_name: str, material_id: str = None, models: list[MaterialModel] | None
):
#EXAMPLE
class ElasticityIsotropic(MaterialModel):
def __init__(dependeant_parameters: list[DependentParameters], independat_parameters: list[IndependentParameters]):
super().__init__(dependant_parameters, independat_parameters)
def write_model(self, material: "Material", pyansys_session: Any) -> None:
is_ok, issues = self.validate_model()
if not is_ok:
raise ModelValidationException("\n".join(issues))
if isinstance(pyansys_session, _MapdlCore):
self._write_mapdl(pyansys_session, material)
else:
raise TypeError(
"This model is only supported by MAPDL and Fluent. Ensure that you have the correct"
"type of the PyAnsys session."
)
def _write_mapdl(self, mapdl: "_MapdlCore", material: "Material") -> None:
mapdl_property_code = mapdl_property_codes[self._name.lower()]
mapdl.mp(mapdl_property_code, material.material_id, self._values)
def validate_model(self) -> "Tuple[bool, List[str]]":
failures = []
is_ok = True
if self._name is None or self._name == "":
failures.append("Invalid property name")
is_ok = False
if self._value is None:
failures.append("Value cannot be None")
is_ok = False
young_modulus = DependentParameters(name="Young's Modulus", values=[200e9]),
poisson_ratio = DependentParameters(name="Poisson's Ratio", values=[0.3])
independat_steel = [
IndependentParameters(name="Temperature", values=[22, 60], default_value=22, units="C", upper_limit="Program Controlled", lower_limit="Program Controlled")
]
steel_elasticity = ElasticityIsotropic(young_modulus=young_modulus, poisson_ratio=poisson_ratio, independat_parameters=independat_steel)
steel = Material(material_name="steel", models=[steel_elasticity])
what is needed:
- definition of the MaterialModel class
- defition of the classes for each element of the MATML_PROPERTY_MAP ("Elasticity::Isotropic", "Elasticity::Orthotropic" ...)
- substitute the Constant with DependentParameters and IndependentParameters
- implement the export for variable material in pymapdl
- implement the export for pydyna
💡 Steps for implementing the feature
No response
🔗 Useful links and references
No response