From 655b95141ea6e41c1b9eccd7490fa81dfefb4389 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Wed, 13 Mar 2024 12:45:15 +0000 Subject: [PATCH] Use one-liner instead of defining `geofac` Avoids extra allocation. --- moment_kinetics/src/z_advection.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/moment_kinetics/src/z_advection.jl b/moment_kinetics/src/z_advection.jl index f39fc467f8..8a4a3f2737 100644 --- a/moment_kinetics/src/z_advection.jl +++ b/moment_kinetics/src/z_advection.jl @@ -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