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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add exponential wall decay profile option to simulate neutral ionisat…
…ion for ions when n_neutrals = 0, and fix some more small errors introduced during restructuring of source system
LucasMontoya4 committed Sep 9, 2024
commit da0f366ee874bc1dcde966f86ca792fa19fd3acf
18 changes: 9 additions & 9 deletions moment_kinetics/src/external_sources.jl
Original file line number Diff line number Diff line change
@@ -350,21 +350,17 @@ function setup_external_sources!(input_dict, r, z, electron_physics)

# If there are no ion sources, add an inactive ion source to the vector
if counter == 1
inactive_ion_source = get_settings_ions(1, false)
push!(ion_sources, inactive_ion_source)
counter += 1
push!(ion_sources, get_settings_ions(1, false))
end

# put all electron sources into electron_source_data struct vector, where
# each entry is a mirror of the ion source vector.
electron_sources = electron_source_data[]
if electron_physics ∈ (braginskii_fluid, kinetic_electrons,
kinetic_electrons_with_temperature_equation)
electron_sources .= get_settings_electrons.(ion_sources)
electron_sources = [get_settings_electrons(ion_sources[i]) for i ∈ 1:counter]
else
# this is not very efficient because we're copying the same electron_settings
# for each ion source
push!(electron_sources, get_settings_electrons(get_settings_ions(1, false)))
electron_sources = [get_settings_electrons(get_settings_ions(1, false)) for i ∈ 1:counter]
end

# put all neutral sources into neutral_source_data struct vector
@@ -408,6 +404,10 @@ function get_source_profile(profile_type, width, relative_minimum, coord)
end
end
return profile
elseif profile_type == "wall_exp_decay"
x = coord.grid
return @. (1.0 - relative_minimum) * exp(-(x-x[1]) / width) + relative_minimum +
(1.0 - relative_minimum) * exp(-(x[end]-x) / width) + relative_minimum
else
error("Unrecognised source profile type '$profile_type'.")
end
@@ -572,7 +572,7 @@ function initialize_external_source_amplitude!(moments, external_source_settings
neutral_source_settings = external_source_settings.neutral
for index ∈ eachindex(neutral_source_settings)
if neutral_source_settings[index].active
if neutral_source.source_type == "energy"
if neutral_source_settings[index].source_type == "energy"
@loop_r_z ir iz begin
moments.neutral.external_source_amplitude[iz,ir,index] =
neutral_source_settings[index].source_strength *
@@ -1087,7 +1087,7 @@ function external_neutral_source!(pdf, fvec, moments, neutral_source, index, vze
end


if neutral_source_settings.source_type == "energy"
if neutral_source.source_type == "energy"
# Take particles out of pdf so source does not change density
@loop_sn_r_z_vzeta_vr_vz isn ir iz ivzeta ivr ivz begin
pdf[iveta,ivr,ivz,iz,ir,isn] -= dt * source_amplitude[iz,ir] *