Skip to content

Commit

Permalink
Fix some accidental allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Jun 23, 2022
1 parent 7023930 commit 2fae0b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/neutral_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/r_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/z_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2fae0b8

Please sign in to comment.