diff --git a/src/MNH/rain_ice.f90 b/src/MNH/rain_ice.f90 index 095d04b4575cda19f468f38fa38992c6ccaa7662..54ce816080ddee0a734908fd56d67a791beafc6d 100644 --- a/src/MNH/rain_ice.f90 +++ b/src/MNH/rain_ice.f90 @@ -535,7 +535,7 @@ GMICRO(:,:,:) = .FALSE. PRGT(IIB:IIE,IJB:IJE,IKTB:IKTE)>XRTMIN(6) END IF !$acc end kernels -!$acc update self(GMICRO) +!$acc update self(GMICRO) !used in BUDGET #ifndef _OPENACC IMICRO = COUNTJV3D( GMICRO(:,:,:),I1(:),I2(:),I3(:)) @@ -654,7 +654,7 @@ IF( IMICRO >= 0 ) THEN ZRHODJ(JL) = PRHODJ(I1(JL),I2(JL),I3(JL)) END DO !$acc end kernels -!$acc update self(ZRHODJ) +!$acc update self(ZRHODJ) !used in BUDGET END IF ! CALL RAIN_ICE_SLOW @@ -755,15 +755,12 @@ IF( IMICRO >= 0 ) THEN PCIT(I1(JL),I2(JL),I3(JL)) = ZCIT(JL) END DO !$acc end kernels -!$acc update self(PRVS,PRCS,PRRS,PRIS,PRSS,PRGS,PTHS) IF ( KRR == 7 ) THEN -!$acc update device(ZRHS) !$acc kernels DO JL=1,IMICRO PRHS(I1(JL),I2(JL),I3(JL)) = ZRHS(JL) END DO !$acc end kernels -!$acc update self(PRHS) END IF #endif ! @@ -1466,9 +1463,6 @@ END IF END DO !$acc update self(PRRS,PRSS,PRGS,PRIS) #ifdef _OPENACC -IF (OSEDIC) THEN -!$acc update self(PRCS) -END IF IF (KRR==7) THEN !$acc update self(PRHS) END IF @@ -1486,8 +1480,10 @@ IF (KRR == 7 .AND. (ILENALLOCH .GT. 0 )) DEALLOCATE(ZRHODREFH,ZRHS,ILISTH) ! !* 2.3 budget storage ! -IF (LBUDGET_RC .AND. OSEDIC) & +IF (LBUDGET_RC .AND. OSEDIC) THEN +!$acc update self(PRCS) CALL BUDGET (PRCS(:,:,:)*PRHODJ(:,:,:),7 ,'SEDI_BU_RRC') +END IF IF (LBUDGET_RR) CALL BUDGET (PRRS(:,:,:)*PRHODJ(:,:,:),8 ,'SEDI_BU_RRR') IF (LBUDGET_RI) CALL BUDGET (PRIS(:,:,:)*PRHODJ(:,:,:),9 ,'SEDI_BU_RRI') IF (LBUDGET_RS) CALL BUDGET (PRSS(:,:,:)*PRHODJ(:,:,:),10,'SEDI_BU_RRS') @@ -1588,7 +1584,6 @@ ENDIF ZRTMIN(:) = XRTMIN(:) * ZINVTSTEP -!$acc update device(ZRTMIN) ! IF (OSEDIC) THEN ZPRCS(:,:,:) = 0.0 @@ -2193,7 +2188,6 @@ IF( INEGT >= 1 ) THEN PCIT(:,:,:) = MAX( ZW(:,:,:), PCIT(:,:,:) ) !$acc end kernels #endif -!$acc update self(PRIS,PRVS,PTHS) END IF DEALLOCATE(ZSSI) DEALLOCATE(ZUSW) @@ -2243,17 +2237,19 @@ IMPLICIT NONE ZTHS(:) = ZTHS(:) + ZZW(:)*(ZLSFACT(:)-ZLVFACT(:)) ! f(L_f*(RCHONI)) ENDWHERE !$acc end kernels -!$acc update self(ZTHS,ZRCS,ZRIS) -! - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'HON_BU_RTH') - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'HON_BU_RRC') - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'HON_BU_RRI') +! + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'HON_BU_RTH') + END IF + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 7,'HON_BU_RRC') + END IF + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'HON_BU_RRI') + END IF ! !* 3.3 compute the spontaneous freezing source: RRHONG ! @@ -2267,17 +2263,19 @@ IMPLICIT NONE ZTHS(:) = ZTHS(:) + ZZW(:)*(ZLSFACT(:)-ZLVFACT(:)) ! f(L_f*(RRHONG)) ENDWHERE !$acc end kernels -!$acc update self(ZTHS,ZRRS,ZRGS) -! - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'SFR_BU_RTH') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'SFR_BU_RRR') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'SFR_BU_RRG') +! + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'SFR_BU_RTH') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 8,'SFR_BU_RRR') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'SFR_BU_RRG') + END IF ! !* 3.4 compute the deposition, aggregation and autoconversion sources ! @@ -2344,16 +2342,18 @@ IMPLICIT NONE ZTHS(:) = ZTHS(:) + ZZW(:)*ZLSFACT(:) END WHERE !$acc end kernels -!$acc update self(ZTHS,ZRVS,ZRSS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'DEPS_BU_RTH') - IF (LBUDGET_RV) CALL BUDGET ( & - UNPACK(ZRVS(:),MASK=GMICRO(:,:,:),FIELD=PRVS)*PRHODJ(:,:,:), & - 6,'DEPS_BU_RRV') - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'DEPS_BU_RRS') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'DEPS_BU_RTH') + END IF + IF (LBUDGET_RV) THEN +!$acc update self(ZRVS) + CALL BUDGET (UNPACK(ZRVS(:),MASK=GMICRO(:,:,:),FIELD=PRVS)*PRHODJ(:,:,:),6,'DEPS_BU_RRV') + END IF + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 10,'DEPS_BU_RRS') + END IF ! !* 3.4.4 compute the aggregation on r_s: RIAGGS ! @@ -2376,13 +2376,14 @@ IMPLICIT NONE ZRIS(:) = ZRIS(:) - ZZW(:) END WHERE !$acc end kernels -!$acc update self(ZRIS,ZRSS) - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'AGGS_BU_RRI') - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'AGGS_BU_RRS') + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'AGGS_BU_RRI') + END IF + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),10,'AGGS_BU_RRS') + END IF ! !* 3.4.5 compute the autoconversion of r_i for r_s production: RIAUTS ! @@ -2407,14 +2408,15 @@ IMPLICIT NONE ZRIS(:) = ZRIS(:) - ZZW(:) END WHERE !$acc end kernels -!$acc update self(ZRIS,ZRSS) DEALLOCATE(ZCRIAUTI) - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'AUTS_BU_RRI') - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'AUTS_BU_RRS') + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'AUTS_BU_RRI') + END IF + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),10,'AUTS_BU_RRS') + END IF ! !* 3.4.6 compute the deposition on r_g: RVDEPG ! @@ -2444,16 +2446,18 @@ IMPLICIT NONE ZTHS(:) = ZTHS(:) + ZZW(:)*ZLSFACT(:) END WHERE !$acc end kernels -!$acc update self(ZTHS,ZRVS,ZRGS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'DEPG_BU_RTH') - IF (LBUDGET_RV) CALL BUDGET ( & - UNPACK(ZRVS(:),MASK=GMICRO(:,:,:),FIELD=PRVS)*PRHODJ(:,:,:), & - 6,'DEPG_BU_RRV') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'DEPG_BU_RRG') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), 4,'DEPG_BU_RTH') + END IF + IF (LBUDGET_RV) THEN +!$acc update self(ZRVS) + CALL BUDGET (UNPACK(ZRVS(:),MASK=GMICRO(:,:,:),FIELD=PRVS)*PRHODJ(:,:,:), 6,'DEPG_BU_RRV') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'DEPG_BU_RRG') + END IF ! END SUBROUTINE RAIN_ICE_SLOW ! @@ -2513,14 +2517,15 @@ REAL :: ZCRIAUTC ! Critical cloud mixing ratio END WHERE END IF !$acc end kernels -!$acc update self(ZRCS,ZRRS) ! - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'AUTO_BU_RRC') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'AUTO_BU_RRR') + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),7,'AUTO_BU_RRC') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),8,'AUTO_BU_RRR') + END IF ! !* 4.3 compute the accretion of r_c for r_r production: RCACCR ! @@ -2541,13 +2546,14 @@ REAL :: ZCRIAUTC ! Critical cloud mixing ratio ZRRS(:) = ZRRS(:) + ZZW(:) END WHERE !$acc end kernels -!$acc update self(ZRCS,ZRRS) - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'ACCR_BU_RRC') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'ACCR_BU_RRR') + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),7,'ACCR_BU_RRC') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),8,'ACCR_BU_RRR') + END IF ! !* 4.4 compute the evaporation of r_r: RREVAV ! @@ -2578,16 +2584,18 @@ REAL :: ZCRIAUTC ! Critical cloud mixing ratio ZTHS(:) = ZTHS(:) - ZZW(:)*ZLVFACT(:) END WHERE !$acc end kernels -!$acc update self(ZTHS,ZRVS,ZRRS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'REVA_BU_RTH') - IF (LBUDGET_RV) CALL BUDGET ( & - UNPACK(ZRVS(:),MASK=GMICRO(:,:,:),FIELD=PRVS)*PRHODJ(:,:,:), & - 6,'REVA_BU_RRV') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'REVA_BU_RRR') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'REVA_BU_RTH') + END IF + IF (LBUDGET_RV) THEN +!$acc update self(ZRVS) + CALL BUDGET (UNPACK(ZRVS(:),MASK=GMICRO(:,:,:),FIELD=PRVS)*PRHODJ(:,:,:),6,'REVA_BU_RRV') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 8,'REVA_BU_RRR') + END IF #ifndef _OPENACC PEVAP3D(:,:,:)=UNPACK(ZZW(:),MASK=GMICRO(:,:,:),FIELD=0.0) @@ -2748,24 +2756,27 @@ INTEGER :: JL ! and PACK intrinsics ZTHS(:) = ZTHS(:) + ZZW1(:,2)*(ZLSFACT(:)-ZLVFACT(:)) ! f(L_f*(RCRIMSG)) END WHERE !$acc end kernels -!$acc update self(ZTHS,ZRCS,ZRSS,ZRGS) DEALLOCATE(IVEC2) DEALLOCATE(IVEC1) DEALLOCATE(ZVEC2) DEALLOCATE(ZVEC1) END IF - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'RIM_BU_RTH') - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'RIM_BU_RRC') - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'RIM_BU_RRS') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'RIM_BU_RRG') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), 4,'RIM_BU_RTH') + END IF + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 7,'RIM_BU_RRC') + END IF + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 10,'RIM_BU_RRS') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'RIM_BU_RRG') + END IF DEALLOCATE(GRIM) ! !* 5.2 rain accretion onto the aggregates @@ -2950,7 +2961,6 @@ INTEGER :: JL ! and PACK intrinsics ! f(L_f*(RRACCSG)) END WHERE !$acc end kernels -!$acc update self(ZRRS,ZRSS,ZRGS,ZTHS) DEALLOCATE(IVEC2) DEALLOCATE(IVEC1) DEALLOCATE(ZVEC3) @@ -2958,18 +2968,22 @@ INTEGER :: JL ! and PACK intrinsics DEALLOCATE(ZVEC1) END IF DEALLOCATE(GACC) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'ACC_BU_RTH') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'ACC_BU_RRR') - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'ACC_BU_RRS') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'ACC_BU_RRG') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), 4,'ACC_BU_RTH') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 8,'ACC_BU_RRR') + END IF + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 10,'ACC_BU_RRS') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'ACC_BU_RRG') + END IF ! !* 5.3 Conversion-Melting of the aggregates ! @@ -3008,13 +3022,14 @@ INTEGER :: JL ! and PACK intrinsics ZRGS(:) = ZRGS(:) + ZZW(:) END WHERE !$acc end kernels -!$acc update self(ZRSS,ZRGS) - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'CMEL_BU_RRS') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'CMEL_BU_RRG') + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),10,'CMEL_BU_RRS') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0),11,'CMEL_BU_RRG') + END IF ! END SUBROUTINE RAIN_ICE_FAST_RS ! @@ -3063,19 +3078,22 @@ INTEGER,DIMENSION(:),ALLOCATABLE :: I1 ZTHS(:) = ZTHS(:) + ZZW1(:,4)*(ZLSFACT(:)-ZLVFACT(:)) ! f(L_f*RRCFRIG) END WHERE !$acc end kernels -!$acc update self(ZRIS,ZRRS,ZRGS,ZTHS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'CFRZ_BU_RTH') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'CFRZ_BU_RRR') - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'CFRZ_BU_RRI') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'CFRZ_BU_RRG') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), 4,'CFRZ_BU_RTH') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 8,'CFRZ_BU_RRR') + END IF + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'CFRZ_BU_RRI') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'CFRZ_BU_RRG') + END IF ! !* 6.2 compute the Dry growth case ! @@ -3415,29 +3433,35 @@ INTEGER,DIMENSION(:),ALLOCATABLE :: I1 END WHERE END IF !$acc end kernels -!$acc update self(ZRCS,ZRIS,ZRSS,ZRGS,ZRRS,ZTHS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'WETG_BU_RTH') - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'WETG_BU_RRC') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'WETG_BU_RRR') - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'WETG_BU_RRI') - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'WETG_BU_RRS') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'WETG_BU_RRG') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'WETG_BU_RTH') + END IF + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 7,'WETG_BU_RRC') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 8,'WETG_BU_RRR') + END IF + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'WETG_BU_RRI') + END IF + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 10,'WETG_BU_RRS') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'WETG_BU_RRG') + END IF IF ( KRR == 7 ) THEN - IF (LBUDGET_RH) CALL BUDGET ( & - UNPACK(ZRHS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 12,'WETG_BU_RRH') + IF (LBUDGET_RH) THEN +!$acc update self(ZRHS) + CALL BUDGET(UNPACK(ZRHS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 12,'WETG_BU_RRH') + END IF END IF ! @@ -3454,25 +3478,30 @@ INTEGER,DIMENSION(:),ALLOCATABLE :: I1 ! f(L_f*(RCDRYG+RRDRYG)) END WHERE !$acc end kernels -!$acc update self(ZRCS,ZRIS,ZRSS,ZRRS,ZRGS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'DRYG_BU_RTH') - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'DRYG_BU_RRC') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'DRYG_BU_RRR') - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'DRYG_BU_RRI') - IF (LBUDGET_RS) CALL BUDGET ( & - UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 10,'DRYG_BU_RRS') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'DRYG_BU_RRG') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'DRYG_BU_RTH') + END IF + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 7,'DRYG_BU_RRC') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 8,'DRYG_BU_RRR') + END IF + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'DRYG_BU_RRI') + END IF + IF (LBUDGET_RS) THEN +!$acc update self(ZRSS) + CALL BUDGET (UNPACK(ZRSS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 10,'DRYG_BU_RRS') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'DRYG_BU_RRG') + END IF ! ! WHERE ( ZZT(:) > XTT ) ! RSWETG case only ! ZRSS(:) = ZRSS(:) - ZZW1(:,6) @@ -3513,16 +3542,18 @@ INTEGER,DIMENSION(:),ALLOCATABLE :: I1 ZTHS(:) = ZTHS(:) - ZZW(:)*(ZLSFACT(:)-ZLVFACT(:)) ! f(L_f*(-RGMLTR)) END WHERE !$acc end kernels -!$acc update self(ZRRS,ZRGS,ZTHS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'GMLT_BU_RTH') - IF (LBUDGET_RR) CALL BUDGET ( & - UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 8,'GMLT_BU_RRR') - IF (LBUDGET_RG) CALL BUDGET ( & - UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 11,'GMLT_BU_RRG') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'GMLT_BU_RTH') + END IF + IF (LBUDGET_RR) THEN +!$acc update self(ZRRS) + CALL BUDGET (UNPACK(ZRRS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 8,'GMLT_BU_RRR') + END IF + IF (LBUDGET_RG) THEN +!$acc update self(ZRGS) + CALL BUDGET (UNPACK(ZRGS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 11,'GMLT_BU_RRG') + END IF ! DEALLOCATE(I1) ! @@ -3870,16 +3901,18 @@ IMPLICIT NONE ZCIT(:) = 0.0 END WHERE !$acc end kernels -!$acc update self(ZRCS,ZTHS,ZRIS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'IMLT_BU_RTH') - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'IMLT_BU_RRC') - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'IMLT_BU_RRI') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'IMLT_BU_RTH') + END IF + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 7,'IMLT_BU_RRC') + END IF + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'IMLT_BU_RRI') + END IF ! !* 7.2 Bergeron-Findeisen effect: RCBERI ! @@ -3902,16 +3935,18 @@ IMPLICIT NONE ZTHS(:) = ZTHS(:) + ZZW(:)*(ZLSFACT(:)-ZLVFACT(:)) ! f(L_f*(RCBERI)) END WHERE !$acc end kernels -!$acc update self(ZRCS,ZRIS,ZTHS) - IF (LBUDGET_TH) CALL BUDGET ( & - UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:), & - 4,'BERFI_BU_RTH') - IF (LBUDGET_RC) CALL BUDGET ( & - UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 7,'BERFI_BU_RRC') - IF (LBUDGET_RI) CALL BUDGET ( & - UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), & - 9,'BERFI_BU_RRI') + IF (LBUDGET_TH) THEN +!$acc update self(ZTHS) + CALL BUDGET (UNPACK(ZTHS(:),MASK=GMICRO(:,:,:),FIELD=PTHS)*PRHODJ(:,:,:),4,'BERFI_BU_RTH') + END IF + IF (LBUDGET_RC) THEN +!$acc update self(ZRCS) + CALL BUDGET (UNPACK(ZRCS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 7,'BERFI_BU_RRC') + END IF + IF (LBUDGET_RI) THEN +!$acc update self(ZRIS) + CALL BUDGET (UNPACK(ZRIS(:)*ZRHODJ(:),MASK=GMICRO(:,:,:),FIELD=0.0), 9,'BERFI_BU_RRI') + END IF ! END SUBROUTINE RAIN_ICE_FAST_RI ! diff --git a/src/MNH/resolved_cloud.f90 b/src/MNH/resolved_cloud.f90 index ee880815fc51d4f24e9e261c633416b77f466d73..7afd1d7408bc47946cb8bb74cd884977069bbcfb 100644 --- a/src/MNH/resolved_cloud.f90 +++ b/src/MNH/resolved_cloud.f90 @@ -285,6 +285,9 @@ USE MODI_C2R2_ADJUST USE MODI_KHKO_NOTADJUST USE MODI_C3R5_ADJUST USE MODI_SHUMAN +#ifdef _OPENACC +USE MODI_SHUMAN_DEVICE +#endif USE MODI_BUDGET USE MODI_GET_HALO ! @@ -620,11 +623,11 @@ IF (HCLOUD == 'KESS' .OR. HCLOUD == 'ICE3' .OR. HCLOUD == 'C2R2' .OR. & ! ZRATIO = ZMASSTOT / ZMASSPOS PRS(:,:,:,JRR) = PRS(:,:,:,JRR) * ZRATIO -!$acc update device(PRS) ! END IF END SELECT END DO +!$acc update device(PRS) END IF ! !* 3.2 Adjustement for liquid and solid cloud @@ -737,7 +740,6 @@ CALL ABORT END DO END DO !$acc end kernels -!$acc update self(PRS,PTHS) ! ! #endif @@ -843,6 +845,7 @@ END SELECT !* 3.3 STORE THE BUDGET TERMS ! ---------------------- ! +!OPENACC: PW: TODO: update self of PTHS and PRS for budgets IF ((HCLOUD /= 'KHKO') .AND. (HCLOUD /= 'C2R2') ) THEN IF (LBUDGET_TH) CALL BUDGET (PTHS(:,:,:) * PRHODJ(:,:,:), 4,'NEGA_BU_RTH') IF (LBUDGET_RV) CALL BUDGET (PRS(:,:,:,1) * PRHODJ(:,:,:), 6,'NEGA_BU_RRV') @@ -999,8 +1002,8 @@ PRINT *,'OPENACC: RESOLVED_CLOUD::ICE3 being implemented' ZDZZ(:,:,JK)=PZZ(:,:,JK+1)-PZZ(:,:,JK) ENDDO !$acc end kernels -!$acc update device(PCIT,PCLDFR) -!$acc update device(PINPRC,PINPRR,PINPRR3D,PEVAP3D,PINPRS,PINPRG,PINDEP) +!$acc update device(PCIT,PCLDFR, & +!$acc & PINPRC,PINPRR,PINPRR3D,PEVAP3D,PINPRS,PINPRG,PINDEP) !$acc data copyin(PSEA,PTOWN) CALL RAIN_ICE ( OSEDIC,CSEDIM, HSUBG_AUCV, OWARM,1,IKU,1, & KSPLITR, PTSTEP, KMI, KRR, & @@ -1014,17 +1017,15 @@ PRINT *,'OPENACC: RESOLVED_CLOUD::ICE3 being implemented' PINPRS, PINPRG, PSIGS, PINDEP, & PSEA, PTOWN) !$acc end data -!$acc update self(PINPRC,PINPRR,PINPRR3D,PEVAP3D,PINPRS,PINPRG,PINDEP) -!$acc update self(PCIT) +!$acc update self(PINPRC,PINPRR,PINPRR3D,PEVAP3D,PINPRS,PINPRG,PINDEP,PCIT) ! !* 9.2 Perform the saturation adjustment over cloud ice and cloud water ! -! #ifndef _OPENACC +#ifndef _OPENACC ZZZ = MZF(1,IKU,1, PZZ ) -! #else -! CALL MZF_DEVICE(1,IKU,1,PZZ,ZZZ) -! #endif -!$acc update device(ZZZ) +#else + CALL MZF_DEVICE(1,IKU,1,PZZ,ZZZ) +#endif CALL ICE_ADJUST (1,IKU,1, KRR, KMI, HRAD, HTURBDIM, & OSUBG_COND, OSIGMAS, PTSTEP,PSIGQSAT, & PRHODJ, PEXNREF, PSIGS, PMFCONV, PPABST, ZZZ, & @@ -1161,7 +1162,6 @@ END IF !* 13. SWITCH BACK TO THE PROGNOSTIC VARIABLES ! --------------------------------------- ! -!$acc update device(PTHS,PRS) !$acc kernels PTHS(:,:,:) = PTHS(:,:,:) * PRHODJ(:,:,:) !