Skip to content

Commit b45bfc3

Browse files
Add LAR materials (#4155)
* try adding material config * dots * move materials file * finally working * add blanket materials * 🐛 Fix materials cache * 🐛 Fix materials cache 2 * ruff * better error message * heavy concrete * ruff * Change run_mode from 'read' to 'run' --------- Co-authored-by: james <[email protected]>
1 parent da2b549 commit b45bfc3

File tree

5 files changed

+203
-35
lines changed

5 files changed

+203
-35
lines changed

bluemira/materials/cache.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212

1313
import copy
1414
import types
15-
from typing import TYPE_CHECKING
1615

1716
from matproplib.library.fluids import Void
17+
from matproplib.material import Material
1818

1919
from bluemira.materials.error import MaterialsError
2020
from bluemira.utilities.tools import get_module
2121

22-
if TYPE_CHECKING:
23-
from matproplib.material import Material
24-
2522
vacuum_void = Void(name="Vacuum")
2623

2724

@@ -94,13 +91,13 @@ def _d(p, name, initial_p):
9491
return None
9592

9693
for p in self._material_packages:
97-
if len(name) == 1:
98-
return _d(p, name[0], p.__name__)
94+
initial_p = p.__name__.replace(".", "/")
9995
mod = p
10096
for n in name:
101-
mod = _d(mod, n, p.__name__)
102-
return mod
103-
raise AttributeError("No such material")
97+
mod = _d(mod, n, initial_p)
98+
if isinstance(mod, Material):
99+
return mod
100+
raise AttributeError(f"No such material: {name}")
104101

105102
def get_material(self, name: str, *, clone: bool = True):
106103
"""

eudemo/config/build_config.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@
106106
"Blanket": {
107107
"run_mode": "run",
108108
"material": {
109-
"IBS": "Homogenised_HCPB_2015_v3_IB",
110-
"OBS": "Homogenised_HCPB_2015_v3_OB"
109+
"FW": "BB_FW_MATERIAL",
110+
"BZ": "BB_BZ_MATERIAL",
111+
"MANIFOLD": "BB_MANI_MATERIAL"
111112
}
112113
},
113114
"Vacuum vessel": {
114-
"material": "SS316-LN"
115+
"material": "VV_MATERIAL"
115116
},
116117
"Divertor": {
117118
"material": "Homogenised_Divertor_2015"
@@ -214,8 +215,8 @@
214215
},
215216
"Upper Port": {
216217
"material": {
217-
"TS": "SS316-LN",
218-
"VV": "SS316-LN"
218+
"TS": "SS316_LN_MAT",
219+
"VV": "SS316_LN_MAT"
219220
}
220221
},
221222
"Equatorial Port": {
@@ -240,8 +241,8 @@
240241
}
241242
},
242243
"material": {
243-
"TS": "SS316-LN",
244-
"VV": "SS316-LN"
244+
"TS": "SS316_LN_MAT",
245+
"VV": "SS316_LN_MAT"
245246
}
246247
},
247248
"Lower Port": {
@@ -272,8 +273,8 @@
272273
}
273274
},
274275
"material": {
275-
"TS": "SS316-LN",
276-
"VV": "SS316-LN"
276+
"TS": "SS316_LN_MAT",
277+
"VV": "SS316_LN_MAT"
277278
}
278279
},
279280
"Cryostat": {
@@ -298,14 +299,14 @@
298299
}
299300
},
300301
"material": {
301-
"Body": "SS316-LN",
302-
"Port Plug": "SS316-LN"
302+
"Body": "SS316_LN_MAT",
303+
"Port Plug": "SS316_LN_MAT"
303304
}
304305
},
305306
"Thermal shield": {
306307
"material": {
307-
"VVTS": "SS316-LN",
308-
"Cryostat TS": "SS316-LN"
308+
"VVTS": "SS316_LN_MAT",
309+
"Cryostat TS": "SS316_LN_MAT"
309310
}
310311
},
311312
"RadiationShield": {
@@ -329,13 +330,13 @@
329330
"long_name": "Castellation offset value."
330331
}
331332
},
332-
"material": "SS316-LN"
333+
"material": "HeavyConcrete"
333334
},
334335
"Coil structures": {
335336
"material": {
336-
"PF ICS": "SS316-LN",
337-
"TF OIS": "SS316-LN",
338-
"GS": "SS316-LN"
337+
"PF ICS": "SS316_LN_MAT",
338+
"TF OIS": "SS316_LN_MAT",
339+
"GS": "SS316_LN_MAT"
339340
}
340341
}
341342
}

eudemo/eudemo/blanket/builder.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,32 @@ def build_xz(self, ib_fw, ib_bz, ib_manifold, ob_fw, ob_bz, ob_manifold):
127127
:
128128
The xz component
129129
"""
130-
ib_fw = PhysicalComponent(f"{self.IBS}_{self.FW}", ib_fw)
131-
ib_bz = PhysicalComponent(f"{self.IBS}_{self.BZ}", ib_bz)
132-
ib_manifold = PhysicalComponent(f"{self.IBS}_{self.MANIFOLD}", ib_manifold)
130+
ib_fw = PhysicalComponent(
131+
f"{self.IBS}_{self.FW}", ib_fw, material=self.get_material(self.FW)
132+
)
133+
ib_bz = PhysicalComponent(
134+
f"{self.IBS}_{self.BZ}", ib_bz, material=self.get_material(self.BZ)
135+
)
136+
ib_manifold = PhysicalComponent(
137+
f"{self.IBS}_{self.MANIFOLD}",
138+
ib_manifold,
139+
material=self.get_material(self.MANIFOLD),
140+
)
133141
apply_component_display_options(ib_fw, color=BLUE_PALETTE[self.BB][0])
134142
apply_component_display_options(ib_bz, color=BLUE_PALETTE[self.BB][1])
135143
apply_component_display_options(ib_manifold, color=BLUE_PALETTE[self.BB][2])
136144

137-
ob_fw = PhysicalComponent(f"{self.OBS}_{self.FW}", ob_fw)
138-
ob_bz = PhysicalComponent(f"{self.OBS}_{self.BZ}", ob_bz)
139-
ob_manifold = PhysicalComponent(f"{self.OBS}_{self.MANIFOLD}", ob_manifold)
145+
ob_fw = PhysicalComponent(
146+
f"{self.OBS}_{self.FW}", ob_fw, material=self.get_material(self.FW)
147+
)
148+
ob_bz = PhysicalComponent(
149+
f"{self.OBS}_{self.BZ}", ob_bz, material=self.get_material(self.BZ)
150+
)
151+
ob_manifold = PhysicalComponent(
152+
f"{self.OBS}_{self.MANIFOLD}",
153+
ob_manifold,
154+
material=self.get_material(self.MANIFOLD),
155+
)
140156
apply_component_display_options(ob_fw, color=BLUE_PALETTE[self.BB][0])
141157
apply_component_display_options(ob_bz, color=BLUE_PALETTE[self.BB][1])
142158
apply_component_display_options(ob_manifold, color=BLUE_PALETTE[self.BB][2])
@@ -159,7 +175,9 @@ def build_xy(self, segments: list[PhysicalComponent]):
159175
slices = []
160176
for segment in segments:
161177
single_slice = PhysicalComponent(
162-
segment.name, BluemiraFace(slice_shape(segment.shape, xy_plane)[0])
178+
segment.name,
179+
BluemiraFace(slice_shape(segment.shape, xy_plane)[0]),
180+
material=segment.material,
163181
)
164182
apply_component_display_options(
165183
single_slice, color=segment.display_cad_options.color
@@ -233,7 +251,7 @@ def get_segments(
233251
segment = PhysicalComponent(
234252
f"{name}_{sub_name}_{no}",
235253
shape,
236-
material=self.get_material(name),
254+
material=self.get_material(sub_name),
237255
)
238256
apply_component_display_options(
239257
segment, color=BLUE_PALETTE[self.BB][color_index]

eudemo/eudemo/materials.py

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# SPDX-FileCopyrightText: 2021-present M. Coleman, J. Cook, F. Franza
2+
# SPDX-FileCopyrightText: 2021-present I.A. Maione, S. McIntosh
3+
# SPDX-FileCopyrightText: 2021-present J. Morris, D. Short
4+
#
5+
# SPDX-License-Identifier: LGPL-2.1-or-later
6+
7+
"""Materials for the LAR example."""
8+
9+
from matproplib.conditions import OperationalConditions
10+
from matproplib.converters.neutronics import OpenMCNeutronicConfig
11+
from matproplib.library.beryllium import Be12Ti
12+
from matproplib.library.concrete import HeavyConcrete
13+
from matproplib.library.fluids import Helium, Water
14+
from matproplib.library.steel import SS316_L
15+
from matproplib.library.tungsten import PlanseeTungsten
16+
from matproplib.material import material, mixture
17+
from matproplib.properties.group import props
18+
19+
from bluemira.base.look_and_feel import bluemira_warn
20+
from bluemira.materials.neutronics import make_KALOS_ACB_mat
21+
22+
try:
23+
from eurofusion_materials.library.steel import SS316_LN, EUROfer97
24+
from eurofusion_materials.library.tungsten import Tungsten
25+
26+
EUROFER_MAT = EUROfer97()
27+
SS316_LN_MAT = SS316_LN()
28+
TUNGSTEN_MAT = Tungsten()
29+
except ImportError:
30+
bluemira_warn(
31+
"You do have eurofusion_materials installed, or do not have access. "
32+
"We're going to use some representative imitation materials instead, "
33+
"as opposed to the official, material descriptions."
34+
)
35+
EUROFER_MAT = material(
36+
name="eurofer",
37+
elements={
38+
"Fe": 0.9006,
39+
"Cr": 0.0886,
40+
"W182": 0.0108 * 0.266,
41+
"W183": 0.0108 * 0.143,
42+
"W184": 0.0108 * 0.307,
43+
"W186": 0.0108 * 0.284,
44+
"fraction_type": "mass",
45+
},
46+
properties=props(density=(7.78, "g/cm^3")),
47+
converters=OpenMCNeutronicConfig(),
48+
)()
49+
SS316_LN_MAT = SS316_L()
50+
TUNGSTEN_MAT = PlanseeTungsten()
51+
52+
WATER_MAT = Water()
53+
HELIUM_MAT = Helium()
54+
HeavyConcrete = HeavyConcrete()
55+
56+
VV_MATERIAL = mixture(
57+
"Steel-water mixture",
58+
[(SS316_LN_MAT, 0.6), (WATER_MAT, 0.4)],
59+
fraction_type="mass",
60+
mix_condition={"temperature": 300, "pressure": 101325},
61+
converters=OpenMCNeutronicConfig(),
62+
)
63+
64+
AL203_MATERIAL = material(
65+
name="Aluminium Oxide",
66+
elements={"Al27": 2 / 5, "O16": 3 / 5},
67+
properties=props(density=(3.95, "g/cm^3")),
68+
converters=OpenMCNeutronicConfig(),
69+
)()
70+
71+
LINED_EUROFER_MATERIAL = mixture(
72+
name="Eurofer with Al2O3 lining",
73+
materials=[
74+
(EUROFER_MAT, 2.0 / 2.4),
75+
(AL203_MATERIAL, 0.4 / 2.4),
76+
],
77+
fraction_type="volume",
78+
mix_condition=OperationalConditions(temperature=673.15),
79+
converters=OpenMCNeutronicConfig(),
80+
)
81+
82+
83+
structural_fraction_vo = 0.128
84+
multiplier_fraction_vo = 0.493
85+
breeder_fraction_vo = 0.103
86+
helium_fraction_vo = 0.276
87+
li6_enrich_atomic = 0.6
88+
89+
KALOS_ACB_MATERIAL = make_KALOS_ACB_mat(li6_enrich_atomic)
90+
91+
BB_FW_MATERIAL = mixture(
92+
name="FW material",
93+
materials=[
94+
(TUNGSTEN_MAT, 2.0 / 27.0),
95+
(EUROFER_MAT, 25.0 * 0.573 / 27.0),
96+
(HELIUM_MAT, 25.0 * 0.427 / 27.0),
97+
],
98+
fraction_type="volume",
99+
mix_condition=OperationalConditions(temperature=673.15, pressure=8e6),
100+
converters=OpenMCNeutronicConfig(material_id=101),
101+
)
102+
103+
BB_BZ_MATERIAL = mixture(
104+
name="BZ material",
105+
materials=[
106+
(EUROFER_MAT, structural_fraction_vo),
107+
(Be12Ti(), multiplier_fraction_vo),
108+
(KALOS_ACB_MATERIAL, breeder_fraction_vo),
109+
(HELIUM_MAT, helium_fraction_vo),
110+
],
111+
fraction_type="volume",
112+
mix_condition=OperationalConditions(temperature=673.15, pressure=8e6),
113+
converters=OpenMCNeutronicConfig(
114+
material_id=102,
115+
enrichment=li6_enrich_atomic * 100,
116+
enrichment_target="Li6",
117+
enrichment_type="atomic",
118+
),
119+
)
120+
121+
BB_MANI_MATERIAL = mixture(
122+
name="Manifold material",
123+
materials=[
124+
(EUROFER_MAT, 0.4724),
125+
(KALOS_ACB_MATERIAL, 0.0241),
126+
(HELIUM_MAT, 0.5035),
127+
],
128+
fraction_type="volume",
129+
mix_condition=OperationalConditions(temperature=673.15, pressure=8e6),
130+
converters=OpenMCNeutronicConfig(
131+
material_id=103,
132+
enrichment=li6_enrich_atomic * 100,
133+
enrichment_target="Li6",
134+
enrichment_type="atomic",
135+
),
136+
)
137+
138+
DIV_FW_MATERIAL = mixture(
139+
name="Divertor FW material",
140+
materials=[
141+
(TUNGSTEN_MAT, 16.0 / 25.0),
142+
(WATER_MAT, 4.5 / 25.0),
143+
(EUROFER_MAT, 4.5 / 25.0),
144+
],
145+
fraction_type="volume",
146+
mix_condition=OperationalConditions(temperature=673.15, pressure=1e5),
147+
converters=OpenMCNeutronicConfig(material_id=302),
148+
)

eudemo/eudemo/reactor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,11 @@ def save_reactor(reactor, reactor_config, folder_name):
636636
n_sectors=reactor_config.global_params.n_TF.value,
637637
)
638638

639-
establish_material_cache(["eurofusion_materials.library", "matproplib"])
639+
establish_material_cache([
640+
"eudemo.materials",
641+
"eurofusion_materials.library",
642+
"matproplib",
643+
])
640644

641645
process_start = time.time()
642646
radial_build(

0 commit comments

Comments
 (0)