From 5437ed07bcaaad6f8614fbbd91b90f2fe63c9c6f Mon Sep 17 00:00:00 2001
From: Antoine Cyril David Hoffmann <ahoffman@spcpc606.epfl.ch>
Date: Fri, 15 Jan 2021 14:33:02 +0100
Subject: [PATCH] closure mod adaptation

---
 src/diagnose.F90 | 7 +++++++
 src/stepon.F90   | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/src/diagnose.F90 b/src/diagnose.F90
index fcc362cb..aadba09e 100644
--- a/src/diagnose.F90
+++ b/src/diagnose.F90
@@ -45,6 +45,13 @@ SUBROUTINE diagnose(kstep)
        CALL creatg(fidrst, '/Basic/moments_e', 'electron moments')
        CALL creatg(fidrst, '/Basic/moments_i', 'ion moments')
        CALL creatg(fidrst, '/Basic/phi', 'ES potential')
+       ! Attaching informations about moments
+       CALL attach(fidrst,"/Basic/moments_e/" , "pmaxe", pmaxe)
+       CALL attach(fidrst,"/Basic/moments_e/" , "jmaxe", jmaxe)
+       CALL attach(fidrst,"/Basic/moments_e/" , "Trunc", CLOS)
+       CALL attach(fidrst,"/Basic/moments_i/" , "pmaxi", pmaxi)
+       CALL attach(fidrst,"/Basic/moments_i/" , "jmaxi", jmaxi)
+       CALL attach(fidrst,"/Basic/moments_i/" , "Trunc", CLOS)
 
        IF (my_id .EQ. 0) WRITE(*,'(3x,a,a)') TRIM(rstfile), ' created'
        CALL flush(6)
diff --git a/src/stepon.F90 b/src/stepon.F90
index 56522ca1..a6ee1033 100644
--- a/src/stepon.F90
+++ b/src/stepon.F90
@@ -8,6 +8,7 @@ SUBROUTINE stepon
   USE grid
   USE advance_field_routine, ONLY: advance_time_level, advance_field
   USE model
+  USE closure
   USE utility, ONLY: checkfield
   use prec_const
   IMPLICIT NONE
@@ -38,6 +39,9 @@ SUBROUTINE stepon
         ENDDO
       ENDDO
 
+      ! Closure enforcement
+      CALL apply_closure_model
+
       ! Execution time end
       CALL cpu_time(t1_adv_field)
       tc_adv_field = tc_adv_field + (t1_adv_field - t0_adv_field)
-- 
GitLab