Skip to content
Snippets Groups Projects
Commit 111dd0a9 authored by ESCOBAR MUNOZ Juan's avatar ESCOBAR MUNOZ Juan
Browse files

Juan 21/09/2021:p_abs.f90, add acc kernels + BIT_REPRO call

parent 1f51c51d
No related branches found
No related tags found
No related merge requests found
......@@ -122,6 +122,10 @@ USE MODE_ll
!JUAN
USE MODE_REPRO_SUM
!JUAN
!
#ifdef MNH_BITREP
USE MODI_BITREP
#endif
!
IMPLICIT NONE
!
......@@ -185,6 +189,7 @@ REAL :: ZPHI0
!
INTEGER :: IINFO_ll
!
LOGICAL :: GPRVREF0
!-------------------------------------------------------------------------------
!
!* 1. COMPUTE DIMENSIONS OF ARRAYS AND OTHER INDICES:
......@@ -196,6 +201,8 @@ IKE = IKU - JPVEXT
!
CALL GET_INDICE_ll(IIB,IJB,IIE,IJE)
!
GPRVREF0 = ( SIZE(PRVREF,1) == 0 )
!
ALLOCATE(ZMASS_O_PI_2D(IIB:IIE,IJB:IJE))
ALLOCATE(ZMASSGUESS_2D(IIB:IIE,IJB:IJE))
ALLOCATE(ZWATERMASST_2D(IIB:IIE,IJB:IJE))
......@@ -212,7 +219,8 @@ ZCVD_O_RD = (XCPD - XRD) / XRD
!
!
IF ( CEQNSYS=='DUR' .OR. CEQNSYS=='MAE' ) THEN
!
!
!$acc kernels
IF(KRR > 0) THEN
!
! compute the mixing ratio of the total water (ZRTOT)
......@@ -227,21 +235,29 @@ IF ( CEQNSYS=='DUR' .OR. CEQNSYS=='MAE' ) THEN
ZMASSGUESS_2D = 0.
ZMASS_O_PI_2D = 0.
ZWATERMASST_2D = 0.
!$acc end kernels
!
IF ( CEQNSYS == 'DUR' ) THEN
!$acc kernels
! compute the Jacobian in ZWORK
IF ( SIZE(PRVREF,1) == 0 ) THEN
IF ( GPRVREF0 ) THEN
ZWORK(:,:,:)= PRHODJ * XTH00 / ( PRHODREF * PTHVREF )
ELSE
ZWORK(:,:,:)=PRHODJ * XTH00 &
/ ( PRHODREF * PTHVREF * (1. + PRVREF) )
END IF
!
!$acc loop seq
DO JK = IKB,IKE
!$acc loop independent collapse(2)
DO JJ = IJB,IJE
DO JI = IIB,IIE
ZMASSGUESS_2D(JI,JJ) = ZMASSGUESS_2D(JI,JJ) + &
(PEXNREF(JI,JJ,JK)+PPHIT(JI,JJ,JK))**ZCVD_O_RD &
ZMASSGUESS_2D(JI,JJ) = ZMASSGUESS_2D(JI,JJ) + &
#ifndef MNH_OPENACC
(PEXNREF(JI,JJ,JK)+PPHIT(JI,JJ,JK))**ZCVD_O_RD &
#else
BR_POW((PEXNREF(JI,JJ,JK)+PPHIT(JI,JJ,JK)),ZCVD_O_RD) &
#endif
* ZWORK(JI,JJ,JK) / PTHETAV(JI,JJ,JK)
ZMASS_O_PI_2D(JI,JJ) = ZMASS_O_PI_2D(JI,JJ) + ZWORK(JI,JJ,JK) / PTHETAV(JI,JJ,JK)
ZWATERMASST_2D(JI,JJ) = ZWATERMASST_2D(JI,JJ) + &
......@@ -249,7 +265,8 @@ IF ( CEQNSYS=='DUR' .OR. CEQNSYS=='MAE' ) THEN
END DO
END DO
END DO
!
!$acc end kernels
!
ELSE
DO JK = IKB,IKE
DO JJ = IJB,IJE
......@@ -273,23 +290,31 @@ IF ( CEQNSYS=='DUR' .OR. CEQNSYS=='MAE' ) THEN
!
ZMASS_O_PI = ZMASS_O_PI*ZP00_O_RD*ZCVD_O_RD
ZPI0 = (PDRYMASST + ZWATERMASST - ZP00_O_RD*ZMASSGUESS ) / ZMASS_O_PI
!$acc kernels
PPHIT(:,:,:) = PPHIT(:,:,:) + ZPI0
!$acc end kernels
!
!
!
! Second iteration
!
!$acc kernels
ZMASSGUESS_2D = 0.
!$acc end kernels
IF ( CEQNSYS == 'DUR' ) THEN
DO JK = IKB,IKE
DO JJ = IJB,IJE
DO JI = IIB,IIE
ZMASSGUESS_2D(JI,JJ) = ZMASSGUESS_2D(JI,JJ) + &
(PEXNREF(JI,JJ,JK)+PPHIT(JI,JJ,JK))**ZCVD_O_RD &
* ZWORK(JI,JJ,JK) / PTHETAV(JI,JJ,JK)
!$acc kernels
!$acc loop seq
DO JK = IKB,IKE
!$acc loop independent collapse(2)
DO JJ = IJB,IJE
DO JI = IIB,IIE
ZMASSGUESS_2D(JI,JJ) = ZMASSGUESS_2D(JI,JJ) + &
(PEXNREF(JI,JJ,JK)+PPHIT(JI,JJ,JK))**ZCVD_O_RD &
* ZWORK(JI,JJ,JK) / PTHETAV(JI,JJ,JK)
END DO
END DO
END DO
END DO
END DO
!$acc end kernels
ELSE
DO JK = IKB,IKE
DO JJ = IJB,IJE
......@@ -306,7 +331,9 @@ IF ( CEQNSYS=='DUR' .OR. CEQNSYS=='MAE' ) THEN
ZMASSGUESS = SUM_DD_R2_ll(ZMASSGUESS_2D)
!
ZPI0 = (PDRYMASST + ZWATERMASST - ZP00_O_RD*ZMASSGUESS ) / ZMASS_O_PI
!$acc kernels
PPHIT(:,:,:) = PPHIT(:,:,:) + ZPI0
!$acc end kernels
!
!
ELSEIF( CEQNSYS == 'LHE' ) THEN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment