From 4f44cca54e93bd2250e965651965389d23e3736c Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Tue, 4 Jul 2023 15:56:33 +0200
Subject: [PATCH] Hyp coll coeff are now 1/(P+1) to avoid /0 when P=0

---
 src/grid_mod.F90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/grid_mod.F90 b/src/grid_mod.F90
index 9891b2ac..dbeda1d1 100644
--- a/src/grid_mod.F90
+++ b/src/grid_mod.F90
@@ -363,7 +363,7 @@ CONTAINS
     END DO
     ! Precomputations
     pmax_xp       = real(pmax,xp)
-    diff_p_coeff  = pmax_xp*(1._xp/pmax_xp)**6
+    diff_p_coeff  = pmax_xp*(1._xp/(pmax_xp+1._xp))**6
     ! Overwrite SOLVE_AMPERE flag if beta is zero
     IF(.NOT. EM) THEN
       SOLVE_AMPERE = .FALSE.
@@ -386,7 +386,7 @@ CONTAINS
     local_jmin = jarray(1+ngj/2)
     ! Precomputations
     jmax_xp      = real(jmax,xp)
-    diff_j_coeff = jmax_xp*(1._xp/jmax_xp)**6
+    diff_j_coeff = jmax_xp*(1._xp/(jmax_xp+1._xp))**6
     ! j=0 and j=1 indices
     DO ij = 1,local_nj+ngj
       IF(jarray(ij) .EQ. 0) ij0 = ij
-- 
GitLab