Newer
Older

WAUTELET Philippe
committed
!MNH_LIC Copyright 1994-2022 CNRS, Meteo-France and Universite Paul Sabatier

WAUTELET Philippe
committed
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence

WAUTELET Philippe
committed
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt

WAUTELET Philippe
committed
!MNH_LIC for details. version 1.
!-----------------------------------------------------------------

WAUTELET Philippe
committed
#ifdef MNH_OPENACC

WAUTELET Philippe
committed
! #########################
MODULE MODI_SHUMAN_DEVICE
! #########################
!
INTERFACE
!
SUBROUTINE DXF_DEVICE(PA,PDXF)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDXF ! result at mass localization
END SUBROUTINE DXF_DEVICE
!
SUBROUTINE DXM_DEVICE(PA,PDXM)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDXM ! result at flux side
END SUBROUTINE DXM_DEVICE
!
SUBROUTINE DYF_DEVICE(PA,PDYF)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDYF ! result at mass localization
END SUBROUTINE DYF_DEVICE
!
SUBROUTINE DYM_DEVICE(PA,PDYM)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDYM ! result at flux side
END SUBROUTINE DYM_DEVICE
!

WAUTELET Philippe
committed
SUBROUTINE DZF_DEVICE(PA,PDZF)

WAUTELET Philippe
committed
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDZF ! result at mass localization
END SUBROUTINE DZF_DEVICE
!

WAUTELET Philippe
committed
SUBROUTINE DZM_DEVICE(PA,PDZM)

WAUTELET Philippe
committed
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDZM ! result at flux side
END SUBROUTINE DZM_DEVICE
!
SUBROUTINE MXF_DEVICE(PA,PMXF)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMXF ! result at mass localization
END SUBROUTINE MXF_DEVICE
!
SUBROUTINE MXM_DEVICE(PA,PMXM)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMXM ! result at flux localization
END SUBROUTINE MXM_DEVICE
!
SUBROUTINE MYF_DEVICE(PA,PMYF)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMYF ! result at mass localization
END SUBROUTINE MYF_DEVICE
!
SUBROUTINE MYM_DEVICE(PA,PMYM)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMYM ! result at flux localization
END SUBROUTINE MYM_DEVICE
!

WAUTELET Philippe
committed
SUBROUTINE MZF_DEVICE(PA,PMZF)

WAUTELET Philippe
committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMZF ! result at mass localization
END SUBROUTINE MZF_DEVICE
!
SUBROUTINE MZM_DEVICE(PA,PMZM)
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMZM ! result at flux localization
END SUBROUTINE MZM_DEVICE
!
END INTERFACE
!
END MODULE MODI_SHUMAN_DEVICE
!
!
! ###############################
SUBROUTINE MXF_DEVICE(PA,PMXF)
! ###############################
!
!!**** *MXF* - Shuman operator : mean operator in x direction for a
!! variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the x direction (I index) for a field PA localized at a x-flux
! point (u point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PMXF(i,:,:) is defined by 0.5*(PA(i,:,:)+PA(i+1,:,:))
!! At i=size(PA,1), PMXF(i,:,:) are replaced by the values of PMXF,
!! which are the right values in the x-cyclic case
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar

WAUTELET Philippe
committed
!! correction of in halo/pseudo-cyclic calculation for JPHEXT<> 1
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMXF ! result at mass localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS
INTEGER :: JJK

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PMXF )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF MXF
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PMXF,PA)

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(3)

WAUTELET Philippe
committed
DO JK = 1, IKU
DO JJ = 1, IJU

WAUTELET Philippe
committed
DO JI = 1 + 1, IIU

WAUTELET Philippe
committed
PMXF(JI-1,JJ,JK) = 0.5*( PA(JI-1,JJ,JK)+PA(JI,JJ,JK) )
ENDDO
ENDDO
ENDDO
!
PMXF(IIU,:,:) = PMXF(2*JPHEXT,:,:)
!$acc end kernels
#else

WAUTELET Philippe
committed
JIJKOR = 1 + 1

