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 @ 12740

Last change on this file since 12740 was 12740, checked in by smasson, 4 years ago

trunk: update/debug of tests and C1D, see #2442

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   !! * 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) ::   zres, zf0
65      REAL(wp) ::   zti, zui, ztj, zvj   ! local scalars
66      !!-------------------------------------------------------------------------------
67      !
68      IF(lwp) WRITE(numout,*)
69      IF(lwp) WRITE(numout,*) 'usr_def_hgr : BENCH configuration bassin'
70      IF(lwp) WRITE(numout,*)
71      IF(lwp) WRITE(numout,*) '          Beta-plane with regular grid-spacing'
72      IF(lwp) WRITE(numout,*) '          given by rn_dx and rn_dy' 
73      !
74      !                         
75      ! Position coordinates (in grid points)
76      !                          ==========
77      DO_2D_11_11
78         
79         zti = REAL( ji - 1 + nimpp - 1, wp )          ;  ztj = REAL( jj - 1 + njmpp - 1, wp )
80         zui = REAL( ji - 1 + nimpp - 1, wp ) + 0.5_wp ;  zvj = REAL( jj - 1 + njmpp - 1, wp ) + 0.5_wp
81         
82         plamt(ji,jj) = zti
83         plamu(ji,jj) = zui
84         plamv(ji,jj) = zti
85         plamf(ji,jj) = zui
86         
87         pphit(ji,jj) = ztj
88         pphiv(ji,jj) = zvj
89         pphiu(ji,jj) = ztj
90         pphif(ji,jj) = zvj
91
92      END_2D
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.