From e0f2f5c262cc045a5c0853a0e09947da125b7082 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Mon, 11 Dec 2023 16:19:00 +0100
Subject: [PATCH] Philippe 11/12/2023: OpenACC: contrav: add condition for data
 present for some variables (available or not depending on the condition)

---
 src/MNH/contrav.f90 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/MNH/contrav.f90 b/src/MNH/contrav.f90
index 8d41cbf3d..c85864a29 100644
--- a/src/MNH/contrav.f90
+++ b/src/MNH/contrav.f90
@@ -669,8 +669,8 @@ CONTAINS
 !  Begin Compute
 !
 
-!$acc data present( PRUT, PRVT, PRWT, PDXX, PDYY, PDZZ, PDZX, PDZY, PRUCT, PRVCT, PRWCT, Z1, Z2 ) &
-!$acc&     present( ZU_EAST, ZV_NORTH, ZDZX_EAST, ZDZY_NORTH )
+!$acc data present( PRUT, PRVT, PRWT, PDXX, PDYY, PDZZ, PDZX, PDZY, PRUCT, PRVCT, PRWCT, Z1, Z2 )
+!$acc data present( ZU_EAST, ZV_NORTH, ZDZX_EAST, ZDZY_NORTH ) if( KADV_ORDER == 4 .AND. .NOT.LFLAT )
 
 IF (GDATA_ON_DEVICE) THEN
 !PW TODO:remplacer (ailleurs aussi...) 1/PDXX... par PINV_PDXX (fait pour la turbulence...) cfr MNH/turb_hor_splt.f90
@@ -948,6 +948,7 @@ END IF
 
 END IF FLAT
 
+!$acc end data
 !$acc end data
 
 !
-- 
GitLab