WAUTELET Philippe
committed
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PMXF,PA)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND
PMXF(JIJK-1,1,1) = 0.5*( PA(JIJK-1,1,1)+PA(JIJK,1,1) )
END DO
!
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JI=1,JPHEXT
DO JJK=1,IJU*IKU
PMXF(IIU-JPHEXT+JI,JJK,1) = PMXF(JPHEXT+JI,JJK,1) ! for reprod JPHEXT <> 1
END DO

WAUTELET Philippe
committed
END DO
!$acc end kernels

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
!
!-------------------------------------------------------------------------------
!
END SUBROUTINE MXF_DEVICE

WAUTELET Philippe
committed
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
!
! ###############################
SUBROUTINE MXM_DEVICE(PA,PMXM)
! ###############################
!
!!**** *MXM* - Shuman operator : mean operator in x direction for a
!! mass variable
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the x direction (I index) for a field PA localized at a mass
! point. The result is localized at a x-flux point (u point).
!
!!** METHOD
!! ------
!! The result PMXM(i,:,:) is defined by 0.5*(PA(i,:,:)+PA(i-1,:,:))
!! At i=1, PMXM(1,:,:) are replaced by the values of PMXM,
!! which are the right values in the x-cyclic case.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar

WAUTELET Philippe
committed
!! correction of in halo/pseudo-cyclic calculation for JPHEXT<> 1
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMXM ! result at flux localization
!

WAUTELET Philippe
committed
!* 0.2 Declarations of local variables
! -------------------------------
!
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA
!
#ifdef _OPT_LINEARIZED_LOOPS
INTEGER :: JJK

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PMXM )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF MXM
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMXM)

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(3)

WAUTELET Philippe
committed
DO JK = 1, IKU
DO JJ = 1, IJU

WAUTELET Philippe
committed
DO JI = 1 + 1, IIU

WAUTELET Philippe
committed
PMXM(JI,JJ,JK) = 0.5*( PA(JI,JJ,JK)+PA(JI-1,JJ,JK) )
ENDDO
ENDDO
ENDDO
!

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(2)

WAUTELET Philippe
committed
DO JK = 1, IKU
DO JJ=1,IJU
PMXM(1,JJ,JK) = PMXM(IIU-2*JPHEXT+1,JJ,JK) !TODO: voir si ce n'est pas plutot JPHEXT+1
ENDDO
ENDDO
!$acc end kernels
#else

WAUTELET Philippe
committed
JIJKOR = 1 + 1

WAUTELET Philippe
committed
JIJKEND = IIU*IJU*IKU
!
!CDIR NODEP
!OCL NOVREC

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMXM)

WAUTELET Philippe
committed
DO JIJK=JIJKOR , JIJKEND
PMXM(JIJK,1,1) = 0.5*( PA(JIJK,1,1)+PA(JIJK-1,1,1) )
END DO
!
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JI=1,JPHEXT
DO JJK=1,IJU*IKU
PMXM(JI,JJK,1) = PMXM(IIU-2*JPHEXT+JI,JJK,1) ! for reprod JPHEXT <> 1
END DO

WAUTELET Philippe
committed
END DO
!$acc end kernels

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
!-------------------------------------------------------------------------------
!
END SUBROUTINE MXM_DEVICE
!
! ###############################
SUBROUTINE MYF_DEVICE(PA,PMYF)
! ###############################
!
!!**** *MYF* - Shuman operator : mean operator in y direction for a
!! variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the y direction (J index) for a field PA localized at a y-flux
! point (v point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PMYF(i,:,:) is defined by 0.5*(PA(:,j,:)+PA(:,j+1,:))
!! At j=size(PA,2), PMYF(:,j,:) are replaced by the values of PMYF,
!! which are the right values in the y-cyclic case
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar

WAUTELET Philippe
committed
!! correction of in halo/pseudo-cyclic calculation for JPHEXT<> 1
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMYF ! result at mass localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PMYF )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF MYF
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMYF)

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!TODO: remplacer le 1 par JPHEXT ?

ESCOBAR MUNOZ Juan
committed
!$mnh_do_concurrent(JI=1:IIU,JJ=1:IJU-1,JK=1:IKU)

