From 40d6e161bfec06a80165ef7d4233f5122e1e2371 Mon Sep 17 00:00:00 2001
From: Antoine <antoine.hoffmann@epfl.ch>
Date: Mon, 24 Jul 2023 10:11:06 +0200
Subject: [PATCH] Input parameter to impose symmetry on ky=0 modes

---
 src/model_mod.F90 | 7 +++++--
 src/stepon.F90    | 8 ++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/model_mod.F90 b/src/model_mod.F90
index b6502694..1dc386eb 100644
--- a/src/model_mod.F90
+++ b/src/model_mod.F90
@@ -28,9 +28,12 @@ MODULE model
   ! Auxiliary variable
   LOGICAL,  PUBLIC, PROTECTED ::      EM =  .false.   ! Electromagnetic effects flag
   LOGICAL,  PUBLIC, PROTECTED ::  MHD_PD =  .false.   ! MHD pressure drift
-
   ! Removes Landau damping in temperature and higher equation (Ivanov 2022)
   LOGICAL,  PUBLIC, PROTECTED :: RM_LD_T_EQ = .false.
+  ! Flag to force the reality condition symmetry for the kx at ky=0
+  LOGICAL,  PUBLIC, PROTECTED :: FORCE_SYMMETRY = .false.
+
+  ! Module's routines
   PUBLIC :: model_readinputs, model_outputinputs
 
 CONTAINS
@@ -42,7 +45,7 @@ CONTAINS
     USE prec_const
     IMPLICIT NONE
 
-    NAMELIST /MODEL_PAR/ KERN, LINEARITY, RM_LD_T_EQ, &
+    NAMELIST /MODEL_PAR/ KERN, LINEARITY, RM_LD_T_EQ, FORCE_SYMMETRY, &
                          mu_x, mu_y, N_HD, HDz_h, mu_z, mu_p, mu_j, HYP_V, Na,&
                          nu, k_gB, k_cB, lambdaD, MHD_PD, beta, ADIAB_E, ADIAB_I, tau_i
 
diff --git a/src/stepon.F90 b/src/stepon.F90
index af24f831..91a7298b 100644
--- a/src/stepon.F90
+++ b/src/stepon.F90
@@ -110,13 +110,13 @@ CONTAINS
       USE utility,ONLY: is_nan, is_inf
       USE fields, ONLY: phi
       USE MPI
-      USE model,            ONLY: LINEARITY
+      USE model,            ONLY: LINEARITY, FORCE_SYMMETRY
       IMPLICIT NONE
       LOGICAL :: checkf_
       REAL    :: sum_
-      !! Maybe useless
-      IF(LINEARITY .NE. 'linear') CALL anti_aliasing   ! ensure 0 mode for 2/3 rule
-      ! IF(LINEARITY .NE. 'linear') CALL enforce_symmetry ! Enforcing symmetry on kx = 0
+      ! filtering
+      IF(LINEARITY .NE. 'linear') CALL anti_aliasing    ! ensure 0 mode for 2/3 rule
+      IF(FORCE_SYMMETRY)          CALL enforce_symmetry ! Enforcing symmetry on kx = 0 (looks useless)
 
       mlend=.FALSE.
       IF(.NOT.nlend) THEN
-- 
GitLab