Repository navigation
Equilibrium - BUGFIX - Build the two-pass ψ grid from kinetic profiles that have no omega_E #617
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
Changes from all commits
c05b2ba
2caf1d0
fc9d9bb
5f7d413
4bba6e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,11 +170,18 @@ function compute_calculated_kinetic_matrices( | |
| end | ||
|
|
||
| # The force-balance solve's two-pass grid inputs: the kinetic profiles as the KineticForces model views them (its | ||
| # control when the source is one, else the default control) and the kinetic-resonance surfaces to pin. | ||
| # control when the source is one, else the default control) and the kinetic-resonance surfaces to pin. The model | ||
| # needs the NTV view, so a missing profile errors; otherwise profiles read for another consumer (e.g. SLAYER without | ||
| # omega_E) are left out and the grid follows the equilibrium alone. | ||
| function ForceFreeStates.kinetic_grid_inputs(source, ctrl, equil, intr; rationals) | ||
| kf_ctrl = source isa KineticForcesControl ? source : KineticForcesControl() | ||
| kinetic_profiles = ntv_profiles(kf_ctrl, equil) | ||
| pinned = resonance_grid_nodes(ctrl, kf_ctrl, kinetic_profiles, ntv_species(kf_ctrl, equil), equil, intr; rationals) | ||
| data = equil.kinetic | ||
| ntv = source isa KineticForcesControl || (data !== nothing && Equilibrium.has_ntv_fields(data)) | ||
| data !== nothing && !ntv && | ||
| @info "Two-pass psi grid: the kinetic profiles lack an NTV field (n_e, T_i, T_e, omega_E), so the grid follows the equilibrium alone" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| kinetic_profiles = ntv ? ntv_profiles(kf_ctrl, equil) : nothing | ||
| species = ntv ? ntv_species(kf_ctrl, equil) : nothing | ||
| pinned = resonance_grid_nodes(ctrl, kf_ctrl, kinetic_profiles, species, equil, intr; rationals) | ||
| return kinetic_profiles, pinned | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,6 +164,22 @@ using HDF5 | |
| ideal = GPEC.maybe_reform_equilibrium(pass1, sl_intr, sl_ctrl) | ||
| pass1.kinetic = kinetic | ||
| @test refined.rzphi_xs != ideal.rzphi_xs | ||
| # Profiles without omega_E (read for SLAYER, say) cannot form the NTV view: the grid follows the | ||
| # equilibrium alone, unless the run computes calculated kinetic matrices, which need it. | ||
| no_omega = GPEC.Equilibrium.KineticProfileData(; psi=kinetic.psi, n_i=kinetic.n_i, n_e=kinetic.n_e, | ||
| T_i=kinetic.T_i, T_e=kinetic.T_e, chi_e=kinetic.chi_e, chi_i=kinetic.chi_i, chi_phi=kinetic.chi_phi) | ||
| @test GPEC.Equilibrium.has_ntv_fields(kinetic) | ||
| @test !GPEC.Equilibrium.has_ntv_fields(no_omega) | ||
| pass1.kinetic = no_omega | ||
| no_omega_grid = GPEC.maybe_reform_equilibrium(pass1, sl_intr, sl_ctrl) | ||
| @test no_omega_grid.kinetic === no_omega | ||
| @test no_omega_grid.rzphi_xs == ideal.rzphi_xs | ||
| calc_deck = merge(sl_deck, Dict("ForceFreeStates" => merge(sl_deck["ForceFreeStates"], Dict("kinetic" => "KineticForces")))) | ||
| calc_ctrl = GPEC.force_balance_control(calc_deck, sl_dir) | ||
| @test_throws "missing required 'omega_E'" GPEC.maybe_reform_equilibrium(pass1, sl_intr, calc_ctrl) | ||
| # The KineticForces source stops up front, before any solve. | ||
| @test_throws "omega_E" solve(pass1, FFS.Forward(); nn=1, kinetic=GPEC.KineticForcesControl()) | ||
|
Comment on lines
+179
to
+181
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an issue: since Julia 1.8, |
||
| pass1.kinetic = kinetic | ||
| end | ||
|
|
||
| @testset "galerkin solve returns a gal result with a unified delta_prime" begin | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair, but leaving it for now. The message lists the four required fields, and if the run got further,
kinetic_profile_splineswould name the missing dataset itself. Changing the wording now would touchsrc/and invalidate the harness stamp that is running for the v2.0 deadline. Happy to take it as a follow-up.