WAUTELET Philippe
committed
PMYF(JI,JJ,JK) = 0.5*( PA(JI,JJ,JK)+PA(JI,JJ+1,JK) )

ESCOBAR MUNOZ Juan
committed
!$mnh_end_do()

WAUTELET Philippe
committed
#else

WAUTELET Philippe
committed
JIJKOR = 1 + IIU
JIJKEND = IIU*IJU*IKU
!
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND
PMYF(JIJK-IIU,1,1) = 0.5*( PA(JIJK-IIU,1,1)+PA(JIJK,1,1) )
END DO

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!

ESCOBAR MUNOZ Juan
committed
!$mnh_do_concurrent(JI=1:IIU,JJ=1:JPHEXT,JK=1:IKU)

ESCOBAR MUNOZ Juan
committed
PMYF(JI,IJU-JPHEXT+JJ,JK) = PMYF(JI,JPHEXT+JJ,JK) ! for reprod JPHEXT <> 1

ESCOBAR MUNOZ Juan
committed
!$mnh_end_do()

WAUTELET Philippe
committed
!$acc end kernels

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
!-------------------------------------------------------------------------------
!
END SUBROUTINE MYF_DEVICE
!
! ###############################
SUBROUTINE MYM_DEVICE(PA,PMYM)
! ###############################
!
!!**** *MYM* - Shuman operator : mean operator in y direction for a
!! mass variable
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the y direction (J index) for a field PA localized at a mass
! point. The result is localized at a y-flux point (v point).
!
!!** METHOD
!! ------
!! The result PMYM(:,j,:) is defined by 0.5*(PA(:,j,:)+PA(:,j-1,:))
!! At j=1, PMYM(:,j,:) are replaced by the values of PMYM,
!! which are the right values in the y-cyclic case.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar

WAUTELET Philippe
committed
!! correction of in halo/pseudo-cyclic calculation for JPHEXT<> 1
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE

WAUTELET Philippe
committed
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!

WAUTELET Philippe
committed
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMYM ! result at flux localization
!

WAUTELET Philippe
committed
!* 0.2 Declarations of local variables
! -------------------------------
!
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA
!
#ifdef _OPT_LINEARIZED_LOOPS
INTEGER :: JJK

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PMYM )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF MYM
! ------------------
!

WAUTELET Philippe
committed
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMYM)

ESCOBAR MUNOZ Juan
committed
!TODO: remplacer le 1+1 par 1+JPHEXT ?

ESCOBAR MUNOZ Juan
committed
!$mnh_do_concurrent(JI=1:IIU,JJ=2:IJU,JK=1:IKU)

WAUTELET Philippe
committed
PMYM(JI,JJ,JK) = 0.5*( PA(JI,JJ,JK)+PA(JI,JJ-1,JK) )

ESCOBAR MUNOZ Juan
committed
!$mnh_end_do()

WAUTELET Philippe
committed
#else

WAUTELET Philippe
committed
JIJKOR = 1 + IIU
JIJKEND = IIU*IJU*IKU
!CDIR NODEP
!OCL NOVREC

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMYM)

WAUTELET Philippe
committed
DO JIJK=JIJKOR , JIJKEND
PMYM(JIJK,1,1) = 0.5*( PA(JIJK,1,1)+PA(JIJK-IIU,1,1) )
END DO

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!

ESCOBAR MUNOZ Juan
committed
!$mnh_do_concurrent(JI=1:IIU,JJ=1:JPHEXT,JK=1:IKU)

ESCOBAR MUNOZ Juan
committed
PMYM(JI,JJ,JK) = PMYM(JI,IJU-2*JPHEXT+JJ,JK) ! for reprod JPHEXT <> 1

ESCOBAR MUNOZ Juan
committed
!$mnh_end_do()

WAUTELET Philippe
committed
!$acc end kernels

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
END SUBROUTINE MYM_DEVICE
!
! ###############################

WAUTELET Philippe
committed
SUBROUTINE MZF_DEVICE(PA,PMZF)

