From 0535574fa3ebc735ea7c4bd4ad2359c9d3c0ee66 Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Wed, 28 Jun 2023 10:48:15 +0200
Subject: [PATCH] fix the dmax closure condition

---
 src/closure_mod.F90 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/closure_mod.F90 b/src/closure_mod.F90
index f89bb1f4..8fd9163c 100644
--- a/src/closure_mod.F90
+++ b/src/closure_mod.F90
@@ -29,11 +29,8 @@ SUBROUTINE set_closure_model
   IMPLICIT NONE
   INTEGER :: ip,ij
   ! adapt the dmax if it is set <0
-  IF(dmax .LT. 0) THEN
+  IF(dmax .LT. 0) &
     dmax = MIN(pmax,2*jmax+1)
-  ELSEIF(dmax .GT. (pmax+2*jmax)) THEN
-    ERROR STOP "dmax is higher than the maximal moments degree available"
-  ENDIF
   ! set the evolve mom array
   ALLOCATE(evolve_mom(local_np+ngp,local_nj+ngj))
   SELECT CASE(hierarchy_closure)
@@ -52,9 +49,12 @@ SUBROUTINE set_closure_model
       ENDDO
     ENDDO
   CASE('max_degree')
+    IF (dmax .GT. (pmax+2*jmax)) &
+      ERROR STOP "dmax is higher than the maximal moments degree available"
     DO ip = 1,local_np+ngp
       DO ij = 1, local_nj+ngj
-        evolve_mom(ip,ij) = ((parray(ip).GE.0) .AND. (jarray(ij).GE.0)) .AND. (parray(ip)+2*jarray(ij) .LE. dmax)
+        evolve_mom(ip,ij) = ((parray(ip).GE.0) .AND. (jarray(ij).GE.0)) &
+                      .AND. (parray(ip)+2*jarray(ij) .LE. dmax)
         ! evolve_mom(ip,ij) = (parray(ip).GE.0) .AND. (jarray(ij).GE.0)
         ! evolve_mom(ip,ij) = ((parray(ip)+2*jarray(ij)) .LE. dmax)
         ! evolve_mom(ip,ij) = evolve_mom(ip,ij) .AND. ((parray(ip)+2*jarray(ij)) .LE. dmax)
-- 
GitLab