Skip to content

Commit

Permalink
Use one-liner instead of defining geofac
Browse files Browse the repository at this point in the history
Avoids extra allocation.
  • Loading branch information
johnomotani authored Mar 13, 2024
1 parent 7ddf1a2 commit 655b951
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions moment_kinetics/src/z_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ function update_speed_z!(advect, upar, vth, evolve_upar, evolve_ppar, fields, vp
# vpa bzed
@. @views advect.speed[:,ivpa,ivperp,ir] = vpa.grid[ivpa]*bzed[:,ir]
# ExB drift
@. geofac = bzeta[:,ir]*jacobian[:,ir]/Bmag[:,ir]
@. @views advect.speed[:,ivpa,ivperp,ir] += ExBfac*geofac*fields.Er[:,ir]
@. @views advect.speed[:,ivpa,ivperp,ir] += ExBfac*bzeta[:,ir]*jacobian[:,ir]/Bmag[:,ir]*fields.Er[:,ir]
# magnetic curvature drift
@. @views advect.speed[:,ivpa,ivperp,ir] += rhostar*(vpa.grid[ivpa]^2)*cvdriftz[:,ir]
# magnetic grad B drift
Expand Down

0 comments on commit 655b951

Please sign in to comment.