WAUTELET Philippe
committed
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
! ###############################
!
!!**** *MZF* - Shuman operator : mean operator in z direction for a
!! variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the z direction (K index) for a field PA localized at a z-flux
! point (w point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PMZF(:,:,k) is defined by 0.5*(PA(:,:,k)+PA(:,:,k+1))
!! At k=size(PA,3), PMZF(:,:,k) is defined by -999.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! optimisation 20/08/00 J. Escobar
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMZF ! result at mass localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS

WAUTELET Philippe
committed
INTEGER :: JIJ
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PMZF )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF MZF
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMZF)

WAUTELET Philippe
committed
PMZF(:,:,1:IKU-1) = 0.5*( PA(:,:,1:IKU-1)+PA(:,:,2:) )
!
PMZF(:,:,IKU) = -999.
!$acc end kernels
#else

WAUTELET Philippe
committed
JIJKOR = 1 + IIU*IJU
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMZF)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JIJK=JIJKOR , JIJKEND
PMZF(JIJK-IIU*IJU,1,1) = 0.5*( PA(JIJK-IIU*IJU,1,1)+PA(JIJK,1,1) )
END DO

WAUTELET Philippe
committed
!
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JIJ=1,IIU*IJU

WAUTELET Philippe
committed
PMZF(JIJ,1,IKU) = PMZF(JIJ,1,IKU-1) !-999.

WAUTELET Philippe
committed
END DO

WAUTELET Philippe
committed
!$acc end kernels

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
!-------------------------------------------------------------------------------
!
END SUBROUTINE MZF_DEVICE
!
! ###############################
SUBROUTINE MZM_DEVICE(PA,PMZM)
! ###############################
!
!!**** *MZM* - Shuman operator : mean operator in z direction for a
!! mass variable
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the z direction (K index) for a field PA localized at a mass
! point. The result is localized at a z-flux point (w point).
!
!!** METHOD
!! ------
!! The result PMZM(:,:,k) is defined by 0.5*(PA(:,:,k)+PA(:,:,k-1))
!! At k=1, PMZM(:,:,1) is defined by -999.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! optimisation 20/08/00 J. Escobar
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PMZM ! result at flux localization
!
!* 0.2 Declarations of local variables
! -------------------------------

WAUTELET Philippe
committed
!
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA
!
#ifdef _OPT_LINEARIZED_LOOPS
INTEGER :: JIJ
INTEGER :: JIJK,JIJKOR,JIJKEND
#endif
!

WAUTELET Philippe
committed
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PMZM )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF MZM
! ------------------
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

WAUTELET Philippe
committed
IKU = SIZE(PA,3)
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMZM)

WAUTELET Philippe
committed
DO JK=2,IKU !TODO: remplacer le 2 par JPHEXT+1 ?
PMZM(:,:,JK) = 0.5* ( PA(:,:,JK) + PA(:,:,JK-1) )
END DO
!

WAUTELET Philippe
committed
PMZM(:,:,1) = -999.
!$acc end kernels

WAUTELET Philippe
committed
#else
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!
JIJKOR = 1 + IIU*IJU
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PMZM)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND
PMZM(JIJK,1,1) = 0.5*( PA(JIJK,1,1)+PA(JIJK-IIU*IJU,1,1) )
END DO
!
!CDIR NODEP
!OCL NOVREC
DO JIJ=1,IIU*IJU
PMZM(JIJ,1,1) = -999.
END DO
!$acc end kernels
!
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------

WAUTELET Philippe
committed
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
!
END SUBROUTINE MZM_DEVICE
!
! ###############################
SUBROUTINE DXF_DEVICE(PA,PDXF)
! ###############################
!
!!**** *DXF* - Shuman operator : finite difference operator in x direction
!! for a variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the x direction (I index) for a field PA localized at a x-flux
! point (u point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PDXF(i,:,:) is defined by (PA(i+1,:,:)-PA(i,:,:))
!! At i=size(PA,1), PDXF(i,:,:) are replaced by the values of PDXF,
!! which are the right values in the x-cyclic case
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar

WAUTELET Philippe
committed
!! correction of in halo/pseudo-cyclic calculation for JPHEXT<> 1
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDXF ! result at mass localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS
INTEGER :: JJK

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PDXF )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF DXF
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDXF)

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(3)

