From 614a6100ee14e28f2e01fdbcac27fec8081b08cd Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Mon, 7 Aug 2023 19:16:29 +0200
Subject: [PATCH] Apply and update ExBs

---
 src/stepon.F90 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/stepon.F90 b/src/stepon.F90
index 91a7298b..b511e179 100644
--- a/src/stepon.F90
+++ b/src/stepon.F90
@@ -8,6 +8,7 @@ SUBROUTINE stepon
    use mpi,                   ONLY: MPI_COMM_WORLD
    USE time_integration,      ONLY: ntimelevel
    USE prec_const,            ONLY: xp
+   USE ExB_shear_flow,        ONLY: Apply_ExB_shear_flow, Update_ExB_shear_flow
 #ifdef TEST_SVD
    USE CLA,                  ONLY: test_svd,filter_sv_moments_ky_pj
 #endif
@@ -16,6 +17,14 @@ SUBROUTINE stepon
    INTEGER :: num_step, ierr
    LOGICAL :: mlend
 
+   ! Update the ExB backg. shear flow before the step
+   ! This call includes :
+   !  - the kx grid update
+   !  - the kernel, poisson op. and ampere op update
+   !  - kx-shift of the fields at required ky values
+   !  - the ExB shear value (s(ky)) update for the next time step
+   CALL Apply_ExB_shear_flow
+
    DO num_step=1,ntimelevel ! eg RK4 compute successively k1, k2, k3, k4
       !----- BEFORE: All fields+ghosts are updated for step = n
       ! Compute right hand side from current fields
@@ -70,6 +79,9 @@ SUBROUTINE stepon
 
    END DO
 
+   ! Update the ExB shear flow for the next step
+   CALL Update_ExB_shear_flow
+
 CONTAINS
 !!!! Basic structure to simplify stepon
    SUBROUTINE assemble_RHS
-- 
GitLab