From 2fae0b81e8820458c6d24888d9a1f585cbc46690 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Thu, 23 Jun 2022 10:43:47 +0100 Subject: [PATCH] Fix some accidental allocations --- src/neutral_advection.jl | 4 ++-- src/r_advection.jl | 4 ++-- src/z_advection.jl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/neutral_advection.jl b/src/neutral_advection.jl index 97d02b5a4..f61a6f700 100644 --- a/src/neutral_advection.jl +++ b/src/neutral_advection.jl @@ -28,7 +28,7 @@ function neutral_advection_r!(f_out, fvec_in, advect, r, z, vzeta, vr, vz, dt, r @loop_z_vzeta_vr_vz iz ivzeta ivr ivz begin # take the normalized pdf contained in fvec_in.pdf and remove the normalization, # returning the true (un-normalized) particle distribution function in r.scratch - @. r.scratch = fvec_in.pdf_neutral[ivz,ivr,ivzeta,iz,:,isn] + @. r.scratch = @views fvec_in.pdf_neutral[ivz,ivr,ivzeta,iz,:,isn] @views advance_f_local!(f_out[ivz,ivr,ivzeta,iz,:,isn], r.scratch, advect[isn], ivz, ivr, ivzeta, iz, @@ -86,7 +86,7 @@ function neutral_advection_z!(f_out, fvec_in, advect, r, z, vzeta, vr, vz, dt, z @loop_r_vzeta_vr_vz ir ivzeta ivr ivz begin # take the normalized pdf contained in fvec_in.pdf and remove the normalization, # returning the true (un-normalized) particle distribution function in r.scratch - @. z.scratch = fvec_in.pdf_neutral[ivz,ivr,ivzeta,:,ir,isn] + @. z.scratch = @views fvec_in.pdf_neutral[ivz,ivr,ivzeta,:,ir,isn] @views advance_f_local!(f_out[ivz,ivr,ivzeta,:,ir,isn], z.scratch, advect[isn], ivz, ivr, ivzeta, ir, diff --git a/src/r_advection.jl b/src/r_advection.jl index 8e2d8a1d4..2574399d0 100644 --- a/src/r_advection.jl +++ b/src/r_advection.jl @@ -27,7 +27,7 @@ function r_advection!(f_out, fvec_in, fields, advect, r, z, vperp, vpa, @loop_z_vperp_vpa iz ivperp ivpa begin # take the normalized pdf contained in fvec_in.pdf and remove the normalization, # returning the true (un-normalized) particle distribution function in r.scratch - @. r.scratch = fvec_in.pdf[ivpa,ivperp,iz,:,is] + @. r.scratch = @views fvec_in.pdf[ivpa,ivperp,iz,:,is] @views advance_f_local!(f_out[ivpa,ivperp,iz,:,is], r.scratch, advect[is], ivpa, ivperp, iz, @@ -49,7 +49,7 @@ function update_speed_r!(advect, fields, vpa, vperp, z, r, geometry) ExBfac = 0.5*geometry.rstar @inbounds begin @loop_z_vperp_vpa iz ivperp ivpa begin - @views advect.speed[:,ivpa,ivperp,iz] .= ExBfac*fields.Ez[iz,:] + @views @. advect.speed[:,ivpa,ivperp,iz] = ExBfac*fields.Ez[iz,:] end end elseif r.advection.option == "default" && r.n == 1 diff --git a/src/z_advection.jl b/src/z_advection.jl index 2d088e4b6..d7ca2e238 100644 --- a/src/z_advection.jl +++ b/src/z_advection.jl @@ -24,7 +24,7 @@ function z_advection!(f_out, fvec_in, fields, advect, z, vpa, vperp, r, dt, t, z # advance z-advection equation @loop_r_vperp_vpa ir ivperp ivpa begin - @. z.scratch = fvec_in.pdf[ivpa,ivperp,:,ir,is] + @. z.scratch = @views fvec_in.pdf[ivpa,ivperp,:,ir,is] @views advance_f_local!(f_out[ivpa,ivperp,:,ir,is], z.scratch, advect[is], ivpa, ivperp, ir, z, dt, z_spectral) end @@ -47,7 +47,7 @@ function update_speed_z!(advect, fields, vpa, vperp, z, r, t, geometry) @inbounds begin @loop_r_vperp_vpa ir ivperp ivpa begin - @views advect.speed[:,ivpa,ivperp,ir] .= vpa.grid[ivpa]*kpar .+ ExBfac*fields.Er[:,ir] + @views @. advect.speed[:,ivpa,ivperp,ir] = vpa.grid[ivpa]*kpar + ExBfac*fields.Er[:,ir] end end