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/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/BENCH/MY_SRC – NEMO

source: NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/BENCH/MY_SRC/usrdef_hgr.F90 @ 10410

Last change on this file since 10410 was 9762, checked in by smasson, 6 years ago

dev_r9759_HPC09_ESIWACE: add BENCH test

File size: 6.0 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   !!----------------------------------------------------------------------
27   !! NEMO/OPA 4.0, NEMO Consortium (2016)
28   !! $Id$
29   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
30   !!----------------------------------------------------------------------
31CONTAINS
32
33   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
34      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
35      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
36      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
37      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
38      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
39      !!----------------------------------------------------------------------
40      !!                  ***  ROUTINE usr_def_hgr  ***
41      !!
42      !! ** Purpose :   square box mesh mesh and Coriolis parameter
43      !!
44      !! ** Method  :   set all intent(out) argument to a proper value
45      !!                BENCH configuration : beta-plance with uniform grid spacing (zres)
46      !!
47      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in grid points)
48      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
49      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
50      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
51      !!----------------------------------------------------------------------
52      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
53      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
54      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
55      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
56      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
57      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
58      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
59      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
60      !
61      INTEGER  ::   ji, jj   ! dummy loop indices
62      REAL(wp) ::   zres, zf0
63      REAL(wp) ::   zti, zui, ztj, zvj   ! local scalars
64      !!-------------------------------------------------------------------------------
65      !
66      IF(lwp) WRITE(numout,*)
67      IF(lwp) WRITE(numout,*) 'usr_def_hgr : BENCH configuration bassin'
68      IF(lwp) WRITE(numout,*)
69      IF(lwp) WRITE(numout,*) '          Beta-plane with regular grid-spacing'
70      IF(lwp) WRITE(numout,*) '          given by rn_dx and rn_dy' 
71      !
72      !                         
73      ! Position coordinates (in grid points)
74      !                          ==========         
75      DO jj = 1, jpj
76         DO ji = 1, jpi
77           
78            zti = REAL( ji - 1 + nimpp - 1, wp )          ;  ztj = REAL( jj - 1 + njmpp - 1, wp )
79            zui = REAL( ji - 1 + nimpp - 1, wp ) + 0.5_wp ;  zvj = REAL( jj - 1 + njmpp - 1, wp ) + 0.5_wp
80
81            plamt(ji,jj) = zti
82            plamu(ji,jj) = zui
83            plamv(ji,jj) = zti
84            plamf(ji,jj) = zui
85   
86            pphit(ji,jj) = ztj
87            pphiv(ji,jj) = zvj
88            pphiu(ji,jj) = ztj
89            pphif(ji,jj) = zvj
90           
91         END DO
92      END DO
93      !     
94      ! Horizontal scale factors (in meters)
95      !                              ======
96      zres = 1.e+5   !  100km
97      pe1t(:,:) = zres  ;   pe2t(:,:) = zres 
98      pe1u(:,:) = zres  ;   pe2u(:,:) = zres
99      pe1v(:,:) = zres  ;   pe2v(:,:) = zres
100      pe1f(:,:) = zres  ;   pe2f(:,:) = zres 
101
102      !                             ! NO reduction of grid size in some straits
103      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_hgr routine
104      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
105      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
106      !
107      !
108      !                       !==  Coriolis parameter  ==!
109      kff = 1                       !  indicate not to compute Coriolis parameter afterward
110      !
111      zf0   = 2._wp * omega * SIN( rad * 45 )   ! constant coriolis factor corresponding to 45°N
112      pff_f(:,:) = zf0
113      pff_t(:,:) = zf0
114      !
115   END SUBROUTINE usr_def_hgr
116
117   !!======================================================================
118END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.