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

model to keep q>1 in stationary transport #785

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
clean cruft
  • Loading branch information
jmcclena committed Dec 12, 2024
commit c7086054d991d9c2c72bdc6502bd11abaa1ca965
31 changes: 9 additions & 22 deletions src/actors/current/qed_actor.jl
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ Base.@kwdef mutable struct FUSEparameters__ActorQED{T<:Real} <: ParametersActor{
#== data flow parameters ==#
ip_from::Switch{Symbol} = switch_get_from(:ip)
vloop_from::Switch{Symbol} = switch_get_from(:vloop)
q0_desired::Entry{Float64} = Entry{Float64}("-", "Desired minimum q-profile"; default=1.0)
end

mutable struct ActorQED{D,P} <: SingleAbstractActor{D,P}
@@ -126,26 +127,14 @@ function _step(actor::ActorQED)
actor.QO = QED.steady_state(actor.QO, η_imas(dd.core_profiles.profiles_1d[]); Vedge, Ip)

j_total = QED.JB(actor.QO; ρ=cp1d.grid.rho_tor_norm) ./ B0
p2 = plot(j_total)
display(p2)
if true

if par.q0_desired > 0
rho = cp1d.grid.rho_tor_norm
qval = 1.0 ./ abs.(actor.QO.ι.(rho))
#println(qval)
qdes = 1.0
i_qeq1 = findlast(qval .< qdes)
print(i_qeq1)
#η = η_imas(dd.core_profiles.profiles_1d[],i_qeq1)
actor.QO = QED.steady_state(actor.QO, η_imas(dd.core_profiles.profiles_1d[],i_qeq1=i_qeq1); Vedge, Ip)
#p = plot(qval)
#display(p)
#p2 = plot!(1.0./abs.(actor.QO.ι.(rho)))
#display(p2)
i_qdes = findlast(qval .< par.q0_desired)
actor.QO = QED.steady_state(actor.QO, η_imas(dd.core_profiles.profiles_1d[],i_qdes=i_qdes); Vedge, Ip)

j_total = QED.JB(actor.QO; ρ=cp1d.grid.rho_tor_norm) ./ B0
p2 = plot!(j_total)
display(p2)
#print(qval-1.0./abs.(actor.QO.ι.(rho)),qval,1.0./abs.(actor.QO.ι.(rho)))
end
end

@@ -160,8 +149,7 @@ function _finalize(actor::ActorQED)

cp1d = dd.core_profiles.profiles_1d[]
j_total = QED.JB(actor.QO; ρ=cp1d.grid.rho_tor_norm) ./ B0
p = plot!(j_total)
display(p)

if ismissing(cp1d, :j_non_inductive)
cp1d.j_ohmic = j_total
else
@@ -217,12 +205,11 @@ function qed_init_from_imas(eqt::IMAS.equilibrium__time_slice, cp1d::IMAS.core_p
return QED.initialize(rho_tor, B0, gm1, f, dvolume_drho_tor, q, j_tor, gm9; ρ_j_non_inductive, ρ_grid)
end

function η_imas(cp1d::IMAS.core_profiles__profiles_1d; use_log::Bool=true,i_qeq1=nothing)
function η_imas(cp1d::IMAS.core_profiles__profiles_1d; use_log::Bool=true,i_qdes=nothing)
rho = cp1d.grid.rho_tor_norm
η = 1.0 ./ cp1d.conductivity_parallel
if i_qeq1 != nothing
η[1:i_qeq1] .= η[i_qeq1]
#println(i_qeq1,η)
if i_qdes != nothing
η[1:i_qdes] .= η[i_qdes]
end
return QED.η_FE(rho, η; use_log)
end