21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476 | class Shield:
def __init__(self):
self.outfile = constants.NOUT
def run(self):
blanket_library.dz_shld_half = self.calculate_shield_half_height(
z_plasma_xpoint_lower=build_variables.z_plasma_xpoint_lower,
dz_xpoint_divertor=build_variables.dz_xpoint_divertor,
dz_divertor=divertor_variables.dz_divertor,
n_divertors=divertor_variables.n_divertors,
z_plasma_xpoint_upper=build_variables.z_plasma_xpoint_upper,
dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard,
dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard,
dr_fw_inboard=build_variables.dr_fw_inboard,
dr_fw_outboard=build_variables.dr_fw_outboard,
dz_blkt_upper=build_variables.dz_blkt_upper,
)
# D-shaped blanket and shield
if physics_variables.itart == 1 or fwbs_variables.i_fw_blkt_vv_shape == 1:
(
build_variables.a_shld_inboard_surface,
build_variables.a_shld_outboard_surface,
build_variables.a_shld_total_surface,
) = self.calculate_dshaped_shield_areas(
r_shld_inboard_inner=build_variables.r_shld_inboard_inner,
dr_shld_inboard=build_variables.dr_shld_inboard,
dr_fw_inboard=build_variables.dr_fw_inboard,
dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard,
rminor=physics_variables.rminor,
dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard,
dr_fw_outboard=build_variables.dr_fw_outboard,
dr_blkt_inboard=build_variables.dr_blkt_inboard,
dr_blkt_outboard=build_variables.dr_blkt_outboard,
dz_shld_half=blanket_library.dz_shld_half,
)
(
blanket_library.vol_shld_inboard,
blanket_library.vol_shld_outboard,
fwbs_variables.vol_shld_total,
) = self.calculate_dshaped_shield_volumes(
r_shld_inboard_inner=build_variables.r_shld_inboard_inner,
dr_shld_inboard=build_variables.dr_shld_inboard,
dr_fw_inboard=build_variables.dr_fw_inboard,
dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard,
rminor=physics_variables.rminor,
dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard,
dr_fw_outboard=build_variables.dr_fw_outboard,
dr_blkt_inboard=build_variables.dr_blkt_inboard,
dr_blkt_outboard=build_variables.dr_blkt_outboard,
dz_shld_half=blanket_library.dz_shld_half,
dr_shld_outboard=build_variables.dr_shld_outboard,
dz_shld_upper=build_variables.dz_shld_upper,
)
else:
(
build_variables.a_shld_inboard_surface,
build_variables.a_shld_outboard_surface,
build_variables.a_shld_total_surface,
) = self.calculate_elliptical_shield_areas(
r_shld_inboard_inner=build_variables.r_shld_inboard_inner,
r_shld_outboard_outer=build_variables.r_shld_outboard_outer,
rmajor=physics_variables.rmajor,
triang=physics_variables.triang,
dr_shld_inboard=build_variables.dr_shld_inboard,
rminor=physics_variables.rminor,
dz_shld_half=blanket_library.dz_shld_half,
dr_shld_outboard=build_variables.dr_shld_outboard,
)
(
blanket_library.vol_shld_inboard,
blanket_library.vol_shld_outboard,
fwbs_variables.vol_shld_total,
) = self.calculate_elliptical_shield_volumes(
r_shld_inboard_inner=build_variables.r_shld_inboard_inner,
r_shld_outboard_outer=build_variables.r_shld_outboard_outer,
rmajor=physics_variables.rmajor,
triang=physics_variables.triang,
dr_shld_inboard=build_variables.dr_shld_inboard,
rminor=physics_variables.rminor,
dz_shld_half=blanket_library.dz_shld_half,
dr_shld_outboard=build_variables.dr_shld_outboard,
dz_shld_upper=build_variables.dz_shld_upper,
)
# Apply shield coverage factors
build_variables.a_shld_inboard_surface = (
fwbs_variables.fvolsi * build_variables.a_shld_inboard_surface
)
build_variables.a_shld_outboard_surface = (
fwbs_variables.fvolso * build_variables.a_shld_outboard_surface
)
build_variables.a_shld_total_surface = (
build_variables.a_shld_inboard_surface
+ build_variables.a_shld_outboard_surface
)
blanket_library.vol_shld_inboard = (
fwbs_variables.fvolsi * blanket_library.vol_shld_inboard
)
blanket_library.vol_shld_outboard = (
fwbs_variables.fvolso * blanket_library.vol_shld_outboard
)
fwbs_variables.vol_shld_total = (
blanket_library.vol_shld_inboard + blanket_library.vol_shld_outboard
)
@staticmethod
def calculate_shield_half_height(
z_plasma_xpoint_lower: float,
dz_xpoint_divertor: float,
dz_divertor: float,
n_divertors: int,
z_plasma_xpoint_upper: float,
dr_fw_plasma_gap_inboard: float,
dr_fw_plasma_gap_outboard: float,
dr_fw_inboard: float,
dr_fw_outboard: float,
dz_blkt_upper: float,
) -> float:
"""Calculate shield half-height.
Parameters
----------
z_plasma_xpoint_lower:
dz_xpoint_divertor:
dz_divertor:
n_divertors: int :
z_plasma_xpoint_upper:
dr_fw_plasma_gap_inboard:
dr_fw_plasma_gap_outboard:
dr_fw_inboard:
dr_fw_outboard:
dz_blkt_upper:
"""
z_bottom = z_plasma_xpoint_lower + dz_xpoint_divertor + dz_divertor
# Calculate component internal upper half-height (m)
# If a double null machine then symmetric
if n_divertors == 2:
z_top = z_bottom
else:
z_top = z_plasma_xpoint_upper + 0.5 * (
dr_fw_plasma_gap_inboard
+ dr_fw_plasma_gap_outboard
+ dr_fw_inboard
+ dr_fw_outboard
)
z_top = z_top + dz_blkt_upper
# Average of top and bottom (m)
return 0.5 * (z_top + z_bottom)
@staticmethod
def calculate_dshaped_shield_volumes(
r_shld_inboard_inner: float,
dr_shld_inboard: float,
dr_fw_inboard: float,
dr_fw_plasma_gap_inboard: float,
rminor: float,
dr_fw_plasma_gap_outboard: float,
dr_fw_outboard: float,
dr_blkt_inboard: float,
dr_blkt_outboard: float,
dz_shld_half: float,
dr_shld_outboard: float,
dz_shld_upper: float,
) -> tuple[float, float, float]:
"""Calculate volumes of D-shaped shield segments.
Parameters
----------
r_shld_inboard_inner:
dr_shld_inboard:
dr_fw_inboard:
dr_fw_plasma_gap_inboard:
rminor:
dr_fw_plasma_gap_outboard:
dr_fw_outboard:
dr_blkt_inboard:
dr_blkt_outboard:
dz_shld_half:
dr_shld_outboard:
dz_shld_upper:
"""
r_1 = r_shld_inboard_inner + dr_shld_inboard
r_2 = (
dr_fw_inboard
+ dr_fw_plasma_gap_inboard
+ 2.0 * rminor
+ dr_fw_plasma_gap_outboard
+ dr_fw_outboard
)
r_2 = dr_blkt_inboard + r_2 + dr_blkt_outboard
(
vol_shld_inboard,
vol_shld_outboard,
vol_shld_total,
) = dshellvol(
rmajor=r_1,
rminor=r_2,
zminor=dz_shld_half,
drin=dr_shld_inboard,
drout=dr_shld_outboard,
dz=dz_shld_upper,
)
return vol_shld_inboard, vol_shld_outboard, vol_shld_total
@staticmethod
def calculate_dshaped_shield_areas(
r_shld_inboard_inner: float,
dr_shld_inboard: float,
dr_fw_inboard: float,
dr_fw_plasma_gap_inboard: float,
rminor: float,
dr_fw_plasma_gap_outboard: float,
dr_fw_outboard: float,
dr_blkt_inboard: float,
dr_blkt_outboard: float,
dz_shld_half: float,
) -> tuple[float, float, float]:
"""Calculate areas of D-shaped shield segments.
Parameters
----------
r_shld_inboard_inner:
dr_shld_inboard:
dr_fw_inboard:
dr_fw_plasma_gap_inboard:
rminor:
dr_fw_plasma_gap_outboard:
dr_fw_outboard:
dr_blkt_inboard:
dr_blkt_outboard:
dz_shld_half:
"""
r_1 = r_shld_inboard_inner + dr_shld_inboard
r_2 = (
dr_fw_inboard
+ dr_fw_plasma_gap_inboard
+ 2.0 * rminor
+ dr_fw_plasma_gap_outboard
+ dr_fw_outboard
)
r_2 = dr_blkt_inboard + r_2 + dr_blkt_outboard
(
a_shld_inboard_surface,
a_shld_outboard_surface,
a_shld_total_surface,
) = dshellarea(rmajor=r_1, rminor=r_2, zminor=dz_shld_half)
return a_shld_inboard_surface, a_shld_outboard_surface, a_shld_total_surface
@staticmethod
def calculate_elliptical_shield_volumes(
r_shld_inboard_inner: float,
r_shld_outboard_outer: float,
rmajor: float,
triang: float,
dr_shld_inboard: float,
rminor: float,
dz_shld_half: float,
dr_shld_outboard: float,
dz_shld_upper: float,
) -> tuple[float, float, float]:
"""Calculate volumes of elliptical shield segments.
Parameters
----------
r_shld_inboard_inner:
r_shld_outboard_outer:
rmajor:
triang:
dr_shld_inboard:
rminor:
dz_shld_half:
dr_shld_outboard:
dz_shld_upper:
"""
# Major radius to centre of inboard and outboard ellipses (m)
# (coincident in radius with top of plasma)
r_1 = rmajor - rminor * triang
r_2 = r_1 - r_shld_inboard_inner
r_2 = r_2 - dr_shld_inboard
r_3 = r_shld_outboard_outer - r_1
r_3 = r_3 - dr_shld_outboard
(
vol_shld_inboard,
vol_shld_outboard,
vol_shld_total,
) = eshellvol(
rshell=r_1,
rmini=r_2,
rmino=r_3,
zminor=dz_shld_half,
drin=dr_shld_inboard,
drout=dr_shld_outboard,
dz=dz_shld_upper,
)
return vol_shld_inboard, vol_shld_outboard, vol_shld_total
@staticmethod
def calculate_elliptical_shield_areas(
r_shld_inboard_inner: float,
r_shld_outboard_outer: float,
rmajor: float,
triang: float,
dr_shld_inboard: float,
rminor: float,
dz_shld_half: float,
dr_shld_outboard: float,
) -> tuple[float, float, float]:
"""Calculate areas of elliptical shield segments.
Parameters
----------
r_shld_inboard_inner:
r_shld_outboard_outer:
rmajor:
triang:
dr_shld_inboard:
rminor:
dz_shld_half:
dr_shld_outboard:
"""
# Major radius to centre of inboard and outboard ellipses (m)
# (coincident in radius with top of plasma)
r_1 = rmajor - rminor * triang
r_2 = r_1 - r_shld_inboard_inner
r_2 = r_2 - dr_shld_inboard
r_3 = r_shld_outboard_outer - r_1
r_3 = r_3 - dr_shld_outboard
(
a_shld_inboard_surface,
a_shld_outboard_surface,
a_shld_total_surface,
) = eshellarea(rshell=r_1, rmini=r_2, rmino=r_3, zminor=dz_shld_half)
return a_shld_inboard_surface, a_shld_outboard_surface, a_shld_total_surface
def output_shld_areas_and_volumes(self):
"""Output shield areas and volumes to log."""
po.oheadr(self.outfile, "Shield Areas and Volumes")
po.ovarrf(
self.outfile,
"Area of inboard shield surface (m^2)",
"(a_shld_inboard_surface)",
build_variables.a_shld_inboard_surface,
"OP ",
)
po.ovarrf(
self.outfile,
"Area of outboard shield surface (m^2)",
"(a_shld_outboard_surface)",
build_variables.a_shld_outboard_surface,
"OP ",
)
po.ovarrf(
self.outfile,
"Total area of shield surface (m^2)",
"(a_shld_total_surface)",
build_variables.a_shld_total_surface,
"OP ",
)
po.ovarrf(
self.outfile,
"Volume of inboard shield (m^3)",
"(vol_shld_inboard)",
blanket_library.vol_shld_inboard,
"OP ",
)
po.ovarrf(
self.outfile,
"Volume of outboard shield (m^3)",
"(vol_shld_outboard)",
blanket_library.vol_shld_outboard,
"OP ",
)
po.ovarrf(
self.outfile,
"Total volume of shield (m^3)",
"(vol_shld_total)",
fwbs_variables.vol_shld_total,
"OP ",
)
|