auxi-mpp 2.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. auxi/mpp/__init__.py +5 -0
  2. auxi/mpp/core/__init__.py +20 -0
  3. auxi/mpp/core/_dataset.py +146 -0
  4. auxi/mpp/core/_dataset.template.csv +17 -0
  5. auxi/mpp/core/_material_component_property_model.py +91 -0
  6. auxi/mpp/core/_material_model.py +5 -0
  7. auxi/mpp/core/_material_property_model.py +89 -0
  8. auxi/mpp/core/_material_type.py +30 -0
  9. auxi/mpp/core/_state_of_matter.py +19 -0
  10. auxi/mpp/core/material_state/__init__.py +26 -0
  11. auxi/mpp/core/material_state/_material_state.py +7 -0
  12. auxi/mpp/core/material_state/_p_state.py +18 -0
  13. auxi/mpp/core/material_state/_slurry_state.py +22 -0
  14. auxi/mpp/core/material_state/_t_state.py +18 -0
  15. auxi/mpp/core/material_state/_tp_state.py +20 -0
  16. auxi/mpp/core/material_state/_tpx_state.py +43 -0
  17. auxi/mpp/core/material_state/_tx_binary_state.py +21 -0
  18. auxi/mpp/core/material_state/_tx_state.py +32 -0
  19. auxi/mpp/core/material_state/_x_binary_state.py +18 -0
  20. auxi/mpp/core/material_state/_x_state.py +18 -0
  21. auxi/mpp/core/material_state/py.typed +0 -0
  22. auxi/mpp/core/py.typed +0 -0
  23. auxi/mpp/py.typed +0 -0
  24. auxi/mpp/slag/D/__init__.py +9 -0
  25. auxi/mpp/slag/D/_model.py +18 -0
  26. auxi/mpp/slag/D/_thibodeau_id_binary.py +87 -0
  27. auxi/mpp/slag/D/_thibodeau_id_binary.yaml +61 -0
  28. auxi/mpp/slag/D/_thibodeau_id_multi.py +88 -0
  29. auxi/mpp/slag/D/_thibodeau_id_multi.yaml +61 -0
  30. auxi/mpp/slag/D/_thibodeau_id_unary.py +67 -0
  31. auxi/mpp/slag/D/_thibodeau_id_unary.yaml +61 -0
  32. auxi/mpp/slag/D/py.typed +0 -0
  33. auxi/mpp/slag/Vm/__init__.py +14 -0
  34. auxi/mpp/slag/Vm/_model.py +16 -0
  35. auxi/mpp/slag/Vm/_thibodeau_binary.py +108 -0
  36. auxi/mpp/slag/Vm/_thibodeau_binary.yaml +72 -0
  37. auxi/mpp/slag/Vm/_thibodeau_multi.py +127 -0
  38. auxi/mpp/slag/Vm/_thibodeau_multi.yaml +74 -0
  39. auxi/mpp/slag/Vm/_thibodeau_unary.py +78 -0
  40. auxi/mpp/slag/Vm/_thibodeau_unary.yaml +23 -0
  41. auxi/mpp/slag/Vm/py.typed +0 -0
  42. auxi/mpp/slag/__init__.py +10 -0
  43. auxi/mpp/slag/_slag_component_property_model.py +21 -0
  44. auxi/mpp/slag/_slag_property_model.py +21 -0
  45. auxi/mpp/slag/py.typed +0 -0
  46. auxi/mpp/slag/state/__init__.py +16 -0
  47. auxi/mpp/slag/state/_silicate_slag_eq_tpx_binary_state.py +63 -0
  48. auxi/mpp/slag/state/_silicate_slag_eq_tpx_state.py +61 -0
  49. auxi/mpp/slag/state/_silicate_slag_eq_tx_binary_state.py +49 -0
  50. auxi/mpp/slag/state/_silicate_slag_eq_tx_state.py +47 -0
  51. auxi/mpp/slag/state/py.typed +0 -0
  52. auxi/mpp/slag//316/274/__init__.py +11 -0
  53. auxi/mpp/slag//316/274/_grundy_kim_brosch_binary.py +161 -0
  54. auxi/mpp/slag//316/274/_grundy_kim_brosch_binary.yaml +80 -0
  55. auxi/mpp/slag//316/274/_grundy_kim_brosch_multi.py +441 -0
  56. auxi/mpp/slag//316/274/_grundy_kim_brosch_multi.yaml +107 -0
  57. auxi/mpp/slag//316/274/_grundy_kim_brosch_unary.py +79 -0
  58. auxi/mpp/slag//316/274/_grundy_kim_brosch_unary.yaml +80 -0
  59. auxi/mpp/slag//316/274/_model.py +16 -0
  60. auxi/mpp/slag//316/274/py.typed +0 -0
  61. auxi/mpp/slag//317/201/__init__.py +11 -0
  62. auxi/mpp/slag//317/201/_model.py +16 -0
  63. auxi/mpp/slag//317/201/_thibodeau_density_binary.py +72 -0
  64. auxi/mpp/slag//317/201/_thibodeau_density_binary.yaml +10 -0
  65. auxi/mpp/slag//317/201/_thibodeau_density_multi.py +73 -0
  66. auxi/mpp/slag//317/201/_thibodeau_density_multi.yaml +10 -0
  67. auxi/mpp/slag//317/201/_thibodeau_density_unary.py +74 -0
  68. auxi/mpp/slag//317/201/_thibodeau_density_unary.yaml +10 -0
  69. auxi/mpp/slag//317/201/py.typed +0 -0
  70. auxi/mpp/slag//317/203/__init__.py +9 -0
  71. auxi/mpp/slag//317/203/_model.py +16 -0
  72. auxi/mpp/slag//317/203/_thibodeau_ec_binary.py +84 -0
  73. auxi/mpp/slag//317/203/_thibodeau_ec_binary.yaml +21 -0
  74. auxi/mpp/slag//317/203/_thibodeau_ec_multi.py +82 -0
  75. auxi/mpp/slag//317/203/_thibodeau_ec_multi.yaml +21 -0
  76. auxi/mpp/slag//317/203/_thibodeau_ec_unary.py +78 -0
  77. auxi/mpp/slag//317/203/_thibodeau_ec_unary.yaml +21 -0
  78. auxi/mpp/slag//317/203/py.typed +0 -0
  79. auxi_mpp-2.2.3.dist-info/METADATA +62 -0
  80. auxi_mpp-2.2.3.dist-info/RECORD +83 -0
  81. auxi_mpp-2.2.3.dist-info/WHEEL +5 -0
  82. auxi_mpp-2.2.3.dist-info/licenses/LICENSE.md +21 -0
  83. auxi_mpp-2.2.3.dist-info/top_level.txt +1 -0
