Skip to content

Commit

Permalink
improved plotting of core_transport
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Oct 13, 2023
1 parent 4952dbf commit dd58739
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -895,22 +895,12 @@ end
# ========= #
@recipe function plot_core_transport(ct::IMAS.core_transport{D}; time0=global_time(ct)) where {D<:Real}
model_type = name_2_index(ct.model)

rhos = D[]
for model in ct.model
if model.identifier.index (model_type[k] for k in (:combined, :unspecified, :transport_solver, :unknown))
continue
end
@series begin
label := model.identifier.name
if model.identifier.index == model_type[:neoclassical]
markershape := :cross
color := :blue
elseif model.identifier.index == model_type[:anomalous]
markershape := :diamond
color := :red
end
model.profiles_1d[time0]
end
append!(rhos, model.profiles_1d[].grid_flux.rho_tor_norm)
end
rhos = unique(rhos)
Expand All @@ -919,7 +909,7 @@ end
if dd !== nothing
@series begin
linewidth := 2
color := :green
color := :blue
label := "Total source"
flux := true
total_sources(dd; time0)
Expand All @@ -928,10 +918,30 @@ end

@series begin
linewidth := 2
color := :black
color := :red
label := "Total transport"
total_fluxes(ct, rhos; time0)
end

for model in ct.model
if model.identifier.index (model_type[k] for k in (:combined, :unspecified, :transport_solver, :unknown))
continue
end
@series begin
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
end
end

@recipe function plot_ct1d(ct1d::IMAS.core_transport__model___profiles_1d; label="", markershape=:none, color=:green, only=nothing)
Expand Down

0 comments on commit dd58739

Please sign in to comment.