diff --git a/moment_kinetics/src/velocity_moments.jl b/moment_kinetics/src/velocity_moments.jl index b515db7c1d..817fdf8460 100644 --- a/moment_kinetics/src/velocity_moments.jl +++ b/moment_kinetics/src/velocity_moments.jl @@ -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 diff --git a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl index 054fe3d6f8..9b0aa3f772 100644 --- a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl +++ b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl @@ -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 @@ -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 @@ -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