auxi/mpp/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ """
2
+ `auxi` provides tools to help users do calculations for metallurgical process engineering. `auxi-mpp` provides tools for calculating material physical properties.
3
+ """
4
+
5
+ __version__ = "2.2.3"
@@ -0,0 +1,20 @@
1
+ """
2
+ Core components used by other `auxi-mpp` sub-packages.
3
+ """
4
+
5
+ from ._dataset import Dataset
6
+ from ._material_component_property_model import MaterialComponentPropertyModel
7
+ from ._material_model import MaterialModel
8
+ from ._material_property_model import MaterialPropertyModel
9
+ from ._material_type import MaterialType
10
+ from ._state_of_matter import StateOfMatter
11
+
12
+
13
+ __all__ = [
14
+ "Dataset",
15
+ "MaterialComponentPropertyModel",
16
+ "MaterialModel",
17
+ "MaterialPropertyModel",
18
+ "MaterialType",
19
+ "StateOfMatter",
20
+ ]
@@ -0,0 +1,146 @@
1
+ import csv
2
+ from pathlib import Path
3
+
4
+ import polars as pl
5
+
6
+
7
+ class Dataset:
8
+ """
9
+ Contains a dataset used to create and/or test a material physical property model.
10
+
11
+ :param path: path to the .csv file that contains the data
12
+ """
13
+
14
+ @classmethod
15
+ def create_template(cls, material: str, path: Path) -> Path:
16
+ """
17
+ Create a template csv file for a dataset.
18
+
19
+ :param material: the name of the material
20
+ :param path: the path of the directory where the file must be written
21
+ :param show: a boolean indicating whether the created file should be displayed after creation
22
+ """
23
+ from shutil import copy
24
+
25
+ file_name = f"dataset-{material.lower().replace(' ', '-')}.csv"
26
+ file_path = path / file_name
27
+
28
+ template_path = Path(__file__).with_suffix(".template.csv")
29
+
30
+ if file_path.exists():
31
+ raise FileExistsError(f"File '{file_path}' already exists.")
32
+
33
+ copy(template_path, file_path)
34
+
35
+ return file_path
36
+
37
+ def __init__(self, path: Path):
38
+ self._path: Path = path
39
+
40
+ self._name: str = path.name
41
+ self._material: str
42
+ self._description: str
43
+ self._reference: str
44
+ self._col_names: dict[str, str]
45
+ self._col_symbols: list[str]
46
+ self._col_display_symbols: dict[str, str]
47
+ self._col_units: dict[str, str]
48
+ self._data: pl.DataFrame
49
+
50
+ self._read_header_information()
51
+ self._read_data()
52
+
53
+ def __str__(self):
54
+ result = "Material: {self.material}\n"
55
+ result += "Description: {self.description}\n"
56
+ result += "References: {self.reference}\n"
57
+ result += "Properties: {self.col_names}\n"
58
+ result += "Symbols: {self.col_symbols}\n"
59
+ result += "Display symbols: {self.col_display_symbols}\n"
60
+ result += "Units: {self.col_units}\n"
61
+ result += "Data:\n"
62
+ result += str(self.data)
63
+
64
+ return result
65
+
66
+ @property
67
+ def path(self) -> Path:
68
+ """Dataset .csv file path."""
69
+ return self._path
70
+
71
+ @property
72
+ def name(self) -> str:
73
+ """Dataset name."""
74
+ return self._name
75
+
76
+ @property
77
+ def material(self) -> str:
78
+ """The name of the material represented by the dataset."""
79
+ return self._material
80
+
81
+ @property
82
+ def description(self) -> str:
83
+ """Dataset description."""
84
+ return self._description
85
+
86
+ @property
87
+ def reference(self) -> str:
88
+ """Dataset source reference."""
89
+ return self._reference
90
+
91
+ @property
92
+ def col_names(self) -> dict[str, str]:
93
+ """Dataset column names."""
94
+ return self._col_names
95
+
96
+ @property
97
+ def col_symbols(self) -> list[str]:
98
+ """Dataset column symbols."""
99
+ return self._col_symbols
100
+
101
+ @property
102
+ def col_display_symbols(self) -> dict[str, str]:
103
+ """Dataset column display symbols."""
104
+ return self._col_display_symbols
105
+
106
+ @property
107
+ def col_units(self) -> dict[str, str]:
108
+ """Dataset column units."""
109
+ return self._col_units
110
+
111
+ @property
112
+ def data(self) -> pl.DataFrame:
113
+ """The dataset as a polars DataFrame."""
114
+ return self._data
115
+
116
+ def _read_header_information(self):
117
+ with open(self._path, newline="") as file:
118
+ lines = csv.reader(file, delimiter=",", quotechar='"')
119
+
120
+ self._material = next(lines)[1]
121
+ self._description = next(lines)[1]
122
+ self._reference = next(lines)[1]
123
+
124
+ col_names = next(lines)
125
+ col_units = next(lines)
126
+ col_display_symbols = next(lines)
127
+ self._col_symbols = next(lines)
128
+
129
+ self._col_names = dict(zip(self._col_symbols, col_names))
130
+ self._col_display_symbols = dict(zip(self._col_symbols, col_display_symbols))
131
+ self._col_units = dict(zip(self._col_symbols, col_units))
132
+
133
+ def _read_data(self):
134
+ self._data: pl.DataFrame = pl.read_csv(self._path, skip_rows=6)
135
+
136
+ # header: dict[
137
+ # str,
138
+ # str,
139
+ # ] = {}
140
+ # for symbol in self.col_symbols:
141
+ # header[symbol] = f"{symbol}[{self.col_units[symbol]}]"
142
+
143
+ # self._data = self.data.rename(
144
+ # mapping=header,
145
+ # strict=True,
146
+ # )
@@ -0,0 +1,17 @@
1
+ Name,<Add a name for the material here. E.g. Blast Furnace Slag>
2
+ Description,<Add a dataset description here.>
3
+ Reference,<Add a reference to the source of the dataset here. A dataset should contain data from at most one referenced data source.>
4
+ Temperature,<parameter 1 name>,<parameter 2 name>,<parameter 3 name>
5
+ K,<parameter 1 units>,<parameter 2 units>,<parameter 3 units>
6
+ T,<parameter 1 display symbol>,<parameter 2 display symbol>,<parameter 3 display symbol>
7
+ T,<parameter 1 symbol>,<parameter 2 symbol>,<parameter 3 symbol>
8
+ 100.0,0.0,10.0,100.0
9
+ 150.0,1.0,11.0,101.0
10
+ 200.0,2.0,12.0,102.0
11
+ 250.0,3.0,13.0,103.0
12
+ 300.0,4.0,14.0,104.0
13
+ 350.0,5.0,15.0,105.0
14
+ 400.0,6.0,16.0,106.0
15
+ 450.0,7.0,17.0,107.0
16
+ 500.0,8.0,18.0,108.0
17
+ 550.0,9.0,19.0,109.0
@@ -0,0 +1,91 @@
1
+ import inspect
2
+ from abc import abstractmethod
3
+ from pathlib import Path
4
+ from typing import Any, ClassVar
5
+
6
+ import yaml
7
+ from pydantic import ConfigDict, Field
8
+
9
+ from auxi.core.objects import Object
10
+ from auxi.core.validation import floatFraction, floatPositiveOrZero, strNotEmpty
11
+
12
+ from ._material_type import MaterialType
13
+
14
+
15
+ class MaterialComponentPropertyModel[T: floatPositiveOrZero, p: floatPositiveOrZero, x: dict[str, floatFraction]](
16
+ Object
17
+ ):
18
+ r"""
19
+ Base class of models that describe the variation of specific component physical properties related to some material.
20
+
21
+ :param material_type: the type of material being described
22
+ :param material: the name of the material being described, e.g. "Air"
23
+ :param property: the name of the property being described, e.g. "density"
24
+ :param symbol: the symbol of the property being described, e.g. "ρ"
25
+ :param display symbol: the LaTeX display symbol of the property being described, e.g. "\\rho"
26
+ :param units: the units used to express the property, e.g. "kg/m3"
27
+ :param references: a list of literature references on which this model implementation is based, e.g. ['lienhard2015', 'smith2006']
28
+ :param datasets: a list of data sets on which this model implementation is based, e.g. ['dataset-air-lienhard2015.csv']
29
+ """
30
+
31
+ data: ClassVar[dict[str, Any]] = {}
32
+
33
+ @classmethod
34
+ def load_data(
35
+ cls,
36
+ path: Path | None = None,
37
+ ) -> None:
38
+ if len(cls.data) == 0:
39
+ if path is None:
40
+ path = Path(inspect.getfile(cls))
41
+ cls.data = yaml.safe_load(path.with_suffix(".yaml").read_text())
42
+
43
+ model_config = ConfigDict(
44
+ validate_assignment=True,
45
+ )
46
+
47
+ material_type: MaterialType = MaterialType.UNKNOWN
48
+ material_components: list[str] = Field(default_factory=list)
49
+ property: strNotEmpty = ""
50
+ symbol: strNotEmpty = ""
51
+ display_symbol: strNotEmpty = ""
52
+ units: strNotEmpty = ""
53
+ references: ClassVar[list[strNotEmpty]] = []
54
+ datasets: ClassVar[list[strNotEmpty]] = []
55
+
56
+ def model_post_init(self, __context: Any) -> None:
57
+ return super().model_post_init(__context)
58
+
59
+ self.allowed_compounds: list[str] = []
60
+
61
+ @staticmethod
62
+ def normalise_assay(x: dict[str, float]) -> dict[str, float]:
63
+ total = sum(x.values())
64
+ x = {key: x[key] / total for key in x.keys()}
65
+ return x
66
+
67
+ def __call__(self, T: T = 298.15, p: p = 101325, x: x = {}):
68
+ """
69
+ For details about this method, please refer to the calculate method.
70
+ """
71
+ return self.calculate(T, p, x)
72
+
73
+ @abstractmethod
74
+ def calculate(self, T: T, p: p, x: x) -> dict[str, float]:
75
+ """
76
+ Calculate the property.
77
+
78
+ Args:
79
+ ----
80
+ T: System temperature.
81
+ p: System pressure.
82
+ x: Chemical composition dictionary.
83
+
84
+ Returns:
85
+ -------
86
+ Material property value.
87
+ """
88
+ ...
89
+
90
+ def _init(self):
91
+ return
@@ -0,0 +1,5 @@
1
+ from auxi.core.objects import Object
2
+
3
+
4
+ class MaterialModel(Object):
5
+ pass
@@ -0,0 +1,89 @@
1
+ import inspect
2
+ from abc import abstractmethod
3
+ from pathlib import Path
4
+ from typing import Any, ClassVar
5
+
6
+ import yaml
7
+ from pydantic import ConfigDict
8
+
9
+ from auxi.core.objects import Object
10
+ from auxi.core.validation import floatFraction, floatPositiveOrZero, strNotEmpty
11
+
12
+ from ._material_type import MaterialType
13
+
14
+
15
+ class MaterialPropertyModel[T: floatPositiveOrZero, p: floatPositiveOrZero, x: dict[str, floatFraction]](Object):
16
+ r"""
17
+ Base class of models that describe the variation of a specific material physical property.
18
+
19
+ :param material_type: the type of material being described
20
+ :param material: the name of the material being described, e.g. "Air"
21
+ :param property: the name of the property being described, e.g. "density"
22
+ :param symbol: the symbol of the property being described, e.g. "ρ"
23
+ :param display symbol: the LaTeX display symbol of the property being described, e.g. "\\rho"
24
+ :param units: the units used to express the property, e.g. "kg/m3"
25
+ :param references: a list of literature references on which this model implementation is based, e.g. ['lienhard2015', 'smith2006']
26
+ :param datasets: a list of data sets on which this model implementation is based, e.g. ['dataset-air-lienhard2015.csv']
27
+ """
28
+
29
+ data: ClassVar[dict[str, Any]] = {}
30
+
31
+ @classmethod
32
+ def load_data(
33
+ cls,
34
+ path: Path | None = None,
35
+ ) -> None:
36
+ if len(cls.data) == 0:
37
+ if path is None:
38
+ path = Path(inspect.getfile(cls))
39
+ cls.data = yaml.safe_load(path.with_suffix(".yaml").read_text())
40
+
41
+ model_config = ConfigDict(
42
+ validate_assignment=True,
43
+ )
44
+
45
+ material_type: MaterialType = MaterialType.UNKNOWN
46
+ material: strNotEmpty = ""
47
+ property: strNotEmpty = ""
48
+ symbol: strNotEmpty = ""
49
+ display_symbol: strNotEmpty = ""
50
+ units: strNotEmpty = ""
51
+ references: ClassVar[list[strNotEmpty]] = []
52
+ datasets: ClassVar[list[strNotEmpty]] = []
53
+
54
+ def model_post_init(self, __context: Any) -> None:
55
+ return super().model_post_init(__context)
56
+
57
+ self.allowed_compounds: list[str] = []
58
+
59
+ @staticmethod
60
+ def normalise_assay(x: dict[str, float]) -> dict[str, float]:
61
+ total = sum(x.values())
62
+ x = {key: x[key] / total for key in x.keys()}
63
+ return x
64
+
65
+ def __call__(self, T: T = 298.15, p: p = 101325, x: x = {}):
66
+ """
67
+ For details about this method, please refer to the calculate method.
68
+ """
69
+ return self.calculate(T, p, x)
70
+
71
+ @abstractmethod
72
+ def calculate(self, T: T, p: p, x: x) -> float:
73
+ """
74
+ Calculate the property.
75
+
76
+ Args:
77
+ ----
78
+ T: System temperature.
79
+ p: System pressure.
80
+ x: Chemical composition dictionary.
81
+
82
+ Returns:
83
+ -------
84
+ Material property value.
85
+ """
86
+ ...
87
+
88
+ def _init(self):
89
+ return
@@ -0,0 +1,30 @@
1
+ from enum import IntEnum
2
+
3
+
4
+ class MaterialType(IntEnum):
5
+ UNKNOWN = 0
6
+ PURE_SUBSTANCE = 2**0
7
+ SINGLE_PHASE = 2**1
8
+ COMPOSITE = 2**2
9
+
10
+ # states of matter
11
+ STATE_SOLID = 2**5
12
+ STATE_LIQUID = 2**6
13
+ STATE_GAS = 2**7
14
+ STATE_PLASMA = 2**8
15
+
16
+ # chemical composition categories
17
+ CATEGORY_METAL = 2**10
18
+ CATEGORY_OXIDE = 2**11
19
+ CATEGORY_SULPHIDE = 2**12
20
+ CATEGORY_ORGANIC = 2**13
21
+
22
+ # single-phase mixtures
23
+ GAS = SINGLE_PHASE | STATE_GAS
24
+ ALLOY_LIQUID = SINGLE_PHASE | STATE_LIQUID | CATEGORY_METAL
25
+ MATTE_LIQUID = SINGLE_PHASE | STATE_LIQUID | CATEGORY_SULPHIDE
26
+ SLAG_LIQUID = SINGLE_PHASE | STATE_LIQUID | CATEGORY_OXIDE
27
+
28
+ # composite materials
29
+ REFRACTORY = COMPOSITE | STATE_SOLID | CATEGORY_OXIDE
30
+ CARBONACEOUS = COMPOSITE | STATE_SOLID | CATEGORY_ORGANIC | CATEGORY_OXIDE
@@ -0,0 +1,19 @@
1
+ from enum import IntEnum
2
+
3
+
4
+ # TODO: move to auxi-core
5
+ class StateOfMatter(IntEnum):
6
+ unknown = 0
7
+ solid = 1
8
+ liquid = 2
9
+ solid_liquid = solid | liquid
10
+ gas = 4
11
+ solid_gas = solid | gas
12
+ solid_liquid_gas = solid | liquid | gas
13
+ plasma = 8
14
+ solid_plasma = solid | plasma
15
+ solid_liquid_plasma = solid | liquid | plasma
16
+ solid_liquid_gas_plasma = solid | liquid | gas | plasma
17
+ liquid_plasma = liquid | plasma
18
+ liquid_gas_plasma = liquid | gas | plasma
19
+ gas_plasma = gas | plasma
@@ -0,0 +1,26 @@
1
+ """Material state descriptor classes."""
2
+
3
+ from ._material_state import MaterialState
4
+ from ._p_state import pState
5
+ from ._slurry_state import SlurryState
6
+ from ._t_state import TState
7
+ from ._tp_state import TpState
8
+ from ._tpx_state import TpxState
9
+ from ._tx_binary_state import TxBinaryState
10
+ from ._tx_state import TxState
11
+ from ._x_binary_state import xBinaryState
12
+ from ._x_state import xState
13
+
14
+
15
+ __all__ = [
16
+ "MaterialState",
17
+ "SlurryState",
18
+ "TState",
19
+ "TpState",
20
+ "TpxState",
21
+ "TxBinaryState",
22
+ "TxState",
23
+ "pState",
24
+ "xBinaryState",
25
+ "xState",
26
+ ]
@@ -0,0 +1,7 @@
1
+ from auxi.core.objects import Object
2
+
3
+
4
+ class MaterialState(Object):
5
+ """A descriptor of the independent state of a material."""
6
+
7
+ ...
@@ -0,0 +1,18 @@
1
+ from auxi.core.validation import floatPositive
2
+
3
+ from ._material_state import MaterialState
4
+
5
+
6
+ class pState(MaterialState):
7
+ """
8
+ Pressure state for a material.
9
+
10
+ Args:
11
+ ----
12
+ p : [Pa] Pressure.
13
+ """
14
+
15
+ p: floatPositive
16
+
17
+ def _init(self):
18
+ return
@@ -0,0 +1,22 @@
1
+ from auxi.core.validation import floatPositive, floatPositiveOrZero
2
+
3
+ from ._material_state import MaterialState
4
+
5
+
6
+ class SlurryState(MaterialState):
7
+ """
8
+ The state of a liquid with suspended solids.
9
+
10
+ Args:
11
+ ----
12
+ μ : [Pa.s] Liquid fraction dynamic viscosity.
13
+ ϕ : [m3/m3] Volume fraction solids.
14
+ pr : Packing ratio of suspended solids.
15
+ """
16
+
17
+ μ: floatPositive
18
+ ϕ: floatPositiveOrZero # TODO: max 0.3
19
+ pr: floatPositive = 2.94
20
+
21
+ def _init(self):
22
+ return
@@ -0,0 +1,18 @@
1
+ from auxi.core.validation import floatPositive
2
+
3
+ from ._material_state import MaterialState
4
+
5
+
6
+ class TState(MaterialState):
7
+ """
8
+ Temperature state for a material.
9
+
10
+ Args:
11
+ ----
12
+ T : [K] Temperature.
13
+ """
14
+
15
+ T: floatPositive
16
+
17
+ def _init(self):
18
+ return
@@ -0,0 +1,20 @@
1
+ from auxi.core.validation import floatPositive
2
+
3
+ from ._material_state import MaterialState
4
+
5
+
6
+ class TpState(MaterialState):
7
+ """
8
+ Temperature and pressure state for a material.
9
+
10
+ Args:
11
+ ----
12
+ T : [K] Temperature.
13
+ p : [Pa] Pressure.
14
+ """
15
+
16
+ T: floatPositive
17
+ p: floatPositive
18
+
19
+ def _init(self):
20
+ return
@@ -0,0 +1,43 @@
1
+ from typing import Self
2
+
3
+ from pydantic import Field, model_validator
4
+
5
+ from auxi.chemistry.validation import listCompoundFormulas
6
+ from auxi.core.validation import floatFraction, floatPositive
7
+
8
+ from ._material_state import MaterialState
9
+
10
+
11
+ class TpxState(MaterialState):
12
+ """
13
+ Temperature and composition state for a material.
14
+
15
+ Args:
16
+ ----
17
+ T : [K] Temperature.
18
+ p : [Pa] Pressure.
19
+ x : Mole fraction of material components.
20
+ """
21
+
22
+ T: floatPositive
23
+ p: floatPositive
24
+ x: dict[str, floatFraction]
25
+ compounds: listCompoundFormulas = Field(default_factory=list)
26
+
27
+ @model_validator(mode="after")
28
+ def check_model(self) -> Self:
29
+ self.compounds = list(self.x.keys())
30
+
31
+ if self.T < 1000 or self.T > 2500:
32
+ raise ValueError("Temperature should be above 1000 K and below 2500 K.")
33
+
34
+ total_mole_frac = 0
35
+ for comp in self.x:
36
+ total_mole_frac += self.x[comp]
37
+ if total_mole_frac != 1.00:
38
+ raise ValueError("Mole fractions should add up to 1.00.")
39
+
40
+ return self
41
+
42
+ def _init(self):
43
+ return
@@ -0,0 +1,21 @@
1
+ from auxi.chemistry.validation import dictChemicalCompositionBinary
2
+ from auxi.core.validation import floatPositive
3
+
4
+ from ._material_state import MaterialState
5
+
6
+
7
+ class TxBinaryState(MaterialState):
8
+ """
9
+ Temperature and composition state for a binary material.
10
+
11
+ Args:
12
+ ----
13
+ T : [K] Temperature.
14
+ x : Mole fraction of binary material components.
15
+ """
16
+
17
+ T: floatPositive
18
+ x: dictChemicalCompositionBinary
19
+
20
+ def _init(self):
21
+ return
@@ -0,0 +1,32 @@
1
+ from typing import Self
2
+
3
+ from pydantic import Field, model_validator
4
+
5
+ from auxi.chemistry.validation import dictChemicalComposition, listCompoundFormulas
6
+ from auxi.core.validation import floatPositive
7
+
8
+ from ._material_state import MaterialState
9
+
10
+
11
+ class TxState(MaterialState):
12
+ """
13
+ Temperature and composition state for a material.
14
+
15
+ Args:
16
+ ----
17
+ T : [K] Temperature.
18
+ x : Mole fraction of material components.
19
+ """
20
+
21
+ T: floatPositive
22
+ x: dictChemicalComposition
23
+ compounds: listCompoundFormulas = Field(default_factory=list)
24
+
25
+ @model_validator(mode="after")
26
+ def check_model(self) -> Self:
27
+ self.compounds = list(self.x.keys())
28
+
29
+ return self
30
+
31
+ def _init(self):
32
+ return
@@ -0,0 +1,18 @@
1
+ from auxi.chemistry.validation import dictChemicalCompositionBinary
2
+
3
+ from ._material_state import MaterialState
4
+
5
+
6
+ class xBinaryState(MaterialState):
7
+ """
8
+ Composition state for a binary material.
9
+
10
+ Args:
11
+ ----
12
+ x : Mole fraction of binary material components.
13
+ """
14
+
15
+ x: dictChemicalCompositionBinary
16
+
17
+ def _init(self):
18
+ return
@@ -0,0 +1,18 @@
1
+ from auxi.chemistry.validation import dictChemicalComposition
2
+
3
+ from ._material_state import MaterialState
4
+
5
+
6
+ class xState(MaterialState):
7
+ """
8
+ Composition state for a material.
9
+
10
+ Args:
11
+ ----
12
+ x : Mole fraction of material components.
13
+ """
14
+
15
+ x: dictChemicalComposition
16
+
17
+ def _init(self):
18
+ return
File without changes