FUSE Introductory Tutorial
Download this tutorial from the FuseExamples repository
NOTE: Julia is a Just In Time (JIT) programming language. The first time something is executed it will take longer because of the compilation process. Subsequent calls the the same code will be blazingly fast.
Import the necessary packages
using Plots # for plotting
using FUSE # this will also import IMAS in the current namespace
Starting from a use-case
FUSE comes with some predefined use-cases, some of which are used for regression testing.
Note that some use cases are for non-nuclear experiments and certain Actors like Blankets or BalanceOfPlant will not perform any actions.
FUSE.test_cases
ARC ini, act = FUSE.case_parameters(:ARC)
CAT ini, act = FUSE.case_parameters(:CAT)
D3D ini, act = FUSE.case_parameters(:D3D; scenario=:default)
D3D_Hmode ini, act = FUSE.case_parameters(:D3D; scenario_sources=true, scenario=:H_mode)
D3D_Lmode ini, act = FUSE.case_parameters(:D3D; scenario_sources=false, scenario=:L_mode)
DTT ini, act = FUSE.case_parameters(:DTT)
EXCITE ini, act = FUSE.case_parameters(:EXCITE)
FPP ini, act = FUSE.case_parameters(:FPP)
ITER_ods ini, act = FUSE.case_parameters(:ITER; init_from=:ods)
ITER_scalars ini, act = FUSE.case_parameters(:ITER; init_from=:scalars)
JET_HDB5 ini, act = FUSE.case_parameters(:HDB5; case=500, tokamak=:JET)
KDEMO ini, act = FUSE.case_parameters(:KDEMO)
KDEMO_compact ini, act = FUSE.case_parameters(:KDEMO_compact)
MANTA ini, act = FUSE.case_parameters(:MANTA)
SPARC ini, act = FUSE.case_parameters(:SPARC; init_from=:ods)
Get initial parameters (ini
) and actions (act
) for a given use-case
ini, act = FUSE.case_parameters(:KDEMO);
Modifying ini
parameters.
ini.equilibrium.B0 = 7.8
ini.equilibrium.R0 = 6.5;
Modifying act
parameters.
act.ActorCoreTransport.model = :FluxMatcher;
Initialize the data dictionary (dd
) using the 0D parameters.
NOTE: init()
does not return a self-consistent solution, just a plausible starting point to initialize our simulations!
dd = IMAS.dd() # an empty dd
FUSE.init(dd, ini, act);
actors: Equilibrium
actors: TEQUILA
actors: HCD
actors: SimpleEC
actors: SimpleIC
actors: SimpleLH
actors: SimpleNB
actors: SimplePellet
actors: Current
actors: SteadyStateCurrent
actors: CXbuild
actors: PassiveStructures
We can @checkin
and @checkout
variables with an associated tag.
This is handy to save and restore our progress (we'll use this later).
@checkin :init dd ini act
Exploring the data dictionary
- FUSE stores data following the IMAS data schema.
- The root of the data structure is
dd
, which stands for "Data Dictionary". - More details are available in the documentation.
Display part of the equilibrium data in dd
dd.equilibrium.time_slice[2].boundary
boundary
├─ elongation ➡ 1.99926
├─ elongation_lower ➡ Function
├─ elongation_upper ➡ Function
├─ geometric_axis
│ ├─ r ➡ 6.49971 [m]
│ └─ z ➡ -0.00101717 [m]
├─ minor_radius ➡ 2.00728 [m]
├─ outline
│ ├─ r ➡ 241-element Vector{Float64} [m]
│ │ min:4.51 avg:6.28 max:8.52
│ └─ z ➡ 241-element Vector{Float64} [m]
│ min:-4.04 avg:-0.0374 max:3.89
├─ ovality ➡ 0.00308297
├─ squareness ➡ -0.00753311
├─ squareness_lower_inner ➡ Function
├─ squareness_lower_outer ➡ Function
├─ squareness_upper_inner ➡ Function
├─ squareness_upper_outer ➡ Function
├─ strike_point
│ ├─ 1
│ │ ├─ r ➡ 5.50924 [m]
│ │ └─ z ➡ -4.91359 [m]
│ └─ 2
│ ├─ r ➡ 4.30003 [m]
│ └─ z ➡ -4.59874 [m]
├─ tilt ➡ -0.00645963
├─ triangularity ➡ 0.585259
├─ triangularity_lower ➡ Function
├─ triangularity_upper ➡ Function
├─ twist ➡ 0.00262375
└─ x_point
├─ 1
│ ├─ r ➡ 5.13542 [m]
│ └─ z ➡ -4.05302 [m]
└─ 2
├─ r ➡ 4.90576 [m]
└─ z ➡ 4.30741 [m]
this can be done up to a certain depth with print_tree
print_tree(dd.equilibrium.time_slice[2].boundary; maxdepth=1)
boundary
├─ elongation ➡ 1.99926
├─ elongation_lower ➡ Function
├─ elongation_upper ➡ Function
├─ geometric_axis
│ ⋮
│
├─ minor_radius ➡ 2.00728 [m]
├─ outline
│ ⋮
│
├─ ovality ➡ 0.00308297
├─ squareness ➡ -0.00753311
├─ squareness_lower_inner ➡ Function
├─ squareness_lower_outer ➡ Function
├─ squareness_upper_inner ➡ Function
├─ squareness_upper_outer ➡ Function
├─ strike_point
│ ⋮
│
├─ tilt ➡ -0.00645963
├─ triangularity ➡ 0.585259
├─ triangularity_lower ➡ Function
├─ triangularity_upper ➡ Function
├─ twist ➡ 0.00262375
└─ x_point
⋮
Plotting data from dd
FUSE uses Plots.jl
recipes for visualizing data from dd
.
This allows different plots to be shown when calling plot()
on different items in the data structure.
Learn more about Plots.jl here
For example plotting the equilibrium...
plot(dd.equilibrium)
...or the core profiles
plot(dd.core_profiles)
Whant to know what arguments can be passed? use help_plot()
function
help_plot(dd.equilibrium; core_profiles_overlay=true, psi_levels_in=21, psi_levels_out=5, show_secondary_separatrix=true, coordinate=:psi_norm)
These plots can be composed by calling plot!()
instead of plot()
plot(dd.equilibrium; color=:gray, cx=true)
plot!(dd.build; equilibrium=false, pf_active=false)
plot!(dd.pf_active)
Plotting an array...
plot(dd.core_profiles.profiles_1d[1].pressure_thermal)
...is different from plotting a field from the IDS (which plots the quantity against its coordinate and with units)
plot(dd.core_profiles.profiles_1d[1], :pressure_thermal)
Customizing plot attributes:
plot(dd.core_profiles.profiles_1d[1], :pressure_thermal; label="", linewidth=2, color=:red, labelfontsize=25)
Use findall(ids, r"...")
to search for certain fields. In Julia string starting with r
are regular expressions.
findall(dd, r"pressure")
[1] dd.core_profiles.profiles_1d[1].ion[1].pressure_fast_perpendicular [Pa] [101-element Vector{Float64}] (all:0)
[2] dd.core_profiles.profiles_1d[1].ion[1].pressure_fast_parallel [Pa] [101-element Vector{Float64}] (all:0)
[3] dd.core_profiles.profiles_1d[1].ion[2].pressure_fast_perpendicular [Pa] [101-element Vector{Float64}] (all:0)
[4] dd.core_profiles.profiles_1d[1].ion[2].pressure_fast_parallel [Pa] [101-element Vector{Float64}] (all:0)
[5] dd.core_profiles.profiles_1d[1].ion[3].pressure_fast_perpendicular [Pa] [101-element Vector{Float64}] (min:7.83e-16, avg:1.8e+04, max:5.37e+04)
[6] dd.core_profiles.profiles_1d[1].ion[3].pressure_fast_parallel [Pa] [101-element Vector{Float64}] (min:7.83e-16, avg:1.8e+04, max:5.37e+04)
[7] dd.equilibrium.time_slice[2].profiles_1d.pressure [Pa] [129-element Vector{Float64}] (min:0, avg:3.24e+05, max:7.33e+05)
[8] dd.equilibrium.time_slice[2].profiles_1d.dpressure_dpsi [Pa.Wb^-1] [129-element Vector{Float64}] (min:-1.38e+04, avg:-1.15e+04, max:-7.92)
findall(ids, r"...")
can be combined with plot()
to plot multiple fields
plot(findall(dd, r"\.pressure"))
Working with time series
The IMAS data structure supports time-dependent data, and IMAS.jl provides ways to handle time data efficiently.
Each dd
has a global_time
attribute, and actors operate at such time
dd.global_time
0.0
Here we see that equilibrium has mulitiple time_slices
dd.equilibrium.time
2-element Vector{Float64}:
-Inf
0.0
Accessing time-dependent arrays of structures, via integer index
eqt = dd.equilibrium.time_slice[2]
eqt.time
0.0
At a given time, by passing the time as a floating point number (in seconds)
eqt = dd.equilibrium.time_slice[0.0]
eqt.time
0.0
At the global time, leaving the square brackets empty
eqt = dd.equilibrium.time_slice[]
eqt.time
0.0
Using the @ddtime
macro to access and modify time-dependent arrays at dd.global_time
:
dd.equilibrium.vacuum_toroidal_field.b0
2-element Vector{Float64}:
7.80034989842101
7.80034989842101
Accessing data at dd.global_time
my_b0 = @ddtime(dd.equilibrium.vacuum_toroidal_field.b0)
7.80034989842101
Writin data at dd.global_time
@ddtime(dd.equilibrium.vacuum_toroidal_field.b0 = my_b0 + 1)
dd.equilibrium.vacuum_toroidal_field.b0
2-element Vector{Float64}:
7.80034989842101
8.800349898421011
Expressions in dd
Some fields in the data dictionary are expressions (ie. Functions). For example dd.core_profiles.profiles_1d[].pressure
is dynamically calculated as the product of thermal densities and temperature with addition of fast ions contributions
print_tree(dd.core_profiles.profiles_1d[1]; maxdepth=1)
1
├─ conductivity_parallel ➡ Function [ohm^-1.m^-1]
├─ electrons
│ ⋮
│
├─ grid
│ ⋮
│
├─ ion
│ ⋮
│
├─ j_bootstrap ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.3e+03 avg:1.56e+05 max:1.95e+05
├─ j_non_inductive ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.3e+03 avg:8.39e+05 max:4.98e+06
├─ j_ohmic ➡ 101-element Vector{Float64} [A/m^2]
│ min:535 avg:4.54e+05 max:1.53e+06
├─ j_tor ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.23e+03 avg:1.31e+06 max:6.65e+06
├─ j_total ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.84e+03 avg:1.29e+06 max:6.48e+06
├─ pressure ➡ Function [Pa]
├─ pressure_ion_total ➡ Function [Pa]
├─ pressure_parallel ➡ Function [Pa]
├─ pressure_perpendicular ➡ Function [Pa]
├─ pressure_thermal ➡ Function [Pa]
├─ rotation_frequency_tor_sonic ➡ 101-element Vector{Float64} [s^-1]
│ all:0
├─ t_i_average ➡ Function [eV]
├─ time ➡ 0 [s]
└─ zeff ➡ 101-element Vector{Float64}
all:2
accessing a dynamic expression, automatically evaluates it (in the pressure
example, we get an array with data)
dd.core_profiles.profiles_1d[1].electrons.pressure
101-element Vector{Float64}:
382161.41109300684
380830.63957078604
379391.591101457
377782.55757196713
376004.2172426514
374061.3354757094
371959.28457999736
369703.3617717455
367298.6384800007
364749.9444273129
⋮
19912.277704598586
18499.461216714055
16815.06186436015
14478.45803169503
11093.81383850173
6816.64842006658
3120.9952290519527
1038.1040174980417
218.37794919600034
In addition to evaluating expressions by accessing them, expressions in the tree can be evaluated using IMAS.freeze()
print_tree(IMAS.freeze(dd.core_profiles.profiles_1d[1]); maxdepth=1)
profiles_1d
├─ conductivity_parallel ➡ 101-element Vector{Float64} [ohm^-1.m^-1]
│ min:2.87e+06 avg:3.62e+09 max:1.25e+10
├─ electrons
│ ⋮
│
├─ grid
│ ⋮
│
├─ ion
│ ⋮
│
├─ j_bootstrap ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.3e+03 avg:1.56e+05 max:1.95e+05
├─ j_non_inductive ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.3e+03 avg:8.39e+05 max:4.98e+06
├─ j_ohmic ➡ 101-element Vector{Float64} [A/m^2]
│ min:535 avg:4.54e+05 max:1.53e+06
├─ j_tor ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.23e+03 avg:1.31e+06 max:6.65e+06
├─ j_total ➡ 101-element Vector{Float64} [A/m^2]
│ min:3.84e+03 avg:1.29e+06 max:6.48e+06
├─ pressure ➡ 101-element Vector{Float64} [Pa]
│ min:413 avg:4.09e+05 max:8.84e+05
├─ pressure_ion_total ➡ 101-element Vector{Float64} [Pa]
│ min:195 avg:1.67e+05 max:3.41e+05
├─ pressure_parallel ➡ 101-element Vector{Float64} [Pa]
│ min:138 avg:1.36e+05 max:2.95e+05
├─ pressure_perpendicular ➡ 101-element Vector{Float64} [Pa]
│ min:138 avg:1.36e+05 max:2.95e+05
├─ pressure_thermal ➡ 101-element Vector{Float64} [Pa]
│ min:413 avg:3.55e+05 max:7.23e+05
├─ rotation_frequency_tor_sonic ➡ 101-element Vector{Float64} [s^-1]
│ all:0
├─ t_i_average ➡ 101-element Vector{Float64} [eV]
│ min:80 avg:1.32e+04 max:2.5e+04
├─ time ➡ 0 [s]
└─ zeff ➡ 101-element Vector{Float64}
all:2
Whole facility design
Here we restore the :init
checkpoint that we had previously stored. Resetting any changes to dd
, ini
, and act
that we did in the meantime.
@checkout :init dd ini act
Actors in FUSE can be executed by passing two arguments to them: dd
and act
. Internally, actors can call other actors, creating workflows. For example, the ActorWholeFacility
can be used to to get a self-consistent stationary whole facility design. The actors:
print statements with their nested output tell us what actors are calling other actors.
FUSE.ActorWholeFacility(dd, act);
actors: WholeFacility
actors: PFdesign
actors: StationaryPlasma
actors: --------------- 1/5
actors: HCD
actors: SimpleEC
actors: SimpleIC
actors: SimpleLH
actors: SimpleNB
actors: SimplePellet
actors: Current
actors: QED
actors: Pedestal
actors: EPED
actors: CoreTransport
actors: FluxMatcher
actors: Current
actors: QED
actors: Equilibrium
actors: TEQUILA
actors: --------------- 1/5 @ 430.95%
actors: HCD
actors: SimpleEC
actors: SimpleIC
actors: SimpleLH
actors: SimpleNB
actors: SimplePellet
actors: Current
actors: QED
actors: Pedestal
actors: EPED
actors: CoreTransport
actors: FluxMatcher
actors: Current
actors: QED
actors: Equilibrium
actors: TEQUILA
actors: --------------- 2/5 @ 194.26%
actors: HCD
actors: SimpleEC
actors: SimpleIC
actors: SimpleLH
actors: SimpleNB
actors: SimplePellet
actors: Current
actors: QED
actors: Pedestal
actors: EPED
actors: CoreTransport
actors: FluxMatcher
actors: Current
actors: QED
actors: Equilibrium
actors: TEQUILA
actors: --------------- 3/5 @ 64.04%
actors: StabilityLimits
actors: HFSsizing
actors: FluxSwing
actors: Stresses
actors: LFSsizing
actors: CXbuild
actors: PFdesign
actors: PassiveStructures
actors: VerticalStability
actors: Neutronics
actors: Blanket
actors: CXbuild
actors: Divertors
actors: BalanceOfPlant
actors: ThermalPlant
actors: PowerNeeds
actors: Costing
actors: CostingARIES
Like before we can checkpoint results for later use
@checkin :awf dd ini act
Running a custom workflow
Let's now run a series of actors similar to what ActorWholeFacility
does and play around with plotting to get a sense of what each individual actor does.
Let's start again from after the initialization stage
@checkout :init dd ini act
Let's start by positioning the PF coils, so that we stand a chance to reproduce the desired plasma shape. This will be important to ensure the stability of the ActorStationaryPlasma
that we are going to run next.
actor = FUSE.ActorPFdesign(dd, act);
actors: PFdesign
The ActorStationaryPlasma
iterates between plasma transport, pedestal, equilibrium and sources to return a self-consistent plasma solution
peq = plot(dd.equilibrium; label="before")
pcp = plot(dd.core_profiles; color=:gray, label="before")
FUSE.ActorStationaryPlasma(dd, act);
actors: StationaryPlasma
actors: --------------- 1/5
actors: HCD
actors: SimpleEC
actors: SimpleIC
actors: SimpleLH
actors: SimpleNB
actors: SimplePellet
actors: Current
actors: QED
actors: Pedestal
actors: EPED
actors: CoreTransport
actors: FluxMatcher
actors: Current
actors: QED
actors: Equilibrium
actors: TEQUILA
actors: --------------- 1/5 @ 430.95%
actors: HCD
actors: SimpleEC
actors: SimpleIC
actors: SimpleLH
actors: SimpleNB
actors: SimplePellet
actors: Current
actors: QED
actors: Pedestal
actors: EPED
actors: CoreTransport
actors: FluxMatcher
actors: Current
actors: QED
actors: Equilibrium
actors: TEQUILA
actors: --------------- 2/5 @ 194.26%
actors: HCD
actors: SimpleEC
actors: SimpleIC
actors: SimpleLH
actors: SimpleNB
actors: SimplePellet
actors: Current
actors: QED
actors: Pedestal
actors: EPED
actors: CoreTransport
actors: FluxMatcher
actors: Current
actors: QED
actors: Equilibrium
actors: TEQUILA
actors: --------------- 3/5 @ 64.04%
we can compare equilibrium before and after the self-consistency loop
plot!(peq, dd.equilibrium; label="after")
we can compare core_profiles before and after the self-consistency loop
plot!(pcp, dd.core_profiles; label="after")
here are the sources
plot(dd.core_sources)
and the flux-matched transport
plot(dd.core_transport)
HFS sizing actor changes the thickness of the OH and TF layers on the high field side to satisfy current and stresses constraints
plot(dd.build)
FUSE.ActorHFSsizing(dd, act);
plot!(dd.build; cx=false)
The stresses on the center stack are stored in the solid_mechanics
IDS
plot(dd.solid_mechanics.center_stack.stress)
LFS sizing actors change location of the outer TF leg to meet ripple requirements
plot(dd.build)
FUSE.ActorLFSsizing(dd, act);
plot!(dd.build; cx=false)
A custom show()
method is defined to print the summary of dd.build.layer
dd.build.layer
23×10 DataFrame
Row │ group details type ΔR R_start R_end material area volume shape
│ String String String Float64 Float64 Float64 String Float64 Float64 String
─────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ in 0.188433 0.0 0.188433 steel 20.2897 100.063
2 │ in oh 1.6959 0.188433 1.88433 nb3sn 7.03852 81.465
3 │ hfs tf 1.41353 1.88433 3.29786 nb3sn_kdemo 43.955 910.795 convex hull
4 │ hfs gap tf vacuum vessel 0.0 3.29786 3.29786 vacuum 7.64897 509.7 double ellipse
5 │ hfs vacuum outer vessel 0.098297 3.29786 3.39616 steel 3.14863 129.645 negative offset
6 │ hfs gap water 0.147445 3.39616 3.54361 water 4.60907 189.901 negative offset
7 │ hfs vacuum inner vessel 0.098297 3.54361 3.6419 steel 2.9968 123.556 negative offset
8 │ hfs gap high temp shield vacuum vess… 0.0098297 3.6419 3.65173 vacuum 0.29634 12.2216 negative offset
9 │ hfs high temp shield 0.196594 3.65173 3.84833 steel 5.79901 239.309 negative offset
10 │ hfs blanket 0.373528 3.84833 4.22185 lithium_lead 21.4803 998.09 negative offset
11 │ hfs first wall 0.0196594 4.22185 4.24151 tungsten 0.830521 30.576 offset
12 │ lhfs plasma 4.55014 4.24151 8.79165 plasma 34.4099 1347.12
13 │ lfs first wall 0.0196594 8.79165 8.81131 tungsten 0.829854 30.5525 offset
14 │ lfs blanket 1.17956 8.81131 9.99087 lithium_lead 21.481 998.113 negative offset
15 │ lfs high temp shield 0.196594 9.99087 10.1875 steel 5.79901 239.309 negative offset
16 │ lfs gap high temp shield vacuum vess… 0.0540622 10.1875 10.2415 vacuum 0.29634 12.2216 negative offset
17 │ lfs vacuum inner vessel 0.098297 10.2415 10.3398 steel 2.9968 123.556 negative offset
18 │ lfs gap water 0.147445 10.3398 10.4873 water 4.60907 189.901 negative offset
19 │ lfs vacuum outer vessel 0.098297 10.4873 10.5856 steel 3.14863 129.645 negative offset
20 │ lfs gap tf vacuum vessel 0.775563 10.5856 11.3611 vacuum 7.64897 509.7 double ellipse
21 │ lfs tf 1.41353 11.3611 12.7747 nb3sn_kdemo 43.955 910.795 convex hull
22 │ out 1.96594 12.7747 14.7406 vacuum 160.272 8372.46
23 │ out cryostat 0.098297 14.7406 14.8389 steel 4.91901 316.852 silo
ActorHFSsizing and ActorLFSsizing only change the layer's thicknesses, so we then need to trigger a build of the 2D cross-sections after them:
FUSE.ActorCXbuild(dd, act);
plot(dd.build)
Generate passive structures information (for now the vacuum vessel)
FUSE.ActorPassiveStructures(dd, act)
plot(dd.pf_passive)
We can now give the PF coils their final position given the new build
actor = FUSE.ActorPFdesign(dd, act);
plot(actor)
With information about both pfactive and pfpassive we can now evaluate vertical stability
FUSE.ActorVerticalStability(dd, act)
IMAS.freeze(dd.mhd_linear)
mhd_linear
├─ time ➡ [0] [s]
└─ time_slice
└─ 1
├─ time ➡ 0 [s]
└─ toroidal_mode
├─ 1
│ ├─ growthrate ➡ 0.0958836 [Hz]
│ ├─ n_tor ➡ 0
│ └─ perturbation_type
│ ├─ description ➡ "Vertical stability margin, > 0.15 for stability (N.B., not in Hz)"
│ └─ name ➡ "m_s"
└─ 2
├─ growthrate ➡ 13.1053 [Hz]
├─ n_tor ➡ 0
└─ perturbation_type
├─ description ➡ "Normalized vertical growth rate, < 10 for stability (N.B., not in Hz)"
└─ name ➡ "γτ"
The ActorNeutronics
calculates the heat flux on the first wall
FUSE.ActorNeutronics(dd, act);
p = plot(; layout=2, size=(900, 350))
plot!(p, dd.neutronics.time_slice[].wall_loading, subplot=1)
plot!(p, FUSE.define_neutrons(dd, 100000)[1], dd.equilibrium.time_slice[]; subplot=1, colorbar_entry=false)
plot!(p, dd.neutronics.time_slice[].wall_loading; cx=false, subplot=2, ylabel="")
The ActorBlanket
will change the thickess of the first wall, breeder, shield, and Li6 enrichment to achieve target TBR
FUSE.ActorBlanket(dd, act);
print_tree(IMAS.freeze(dd.blanket); maxdepth=5)
actors: Blanket
actors: CXbuild
blanket
├─ module
│ └─ 1
│ ├─ layer
│ │ ├─ 1
│ │ │ ├─ material ➡ "tungsten"
│ │ │ ├─ midplane_thickness ➡ 0.0407815 [m]
│ │ │ └─ name ➡ "lfs first wall"
│ │ ├─ 2
│ │ │ ├─ material ➡ "lithium-lead: Li6/7=100.000"
│ │ │ ├─ midplane_thickness ➡ 1.17956 [m]
│ │ │ └─ name ➡ "lfs blanket"
│ │ └─ 3
│ │ ├─ material ➡ "steel"
│ │ ├─ midplane_thickness ➡ 1.56559 [m]
│ │ └─ name ➡ "lfs high temp shield"
│ ├─ name ➡ "blanket"
│ └─ time_slice
│ └─ 1
│ ├─ peak_escape_flux ➡ 961562 [W/m^2]
│ ├─ peak_wall_flux ➡ 2.66575e+06 [W/m^2]
│ ├─ power_incident_neutrons ➡ 2.7153e+08 [W]
│ ├─ power_incident_radiated ➡ 0 [W]
│ ├─ power_thermal_extracted ➡ 3.25836e+08 [W]
│ ├─ power_thermal_neutrons ➡ 3.25836e+08 [W]
│ ├─ power_thermal_radiated ➡ 0 [W]
│ ├─ time ➡ 0 [s]
│ └─ tritium_breeding_ratio ➡ 1.20694
├─ time ➡ [0] [s]
└─ tritium_breeding_ratio ➡ [1.15215]
The ActorDivertors
actor calculates the divertors heat flux
FUSE.ActorDivertors(dd, act);
print_tree(IMAS.freeze(dd.divertors); maxdepth=4)
actors: Divertors
divertors
├─ divertor
│ └─ 1
│ ├─ power_conducted
│ │ ├─ data ➡ [1.28014e+08] [W]
│ │ └─ time ➡ [0] [s]
│ ├─ power_convected
│ │ ├─ data ➡ [0] [W]
│ │ └─ time ➡ [0] [s]
│ ├─ power_incident
│ │ ├─ data ➡ [1.92851e+07] [W]
│ │ └─ time ➡ [0] [s]
│ ├─ power_thermal_extracted
│ │ ├─ data ➡ [1.92851e+07] [W]
│ │ └─ time ➡ [0] [s]
│ └─ target
│ ├─ 1
│ │ ⋮
│ │
│ └─ 2
│ ⋮
│
└─ time ➡ [0] [s]
The ActorBalanceOfPlant
calculates the optimal cooling flow rates for the heat sources (breeder, divertor, and wall) and get an efficiency for the electricity conversion cycle
FUSE.ActorBalanceOfPlant(dd, act);
IMAS.freeze(dd.balance_of_plant)
balance_of_plant
├─ Q_plant ➡ [0.985683]
├─ power_electric_net ➡ [-2.0759e+06] [W]
├─ power_electric_plant_operation
│ ├─ system
│ │ ├─ 1
│ │ │ ├─ index ➡ 1
│ │ │ ├─ name ➡ "HCD"
│ │ │ ├─ power ➡ [1e+08] [W]
│ │ │ └─ subsystem
│ │ │ ├─ 1
│ │ │ │ ├─ index ➡ 1
│ │ │ │ ├─ name ➡ "nbi"
│ │ │ │ └─ power ➡ [0] [W]
│ │ │ ├─ 2
│ │ │ │ ├─ index ➡ 2
│ │ │ │ ├─ name ➡ "ec_launchers"
│ │ │ │ └─ power ➡ [5e+07] [W]
│ │ │ ├─ 3
│ │ │ │ ├─ index ➡ 3
│ │ │ │ ├─ name ➡ "ic_antennas"
│ │ │ │ └─ power ➡ [5e+07] [W]
│ │ │ └─ 4
│ │ │ ├─ index ➡ 4
│ │ │ ├─ name ➡ "lh_antennas"
│ │ │ └─ power ➡ [0] [W]
│ │ ├─ 2
│ │ │ ├─ index ➡ 3
│ │ │ ├─ name ➡ "cryostat"
│ │ │ └─ power ➡ [3e+07] [W]
│ │ ├─ 3
│ │ │ ├─ index ➡ 4
│ │ │ ├─ name ➡ "tritium_handling"
│ │ │ └─ power ➡ [1.5e+07] [W]
│ │ └─ 4
│ │ ├─ index ➡ 6
│ │ ├─ name ➡ "pf_active"
│ │ └─ power ➡ [0] [W]
│ └─ total_power ➡ [1.45e+08] [W]
├─ power_plant
│ ├─ heat_load
│ │ ├─ breeder ➡ [3.25836e+08] [W]
│ │ ├─ divertor ➡ [1.92851e+07] [W]
│ │ └─ wall ➡ [4.31834e+07] [W]
│ ├─ power_cycle_type ➡ "rankine"
│ ├─ power_electric_generated ➡ [1.42924e+08] [W]
│ └─ total_heat_supplied ➡ [3.88304e+08] [W]
├─ thermal_efficiency_plant ➡ [0.368072]
└─ time ➡ [0] [s]
ActorCosting
will break down the capital and operational costs
FUSE.ActorCosting(dd, act)
plot(dd.costing)
Let's checkpoint our results
@checkin :manual dd ini act
Saving and loading data
tutorial_temp_dir = tempdir()
filename = joinpath(tutorial_temp_dir, "$(ini.general.casename).json")
"/tmp/K-DEMO.json"
When saving data to be shared outside of FUSE, one can set freeze=true
so that all expressions in the dd are evaluated and saved to file.
IMAS.imas2json(dd, filename; freeze=false, strict=false);
Load from JSON
dd1 = IMAS.json2imas(filename);
Comparing two IDSs
We can introduce a change in the dd1
and spot it with the diff
function
dd1.equilibrium.time_slice[1].time = -100.0
IMAS.diff(dd.equilibrium, dd1.equilibrium)
Dict{String, String} with 1 entry:
"time_slice[1].time" => "value: -Inf -- -100.0"
Summary
Snapshot of dd
in 0D quantities (evaluated at dd.global_time
)
FUSE.extract(dd)
GEOMETRY EQUILIBRIUM TEMPERATURES
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
R0 → 6.5 [m] B0 → 7.8 [T] Te0 → 22.4 [keV]
a → 2.01 [m] ip → 13.1 [MA] Ti0 → 21.3 [keV]
1/ϵ → 3.24 q95 → 6.75 <Te> → 8.92 [keV]
κ → 2 <Bpol> → 0.828 [T] <Ti> → 8.08 [keV]
δ → 0.585 βpol_MHD → 0.888 Te0/<Te> → 2.51
ζ → -0.00753 βtor_MHD → 0.00957 Ti0/<Ti> → 2.64
Volume → 978 [m³] βn_MHD → 1.15
Surface → 783 [m²]
DENSITIES PRESSURES TRANSPORT
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
ne0 → 1.03e+20 [m⁻³] P0 → 0.816 [MPa] τe → 1.92 [s]
ne_ped → 6.93e+19 [m⁻³] <P> → 0.235 [MPa] τe_exp → 2.57 [s]
ne_line → 8.96e+19 [m⁻³] P0/<P> → 3.47 H98y2 → 0.833
<ne> → 8.06e+19 [m⁻³] βn → 1.17 H98y2_exp → 0.912
ne0/<ne> → 1.28 βn_th → 1.11 Hds03 → 0.594
fGW → 0.863 Hds03_exp → 0.677
zeff_ped → 2 τα_thermalization → 0.833 [s]
<zeff> → 2 τα_slowing_down → 1.14 [s]
impurities → DT Ne20 He4
SOURCES EXHAUST CURRENTS
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
Pec → 50 [MW] Psol → 128 [MW] ip_bs_aux_ohm → 13 [MA]
rho0_ec → 0.5 [MW] PLH → 72.5 [MW] ip_ni → 7.04 [MA]
Pnbi → NaN [MW] Bpol_omp → 1.55 [T] ip_bs → 3.37 [MA]
Enbi1 → NaN [MeV] λq → 0.723 [mm] ip_aux → 3.67 [MA]
Pic → 50 [MW] qpol → 3.3e+03 [MW/m²] ip_ohm → 5.95 [MA]
Plh → NaN [MW] qpar → 1.31e+04 [MW/m²] ejima → 0.4
Paux_tot → 100 [MW] P/R0 → 19.7 [MW/m] flattop → 0.7 [Hours]
Pα → 71.1 [MW] PB/R0 → 154 [MW T/m]
Pohm → 0.0869 [MW] PBp/R0 → 16.3 [MW T/m]
Pheat → 171 [MW] PBϵ/R0q95 → 7.03 [MW T/m]
Prad_tot → -43.2 [MW] neutrons_peak → 0.483 [MW/m²]
BOP BUILD COSTING
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
Pfusion → 356 [MW] PF_material → nb3sn capital_cost → 6.69 [$B]
Qfusion → 3.56 TF_material → nb3sn_kdemo levelized_CoE → Inf [$/kWh]
thermal_cycle_type → rankine OH_material → nb3sn TF_of_total → 14 [%]
thermal_efficiency_plant → 36.8 [%] TF_max_b → 15.4 [T] BOP_of_total → 5.27 [%]
thermal_efficiency_cycle → NaN [%] OH_max_b → 20 [T] blanket_of_total → 17.6 [%]
power_electric_generated → 143 [MW] TF_j_margin → 5.73 cryostat_of_total → 2.97 [%]
Pelectric_net → -2.08 [MW] OH_j_margin → 1.7
Qplant → 0.986 TF_stress_margin → 3.14
TBR → 1.15 OH_stress_margin → 1.36
Extract + plots saved to PDF (or printed to screen it filename
is omitted)
filename = joinpath(tutorial_temp_dir, "$(ini.general.casename).pdf")
FUSE.digest(dd)#, filename)
GEOMETRY EQUILIBRIUM TEMPERATURES
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
R0 → 6.5 [m] B0 → 7.8 [T] Te0 → 22.4 [keV]
a → 2.01 [m] ip → 13.1 [MA] Ti0 → 21.3 [keV]
1/ϵ → 3.24 q95 → 6.75 <Te> → 8.92 [keV]
κ → 2 <Bpol> → 0.828 [T] <Ti> → 8.08 [keV]
δ → 0.585 βpol_MHD → 0.888 Te0/<Te> → 2.51
ζ → -0.00753 βtor_MHD → 0.00957 Ti0/<Ti> → 2.64
Volume → 978 [m³] βn_MHD → 1.15
Surface → 783 [m²]
DENSITIES PRESSURES TRANSPORT
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
ne0 → 1.03e+20 [m⁻³] P0 → 0.816 [MPa] τe → 1.92 [s]
ne_ped → 6.93e+19 [m⁻³] <P> → 0.235 [MPa] τe_exp → 2.57 [s]
ne_line → 8.96e+19 [m⁻³] P0/<P> → 3.47 H98y2 → 0.833
<ne> → 8.06e+19 [m⁻³] βn → 1.17 H98y2_exp → 0.912
ne0/<ne> → 1.28 βn_th → 1.11 Hds03 → 0.594
fGW → 0.863 Hds03_exp → 0.677
zeff_ped → 2 τα_thermalization → 0.833 [s]
<zeff> → 2 τα_slowing_down → 1.14 [s]
impurities → DT Ne20 He4
SOURCES EXHAUST CURRENTS
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
Pec → 50 [MW] Psol → 128 [MW] ip_bs_aux_ohm → 13 [MA]
rho0_ec → 0.5 [MW] PLH → 72.5 [MW] ip_ni → 7.04 [MA]
Pnbi → NaN [MW] Bpol_omp → 1.55 [T] ip_bs → 3.37 [MA]
Enbi1 → NaN [MeV] λq → 0.723 [mm] ip_aux → 3.67 [MA]
Pic → 50 [MW] qpol → 3.3e+03 [MW/m²] ip_ohm → 5.95 [MA]
Plh → NaN [MW] qpar → 1.31e+04 [MW/m²] ejima → 0.4
Paux_tot → 100 [MW] P/R0 → 19.7 [MW/m] flattop → 0.7 [Hours]
Pα → 71.1 [MW] PB/R0 → 154 [MW T/m]
Pohm → 0.0869 [MW] PBp/R0 → 16.3 [MW T/m]
Pheat → 171 [MW] PBϵ/R0q95 → 7.03 [MW T/m]
Prad_tot → -43.2 [MW] neutrons_peak → 0.483 [MW/m²]
BOP BUILD COSTING
─────────────────────────────────── ─────────────────────────────────── ───────────────────────────────────
Pfusion → 356 [MW] PF_material → nb3sn capital_cost → 6.69 [$B]
Qfusion → 3.56 TF_material → nb3sn_kdemo levelized_CoE → Inf [$/kWh]
thermal_cycle_type → rankine OH_material → nb3sn TF_of_total → 14 [%]
thermal_efficiency_plant → 36.8 [%] TF_max_b → 15.4 [T] BOP_of_total → 5.27 [%]
thermal_efficiency_cycle → NaN [%] OH_max_b → 20 [T] blanket_of_total → 17.6 [%]
power_electric_generated → 143 [MW] TF_j_margin → 5.73 cryostat_of_total → 2.97 [%]
Pelectric_net → -2.08 [MW] OH_j_margin → 1.7
Qplant → 0.986 TF_stress_margin → 3.14
TBR → 1.15 OH_stress_margin → 1.36
@ time = 0.0 [s]
GKS: could not find font middle.ttf
More things
disable or enable printing of what actor is executed
FUSE.actor_logging(dd, false) # or true
true