Skip to content

Commit

Permalink
Make FluxMatcher the default transport solver (#584)
Browse files Browse the repository at this point in the history
make FM the default transport solver with density evolve
  • Loading branch information
TimSlendebroek committed Sep 16, 2024
1 parent 91f4a4e commit 26713f6
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/actors/transport/core_transport_actor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Base.@kwdef mutable struct FUSEparameters__ActorCoreTransport{T<:Real} <: Parame
_parent::WeakRef = WeakRef(nothing)
_name::Symbol = :not_set
_time::Float64 = NaN
model::Switch{Symbol} = Switch{Symbol}([:FluxMatcher, :EPEDProfiles, :none], "-", "Transport actor to run"; default=:none)
model::Switch{Symbol} = Switch{Symbol}([:FluxMatcher, :EPEDProfiles, :none], "-", "Transport actor to run"; default=:FluxMatcher)
do_plot::Entry{Bool} = act_common_parameters(do_plot=false)
end

Expand Down
2 changes: 1 addition & 1 deletion src/actors/transport/flux_matcher_actor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Base.@kwdef mutable struct FUSEparameters__ActorFluxMatcher{T<:Real} <: Paramete
Entry{Union{AbstractDict,Symbol}}(
"-",
"Densities `:fixed`, or electron flux-match and rest match ne scale `:flux_match`, or Dict to specify which species are `:flux_match`, kept `:fixed`, used to enforce `:quasi_neutrality`, or scaled to `:match_ne_scale`";
default=:fixed
default=:flux_match
)
evolve_rotation::Switch{Symbol} = Switch{Symbol}([:flux_match, :fixed], "-", "Rotation `:flux_match` or keep `:fixed`"; default=:fixed)
evolve_pedestal::Entry{Bool} = Entry{Bool}("-", "Evolve the pedestal within the transport solver"; default=true)
Expand Down
12 changes: 11 additions & 1 deletion src/cases/ARC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CFS/MIT ARC design
"""
function case_parameters(::Type{Val{:ARC}})::Tuple{ParametersAllInits,ParametersAllActors}
function case_parameters(::Type{Val{:ARC}};tjlf_transport=false)::Tuple{ParametersAllInits,ParametersAllActors}
ini = ParametersInits(; n_ic=1)
act = ParametersActors()
ini.general.casename = "ARC"
Expand Down Expand Up @@ -80,6 +80,16 @@ function case_parameters(::Type{Val{:ARC}})::Tuple{ParametersAllInits,Parameters
ini.requirements.coil_j_margin = 0.1
ini.requirements.coil_stress_margin = 0.1

#### ACT ####
if tjlf_transport
act.ActorFluxMatcher.max_iterations = 50
act.ActorTGLF.electromagnetic = false
act.ActorTGLF.sat_rule = :sat0
act.ActorTGLF.model = :TJLF
else
act.ActorCoreTransport.model = :none
end

set_new_base!(ini)
set_new_base!(act)

Expand Down
5 changes: 4 additions & 1 deletion src/cases/D3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ function case_parameters(::Type{Val{:D3D}}; scenario=:default, use_ods_sources=f
ini.requirements.flattop_duration = 5.0

act.ActorPFdesign.symmetric = true
act.ActorFluxMatcher.evolve_densities = :flux_match

act.ActorWholeFacility.update_build = false
act.ActorFluxMatcher.evolve_pedestal = false
act.ActorStabilityLimits.raise_on_breach = false


if use_ods_sources
act.ActorHCD.nb_model = :none
Expand Down
3 changes: 0 additions & 3 deletions src/cases/DTT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ function case_parameters(::Type{Val{:DTT}})::Tuple{ParametersAllInits,Parameters
ini.ec_launcher[1].power_launched = 29e6 #of 32 installed
ini.ic_antenna[1].power_launched = 6e6 #of 8 installed

act.ActorFluxMatcher.evolve_densities = :flux_match
act.ActorStabilityLimits.raise_on_breach = false

set_new_base!(ini)
set_new_base!(act)

Expand Down
2 changes: 2 additions & 0 deletions src/cases/EXCITE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function case_parameters(::Type{Val{:EXCITE}})::Tuple{ParametersAllInits,Paramet
act.ActorEquilibrium.model = :TEQUILA
act.ActorTEQUILA.relax = 0.25

act.ActorCoreTransport.model = :none # No flux matching possible

# finalize
set_new_base!(ini)
set_new_base!(act)
Expand Down
2 changes: 2 additions & 0 deletions src/cases/FPP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ function case_parameters(::Type{Val{:FPP}})::Tuple{ParametersAllInits,Parameters

act.ActorStabilityLimits.models = [:q95_gt_2, :κ_controllability]

act.ActorCoreTransport.model=:none

act.ActorEquilibrium.model = :TEQUILA

# finalize
Expand Down
2 changes: 1 addition & 1 deletion src/cases/ITER.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function case_parameters(
ini.pellet_launcher[1].size = Float64[0.003, 0.004] / 2.0
ini.pellet_launcher[1].frequency = 0.02 # Hz

act.ActorFluxMatcher.evolve_densities = :flux_match

act.ActorTGLF.user_specified_model = "sat1_em_iter"

act.ActorWholeFacility.update_build = false
Expand Down
3 changes: 2 additions & 1 deletion src/cases/KDEMO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ function case_parameters(::Type{Val{:KDEMO}})::Tuple{ParametersAllInits,Paramete
ini.requirements.tritium_breeding_ratio = 1.1
ini.requirements.power_electric_net = 400e6 # as example

act.ActorFluxMatcher.evolve_densities = :flux_match

act.ActorTGLF.user_specified_model = "sat1_em_iter"
act.ActorStabilityLimits.raise_on_breach = false

set_new_base!(ini)
set_new_base!(act)
Expand Down
3 changes: 3 additions & 0 deletions src/cases/MANTA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ function case_parameters(::Type{Val{:MANTA}})::Tuple{ParametersAllInits,Paramete
act.ActorPedestal.model = :WPED
act.ActorWPED.ped_to_core_fraction = 0.3

#### ACT ####
act.ActorCoreTransport.model = :none # No flux matching possible

set_new_base!(ini)
set_new_base!(act)

Expand Down
12 changes: 11 additions & 1 deletion src/cases/SPARC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CFS/MIT SPARC design
"""
function case_parameters(::Type{Val{:SPARC}})::Tuple{ParametersAllInits,ParametersAllActors}
function case_parameters(::Type{Val{:SPARC}}; tjlf_transport=false)::Tuple{ParametersAllInits,ParametersAllActors}
ini = ParametersInits(; n_ic=1)
act = ParametersActors()
ini.general.casename = "SPARC"
Expand Down Expand Up @@ -63,6 +63,16 @@ function case_parameters(::Type{Val{:SPARC}})::Tuple{ParametersAllInits,Paramete

ini.ic_antenna[1].power_launched = 11.1 * 1e6 #25 MW maximum available, P_threshold = 21 MW

#### ACT ####
act.ActorTGLF.model = :TJLF
if tjlf_transport
act.ActorFluxMatcher.max_iterations = 100
act.ActorTGLF.electromagnetic = false
act.ActorTGLF.sat_rule = :sat0
act.ActorTGLF.model = :TJLF
else
act.ActorCoreTransport.model = :none
end
act.ActorPFdesign.symmetric = true
# act.ActorCXbuild.divertor_size = 0.6

Expand Down
2 changes: 1 addition & 1 deletion src/cases/STEP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function case_parameters(::Type{Val{:STEP}}; init_from::Symbol=:scalars, pf_from
ini.requirements.power_electric_net = 236e6 # from PyTok

act.ActorCoreTransport.model = :FluxMatcher
act.ActorFluxMatcher.evolve_densities = :flux_match

act.ActorFluxMatcher.evolve_densities = :fixed
act.ActorFluxMatcher.rho_transport = 0.3:0.05:0.8
act.ActorTGLF.user_specified_model = "sat0_em_d3d"
Expand Down
2 changes: 1 addition & 1 deletion studies/DatabaseGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function study_parameters(::Type{Val{:DatabaseGenerator}})::Tuple{FUSEparameters
act.ActorFluxMatcher.evolve_pedestal = false
act.ActorTGLF.warn_nn_train_bounds = false
act.ActorFluxMatcher.evolve_rotation = :fixed
act.ActorFluxMatcher.evolve_densities = :flux_match


# finalize
set_new_base!(sty)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests_actors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Test
FUSE.init(dd, ini, act)
act.ActorFluxMatcher.max_iterations = 2
act.ActorFluxMatcher.evolve_pedestal = true
act.ActorFluxMatcher.evolve_densities = :flux_match

act.ActorFluxMatcher.optimizer_algorithm = :simple
act.ActorTGLF.model = :TJLF
FUSE.ActorFluxMatcher(dd, act)
Expand Down

0 comments on commit 26713f6

Please sign in to comment.