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

Final transfer version #306

Merged
merged 58 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e6676ef
Update naming of update_qpar for ions to be update_ion_qpar, in line …
LucasMontoya4 Sep 18, 2024
53a673c
Add ion_physics flag to determine drift_kinetic, gyrokinetic or bragi…
LucasMontoya4 Sep 18, 2024
6f6df74
Update gyrokinetic flag uses throughout the repo, so that instead of …
LucasMontoya4 Sep 18, 2024
e92dc5c
Some of the Braginskii functionality (unfinished)
LucasMontoya4 Sep 19, 2024
f92f20f
Merge branch 'master' into ion_flags
LucasMontoya4 Sep 19, 2024
a0e2b20
Merge branch 'ion_flags' into ion_braginskii_fluid
LucasMontoya4 Sep 19, 2024
1dbf661
Make initialisation for braginskii ion heat flux be calculated from u…
LucasMontoya4 Sep 19, 2024
77a30c1
Merge branch 'master' into ion_braginskii_fluid
LucasMontoya4 Sep 19, 2024
3b9bc66
Add braginskii heat flux formula by adding an ion dT_dz component in …
LucasMontoya4 Sep 20, 2024
1d8b559
add loop to allow n_neutral_species = 0 and CFL plots to still be mad…
LucasMontoya4 Sep 20, 2024
bb64609
Merge branch 'master' into ion_braginskii_fluid
LucasMontoya4 Sep 20, 2024
77cce1a
Move order of krook_collisions.jl inclusion to allow velocity_moments…
LucasMontoya4 Sep 20, 2024
18cd33e
Add plotting for collisionality (comparing gradient scale lengths to …
LucasMontoya4 Sep 21, 2024
9a1e30a
Add comparison plots functionality for collisionality_plots, and add …
LucasMontoya4 Sep 23, 2024
0e28693
Add comments to boundary condition of braginskii heat flux, and add d…
LucasMontoya4 Sep 23, 2024
5ef19bd
Fix bug during restarts to allow for multiple sources while external_…
LucasMontoya4 Sep 23, 2024
4213c52
Make collisionality_plots plot the last timestep value (which was ori…
LucasMontoya4 Sep 23, 2024
6fc4c76
Merge branch 'master' into ion_braginskii_fluid
LucasMontoya4 Sep 23, 2024
14e510d
Merge branch 'master' into ion_braginskii_fluid
johnomotani Sep 26, 2024
701ab84
Add option of overlaying what the Braginskii heat flux would be for t…
LucasMontoya4 Sep 27, 2024
0e6d395
Add option for super Gaussian with decay of 4th power instead of seco…
LucasMontoya4 Sep 27, 2024
b2b001d
Merge branch 'master' into ion_braginskii_fluid
LucasMontoya4 Sep 27, 2024
9d92ca2
Fix typo when energy source used
LucasMontoya4 Sep 28, 2024
fab3f8a
Don't plot braginskii overlay if the original simulation itself was a…
LucasMontoya4 Sep 30, 2024
8e5ecd9
Add string to braginskii_overlay system to tell you its an overlay, w…
LucasMontoya4 Oct 1, 2024
78bf27e
Merge branch 'ion_braginskii_fluid' of github.com:mabarnes/moment_kin…
LucasMontoya4 Oct 1, 2024
8309e99
Fix PI_controller file io for option
LucasMontoya4 Oct 3, 2024
0062ca8
Edit PI_controller for density_midpoint_control option to begin the s…
LucasMontoya4 Oct 3, 2024
1394626
remove printing function that was used for debugging
LucasMontoya4 Oct 3, 2024
22f91bd
Change naming from Braginskii_ions to coll_krook_ions, and change ins…
LucasMontoya4 Oct 3, 2024
0462f32
Don't evolve shape function if heat flux closure comes from coll_kroo…
LucasMontoya4 Oct 3, 2024
7348809
Allow collisionality_plots to animate comparison runs with different …
LucasMontoya4 Oct 4, 2024
dc627cf
add neutral controller_integral file_io.jl bug fix (ion version was f…
LucasMontoya4 Oct 4, 2024
44ee25a
skip chodura condition check in coll_krook fluid ion case, so that ng…
LucasMontoya4 Oct 6, 2024
1b1cac1
Merge branch 'master' into remove_redundant_shapefn_evolution
LucasMontoya4 Oct 6, 2024
bc7401d
change gamma back to 2, and change the boundary condition for heat fl…
LucasMontoya4 Oct 7, 2024
8155690
Create new module for collision_frequency calculations, so that krook…
LucasMontoya4 Oct 7, 2024
66cbcc1
Change gamma_i to 2.5, from Stangeby (25.2)
LucasMontoya4 Oct 7, 2024
eb01872
Add temperature_midpoint_control source option. This will change the …
LucasMontoya4 Oct 9, 2024
b8d8b6b
Merge branch 'master' into remove_redundant_shapefn_evolution
LucasMontoya4 Oct 9, 2024
499b9ec
Change gamma_i boundary condition for coll_krook heat flux closure de…
LucasMontoya4 Oct 15, 2024
06dcf5d
Correction to heat flux itself, should be 1D instead of 3D calculation
LucasMontoya4 Oct 31, 2024
63321ad
Include all input files that I made for transfer, and the files that …
LucasMontoya4 Jan 7, 2025
b65ac35
Add tests for multi source functionality and PI controllers
LucasMontoya4 Jan 8, 2025
c91c51e
small changes
LucasMontoya4 Jan 8, 2025
f870002
Merge remote-tracking branch 'origin/master' into final_transfer_version
LucasMontoya4 Jan 8, 2025
124a715
Merge branch 'master' of github.com:mabarnes/moment_kinetics into fin…
LucasMontoya4 Jan 13, 2025
a227169
Merge branch 'master' into final_transfer_version
LucasMontoya4 Jan 14, 2025
1dd6046
Merge remote-tracking branch 'origin/master' into final_transfer_version
LucasMontoya4 Jan 14, 2025
96032af
move transfer input files from examples to publication inputs folder
LucasMontoya4 Jan 14, 2025
b3c5f7f
Add a couple of example multi source files with a collisional closure…
LucasMontoya4 Jan 14, 2025
eabb5e9
deleted transfer input files as they were moved
LucasMontoya4 Jan 14, 2025
e3035b3
Add docs page for collision_frequencies.jl
LucasMontoya4 Jan 14, 2025
bed3de4
remove example files so they are not run by remote server checks
LucasMontoya4 Jan 16, 2025
611c284
Change input file for multi source tests to only include 2 tests, whi…
LucasMontoya4 Jan 16, 2025
41a17b1
Comment out julia-actions/cache in documentation CI job
johnomotani Jan 16, 2025
1553fa6
Fix MPI in setup_external_sources!() when `ignore_MPI = true`
johnomotani Jan 17, 2025
af475cc
Apply suggestions from code review
johnomotani Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: julia-actions/setup-julia@latest
with:
version: '1.10'
- uses: julia-actions/cache@v2
#- uses: julia-actions/cache@v2
- name: Install dependencies
run: |
# Version 3.9.0 of matplotlib causes an error with PyPlot.jl, so pin
Expand Down
6 changes: 6 additions & 0 deletions docs/src/zz_collision_frequencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
`collision_frequencies`
=================

```@autodocs
Modules = [moment_kinetics.collision_frequencies]
```
2 changes: 1 addition & 1 deletion examples/gk-ions/2D-periodic-gk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ discretization = "chebyshev_pseudospectral"
n_ion_species = 1
n_neutral_species = 0
electron_physics = "boltzmann_electron_response"
gyrokinetic_ions = true
ion_physics = "gyrokinetic_ions"
T_e = 1.0
T_wall = 1.0

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion moment_kinetics/debug_test/gyroaverage_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_input = OptionsDict(
"output" => OptionsDict("run_name" => "gyroaverage"),
"composition" => OptionsDict("n_ion_species" => 1,
"n_neutral_species" => 0,
"gyrokinetic_ions" => true,
"ion_physics" => "gyrokinetic_ions",
"T_e" => 1.0,
"T_wall" => 1.0),
"evolve_moments" => OptionsDict("density" => false,
Expand Down
118 changes: 118 additions & 0 deletions moment_kinetics/src/collision_frequencies.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
module collision_frequencies

export get_collision_frequency_ii, get_collision_frequency_ee, get_collision_frequency_ei

using ..reference_parameters: get_reference_collision_frequency_ii,
get_reference_collision_frequency_ee,
get_reference_collision_frequency_ei
using ..reference_parameters: setup_reference_parameters

"""
get_collision_frequency_ii(collisions, n, vth)

Calculate the ion-ion collision frequency, depending on the settings/parameters in
`collisions`, for the given density `n` and thermal speed `vth`.

`n` and `vth` may be scalars or arrays, but should have shapes that can be broadcasted
together.
"""
function get_collision_frequency_ii(collisions, n, vth)
# extract krook options from collisions struct
colk = collisions.krook
nuii0 = colk.nuii0
frequency_option = colk.frequency_option
if frequency_option ∈ ("reference_parameters", "collisionality_scan")
return @. nuii0 * n * vth^(-3)
elseif frequency_option == "manual"
# Include 0.0*n so that the result gets promoted to an array if n is an array,
# which hopefully means this function will have a fixed return type given the
# types of the arguments (we don't want to be 'type unstable' for array inputs by
# returning a scalar from this branch but an array from the "reference_parameters"
# branch).
return @. nuii0 + 0.0 * n
elseif frequency_option == "none"
# Include 0.0*n so that the result gets promoted to an array if n is an array,
# which hopefully means this function will have a fixed return type given the
# types of the arguments (we don't want to be 'type unstable' for array inputs by
# returning a scalar from this branch but an array from the "reference_parameters"
# branch).
return @. 0.0 * n
else
error("Unrecognised option [krook_collisions] "
* "frequency_option=$(frequency_option)")
end
end

"""
get_collision_frequency_ee(collisions, n, vthe)

Calculate the electron-electron collision frequency, depending on the settings/parameters
in `collisions`, for the given density `n` and electron thermal speed `vthe`.

`n` and `vthe` may be scalars or arrays, but should have shapes that can be broadcasted
together.
"""
function get_collision_frequency_ee(collisions, n, vthe)
# extract krook options from collisions struct
colk = collisions.krook
nuee0 = colk.nuee0
frequency_option = colk.frequency_option
if frequency_option == "reference_parameters"
return @. nuee0 * n * vthe^(-3)
elseif frequency_option == "manual"
# Include 0.0*n so that the result gets promoted to an array if n is an array,
# which hopefully means this function will have a fixed return type given the
# types of the arguments (we don't want to be 'type unstable' for array inputs by
# returning a scalar from this branch but an array from the "reference_parameters"
# branch).
return @. nuee0 + 0.0 * n
elseif frequency_option == "none"
# Include 0.0*n so that the result gets promoted to an array if n is an array,
# which hopefully means this function will have a fixed return type given the
# types of the arguments (we don't want to be 'type unstable' for array inputs by
# returning a scalar from this branch but an array from the "reference_parameters"
# branch).
return @. 0.0 * n
else
error("Unrecognised option [krook_collisions] "
* "frequency_option=$(frequency_option)")
end
end

"""
get_collision_frequency_ei(collisions, n, vthe)

Calculate the electron-electron collision frequency, depending on the settings/parameters
in `collisions`, for the given density `n` and electron thermal speed `vthe`.

`n` and `vthe` may be scalars or arrays, but should have shapes that can be broadcasted
together.
"""
function get_collision_frequency_ei(collisions, n, vthe)
# extract krook options from collisions struct
colk = collisions.krook
nuei0 = colk.nuei0
frequency_option = colk.frequency_option
if frequency_option == "reference_parameters"
return @. nuei0 * n * vthe^(-3)
elseif frequency_option == "manual"
# Include 0.0*n so that the result gets promoted to an array if n is an array,
# which hopefully means this function will have a fixed return type given the
# types of the arguments (we don't want to be 'type unstable' for array inputs by
# returning a scalar from this branch but an array from the "reference_parameters"
# branch).
return @. nuei0 + 0.0 * n
elseif frequency_option == "none"
# Include 0.0*n so that the result gets promoted to an array if n is an array,
# which hopefully means this function will have a fixed return type given the
# types of the arguments (we don't want to be 'type unstable' for array inputs by
# returning a scalar from this branch but an array from the "reference_parameters"
# branch).
return @. 0.0 * n
else
error("Unrecognised option [krook_collisions] "
* "frequency_option=$(frequency_option)")
end
end

end
6 changes: 3 additions & 3 deletions moment_kinetics/src/electron_kinetic_equation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ using ..external_sources: total_external_electron_sources!,
add_total_external_electron_source_to_v_only_Jacobian!,
add_total_external_electron_source_to_z_only_Jacobian!
using ..file_io: get_electron_io_info, write_electron_state, finish_electron_io
using ..krook_collisions: electron_krook_collisions!, get_collision_frequency_ee,
get_collision_frequency_ei,
add_electron_krook_collisions_to_Jacobian!,
using ..collision_frequencies: get_collision_frequency_ee,
get_collision_frequency_ei
using ..krook_collisions: electron_krook_collisions!, add_electron_krook_collisions_to_Jacobian!,
add_electron_krook_collisions_to_v_only_Jacobian!,
add_electron_krook_collisions_to_z_only_Jacobian!
using ..timer_utils
Expand Down
2 changes: 1 addition & 1 deletion moment_kinetics/src/em_fields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function update_phi!(fields, fvec, vperp, z, r, composition, collisions, moments
end

# get gyroaveraged field arrays for distribution function advance
gkions = composition.gyrokinetic_ions
gkions = composition.ion_physics == gyrokinetic_ions
if gkions
gyroaverage_field!(fields.gphi,fields.phi,gyroavs,vperp,z,r,composition)
gyroaverage_field!(fields.gEz,fields.Ez,gyroavs,vperp,z,r,composition)
Expand Down
Loading
Loading