d0fus 3.3.1__tar.gz → 3.3.3__tar.gz
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.
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_figures.py +326 -42
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_EXE/D0FUS_run.py +1 -1
- {d0fus-3.3.1 → d0fus-3.3.3}/PKG-INFO +4 -5
- {d0fus-3.3.1 → d0fus-3.3.3}/README.md +2 -2
- {d0fus-3.3.1 → d0fus-3.3.3}/d0fus.egg-info/PKG-INFO +4 -5
- {d0fus-3.3.1 → d0fus-3.3.3}/d0fus.egg-info/SOURCES.txt +1 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/pyproject.toml +4 -4
- d0fus-3.3.3/tests/test_figures.py +33 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_cost_data.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_cost_functions.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_import.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_machine_presets.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_parameterization.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_physical_functions.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_power_flow.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_BIB/D0FUS_radial_build_functions.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_EXE/D0FUS_genetic.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_EXE/D0FUS_popcon.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_EXE/D0FUS_scan.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/D0FUS_EXE/D0FUS_uncertainty.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/LICENSE +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/d0fus.egg-info/dependency_links.txt +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/d0fus.egg-info/entry_points.txt +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/d0fus.egg-info/requires.txt +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/d0fus.egg-info/top_level.txt +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/setup.cfg +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/tests/test_blanket_layers.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/tests/test_modes.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/tests/test_physical_functions.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/tests/test_plant_balance.py +0 -0
- {d0fus-3.3.1 → d0fus-3.3.3}/tests/test_radial_build_functions.py +0 -0
|
@@ -66,7 +66,8 @@ if __name__ != "__main__":
|
|
|
66
66
|
_offset_contour,
|
|
67
67
|
f_TBR,
|
|
68
68
|
)
|
|
69
|
-
from .D0FUS_parameterization import DEFAULT_CONFIG, E_ELEM, BLANKET_CONCEPTS,
|
|
69
|
+
from .D0FUS_parameterization import (DEFAULT_CONFIG, E_ELEM, BLANKET_CONCEPTS,
|
|
70
|
+
radial_layers_effective, radial_build_feasibility)
|
|
70
71
|
|
|
71
72
|
# Standalone-execution imports (development / testing)
|
|
72
73
|
else:
|
|
@@ -101,7 +102,8 @@ else:
|
|
|
101
102
|
_offset_contour,
|
|
102
103
|
f_TBR,
|
|
103
104
|
)
|
|
104
|
-
from D0FUS_BIB.D0FUS_parameterization import DEFAULT_CONFIG, E_ELEM, BLANKET_CONCEPTS,
|
|
105
|
+
from D0FUS_BIB.D0FUS_parameterization import (DEFAULT_CONFIG, E_ELEM, BLANKET_CONCEPTS,
|
|
106
|
+
radial_layers_effective, radial_build_feasibility)
|
|
105
107
|
|
|
106
108
|
|
|
107
109
|
# =============================================================================
|
|
@@ -2982,6 +2984,38 @@ def _smooth_closed(R, Z, frac=0.045):
|
|
|
2982
2984
|
return _sm(R), _sm(Z)
|
|
2983
2985
|
|
|
2984
2986
|
|
|
2987
|
+
# Palette of the radial-build figures (plot_assembly_side_view, plot_radial_build)
|
|
2988
|
+
_RB_ALPHA = 0.72
|
|
2989
|
+
_RB_COL = {
|
|
2990
|
+
"plasma": "#7E3FA8", # violet
|
|
2991
|
+
"FW": "#9AA0A6", # grey
|
|
2992
|
+
"breeder": "#E8853A", # orange
|
|
2993
|
+
"TF": "#D1495B", # red
|
|
2994
|
+
"CS": "#3E6DB5", # blue
|
|
2995
|
+
}
|
|
2996
|
+
# Structure, shield and vacuum-vessel layers: green shades, darkest at the plasma side
|
|
2997
|
+
_RB_GREEN_ROLES = ("structure", "multiplier", "shield_HT", "shield_LT", "VV")
|
|
2998
|
+
_RB_GREEN_SHADES = ("#1B5E20", "#2E7D32", "#43A047", "#66BB6A", "#86C98E", "#A5D6A7")
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
def _rb_green_colors(layers):
|
|
3002
|
+
"""Green shade of each structure / shield / VV layer, by index in ``layers``."""
|
|
3003
|
+
order = [i for i, L in enumerate(layers) if L["role"] in _RB_GREEN_ROLES]
|
|
3004
|
+
return {gi: _RB_GREEN_SHADES[min(k, len(_RB_GREEN_SHADES) - 1)]
|
|
3005
|
+
for k, gi in enumerate(order)}
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
def _rb_label(L, short=False):
|
|
3009
|
+
"""Display name of a radial-build layer (legend names of plot_assembly_side_view)."""
|
|
3010
|
+
role = L["role"]
|
|
3011
|
+
name = L["name"].split("(")[0].strip()
|
|
3012
|
+
full = {"SOL": "Scrape-off layer", "FW": "First wall",
|
|
3013
|
+
"breeder": "Breeding blanket", "gap": "Gap"}
|
|
3014
|
+
abbr = {"SOL": "SOL", "FW": "FW", "breeder": "BB", "gap": "Gap",
|
|
3015
|
+
"shield_HT": "HT shield", "shield_LT": "LT shield", "VV": "VV"}
|
|
3016
|
+
return (abbr if short else full).get(role, name)
|
|
3017
|
+
|
|
3018
|
+
|
|
2985
3019
|
def plot_assembly_side_view(run, save_dir=None, n_cs_modules=None):
|
|
2986
3020
|
"""Poloidal (R-Z) cross-section of the full radial build.
|
|
2987
3021
|
|
|
@@ -3082,20 +3116,19 @@ def plot_assembly_side_view(run, save_dir=None, n_cs_modules=None):
|
|
|
3082
3116
|
# smoothing them would alter layer widths and can create overlaps.
|
|
3083
3117
|
|
|
3084
3118
|
# -- Colour scheme ------------------------------------------------------
|
|
3085
|
-
ALPHA =
|
|
3086
|
-
col_plasma = "
|
|
3119
|
+
ALPHA = _RB_ALPHA
|
|
3120
|
+
col_plasma = _RB_COL["plasma"]
|
|
3087
3121
|
col_sol = "white" # SOL drawn as open space (see docstring)
|
|
3088
|
-
col_fw = "
|
|
3089
|
-
col_bb = "
|
|
3090
|
-
col_tf = "
|
|
3091
|
-
col_cs = "
|
|
3122
|
+
col_fw = _RB_COL["FW"]
|
|
3123
|
+
col_bb = _RB_COL["breeder"]
|
|
3124
|
+
col_tf = _RB_COL["TF"]
|
|
3125
|
+
col_cs = _RB_COL["CS"]
|
|
3092
3126
|
col_gap = "white"
|
|
3093
3127
|
# green shades (inner -> outer) for the structure/shield/VV block
|
|
3094
|
-
GREEN_ROLES =
|
|
3095
|
-
green_shades =
|
|
3128
|
+
GREEN_ROLES = _RB_GREEN_ROLES
|
|
3129
|
+
green_shades = list(_RB_GREEN_SHADES)
|
|
3096
3130
|
green_order = [i for i, L in enumerate(layers) if L["role"] in GREEN_ROLES]
|
|
3097
|
-
green_color =
|
|
3098
|
-
for k, gi in enumerate(green_order)}
|
|
3131
|
+
green_color = _rb_green_colors(layers)
|
|
3099
3132
|
|
|
3100
3133
|
def _role_color(i, L):
|
|
3101
3134
|
r = L["role"]
|
|
@@ -3297,6 +3330,251 @@ def plot_assembly_side_view(run, save_dir=None, n_cs_modules=None):
|
|
|
3297
3330
|
return fig
|
|
3298
3331
|
|
|
3299
3332
|
|
|
3333
|
+
# ---------------------------------------------------------------------------
|
|
3334
|
+
# B2b — Midplane radial build (bar from the machine axis to the TF outer face)
|
|
3335
|
+
# ---------------------------------------------------------------------------
|
|
3336
|
+
|
|
3337
|
+
def _midplane_build(run: dict) -> list:
|
|
3338
|
+
"""
|
|
3339
|
+
Midplane radial build of a run, as contiguous segments from R = 0 to the
|
|
3340
|
+
outer face of the TF outboard leg.
|
|
3341
|
+
|
|
3342
|
+
Order: CS bore, CS, TF-CS gap (wedging only), TF inboard leg, inboard
|
|
3343
|
+
layers (TF -> LCFS), plasma (2a), outboard layers (LCFS -> TF), TF
|
|
3344
|
+
outboard leg. The layers and their midplane widths (delta_ib, delta_ob)
|
|
3345
|
+
come from radial_layers_effective, as in plot_assembly_side_view; layers
|
|
3346
|
+
of zero width are dropped. The outboard stack fills b + Delta_TF, its last
|
|
3347
|
+
gap taking the remaining space. The outboard leg has the inboard thickness
|
|
3348
|
+
c_TF, as in f_TF_cross_section. When the mandatory layers do not fit
|
|
3349
|
+
(radial_build_feasibility), each side is a single 'build' segment.
|
|
3350
|
+
|
|
3351
|
+
Parameters
|
|
3352
|
+
----------
|
|
3353
|
+
run : dict D0FUS run output.
|
|
3354
|
+
|
|
3355
|
+
Returns
|
|
3356
|
+
-------
|
|
3357
|
+
list of dict, inboard to outboard, each with: name, short (abbreviated
|
|
3358
|
+
name), role, R_in, R_out [m], color, alpha.
|
|
3359
|
+
"""
|
|
3360
|
+
R0, a = float(run["R0"]), float(run["a"])
|
|
3361
|
+
bd = _resolve_build(run)
|
|
3362
|
+
b, c_TF, Delta_TF = bd["b"], bd["c_TF"], bd["Delta_TF"]
|
|
3363
|
+
if radial_build_feasibility(bd["Blanket_choice"], b, Delta_TF)["feasible"]:
|
|
3364
|
+
layers = radial_layers_effective(
|
|
3365
|
+
bd["Blanket_choice"], b, Delta_TF,
|
|
3366
|
+
float(run.get("delta_BB_IB", 0.50)), float(run.get("delta_BB_OB", 0.50)),
|
|
3367
|
+
float(run.get("delta_shield_IB", 0.30)), float(run.get("delta_shield_OB", 0.30)))
|
|
3368
|
+
else:
|
|
3369
|
+
layers = []
|
|
3370
|
+
green = _rb_green_colors(layers)
|
|
3371
|
+
|
|
3372
|
+
def _seg(name, short, role, R_in, R_out, color, alpha=_RB_ALPHA):
|
|
3373
|
+
return dict(name=name, short=short, role=role, R_in=float(R_in),
|
|
3374
|
+
R_out=float(R_out), color=color, alpha=alpha)
|
|
3375
|
+
|
|
3376
|
+
def _stack(R_start, side, budget, order):
|
|
3377
|
+
if not layers:
|
|
3378
|
+
return ([_seg("Blanket and shield", "Build", "build", R_start,
|
|
3379
|
+
R_start + budget, "#D9D9D9", 1.0)] if budget > 1e-9 else [])
|
|
3380
|
+
segs, R = [], R_start
|
|
3381
|
+
for i in order:
|
|
3382
|
+
L = layers[i]
|
|
3383
|
+
width = float(L["delta_" + side])
|
|
3384
|
+
if width <= 1e-9:
|
|
3385
|
+
continue
|
|
3386
|
+
if L["role"] in ("SOL", "gap"):
|
|
3387
|
+
color, alpha = "white", 1.0
|
|
3388
|
+
elif L["role"] in ("FW", "breeder"):
|
|
3389
|
+
color, alpha = _RB_COL[L["role"]], _RB_ALPHA
|
|
3390
|
+
else:
|
|
3391
|
+
color, alpha = green.get(i, _RB_GREEN_SHADES[-1]), _RB_ALPHA
|
|
3392
|
+
segs.append(_seg(_rb_label(L), _rb_label(L, short=True), L["role"], R,
|
|
3393
|
+
R + width, color, alpha))
|
|
3394
|
+
R += width
|
|
3395
|
+
return segs
|
|
3396
|
+
|
|
3397
|
+
gap_eff = bd["Gap"] if run.get("Choice_Buck_Wedg", "Wedging") == "Wedging" else 0.0
|
|
3398
|
+
R_TF_in = bd["R_TF_in"] # plasma-side face of the TF inboard leg
|
|
3399
|
+
R_ob = R0 + a + b + Delta_TF # plasma-side face of the TF outboard leg
|
|
3400
|
+
segs = [_seg("CS bore", "Bore", "bore", 0.0, bd["R_CS_int"], "#EFEFEF", 1.0),
|
|
3401
|
+
_seg("CS", "CS", "CS", bd["R_CS_int"], bd["R_CS_ext"], _RB_COL["CS"])]
|
|
3402
|
+
if gap_eff > 0:
|
|
3403
|
+
segs.append(_seg("TF-CS gap", "Gap", "gap", bd["R_CS_ext"],
|
|
3404
|
+
bd["R_CS_ext"] + gap_eff, "white", 1.0))
|
|
3405
|
+
segs.append(_seg("TF inboard leg", "TF", "TF", R_TF_in - c_TF, R_TF_in, _RB_COL["TF"]))
|
|
3406
|
+
segs += _stack(R_TF_in, "ib", b, range(len(layers) - 1, -1, -1))
|
|
3407
|
+
segs.append(_seg("Plasma", "Plasma", "plasma", R0 - a, R0 + a, _RB_COL["plasma"]))
|
|
3408
|
+
segs += _stack(R0 + a, "ob", b + Delta_TF, range(len(layers)))
|
|
3409
|
+
segs.append(_seg("TF outboard leg", "TF", "TF", R_ob, bd["R_TF_out"], _RB_COL["TF"]))
|
|
3410
|
+
return segs
|
|
3411
|
+
|
|
3412
|
+
|
|
3413
|
+
def plot_radial_build(run: dict, save_dir: str | None = None) -> None:
|
|
3414
|
+
"""
|
|
3415
|
+
Midplane radial build: bar from the machine axis to the TF outer face.
|
|
3416
|
+
|
|
3417
|
+
Top: the whole build at scale (CS bore, CS, TF legs, inboard and outboard
|
|
3418
|
+
layers, plasma), with the inboard build b, the outboard build b + Delta_TF
|
|
3419
|
+
and the major radius R0. Bottom: zooms on the inboard (TF -> LCFS) and
|
|
3420
|
+
outboard (LCFS -> TF) layers, each layer labelled with its width (above the
|
|
3421
|
+
bar, with a leader line, when the layer is too thin).
|
|
3422
|
+
Same layers and colours as plot_assembly_side_view (see _midplane_build).
|
|
3423
|
+
White segments are empty: scrape-off layer and gaps.
|
|
3424
|
+
|
|
3425
|
+
Parameters
|
|
3426
|
+
----------
|
|
3427
|
+
run : dict D0FUS run output.
|
|
3428
|
+
save_dir : str or None Saves run_radial_build.png there; otherwise shown.
|
|
3429
|
+
"""
|
|
3430
|
+
segs = _midplane_build(run)
|
|
3431
|
+
R0, a = float(run["R0"]), float(run["a"])
|
|
3432
|
+
bd = _resolve_build(run)
|
|
3433
|
+
b, Delta_TF = bd["b"], bd["Delta_TF"]
|
|
3434
|
+
R_TF_in, R_end = bd["R_TF_in"], segs[-1]["R_out"]
|
|
3435
|
+
R_ob = R0 + a + b + Delta_TF
|
|
3436
|
+
i_pl = next(i for i, s in enumerate(segs) if s["role"] == "plasma")
|
|
3437
|
+
ib = [s for s in segs[:i_pl] if s["R_in"] >= R_TF_in - 1e-9]
|
|
3438
|
+
ob = [s for s in segs[i_pl + 1:] if s["R_out"] <= R_ob + 1e-9]
|
|
3439
|
+
|
|
3440
|
+
# Fixed layout in inches, so that the label fit tests of _bar are exact
|
|
3441
|
+
fig_w, fig_h = 9.0, 4.95
|
|
3442
|
+
x0, w_main, w_zoom, gap = 0.4, 8.35, 3.95, 0.45
|
|
3443
|
+
h_main, h_zoom = 1.45, 1.7
|
|
3444
|
+
fig = plt.figure(figsize=(fig_w, fig_h))
|
|
3445
|
+
ax = fig.add_axes([x0 / fig_w, 3.05 / fig_h, w_main / fig_w, h_main / fig_h])
|
|
3446
|
+
ax_ib = fig.add_axes([x0 / fig_w, 0.5 / fig_h, w_zoom / fig_w, h_zoom / fig_h])
|
|
3447
|
+
ax_ob = fig.add_axes([(x0 + w_zoom + gap) / fig_w, 0.5 / fig_h, w_zoom / fig_w,
|
|
3448
|
+
h_zoom / fig_h])
|
|
3449
|
+
|
|
3450
|
+
def _text_w(text, size):
|
|
3451
|
+
"""Approximate length of the longest line of a label [in] (0.6 em per glyph)."""
|
|
3452
|
+
return 0.6 * size / 72.0 * max(len(t) for t in text.split("\n"))
|
|
3453
|
+
|
|
3454
|
+
def _spread(want, widths, lo, hi):
|
|
3455
|
+
"""Centres of labels of given widths, wanted at increasing positions, without
|
|
3456
|
+
overlap and inside [lo, hi]. Overlapping labels merge into a cluster centred
|
|
3457
|
+
on the mean of their wanted positions."""
|
|
3458
|
+
def _place(cl):
|
|
3459
|
+
total = sum(widths[i] for i in cl)
|
|
3460
|
+
x = max(lo, min(float(np.mean([want[i] for i in cl])) - 0.5 * total,
|
|
3461
|
+
hi - total))
|
|
3462
|
+
centres = []
|
|
3463
|
+
for i in cl:
|
|
3464
|
+
centres.append(x + 0.5 * widths[i])
|
|
3465
|
+
x += widths[i]
|
|
3466
|
+
return centres
|
|
3467
|
+
clusters, k = [[i] for i in range(len(want))], 0
|
|
3468
|
+
while k < len(clusters) - 1:
|
|
3469
|
+
left, right = clusters[k], clusters[k + 1]
|
|
3470
|
+
if (_place(left)[-1] + 0.5 * widths[left[-1]]
|
|
3471
|
+
> _place(right)[0] - 0.5 * widths[right[0]] + 1e-12):
|
|
3472
|
+
clusters[k] = left + clusters.pop(k + 1)
|
|
3473
|
+
k = max(k - 1, 0) # the merged cluster may now reach its left neighbour
|
|
3474
|
+
else:
|
|
3475
|
+
k += 1
|
|
3476
|
+
return [c for cl in clusters for c in _place(cl)]
|
|
3477
|
+
|
|
3478
|
+
def _bar(axis, items, y_top, axis_w, axis_h, x_lo, x_hi, size, digits, above):
|
|
3479
|
+
"""Bar of segments on y in [0, 1], ylim (-0.02, y_top). Labels inside: two
|
|
3480
|
+
lines, horizontal then vertical, full name then abbreviation, then one vertical
|
|
3481
|
+
line. Else above the bar (zooms only), spread apart, with leader lines."""
|
|
3482
|
+
axis.set_xlim(x_lo, x_hi)
|
|
3483
|
+
axis.set_ylim(-0.02, y_top)
|
|
3484
|
+
per_m = axis_w / (x_hi - x_lo) # inches per metre
|
|
3485
|
+
bar_h = axis_h / (y_top + 0.02) # bar height [in]
|
|
3486
|
+
line = 1.3 * size / 72.0 # width of one vertical line [in]
|
|
3487
|
+
tops = [] # labels placed above the bar
|
|
3488
|
+
for s in items:
|
|
3489
|
+
w = s["R_out"] - s["R_in"]
|
|
3490
|
+
axis.add_patch(plt.Rectangle((s["R_in"], 0.0), w, 1.0, fc=s["color"],
|
|
3491
|
+
alpha=s["alpha"], ec="none", zorder=2))
|
|
3492
|
+
axis.plot([s["R_in"], s["R_in"]], [0.0, 1.0], color="grey", lw=0.4, zorder=3)
|
|
3493
|
+
width = (f"2a = {w:.{digits}f} m" if s["role"] == "plasma"
|
|
3494
|
+
else f"{w:.{digits}f} m")
|
|
3495
|
+
seg_in, xc = w * per_m, 0.5 * (s["R_in"] + s["R_out"])
|
|
3496
|
+
tries = [(f"{name}\n{width}", rot) for name in (s["name"], s["short"])
|
|
3497
|
+
for rot in (0, 90)]
|
|
3498
|
+
tries += [(f"{name} {width}", 90) for name in (s["name"], s["short"])]
|
|
3499
|
+
for text, rot in tries:
|
|
3500
|
+
n_lines = text.count("\n") + 1
|
|
3501
|
+
fits = (_text_w(text, size) <= 0.9 * seg_in if rot == 0 else
|
|
3502
|
+
_text_w(text, size) <= 0.9 * bar_h and n_lines * line <= seg_in)
|
|
3503
|
+
if fits:
|
|
3504
|
+
axis.text(xc, 0.5, text, ha="center", va="center", fontsize=size,
|
|
3505
|
+
rotation=rot, linespacing=1.25, zorder=5)
|
|
3506
|
+
break
|
|
3507
|
+
else:
|
|
3508
|
+
if above:
|
|
3509
|
+
# One line if it fits in the space above the bar, else two
|
|
3510
|
+
text = f"{s['short']} {width}"
|
|
3511
|
+
if _text_w(text, size - 1) > (y_top - 1.16) * bar_h:
|
|
3512
|
+
text = f"{s['short']}\n{width}"
|
|
3513
|
+
tops.append((xc, text))
|
|
3514
|
+
if tops:
|
|
3515
|
+
# Width of each vertical label [m]: its lines at size - 1, plus a small gap
|
|
3516
|
+
widths = [((t.count("\n") + 1) * 1.35 * (size - 1) / 72.0 + 0.015) / per_m
|
|
3517
|
+
for _, t in tops]
|
|
3518
|
+
for (xc, text), x in zip(tops, _spread([xc for xc, _ in tops], widths,
|
|
3519
|
+
x_lo, x_hi)):
|
|
3520
|
+
axis.plot([xc, xc, x, x], [1.0, 1.03, 1.12, 1.15], color="grey", lw=0.5,
|
|
3521
|
+
zorder=3)
|
|
3522
|
+
axis.text(x, 1.16, text, ha="center", va="bottom", fontsize=size - 1,
|
|
3523
|
+
rotation=90, linespacing=1.1, zorder=5)
|
|
3524
|
+
axis.plot([items[-1]["R_out"]] * 2, [0.0, 1.0], color="grey", lw=0.4, zorder=3)
|
|
3525
|
+
axis.add_patch(plt.Rectangle((items[0]["R_in"], 0.0),
|
|
3526
|
+
items[-1]["R_out"] - items[0]["R_in"], 1.0,
|
|
3527
|
+
fc="none", ec="black", lw=0.8, zorder=4))
|
|
3528
|
+
axis.set_yticks([])
|
|
3529
|
+
for side in ("left", "right", "top"):
|
|
3530
|
+
axis.spines[side].set_visible(False)
|
|
3531
|
+
axis.tick_params(labelsize=9, direction="out")
|
|
3532
|
+
axis.set_xlabel("$R$ [m]", fontsize=10)
|
|
3533
|
+
|
|
3534
|
+
# -- Whole build ----------------------------------------------------------
|
|
3535
|
+
pad = 0.01 * R_end
|
|
3536
|
+
_bar(ax, segs, 1.62, w_main, h_main, -pad, R_end + pad, 9, 2, above=False)
|
|
3537
|
+
|
|
3538
|
+
def _span(R1, R2, label):
|
|
3539
|
+
ax.annotate("", xy=(R2, 1.2), xytext=(R1, 1.2), zorder=6,
|
|
3540
|
+
arrowprops=dict(arrowstyle="<->", color="#333333", lw=0.9,
|
|
3541
|
+
mutation_scale=9, shrinkA=0, shrinkB=0))
|
|
3542
|
+
ax.text(0.5 * (R1 + R2), 1.26, label, ha="center", va="bottom", fontsize=9,
|
|
3543
|
+
color="#333333", zorder=6)
|
|
3544
|
+
|
|
3545
|
+
_span(R_TF_in, R0 - a, f"$b$ = {b:.2f} m")
|
|
3546
|
+
_span(R0 + a, R_ob, f"$b + \\Delta_{{TF}}$ = {b + Delta_TF:.2f} m")
|
|
3547
|
+
for y1, y2 in ((0.0, 0.27), (0.73, 1.0)): # R0 line, broken at the label
|
|
3548
|
+
ax.plot([R0, R0], [y1, y2], color="black", lw=0.8, ls="--", zorder=6)
|
|
3549
|
+
ax.text(R0, 1.06, f"$R_0$ = {R0:.2f} m", ha="center", va="bottom", fontsize=9,
|
|
3550
|
+
zorder=6)
|
|
3551
|
+
|
|
3552
|
+
# -- Zooms on the inboard and outboard layers ----------------------------
|
|
3553
|
+
zooms = ((ax_ib, ib, "Inboard, TF to LCFS", f"$b$ = {b:.3f} m"),
|
|
3554
|
+
(ax_ob, ob, "Outboard, LCFS to TF",
|
|
3555
|
+
f"$b + \\Delta_{{TF}}$ = {b + Delta_TF:.3f} m"))
|
|
3556
|
+
for axis, items, title, total in zooms:
|
|
3557
|
+
if not items: # no radial space on that side
|
|
3558
|
+
axis.set_axis_off()
|
|
3559
|
+
continue
|
|
3560
|
+
lo, hi = items[0]["R_in"], items[-1]["R_out"]
|
|
3561
|
+
pz = 0.02 * (hi - lo)
|
|
3562
|
+
_bar(axis, items, 2.25, w_zoom, h_zoom, lo - pz, hi + pz, 8, 3, above=True)
|
|
3563
|
+
for x, text, ha in ((0.0, title, "left"), (1.0, total, "right")):
|
|
3564
|
+
axis.text(x, 1.03, text, transform=axis.transAxes, ha=ha, va="bottom",
|
|
3565
|
+
fontsize=9.5, fontweight="bold")
|
|
3566
|
+
axis.xaxis.set_major_locator(plt.MaxNLocator(6))
|
|
3567
|
+
|
|
3568
|
+
Bmax = run.get("B_max")
|
|
3569
|
+
head = f"Midplane radial build: $R_0$ = {R0:.2f} m, $a$ = {a:.2f} m"
|
|
3570
|
+
if Bmax is not None and np.isfinite(Bmax):
|
|
3571
|
+
head += f", $B_{{max,TF}}$ = {float(Bmax):.1f} T"
|
|
3572
|
+
head += f", {run.get('Choice_Buck_Wedg', 'Wedging')}"
|
|
3573
|
+
fig.text(x0 / fig_w, (fig_h - 0.12) / fig_h, head, ha="left", va="top", fontsize=11,
|
|
3574
|
+
fontweight="bold")
|
|
3575
|
+
_save_or_show(fig, save_dir, "run_radial_build")
|
|
3576
|
+
|
|
3577
|
+
|
|
3300
3578
|
def plot_blanket_concepts_comparison(save_dir: str | None = None) -> None:
|
|
3301
3579
|
"""
|
|
3302
3580
|
Compare the breeding-blanket concepts defined in BLANKET_CONCEPTS.
|
|
@@ -4229,6 +4507,9 @@ def plot_all(
|
|
|
4229
4507
|
_p(26, "Radial build assembly (CS / TF / blanket)")
|
|
4230
4508
|
plot_assembly_side_view(run, save_dir=save_dir)
|
|
4231
4509
|
|
|
4510
|
+
_p("26b", "Midplane radial build")
|
|
4511
|
+
plot_radial_build(run, save_dir=save_dir)
|
|
4512
|
+
|
|
4232
4513
|
_p(27, "TF coil side view")
|
|
4233
4514
|
plot_TF_side_view(run, save_dir=save_dir)
|
|
4234
4515
|
|
|
@@ -4264,31 +4545,32 @@ def plot_run(
|
|
|
4264
4545
|
view_3d: bool = True,
|
|
4265
4546
|
) -> None:
|
|
4266
4547
|
"""
|
|
4267
|
-
Render the run-specific figure set (
|
|
4548
|
+
Render the run-specific figure set (19 figures, 18 without the 3D view).
|
|
4268
4549
|
|
|
4269
4550
|
This is the subset called after each D0FUS run. It contains only the
|
|
4270
4551
|
figures that depend on the current run configuration and results —
|
|
4271
4552
|
no verification curves, no benchmarks, no scaling-law surveys.
|
|
4272
4553
|
|
|
4273
4554
|
Figures produced:
|
|
4274
|
-
[ 1/
|
|
4275
|
-
[ 2/
|
|
4276
|
-
[ 3/
|
|
4277
|
-
[ 4/
|
|
4278
|
-
[ 5/
|
|
4279
|
-
[ 6/
|
|
4280
|
-
[ 7/
|
|
4281
|
-
[ 8/
|
|
4282
|
-
[ 9/
|
|
4283
|
-
[10/
|
|
4284
|
-
[11/
|
|
4285
|
-
[12/
|
|
4286
|
-
[13/
|
|
4287
|
-
[14/
|
|
4288
|
-
[15/
|
|
4289
|
-
[16/
|
|
4290
|
-
[17/
|
|
4291
|
-
[18/
|
|
4555
|
+
[ 1/19] Tokamak LCFS comparison (with D0FUS overlay)
|
|
4556
|
+
[ 2/19] Miller flux surfaces (run geometry)
|
|
4557
|
+
[ 3/19] Shaping profiles κ(ρ), δ(ρ)
|
|
4558
|
+
[ 4/19] Kinetic profiles n(ρ), T(ρ), p(ρ)
|
|
4559
|
+
[ 5/19] Safety factor q(ρ) and current decomposition
|
|
4560
|
+
[ 6/19] Radiation profiles
|
|
4561
|
+
[ 7/19] Divertor two-point model (detachment vs SOL dissipation)
|
|
4562
|
+
[ 8/19] Radial build assembly (CS / TF / blanket)
|
|
4563
|
+
[ 9/19] Midplane radial build
|
|
4564
|
+
[10/19] TF coil side view
|
|
4565
|
+
[11/19] CICC TF conductor
|
|
4566
|
+
[12/19] CS cross-section
|
|
4567
|
+
[13/19] CICC CS conductor
|
|
4568
|
+
[14/19] Cost breakdown (Sheffield 2016 or Whyte 2024, CapEx / OpEx / COE)
|
|
4569
|
+
[15/19] Plasma temperature map T(rho)
|
|
4570
|
+
[16/19] Plasma density map n(rho)
|
|
4571
|
+
[17/19] Plant power balance — pulse
|
|
4572
|
+
[18/19] Plant power balance — dwell
|
|
4573
|
+
[19/19] 3D machine view (PyVista; skipped if PyVista is missing,
|
|
4292
4574
|
or with view_3d=False)
|
|
4293
4575
|
|
|
4294
4576
|
The breeding-blanket concept comparison does not depend on the run: it
|
|
@@ -4303,7 +4585,7 @@ def plot_run(
|
|
|
4303
4585
|
view_3d : bool
|
|
4304
4586
|
False skips the 3D machine view (command-line option --no-3d).
|
|
4305
4587
|
"""
|
|
4306
|
-
N =
|
|
4588
|
+
N = 19 if view_3d else 18
|
|
4307
4589
|
|
|
4308
4590
|
# When saving, prefix each PNG with its order index so that the files sort
|
|
4309
4591
|
# in the logical reading order: geometry (Miller), profiles, physics detail,
|
|
@@ -4355,27 +4637,29 @@ def plot_run(
|
|
|
4355
4637
|
# ── Radial build & coils ──────────────────────────────────────────
|
|
4356
4638
|
_emit(8, "Radial build assembly (CS / TF / blanket)",
|
|
4357
4639
|
lambda: plot_assembly_side_view(run, save_dir=save_dir))
|
|
4358
|
-
_emit(9, "
|
|
4640
|
+
_emit(9, "Midplane radial build",
|
|
4641
|
+
lambda: plot_radial_build(run, save_dir=save_dir))
|
|
4642
|
+
_emit(10, "TF coil side view",
|
|
4359
4643
|
lambda: plot_TF_side_view(run, save_dir=save_dir))
|
|
4360
|
-
_emit(
|
|
4644
|
+
_emit(11, "CICC TF conductor",
|
|
4361
4645
|
lambda: plot_CICC_cross_section(build_conductor_from_run(run, coil="TF"), save_dir=save_dir))
|
|
4362
|
-
_emit(
|
|
4646
|
+
_emit(12, "CS cross-section",
|
|
4363
4647
|
lambda: plot_CS_cross_section(run, save_dir=save_dir))
|
|
4364
|
-
_emit(
|
|
4648
|
+
_emit(13, "CICC CS conductor",
|
|
4365
4649
|
lambda: plot_CICC_cross_section(build_conductor_from_run(run, coil="CS"), save_dir=save_dir))
|
|
4366
4650
|
|
|
4367
4651
|
# ── Techno-economic synthesis ─────────────────────────────────────
|
|
4368
|
-
_emit(
|
|
4652
|
+
_emit(14, f"Cost breakdown ({(run.get('cost_breakdown') or {}).get('model', 'cost model off')})",
|
|
4369
4653
|
lambda: plot_cost_breakdown(run, save_dir=save_dir))
|
|
4370
4654
|
|
|
4371
4655
|
# ── Plasma field maps ────────────────────────────────────
|
|
4372
|
-
_emit(
|
|
4373
|
-
_emit(
|
|
4656
|
+
_emit(15, "Plasma temperature map", lambda: plot_temperature_map(run, save_dir=save_dir))
|
|
4657
|
+
_emit(16, "Plasma density map", lambda: plot_density_map(run, save_dir=save_dir))
|
|
4374
4658
|
|
|
4375
4659
|
# ── Phase-specific energy and power balance ───────────────────────
|
|
4376
|
-
_emit(
|
|
4660
|
+
_emit(17, "Plant power balance (pulse)",
|
|
4377
4661
|
lambda: plot_plant_power_balance(run, phase="pulse", save_dir=save_dir))
|
|
4378
|
-
_emit(
|
|
4662
|
+
_emit(18, "Plant power balance (dwell)",
|
|
4379
4663
|
lambda: plot_plant_power_balance(run, phase="dwell", save_dir=save_dir))
|
|
4380
4664
|
|
|
4381
4665
|
# ── 3D machine view (optional PyVista dependency) ─────────────────
|
|
@@ -4388,7 +4672,7 @@ def plot_run(
|
|
|
4388
4672
|
print(f" [warn] 3D machine view failed ({type(_e).__name__}: "
|
|
4389
4673
|
f"{_e}) — skipped.")
|
|
4390
4674
|
if view_3d:
|
|
4391
|
-
_emit(
|
|
4675
|
+
_emit(19, "3D machine view (PyVista)", _fig_3d)
|
|
4392
4676
|
|
|
4393
4677
|
print("Done.")
|
|
4394
4678
|
|
|
@@ -5241,7 +5241,7 @@ def _generate_run_figures(config: GlobalConfig, results: tuple,
|
|
|
5241
5241
|
output_path: str, verbose: int = 0,
|
|
5242
5242
|
view_3d: bool = True) -> None:
|
|
5243
5243
|
"""
|
|
5244
|
-
Generate and save run-specific figures (
|
|
5244
|
+
Generate and save run-specific figures (19, 18 without the 3D view) into
|
|
5245
5245
|
output_path/figures/.
|
|
5246
5246
|
|
|
5247
5247
|
Calls D0FUS_figures.plot_run() which produces only the figures that
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: d0fus
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.3
|
|
4
4
|
Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
|
|
5
5
|
Author-email: Timothé Auclair <timothe.auclair@proton.me>
|
|
6
6
|
Maintainer-email: Timothé Auclair <timothe.auclair@proton.me>
|
|
7
|
-
License:
|
|
7
|
+
License-Expression: CECILL-C
|
|
8
8
|
Project-URL: Homepage, https://github.com/IRFM/D0FUS
|
|
9
9
|
Project-URL: Repository, https://github.com/IRFM/D0FUS
|
|
10
10
|
Project-URL: Documentation, https://d0fus.readthedocs.io
|
|
@@ -14,7 +14,6 @@ Classifier: Development Status :: 4 - Beta
|
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
15
15
|
Classifier: Intended Audience :: Education
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
17
|
-
Classifier: License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)
|
|
18
17
|
Classifier: Programming Language :: Python :: 3
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -162,7 +161,7 @@ The mode is detected from the content of the input file. Text after `#` is a com
|
|
|
162
161
|
|
|
163
162
|
| Mode | Purpose | Trigger in the deck |
|
|
164
163
|
|------|---------|---------------------|
|
|
165
|
-
| **RUN** | Single design point, 165 outputs, report files,
|
|
164
|
+
| **RUN** | Single design point, 165 outputs, report files, 19 figures | Fixed values only (`R0 = 9`) |
|
|
166
165
|
| **SCAN** | 2D feasibility map, 108 registered output quantities | Exactly 2 entries `[min, max, n_points]`, other than the POPCON pair |
|
|
167
166
|
| **OPTIMIZATION** | Genetic cost minimisation (DEAP) | 2+ entries `[min, max]` |
|
|
168
167
|
| **POPCON** | Operating map (n̄, T̄) at fixed machine | `nbar_line` and `Tbar` written `[min, max, n_points]` |
|
|
@@ -281,7 +280,7 @@ Continuous distributions: `norm(sigma)`, `norm(lo, hi)`, `norm(lo, centre, hi)`,
|
|
|
281
280
|
|
|
282
281
|
## Outputs
|
|
283
282
|
|
|
284
|
-
Every mode writes a folder named after the mode and the time, to the second, under `D0FUS_OUTPUTS/<mode>/`. From a clone, `D0FUS_OUTPUTS` is at the root of the repository, whatever the working directory. For an installed package, it is in the working directory. A RUN produces `input_parameters.txt` (the deck), `output_highlight.txt` (key results), `output_detailed.txt` (every input including defaults, every output), and
|
|
283
|
+
Every mode writes a folder named after the mode and the time, to the second, under `D0FUS_OUTPUTS/<mode>/`. From a clone, `D0FUS_OUTPUTS` is at the root of the repository, whatever the working directory. For an installed package, it is in the working directory. A RUN produces `input_parameters.txt` (the deck), `output_highlight.txt` (key results), `output_detailed.txt` (every input including defaults, every output), and 19 figures (cross-section, Miller surfaces, profiles, q(ρ), radiation, divertor two-point, radial build as a cross-section and as a midplane bar, coil and CICC drawings, cost breakdown, temperature and density maps, pulse and dwell power-balance Sankey diagrams, PyVista 3D view skipped with `--no-3d`). A design without a solution gives NaN in the reports and figures. SCAN writes the 2D map, OPTIMIZATION the convergence plot, `optimization_summary.json` (settings, seed, Hall of Fame), a copy of the deck and the reports of the best design, POPCON the operating-contour map, UNCERTAINTY a summary with the feasible share and its confidence interval, the per-output distributions and figures.
|
|
285
284
|
|
|
286
285
|
---
|
|
287
286
|
|
|
@@ -121,7 +121,7 @@ The mode is detected from the content of the input file. Text after `#` is a com
|
|
|
121
121
|
|
|
122
122
|
| Mode | Purpose | Trigger in the deck |
|
|
123
123
|
|------|---------|---------------------|
|
|
124
|
-
| **RUN** | Single design point, 165 outputs, report files,
|
|
124
|
+
| **RUN** | Single design point, 165 outputs, report files, 19 figures | Fixed values only (`R0 = 9`) |
|
|
125
125
|
| **SCAN** | 2D feasibility map, 108 registered output quantities | Exactly 2 entries `[min, max, n_points]`, other than the POPCON pair |
|
|
126
126
|
| **OPTIMIZATION** | Genetic cost minimisation (DEAP) | 2+ entries `[min, max]` |
|
|
127
127
|
| **POPCON** | Operating map (n̄, T̄) at fixed machine | `nbar_line` and `Tbar` written `[min, max, n_points]` |
|
|
@@ -240,7 +240,7 @@ Continuous distributions: `norm(sigma)`, `norm(lo, hi)`, `norm(lo, centre, hi)`,
|
|
|
240
240
|
|
|
241
241
|
## Outputs
|
|
242
242
|
|
|
243
|
-
Every mode writes a folder named after the mode and the time, to the second, under `D0FUS_OUTPUTS/<mode>/`. From a clone, `D0FUS_OUTPUTS` is at the root of the repository, whatever the working directory. For an installed package, it is in the working directory. A RUN produces `input_parameters.txt` (the deck), `output_highlight.txt` (key results), `output_detailed.txt` (every input including defaults, every output), and
|
|
243
|
+
Every mode writes a folder named after the mode and the time, to the second, under `D0FUS_OUTPUTS/<mode>/`. From a clone, `D0FUS_OUTPUTS` is at the root of the repository, whatever the working directory. For an installed package, it is in the working directory. A RUN produces `input_parameters.txt` (the deck), `output_highlight.txt` (key results), `output_detailed.txt` (every input including defaults, every output), and 19 figures (cross-section, Miller surfaces, profiles, q(ρ), radiation, divertor two-point, radial build as a cross-section and as a midplane bar, coil and CICC drawings, cost breakdown, temperature and density maps, pulse and dwell power-balance Sankey diagrams, PyVista 3D view skipped with `--no-3d`). A design without a solution gives NaN in the reports and figures. SCAN writes the 2D map, OPTIMIZATION the convergence plot, `optimization_summary.json` (settings, seed, Hall of Fame), a copy of the deck and the reports of the best design, POPCON the operating-contour map, UNCERTAINTY a summary with the feasible share and its confidence interval, the per-output distributions and figures.
|
|
244
244
|
|
|
245
245
|
---
|
|
246
246
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: d0fus
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.3
|
|
4
4
|
Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
|
|
5
5
|
Author-email: Timothé Auclair <timothe.auclair@proton.me>
|
|
6
6
|
Maintainer-email: Timothé Auclair <timothe.auclair@proton.me>
|
|
7
|
-
License:
|
|
7
|
+
License-Expression: CECILL-C
|
|
8
8
|
Project-URL: Homepage, https://github.com/IRFM/D0FUS
|
|
9
9
|
Project-URL: Repository, https://github.com/IRFM/D0FUS
|
|
10
10
|
Project-URL: Documentation, https://d0fus.readthedocs.io
|
|
@@ -14,7 +14,6 @@ Classifier: Development Status :: 4 - Beta
|
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
15
15
|
Classifier: Intended Audience :: Education
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
17
|
-
Classifier: License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)
|
|
18
17
|
Classifier: Programming Language :: Python :: 3
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -162,7 +161,7 @@ The mode is detected from the content of the input file. Text after `#` is a com
|
|
|
162
161
|
|
|
163
162
|
| Mode | Purpose | Trigger in the deck |
|
|
164
163
|
|------|---------|---------------------|
|
|
165
|
-
| **RUN** | Single design point, 165 outputs, report files,
|
|
164
|
+
| **RUN** | Single design point, 165 outputs, report files, 19 figures | Fixed values only (`R0 = 9`) |
|
|
166
165
|
| **SCAN** | 2D feasibility map, 108 registered output quantities | Exactly 2 entries `[min, max, n_points]`, other than the POPCON pair |
|
|
167
166
|
| **OPTIMIZATION** | Genetic cost minimisation (DEAP) | 2+ entries `[min, max]` |
|
|
168
167
|
| **POPCON** | Operating map (n̄, T̄) at fixed machine | `nbar_line` and `Tbar` written `[min, max, n_points]` |
|
|
@@ -281,7 +280,7 @@ Continuous distributions: `norm(sigma)`, `norm(lo, hi)`, `norm(lo, centre, hi)`,
|
|
|
281
280
|
|
|
282
281
|
## Outputs
|
|
283
282
|
|
|
284
|
-
Every mode writes a folder named after the mode and the time, to the second, under `D0FUS_OUTPUTS/<mode>/`. From a clone, `D0FUS_OUTPUTS` is at the root of the repository, whatever the working directory. For an installed package, it is in the working directory. A RUN produces `input_parameters.txt` (the deck), `output_highlight.txt` (key results), `output_detailed.txt` (every input including defaults, every output), and
|
|
283
|
+
Every mode writes a folder named after the mode and the time, to the second, under `D0FUS_OUTPUTS/<mode>/`. From a clone, `D0FUS_OUTPUTS` is at the root of the repository, whatever the working directory. For an installed package, it is in the working directory. A RUN produces `input_parameters.txt` (the deck), `output_highlight.txt` (key results), `output_detailed.txt` (every input including defaults, every output), and 19 figures (cross-section, Miller surfaces, profiles, q(ρ), radiation, divertor two-point, radial build as a cross-section and as a midplane bar, coil and CICC drawings, cost breakdown, temperature and density maps, pulse and dwell power-balance Sankey diagrams, PyVista 3D view skipped with `--no-3d`). A design without a solution gives NaN in the reports and figures. SCAN writes the 2D map, OPTIMIZATION the convergence plot, `optimization_summary.json` (settings, seed, Hall of Fame), a copy of the deck and the reports of the best design, POPCON the operating-contour map, UNCERTAINTY a summary with the feasible share and its confidence interval, the per-output distributions and figures.
|
|
285
284
|
|
|
286
285
|
---
|
|
287
286
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "d0fus"
|
|
7
|
-
version = "3.3.
|
|
7
|
+
version = "3.3.3"
|
|
8
8
|
description = "Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
license =
|
|
10
|
+
license = "CECILL-C"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
11
12
|
authors = [
|
|
12
13
|
{name = "Timothé Auclair", email = "timothe.auclair@proton.me"}
|
|
13
14
|
]
|
|
@@ -31,7 +32,6 @@ classifiers = [
|
|
|
31
32
|
"Intended Audience :: Science/Research",
|
|
32
33
|
"Intended Audience :: Education",
|
|
33
34
|
"Topic :: Scientific/Engineering :: Physics",
|
|
34
|
-
"License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)",
|
|
35
35
|
"Programming Language :: Python :: 3",
|
|
36
36
|
"Programming Language :: Python :: 3.10",
|
|
37
37
|
"Programming Language :: Python :: 3.11",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Midplane radial build drawn by ``plot_radial_build``: the segments of
|
|
2
|
+
``_midplane_build`` tile the midplane from the machine axis to the outer face of
|
|
3
|
+
the TF outboard leg. Structural checks only, no frozen values.
|
|
4
|
+
"""
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from D0FUS_BIB.D0FUS_figures import _midplane_build, demo_run_dict, plot_radial_build
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.parametrize("variant", [
|
|
11
|
+
{}, # ITER demo, wedging with a TF-CS gap
|
|
12
|
+
{"Choice_Buck_Wedg": "Bucking"}, # no TF-CS gap
|
|
13
|
+
{"Delta_TF": 0.8}, # outboard clearance for port access
|
|
14
|
+
{"b": 0.15}, # compressed mandatory layers
|
|
15
|
+
{"b": 0.0}, # no radial space for the layers
|
|
16
|
+
])
|
|
17
|
+
def test_midplane_build_tiles_the_midplane(variant):
|
|
18
|
+
run = dict(demo_run_dict(), **variant)
|
|
19
|
+
segs = _midplane_build(run)
|
|
20
|
+
R0, a, b, c_TF = run["R0"], run["a"], run["b"], run["c_TF"]
|
|
21
|
+
Delta_TF = run.get("Delta_TF", 0.0)
|
|
22
|
+
assert segs[0]["R_in"] == 0.0
|
|
23
|
+
for prev, nxt in zip(segs, segs[1:]):
|
|
24
|
+
assert nxt["R_in"] == pytest.approx(prev["R_out"], abs=1e-9)
|
|
25
|
+
assert all(s["R_out"] > s["R_in"] for s in segs)
|
|
26
|
+
plasma = next(s for s in segs if s["role"] == "plasma")
|
|
27
|
+
assert (plasma["R_in"], plasma["R_out"]) == pytest.approx((R0 - a, R0 + a))
|
|
28
|
+
assert segs[-1]["R_out"] == pytest.approx(R0 + a + b + Delta_TF + c_TF)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_plot_radial_build_writes_png(tmp_path):
|
|
32
|
+
plot_radial_build(demo_run_dict(), save_dir=str(tmp_path))
|
|
33
|
+
assert (tmp_path / "run_radial_build.png").is_file()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|