Skip to content

Commit

Permalink
Add a simple demo
Browse files Browse the repository at this point in the history
  • Loading branch information
eldond committed Feb 16, 2024
1 parent 4114ca1 commit b4c4ffa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions example/simple_demo.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# A simple demo that can be run without jupyter notebooks.
# First, activate the project (preferably after loading Revise), then include this file:
# > using Revise
# ] activate .
# > include("example/simple_demo.jl")
using SOLPS2IMAS: SOLPS2IMAS
using GGDUtils: GGDUtils
using Plots
using SD4SOLPS

sample_path = "$(@__DIR__)/../sample/ITER_Lore_2296_00000/"
solps2imas_samples = splitdir(pathof(SOLPS2IMAS))[1] * "/../samples"

dd = SD4SOLPS.preparation(
"Baseline2008-li0.70.x4.mod3.eqdsk",
[sample_path, solps2imas_samples]...;
)

grid_ggd = ids.edge_profiles.grid_ggd[1] # First grid_ggd time slice. It is allowed to vary in time
space = grid_ggd.space[1] # First space in this grid_ggd

# Choose backend
gr() # Fast and can save pdf
# plotlyjs() # Use for interactive plot, can only save png
n_e = GGDUtils.get_prop_with_grid_subset_index(ids.edge_profiles.ggd[1].electrons.density, 5)
plot(ids.edge_profiles.grid_ggd, n_e, colorbar_title="Electrons density / m^(-3)")
plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 16), linecolor=:black, linewidth=2, linestyle=:solid, label="Separatix", legend=true)

0 comments on commit b4c4ffa

Please sign in to comment.