WAUTELET Philippe
committed
DO JK=1,IKU
DO JJ=1,IJU

WAUTELET Philippe
committed
DO JI=1+1,IIU

WAUTELET Philippe
committed
PDXF(JI-1,JJ,JK) = PA(JI,JJ,JK) - PA(JI-1,JJ,JK)
END DO
END DO
END DO
!

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(2)

WAUTELET Philippe
committed
DO JK=1,IKU
DO JJ=1,IJU
PDXF(IIU,JJ,JK) = PDXF(2*JPHEXT,JJ,JK)
ENDDO
ENDDO
!$acc end kernels
#else

WAUTELET Philippe
committed
JIJKOR = 1 + 1

WAUTELET Philippe
committed
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDXF)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND
PDXF(JIJK-1,1,1) = PA(JIJK,1,1) - PA(JIJK-1,1,1)
END DO
!
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JI=1,JPHEXT
DO JJK=1,IJU*IKU
PDXF(IIU-JPHEXT+JI,JJK,1) = PDXF(JPHEXT+JI,JJK,1) ! for reprod JPHEXT <> 1
END DO

WAUTELET Philippe
committed
END DO
!$acc end kernels

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
!-------------------------------------------------------------------------------
!
END SUBROUTINE DXF_DEVICE
!
! ###############################
SUBROUTINE DXM_DEVICE(PA,PDXM)
! ###############################
!
!!**** *DXM* - Shuman operator : finite difference operator in x direction
!! for a variable at a mass localization
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the x direction (I index) for a field PA localized at a mass
! point. The result is localized at a x-flux point (u point).
!
!!** METHOD
!! ------
!! The result PDXM(i,:,:) is defined by (PA(i,:,:)-PA(i-1,:,:))
!! At i=1, PDXM(1,:,:) are replaced by the values of PDXM,
!! which are the right values in the x-cyclic case.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDXM ! result at flux side
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS
INTEGER :: JJK

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PDXM )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF DXM
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDXM)

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(3)

WAUTELET Philippe
committed
DO JK=1,IKU
DO JJ=1,IJU
DO JI=1+1,IIU !TODO: remplacer le 1 par JPHEXT ?
PDXM(JI,JJ,JK) = PA(JI,JJ,JK) - PA(JI-1,JJ,JK)
END DO
END DO
END DO
!

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(2)

WAUTELET Philippe
committed
DO JK=1,IKU
DO JJ=1,IJU
PDXM(1,JJ,JK) = PDXM(IIU-2*JPHEXT+1,JJ,JK) !TODO: remplacer -2*JPHEXT+1 par -JPHEXT ?
ENDDO
ENDDO
!$acc end kernels
#else

WAUTELET Philippe
committed
JIJKOR = 1 + 1
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDXM)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND
PDXM(JIJK,1,1) = PA(JIJK,1,1) - PA(JIJK-1,1,1)
END DO
!
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JI=1,JPHEXT
DO JJK=1,IJU*IKU
PDXM(JI,JJK,1) = PDXM(IIU-2*JPHEXT+JI,JJK,1) ! for reprod JPHEXT <> 1
END DO

WAUTELET Philippe
committed
END DO
!$acc end kernels

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
!-------------------------------------------------------------------------------
!
END SUBROUTINE DXM_DEVICE
!
! ###############################
SUBROUTINE DYF_DEVICE(PA,PDYF)
! ###############################
!
!!**** *DYF* - Shuman operator : finite difference operator in y direction
!! for a variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the y direction (J index) for a field PA localized at a y-flux
! point (v point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PDYF(:,j,:) is defined by (PA(:,j+1,:)-PA(:,j,:))
!! At j=size(PA,2), PDYF(:,j,:) are replaced by the values of PDYM,
!! which are the right values in the y-cyclic case
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar

WAUTELET Philippe
committed
!! correction of in halo/pseudo-cyclic calculation for JPHEXT<> 1
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDYF ! result at mass localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PDYF )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF DYF
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDYF)

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!TODO: remplacer le 1 par JPHEXT ?

ESCOBAR MUNOZ Juan
committed
!$mnh_do_concurrent(JI=1:IIU,JJ=1:IJU-1,JK=1:IKU)

