Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 11 additions & 3 deletions moment_kinetics/src/velocity_moments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,17 @@ function calculate_ion_qpar_from_pdf!(qpar, density, upar, vth, ff, vpa, vperp,
density[iz,ir]
end
else
@loop_r_z ir iz begin
@. vpa.scratch = vpa.grid - upar[iz,ir]
qpar[iz,ir] = integrate_over_vspace(@view(ff[:,:,iz,ir]), vpa.scratch, 3, vpa.wgts, vperp.grid, 0, vperp.wgts)
if vperp.n > 1
@loop_r_z ir iz begin
# use a copy here as a temporary solution as we only need this change to fix tests.
dummy = copy(ff[:,:,iz,ir])
@views qpar[iz,ir] = get_qpar(ff[:,:,iz,ir], vpa, vperp, upar[iz,ir], dummy)
end
else
@loop_r_z ir iz begin
@. vpa.scratch = vpa.grid - upar[iz,ir]
qpar[iz,ir] = integrate_over_vspace(@view(ff[:,:,iz,ir]), vpa.scratch, 3, vpa.wgts, vperp.grid, 0, vperp.wgts)
end
end
end
return nothing
Expand Down
6 changes: 3 additions & 3 deletions moment_kinetics/test/fokker_planck_time_evolution_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const expected_zero_impose_regularity =
# Expected pperp_ion
[0.719549591157190, 0.535875941382659],
# Expected qpar_ion
[-0.019194164922596, -0.007216264716710],
[-0.019194164922596, -0.009129766611448],
# Expected v_t_ion
[1.021755168637407, 1.034087075929172],
# Expected dSdt_ion
Expand Down Expand Up @@ -111,7 +111,7 @@ expected_data(
# Expected pperp_ion
[0.719320904338625, 0.530989648519366],
# Expected qpar_ion
[-0.018835815833337, -0.003341501709899],
[-0.018835815833337, -0.004102156991540],
# Expected v_t_ion
[1.030335090859288, 1.030335090859291],
# Expected dSdt_ion
Expand Down Expand Up @@ -165,7 +165,7 @@ expected_data(
# Expected pperp_ion
[0.719321198401106, 0.534332235350059],
# Expected qpar_ion
[-0.018835817064195, -0.003073200116913],
[-0.018835817064195, -0.002581443235410],
# Expected v_t_ion
[1.030335250714622, 1.030335250714620],
# Expected dSdt_ion
Expand Down