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

Multiple source functionality #250

Merged
merged 24 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
af49432
Split get_settings function for neutrals and ions, in preparation for…
LucasMontoya4 Sep 6, 2024
0c67d26
Convert form of ion_settings, electron_settings and neutral_settings …
LucasMontoya4 Sep 6, 2024
372988a
Add options to ion and neutral source profile type error
LucasMontoya4 Sep 6, 2024
4a74181
Change names of structs from 'profile' to 'data'
LucasMontoya4 Sep 6, 2024
a381240
Change create_moments_ion and create_moments_neutral functions to be …
LucasMontoya4 Sep 7, 2024
fb0b082
Restructure main initialisation files and update loops to view each s…
LucasMontoya4 Sep 8, 2024
2e5527a
Update file_io.jl to write out external_source_amplitudes for each mo…
LucasMontoya4 Sep 8, 2024
0cf1c36
Update load_data.jl for multiple sources
LucasMontoya4 Sep 8, 2024
0362f21
Update source functionality for all moment kinetic advances of densit…
LucasMontoya4 Sep 8, 2024
41759d9
clean up external_sources.jl
LucasMontoya4 Sep 8, 2024
2622a24
Clean up small typos
LucasMontoya4 Sep 8, 2024
6123063
Update all example input files and test files
LucasMontoya4 Sep 8, 2024
dddad29
Fix bug in velocity_moments.jl PI_density_controller loop
LucasMontoya4 Sep 9, 2024
da0f366
Add exponential wall decay profile option to simulate neutral ionisat…
LucasMontoya4 Sep 9, 2024
9bfb631
Temporary fix for file_io.jl, where only the first source profile of …
LucasMontoya4 Sep 9, 2024
25bdbfe
Add collisionality_scan option to krook operator for ions
LucasMontoya4 Sep 9, 2024
8dd9025
Allow NamedTuple 'coords' in create_dynamic_variable!()
johnomotani Sep 10, 2024
69b80ba
Merge remote-tracking branch 'origin/simplify-io-variable-creation' i…
LucasMontoya4 Sep 10, 2024
8d61d1e
Allow output of all sources as one variable (after John's update to a…
LucasMontoya4 Sep 11, 2024
d4dd565
bug fixes for plotting sources in makie_post_processing
LucasMontoya4 Sep 11, 2024
e8f2926
Use ion_sources directly instead of `counter` to set up electron sources
johnomotani Sep 12, 2024
150d05a
Fix import of external source function in electron_kinetic_equation
johnomotani Sep 12, 2024
fe922fa
Fix typo in external_electron_source!()
johnomotani Sep 12, 2024
5ecabac
Fix output of neutral source terms
johnomotani Sep 12, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sd_mi = 0.5 # mD/malpha
sd_me = 0.000013616 # 0.25/1836.0 me/malpha
sd_q = 1.0

[ion_source]
[ion_source_1]
active=false
source_strength=0.0
source_T=0.005
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sd_mi = 0.5 # mD/malpha
sd_me = 0.000013616 # 0.25/1836.0 me/malpha
sd_q = 1.0

[ion_source]
[ion_source_1]
active=true
source_strength=1.0
source_T=0.005
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sd_mi = 0.5 # mD/malpha
sd_me = 0.000013616 # 0.25/1836.0 me/malpha
sd_q = 1.0

[ion_source]
[ion_source_1]
active=true
source_strength=1.0
source_T=0.005
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ steady_state_residual = true
converged_residual_value = 1.0e-3
#write_after_fixed_step_count = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ minimum_dt = 1.0e-9
initialization_residual_value = 2.5
converged_residual_value = 0.1 #1.0e-3

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ converged_residual_value = 1.0e-3
[krook_collisions]
use_krook = true

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
2 changes: 1 addition & 1 deletion examples/wall-bc/wall-bc_no-neutrals.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ nwrite = 5000
nwrite_dfns = 5000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
2 changes: 1 addition & 1 deletion examples/wall-bc/wall-bc_no-neutrals_split1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ nwrite = 5000
nwrite_dfns = 5000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
2 changes: 1 addition & 1 deletion examples/wall-bc/wall-bc_no-neutrals_split2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ nwrite = 5000
nwrite_dfns = 5000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
2 changes: 1 addition & 1 deletion examples/wall-bc/wall-bc_no-neutrals_split3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ nwrite = 5000
nwrite_dfns = 5000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
Expand Down
4 changes: 2 additions & 2 deletions examples/wall-bc/wall-bc_volumerecycle.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ nwrite = 10000
nwrite_dfns = 10000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
source_strength = 2.0
source_T = 2.0

[neutral_source]
[neutral_source_1]
active = true
source_type = "recycling"
recycling_controller_fraction = 0.25
Expand Down
4 changes: 2 additions & 2 deletions examples/wall-bc/wall-bc_volumerecycle_split1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ nwrite = 10000
nwrite_dfns = 10000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
source_strength = 2.0
source_T = 2.0

[neutral_source]
[neutral_source_1]
active = true
source_type = "recycling"
recycling_controller_fraction = 0.25
Expand Down
4 changes: 2 additions & 2 deletions examples/wall-bc/wall-bc_volumerecycle_split2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ nwrite = 10000
nwrite_dfns = 10000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
source_strength = 2.0
source_T = 2.0

[neutral_source]
[neutral_source_1]
active = true
source_type = "recycling"
recycling_controller_fraction = 0.25
Expand Down
4 changes: 2 additions & 2 deletions examples/wall-bc/wall-bc_volumerecycle_split3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ nwrite = 10000
nwrite_dfns = 10000
split_operators = false

[ion_source]
[ion_source_1]
active = true
z_profile = "gaussian"
z_width = 0.125
source_strength = 2.0
source_T = 2.0

[neutral_source]
[neutral_source_1]
active = true
source_type = "recycling"
recycling_controller_fraction = 0.25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ using moment_kinetics.load_data: close_run_info, get_run_info_no_setup, get_vari
neutral_moment_variables, all_moment_variables,
ion_dfn_variables, electron_dfn_variables,
neutral_dfn_variables, all_dfn_variables, ion_variables,
neutral_variables, all_variables
neutral_variables, all_variables, ion_source_variables,
neutral_source_variables, electron_source_variables
using moment_kinetics.initial_conditions: vpagrid_to_dzdt
using .shared_utils: calculate_and_write_frequencies
using moment_kinetics.type_definitions: mk_float, mk_int
Expand Down Expand Up @@ -233,14 +234,6 @@ function makie_post_process(run_dir::Union{String,Tuple},
# Plots from moment variables
#############################

moment_variable_list = tuple(em_variables..., ion_moment_variables...)
if has_electrons
moment_variable_list = tuple(moment_variable_list..., electron_moment_variables...)
end
if has_neutrals
moment_variable_list = tuple(moment_variable_list..., neutral_moment_variables...)
end

if any(ri !== nothing for ri ∈ run_info_moments)
has_moments = true

Expand Down Expand Up @@ -276,7 +269,7 @@ function makie_post_process(run_dir::Union{String,Tuple},
end

do_steady_state_residuals = any(input_dict[v]["steady_state_residual"]
for v ∈ moment_variable_list)
for v ∈ all_moment_variables)
if do_steady_state_residuals
textoutput_files = Tuple(ri.run_prefix * "_residuals.txt"
for ri in run_info if ri !== nothing)
Expand All @@ -299,7 +292,7 @@ function makie_post_process(run_dir::Union{String,Tuple},
steady_state_residual_fig_axes = nothing
end

for variable_name ∈ moment_variable_list
for variable_name ∈ all_moment_variables
plots_for_variable(run_info, variable_name; plot_prefix=plot_prefix,
has_rdim=has_rdim, has_zdim=has_zdim, is_1V=is_1V,
steady_state_residual_fig_axes=steady_state_residual_fig_axes)
Expand Down Expand Up @@ -1030,8 +1023,18 @@ function plots_for_variable(run_info, variable_name; plot_prefix, has_rdim=true,
elseif variable_name ∈ neutral_moment_variables ||
variable_name ∈ neutral_dfn_variables
species_indices = 1:maximum(ri.n_neutral_species for ri ∈ run_info)
else
elseif variable_name ∈ ion_moment_variables ||
variable_name ∈ ion_dfn_variables
species_indices = 1:maximum(ri.n_ion_species for ri ∈ run_info)
elseif variable_name in ion_source_variables
species_indices = 1:maximum(length(ri.external_source_settings.ion) for ri ∈ run_info)
elseif variable_name in electron_source_variables
species_indices = 1:maximum(length(ri.external_source_settings.electron) for ri ∈ run_info)
elseif variable_name in neutral_source_variables
species_indices = 1:maximum(length(ri.external_source_settings.neutral) for ri ∈ run_info)
else
species_indices = 1:1
#error("variable_name=$variable_name not found in any defined group")
end
for is ∈ species_indices
if is !== nothing
Expand Down
2 changes: 1 addition & 1 deletion moment_kinetics/debug_test/kinetic_electron_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1,
"vz_L" => 6.0,
"vz_bc" => "zero",
"vz_discretization" => "chebyshev_pseudospectral",
"ion_source" => OptionsDict("active" => true,
"ion_source_1" => OptionsDict("active" => true,
"z_profile" => "gaussian",
"z_width" => 0.125,
"source_strength" => 2.0,
Expand Down
2 changes: 1 addition & 1 deletion moment_kinetics/debug_test/recycling_fraction_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1,
"vz_L" => 6.0,
"vz_bc" => "zero",
"vz_discretization" => "chebyshev_pseudospectral",
"ion_source" => OptionsDict("active" => true,
"ion_source_1" => OptionsDict("active" => true,
"z_profile" => "gaussian",
"z_width" => 0.125,
"source_strength" => 2.0,
Expand Down
Loading
Loading