WAUTELET Philippe
committed
PDYF(JI,JJ,JK) = PA(JI,JJ+1,JK) - PA(JI,JJ,JK)

ESCOBAR MUNOZ Juan
committed
!$mnh_end_do()

WAUTELET Philippe
committed
#else

WAUTELET Philippe
committed
JIJKOR = 1 + IIU
JIJKEND = IIU*IJU*IKU
!
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND
PDYF(JIJK-IIU,1,1) = PA(JIJK,1,1) - PA(JIJK-IIU,1,1)
END DO

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!

ESCOBAR MUNOZ Juan
committed
!$acc loop seq

WAUTELET Philippe
committed
DO JJ=1,JPHEXT

ESCOBAR MUNOZ Juan
committed
!$mnh_do_concurrent(JI=1:IIU,JK=1:IKU)

ESCOBAR MUNOZ Juan
committed
PDYF(JI,IJU-JPHEXT+JJ,JK) = PDYF(JI,JPHEXT+JJ,JK) ! for reprod JPHEXT <> 1

ESCOBAR MUNOZ Juan
committed
!$mnh_end_do()

WAUTELET Philippe
committed
END DO

WAUTELET Philippe
committed
!$acc end kernels

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
!-------------------------------------------------------------------------------
!
END SUBROUTINE DYF_DEVICE
!
! ###############################
SUBROUTINE DYM_DEVICE(PA,PDYM)
! ###############################
!
!!**** *DYM* - Shuman operator : finite difference operator in y direction
!! for a variable at a mass localization
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the y direction (J index) for a field PA localized at a mass
! point. The result is localized at a y-flux point (v point).
!
!!** METHOD
!! ------
!! The result PDYM(:,j,:) is defined by (PA(:,j,:)-PA(:,j-1,:))
!! At j=1, PDYM(:,1,:) are replaced by the values of PDYM,
!! which are the right values in the y-cyclic case.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_PARAMETERS: declaration of parameter variables
!! JPHEXT: define the number of marginal points out of the
!! physical domain along the horizontal directions.
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! Modification to include the periodic case 13/10/94 J.Stein
!! optimisation 20/08/00 J. Escobar

WAUTELET Philippe
committed
!! correction of in halo/pseudo-cyclic calculation for JPHEXT<> 1
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_PARAMETERS
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDYM ! result at flux side
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS

WAUTELET Philippe
committed
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PDYM )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF DYM
! ------------------
!
IIU=SIZE(PA,1)
IJU=SIZE(PA,2)
IKU=SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDYM)

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(3)

WAUTELET Philippe
committed
DO JK=1,IKU
DO JJ=2,IJU !TODO: remplacer le 2 par JPHEXT+1 ?
DO JI=1,IIU
PDYM(JI,JJ,JK) = PA(JI,JJ,JK) - PA(JI,JJ-1,JK)
END DO
END DO
END DO
!
#else

WAUTELET Philippe
committed
JIJKOR = 1 + IIU
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDYM)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND

WAUTELET Philippe
committed
PDYM(JIJK,1,1) = PA(JIJK,1,1) - PA(JIJK-IIU,1,1)

WAUTELET Philippe
committed
END DO

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
DO JJ=1,JPHEXT
PDYM(:,JJ,:) = PDYM(:,IJU-2*JPHEXT+JJ,:) ! for reprod JPHEXT <> 1
END DO

WAUTELET Philippe
committed
!$acc end kernels

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
END SUBROUTINE DYM_DEVICE
!
! ###############################

WAUTELET Philippe
committed
SUBROUTINE DZF_DEVICE(PA,PDZF)

WAUTELET Philippe
committed
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
! ###############################
!
!!**** *DZF* - Shuman operator : finite difference operator in z direction
!! for a variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the z direction (K index) for a field PA localized at a z-flux
! point (w point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PDZF(:,:,k) is defined by (PA(:,:,k+1)-PA(:,:,k))
!! At k=size(PA,3), PDZF(:,:,k) is defined by -999.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! optimisation 20/08/00 J. Escobar
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at flux side
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDZF ! result at mass localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS

WAUTELET Philippe
committed
INTEGER :: JIJ
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PDZF )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF DZF
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDZF)

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(3)

