Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add multiple boundary models #578

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 2 additions & 35 deletions src/actors/divertors/divertors_actor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Base.@kwdef mutable struct FUSEparameters__ActorDivertors{T<:Real} <: Parameters
_parent::WeakRef = WeakRef(nothing)
_name::Symbol = :not_set
_time::Float64 = NaN
heat_flux_model::Switch{Symbol} = Switch{Symbol}([:lengyel], "-", "Divertor heat flux model"; default=:lengyel)
heat_flux_model::BoundaryPlasmaModels.DivertorHeatFluxParameters{T} = BoundaryPlasmaModels.DivertorHeatFluxParameters{T}()
impurities::Entry{Vector{Symbol}} = Entry{Vector{Symbol}}("-", "Vector of impurity species"; default=Symbol[])
impurities_fraction::Entry{Vector{T}} = Entry{Vector{T}}("-", "Vector of impurity fractions"; default=T[])
heat_spread_factor::Entry{T} = Entry{T}("-", "Heat flux expansion factor in the private flux region (eg. due to transport) should be >= 1.0"; default=1.0)
Expand Down Expand Up @@ -92,7 +92,7 @@ function _step(actor::ActorDivertors)
# Setup model based on dd and run
boundary_plasma_model = BoundaryPlasmaModels.DivertorHeatFluxModel(par.heat_flux_model)
push!(actor.boundary_plasma_models, boundary_plasma_model)
setup_model(boundary_plasma_model, target, eqt, cp1d, sol1; par.impurities, par.impurities_fraction, par.heat_spread_factor)
BoundaryPlasmaModels.setup_model(boundary_plasma_model, target, eqt, cp1d, sol1; par.impurities, par.impurities_fraction, par.heat_spread_factor)
boundary_plasma_model()
if par.verbose
println(" == $(uppercase(target.name)) ==")
Expand All @@ -114,36 +114,3 @@ function _step(actor::ActorDivertors)
return actor
end

function setup_model(
boundary_plasma_model::BoundaryPlasmaModels.LengyelModel,
target::IMAS.divertors__divertor___target,
eqt::IMAS.equilibrium__time_slice,
cp1d::IMAS.core_profiles__profiles_1d,
sol1::IMAS.OpenFieldLine;
impurities::Vector{Symbol},
impurities_fraction::Vector{<:Real},
heat_spread_factor::Real=1.0)

@assert (length(impurities) == length(impurities_fraction))

boundary_plasma_model.parameters.plasma.P_SOL = @ddtime(target.power_conducted.data) + @ddtime(target.power_convected.data)
boundary_plasma_model.parameters.plasma.R_omp = sol1.r[sol1.midplane_index]
boundary_plasma_model.parameters.plasma.Ip = eqt.global_quantities.ip
boundary_plasma_model.parameters.plasma.κ = eqt.boundary.elongation
boundary_plasma_model.parameters.plasma.ϵ = eqt.boundary.minor_radius / eqt.boundary.geometric_axis.r
boundary_plasma_model.parameters.plasma.Bt_omp = sol1.Bt[sol1.midplane_index]
boundary_plasma_model.parameters.plasma.Bpol_omp = sol1.Bp[sol1.midplane_index]

boundary_plasma_model.parameters.sol.n_up = cp1d.electrons.density_thermal[end]
boundary_plasma_model.parameters.sol.T_up = cp1d.electrons.temperature[end]
boundary_plasma_model.parameters.sol.λ_omp = target.two_point_model[].sol_heat_decay_length
boundary_plasma_model.parameters.sol.imp = impurities
boundary_plasma_model.parameters.sol.f_imp = impurities_fraction

boundary_plasma_model.parameters.target.f_omp2target_expansion = @ddtime(target.flux_expansion.data)
λ_target = boundary_plasma_model.parameters.sol.λ_omp * boundary_plasma_model.parameters.target.f_omp2target_expansion
boundary_plasma_model.parameters.target.R = @ddtime(target.wetted_area.data) / (λ_target * 2π)
boundary_plasma_model.parameters.target.f_spread_pfr = heat_spread_factor
boundary_plasma_model.parameters.target.α_sp = @ddtime(target.tilt_angle_tor.data)
boundary_plasma_model.parameters.target.θ_sp = @ddtime(target.tilt_angle_pol.data)
end
Loading