From 0ee0aa8af86ee52065d88248e3d02870d9bdba7a Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Wed, 8 Dec 2021 11:59:13 +0100
Subject: [PATCH] Philippe 08/12/2021: OpenACC: correct XRU/V/WS updates

---
 src/MNH/ini_modeln.f90 | 1 +
 src/MNH/modeln.f90     | 2 +-
 src/ZSOLVER/modeln.f90 | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/MNH/ini_modeln.f90 b/src/MNH/ini_modeln.f90
index 3103dd951..3cf3c9525 100644
--- a/src/MNH/ini_modeln.f90
+++ b/src/MNH/ini_modeln.f90
@@ -851,6 +851,7 @@ ALLOCATE(XTHT(IIU,IJU,IKU))     ; XTHT = 0.0
 ALLOCATE(XRUS(IIU,IJU,IKU))     ; XRUS = 0.0
 ALLOCATE(XRVS(IIU,IJU,IKU))     ; XRVS = 0.0
 ALLOCATE(XRWS(IIU,IJU,IKU))     ; XRWS = 0.0
+!$acc enter data copyin(XRUS,XRVS,XRWS)
 ALLOCATE(XRUS_PRES(IIU,IJU,IKU)); XRUS_PRES = 0.0
 ALLOCATE(XRVS_PRES(IIU,IJU,IKU)); XRVS_PRES = 0.0
 ALLOCATE(XRWS_PRES(IIU,IJU,IKU)); XRWS_PRES = 0.0
diff --git a/src/MNH/modeln.f90 b/src/MNH/modeln.f90
index 8497080b6..5c14265f0 100644
--- a/src/MNH/modeln.f90
+++ b/src/MNH/modeln.f90
@@ -1740,6 +1740,7 @@ END IF
 !
 ZTIME1 = ZTIME2
 !
+!$acc update self( XRUS, XRVS, XRWS )
 ZRUS=XRUS
 ZRVS=XRVS
 ZRWS=XRWS
@@ -1750,7 +1751,6 @@ if ( .not. l1d ) then
   if ( lbudget_w ) call Budget_store_init( tbudgets(NBUDGET_W), 'PRES', xrws(:, :, :) )
 end if
 
-!$acc update self( XRUS, XRVS, XRWS )
 CALL RAD_BOUND (CLBCX,CLBCY,CTURB,XCARPKMAX,             &
                 XTSTEP,                                  &
                 XDXHAT, XDYHAT, XZHAT,                   &
diff --git a/src/ZSOLVER/modeln.f90 b/src/ZSOLVER/modeln.f90
index d4fe8d0f8..d32a970f6 100644
--- a/src/ZSOLVER/modeln.f90
+++ b/src/ZSOLVER/modeln.f90
@@ -1740,6 +1740,7 @@ END IF
 !
 ZTIME1 = ZTIME2
 !
+!$acc update self( XRUS, XRVS, XRWS )
 ZRUS=XRUS
 ZRVS=XRVS
 ZRWS=XRWS
@@ -1750,7 +1751,6 @@ if ( .not. l1d ) then
   if ( lbudget_w ) call Budget_store_init( tbudgets(NBUDGET_W), 'PRES', xrws(:, :, :) )
 end if
 
-!$acc update self( XRUS, XRVS, XRWS )
 CALL RAD_BOUND (CLBCX,CLBCY,CTURB,XCARPKMAX,             &
                 XTSTEP,                                  &
                 XDXHAT, XDYHAT, XZHAT,                   &
-- 
GitLab