WAUTELET Philippe
committed
DO JK=1,IKU-1 !TODO: remplacer le 1 par JPHEXT ?
DO JJ=1,IJU
DO JI=1,IIU
PDZF(JI,JJ,JK) = PA(JI,JJ,JK+1)-PA(JI,JJ,JK)
END DO
END DO
END DO
!
PDZF(:,:,IKU) = -999.
!$acc end kernels
#else

WAUTELET Philippe
committed
JIJKOR = 1 + IIU*IJU
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDZF)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC
DO JIJK=JIJKOR , JIJKEND
PDZF(JIJK-IIU*IJU,1,1) = PA(JIJK,1,1)-PA(JIJK-IIU*IJU,1,1)
END DO
!
!CDIR NODEP
!OCL NOVREC
DO JIJ=1,IIU*IJU
PDZF(JIJ,1,IKU) = -999.
END DO
!$acc end kernels

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
END SUBROUTINE DZF_DEVICE
!
! ###############################

WAUTELET Philippe
committed
SUBROUTINE DZM_DEVICE(PA,PDZM)

WAUTELET Philippe
committed
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
! ###############################
!
!!**** *DZM* - Shuman operator : finite difference operator in z direction
!! for a variable at a mass localization
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the z direction (K index) for a field PA localized at a mass
! point. The result is localized at a z-flux point (w point).
!
!!** METHOD
!! ------
!! The result PDZM(:,j,:) is defined by (PA(:,:,k)-PA(:,:,k-1))
!! At k=1, PDZM(:,:,k) is defined by -999.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! optimisation 20/08/00 J. Escobar
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDZM ! result at flux side
!
!* 0.2 Declarations of local variables
! -------------------------------
!

WAUTELET Philippe
committed
INTEGER :: JI, JJ, JK ! Loop indices
INTEGER :: IIU, IJU, IKU ! upper bounds of PA

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
#ifdef _OPT_LINEARIZED_LOOPS

WAUTELET Philippe
committed
INTEGER :: JIJ
INTEGER :: JIJK,JIJKOR,JIJKEND

WAUTELET Philippe
committed
#endif

WAUTELET Philippe
committed
!
!-------------------------------------------------------------------------------

ESCOBAR MUNOZ Juan
committed
!$acc data present_crm( PA, PDZM )

WAUTELET Philippe
committed
!
!* 1. DEFINITION OF DZM
! ------------------
!
IIU = SIZE(PA,1)
IJU = SIZE(PA,2)
IKU = SIZE(PA,3)
!

WAUTELET Philippe
committed
#ifndef _OPT_LINEARIZED_LOOPS

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDZM)

ESCOBAR MUNOZ Juan
committed
!$acc loop independent collapse(3)

WAUTELET Philippe
committed
DO JK=2,IKU !TODO: remplacer le 1+1 par 1+JPHEXT ?
DO JJ=1,IJU
DO JI=1,IIU
PDZM(JI,JJ,JK) = PA(JI,JJ,JK) - PA(JI,JJ,JK-1)
END DO
END DO
END DO
!
PDZM(:,:,1) = -999.
!$acc end kernels
#else

WAUTELET Philippe
committed
JIJKOR = 1 + IIU*IJU
JIJKEND = IIU*IJU*IKU
!

ESCOBAR MUNOZ Juan
committed
!$acc kernels present_crm(PA,PDZM)

WAUTELET Philippe
committed
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JIJK=JIJKOR , JIJKEND
PDZM(JIJK,1,1) = PA(JIJK,1,1)-PA(JIJK-IIU*IJU,1,1)
END DO

WAUTELET Philippe
committed
!
!CDIR NODEP
!OCL NOVREC

WAUTELET Philippe
committed
DO JIJ=1,IIU*IJU
PDZM(JIJ,1,1) = -999.
END DO
#endif

WAUTELET Philippe
committed
!$acc end data

WAUTELET Philippe
committed
!-------------------------------------------------------------------------------
!
END SUBROUTINE DZM_DEVICE