New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
usrdef_hgr.F90 in NEMO/trunk/tests/BENCH/MY_SRC – NEMO

source: NEMO/trunk/tests/BENCH/MY_SRC/usrdef_hgr.F90

Last change on this file was 15300, checked in by smasson, 3 years ago

trunk: improve BENCH for reproducibility tests

File size: 7.1 KB
Line 
1MODULE usrdef_hgr
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_hgr  ***
4   !!
5   !!                      ===  BENCH configuration  ===
6   !!
7   !! User defined :   mesh and Coriolis parameter of a user configuration
8   !!======================================================================
9   !! History :  NEMO  !
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_hgr    : initialize the horizontal mesh for BENCH configuration
14   !!----------------------------------------------------------------------
15   USE dom_oce         ! ocean space and time domain
16   USE par_oce         ! ocean space and time domain
17   USE phycst          ! physical constants
18   USE in_out_manager  ! I/O manager
19   USE lib_mpp         ! MPP library
20   
21   IMPLICIT NONE
22   PRIVATE
23
24   PUBLIC   usr_def_hgr   ! called by domhgr.F90
25
26   !! * Substitutions
27#  include "do_loop_substitute.h90"
28   !!----------------------------------------------------------------------
29   !! NEMO/OPA 4.0, NEMO Consortium (2016)
30   !! $Id$
31   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
32   !!----------------------------------------------------------------------
33CONTAINS
34
35   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
36      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
37      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
38      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
39      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
40      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
41      !!----------------------------------------------------------------------
42      !!                  ***  ROUTINE usr_def_hgr  ***
43      !!
44      !! ** Purpose :   square box mesh mesh and Coriolis parameter
45      !!
46      !! ** Method  :   set all intent(out) argument to a proper value
47      !!                BENCH configuration : beta-plance with uniform grid spacing (zres)
48      !!
49      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in grid points)
50      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
51      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
52      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
53      !!----------------------------------------------------------------------
54      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
55      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
56      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
57      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
58      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
59      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
60      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
61      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
62      !
63      INTEGER  ::   ji, jj         ! dummy loop indices
64      REAL(wp), DIMENSION(jpi,jpj) ::   z2d   ! 2D workspace
65      REAL(wp) ::   zres, zf0
66      REAL(wp) ::   zti, ztj       ! local scalars
67      !!-------------------------------------------------------------------------------
68      !
69      IF(lwp) WRITE(numout,*)
70      IF(lwp) WRITE(numout,*) 'usr_def_hgr : BENCH configuration bassin'
71      IF(lwp) WRITE(numout,*)
72      IF(lwp) WRITE(numout,*) '          Beta-plane with regular grid-spacing'
73      IF(lwp) WRITE(numout,*) '          given by rn_dx and rn_dy' 
74      !
75      ! define unique value on each point of the inner global domain. z2d ranging from 0.05 to -0.05
76      !
77      DO_2D( 0, 0, 0, 0 )   !  +/- 0.5
78         z2d(ji,jj) = 0.5 - REAL( mig0(ji) + (mjg0(jj)-1) * Ni0glo, wp ) / REAL( Ni0glo * Nj0glo, wp )
79      END_2D
80      !
81      ! Position coordinates (in grid points)
82      !                          ==========
83      DO_2D( 0, 0, 0, 0 )
84         
85         zti = REAL( mig0(ji), wp ) - 0.5_wp   ! start at i=0.5 in the global grid without halos
86         ztj = REAL( mjg0(jj), wp ) - 0.5_wp   ! start at j=0.5 in the global grid without halos
87         
88         plamt(ji,jj) =   zti            * (1. + 1.0e-5 * z2d(ji,jj) )
89         plamu(ji,jj) = ( zti + 0.5_wp ) * (1. + 2.0e-5 * z2d(ji,jj) )
90         plamv(ji,jj) =   zti            * (1. + 3.0e-5 * z2d(ji,jj) )
91         plamf(ji,jj) = ( zti + 0.5_wp ) * (1. + 4.0e-5 * z2d(ji,jj) )
92         
93         pphit(ji,jj) =   ztj            * (1. + 1.5e-5 * z2d(ji,jj) )         
94         pphiu(ji,jj) =   ztj            * (1. + 2.5e-5 * z2d(ji,jj) )         
95         pphiv(ji,jj) = ( ztj + 0.5_wp ) * (1. + 3.5e-5 * z2d(ji,jj) )
96         pphif(ji,jj) = ( ztj + 0.5_wp ) * (1. + 4.5e-5 * z2d(ji,jj) )
97
98      END_2D
99      !     
100      ! Horizontal scale factors (in meters)
101      !                              ======
102      DO_2D( 0, 0, 0, 0 )
103         zres = 1.e+5   !  100km
104         pe1t(ji,jj) = zres * (1. + 1.0e-5 * z2d(ji,jj) )  ;   pe2t(ji,jj) = zres * (1. + 1.5e-5 * z2d(ji,jj) )
105         pe1u(ji,jj) = zres * (1. + 2.0e-5 * z2d(ji,jj) )  ;   pe2u(ji,jj) = zres * (1. + 2.5e-5 * z2d(ji,jj) )
106         pe1v(ji,jj) = zres * (1. + 3.0e-5 * z2d(ji,jj) )  ;   pe2v(ji,jj) = zres * (1. + 3.5e-5 * z2d(ji,jj) )
107         pe1f(ji,jj) = zres * (1. + 4.0e-5 * z2d(ji,jj) )  ;   pe2f(ji,jj) = zres * (1. + 4.5e-5 * z2d(ji,jj) )
108      END_2D
109      !                             ! NO reduction of grid size in some straits
110      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_hgr routine
111      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
112      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
113      !
114      !
115      !                       !==  Coriolis parameter  ==!
116      kff = 1                       !  indicate not to compute Coriolis parameter afterward
117      !
118      zf0 = 2._wp * omega * SIN( rad * 45 )   ! constant coriolis factor corresponding to 45°N
119      DO_2D( 0, 0, 0, 0 )
120         pff_f(ji,jj) = zf0 * (1. + 1.0e-5 * z2d(ji,jj) )
121         pff_t(ji,jj) = zf0 * (1. + 2.0e-5 * z2d(ji,jj) )
122      END_2D
123      !
124      ! calls lbc_lnk done in dom_hgr
125      !
126   END SUBROUTINE usr_def_hgr
127
128   !!======================================================================
129END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.