Skip to content

Commit

Permalink
handle plot of core_transport for time_slices before data is available
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Feb 4, 2025
1 parent 3971202 commit e586640
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
14 changes: 8 additions & 6 deletions src/physics/transport.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ function total_fluxes(
push!(total_flux1d_ions, tmp)
end
for model in core_transport.model
model1d = model.profiles_1d[time0]
for ion in model1d.ion
l = length(total_flux1d.ion)
tmp = resize!(total_flux1d.ion, "element[1].a" => ion.element[1].z_n, "element[1].z_n" => ion.element[1].z_n, "label" => ion.label)
if l != length(total_flux1d.ion)
push!(total_flux1d_ions, tmp)
if !isempty(model.profiles_1d) && time0 >= model.profiles_1d[1].time
model1d = model.profiles_1d[time0]
for ion in model1d.ion
l = length(total_flux1d.ion)
tmp = resize!(total_flux1d.ion, "element[1].a" => ion.element[1].z_n, "element[1].z_n" => ion.element[1].z_n, "label" => ion.label)
if l != length(total_flux1d.ion)
push!(total_flux1d_ions, tmp)
end
end
end
end
Expand Down
34 changes: 19 additions & 15 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1485,8 +1485,10 @@ end
if model.identifier.index (model_type[k] for k in (:combined, :unspecified, :transport_solver, :unknown))
continue
end
ct1d = model.profiles_1d[time0]
append!(rhos, ct1d.grid_flux.rho_tor_norm)
if !isempty(model.profiles_1d) && time0 >= model.profiles_1d[1].time
ct1d = model.profiles_1d[time0]
append!(rhos, ct1d.grid_flux.rho_tor_norm)
end
end
rhos = unique(rhos)

Expand Down Expand Up @@ -1514,20 +1516,22 @@ end
if model.identifier.index (model_type[k] for k in (:combined, :unspecified, :transport_solver, :unknown))
continue
end
@series begin
ions := ions
label := model.identifier.name
if model.identifier.index == model_type[:anomalous]
markershape := :diamond
markerstrokewidth := 0.5
linewidth := 0
color := :orange
elseif model.identifier.index == model_type[:neoclassical]
markershape := :cross
linewidth := 0
color := :purple
if !isempty(model.profiles_1d) && time0 >= model.profiles_1d[1].time
@series begin
ions := ions
label := model.identifier.name
if model.identifier.index == model_type[:anomalous]
markershape := :diamond
markerstrokewidth := 0.5
linewidth := 0
color := :orange
elseif model.identifier.index == model_type[:neoclassical]
markershape := :cross
linewidth := 0
color := :purple
end
model.profiles_1d[time0]
end
model.profiles_1d[time0]
end
end
end
Expand Down

0 comments on commit e586640

Please sign in to comment.