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/ICB/MY_SRC – NEMO

source: NEMO/trunk/tests/ICB/MY_SRC/usrdef_hgr.F90 @ 14227

Last change on this file since 14227 was 13899, checked in by mathiot, 4 years ago

ticket #1900: update branch to trunk and add ICB test case

File size: 6.3 KB
Line 
1MODULE usrdef_hgr
2   !!======================================================================
3   !!                       ***  MODULE usrdef_hgr   ***
4   !!
5   !!                  ===  LOCK_EXCHANGE configuration  ===
6   !!
7   !! User defined :   mesh and Coriolis parameter of a user configuration
8   !!======================================================================
9   !! History :  NEMO  ! 2016-08  (S. Flavoni, G. Madec)   Original code
10   !!                  ! 2017-02  (P. Mathiot, S. Flavoni) Adapt code to ISOMIP case
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   usr_def_hgr    : initialize the horizontal mesh for ISOMIP configuration
15   !!----------------------------------------------------------------------
16   USE dom_oce  ,  ONLY: nimpp, njmpp       ! ocean space and time domain
17   USE par_oce         ! ocean space and time domain
18   USE phycst          ! physical constants
19   USE usrdef_nam, ONLY: rn_dx, rn_dy
20   !
21   USE in_out_manager  ! I/O manager
22   USE lib_mpp         ! MPP library
23   
24   IMPLICIT NONE
25   PRIVATE
26
27   PUBLIC   usr_def_hgr   ! called by domhgr.F90
28
29   !! * Substitutions
30#  include "do_loop_substitute.h90"
31   !!----------------------------------------------------------------------
32   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
33   !! $Id: usrdef_hgr.F90 12740 2020-04-12 09:03:06Z smasson $
34   !! Software governed by the CeCILL license (see ./LICENSE)
35   !!----------------------------------------------------------------------
36CONTAINS
37
38   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
39      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
40      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
41      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
42      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
43      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
44      !!----------------------------------------------------------------------
45      !!                  ***  ROUTINE usr_def_hgr  ***
46      !!
47      !! ** Purpose :   user defined mesh and Coriolis parameter
48      !!
49      !! ** Method  :   set all intent(out) argument to a proper value
50      !!                ISOMIP configuration
51      !!
52      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
53      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
54      !!              - define u- & v-surfaces (in m2)
55      !!----------------------------------------------------------------------
56      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
57      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
58      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
59      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
60      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
61      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
62      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
63      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
64      !
65      INTEGER  ::   ji, jj   ! dummy loop indices
66      REAL(wp) ::   zfact, zlam0, zphi0, zti, zui, zvi, zfi, ztj, zuj, zvj, zfj      ! local scalars
67      !!-------------------------------------------------------------------------------
68      !
69      IF(lwp) THEN
70         WRITE(numout,*)
71         WRITE(numout,*) 'usr_def_hgr : ISOMIP configuration'
72         WRITE(numout,*) '~~~~~~~~~~~'
73         WRITE(numout,*)
74         WRITE(numout,*) '   ===>>  geographical mesh on the sphere with regular grid-spacing'
75         WRITE(numout,*) '          given by rn_e1deg and rn_e2deg'
76      ENDIF
77      !
78      zlam0 = 0.0
79      zphi0 = 0.0
80      DO_2D (1,1,1,1)
81         zti = FLOAT( ji - 1 + nimpp - 1 )          ;  ztj = FLOAT( jj - 1 + njmpp - 1 )
82         zui = FLOAT( ji - 1 + nimpp - 1 ) + 0.5_wp ;  zvj = FLOAT( jj - 1 + njmpp - 1 ) + 0.5_wp
83         
84         plamt(ji,jj) = zlam0 + rn_dx * zti
85         plamu(ji,jj) = zlam0 + rn_dx * zui
86         plamv(ji,jj) = plamt(ji,jj) 
87         plamf(ji,jj) = plamu(ji,jj) 
88         
89         pphit(ji,jj) = zphi0 + rn_dy * ztj
90         pphiv(ji,jj) = zphi0 + rn_dy * zvj
91         pphiu(ji,jj) = pphit(ji,jj) 
92         pphif(ji,jj) = pphiv(ji,jj) 
93      END_2D
94      !
95      !                       !==  Horizontal scale factors  ==!   (in meters)
96      DO_2D (1,1,1,1)
97         !                       ! e1   (zonal)
98         pe1t(ji,jj) = rn_dx
99         pe1u(ji,jj) = rn_dx
100         pe1v(ji,jj) = rn_dx
101         pe1f(ji,jj) = rn_dx
102         !                       ! e2   (meridional)
103         pe2t(ji,jj) = rn_dy
104         pe2u(ji,jj) = rn_dy
105         pe2v(ji,jj) = rn_dy
106         pe2f(ji,jj) = rn_dy
107      END_2D
108      !                             ! NO reduction of grid size in some straits
109      ke1e2u_v    = 0               !    ==>> u_ & v_surfaces will be computed in dom_ghr routine
110      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
111      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
112      !
113      !
114      !                       !==  Coriolis parameter  ==!
115      kff = 1                       ! Coriolis parameter set to 0
116      pff_f(:,:) = 0._wp            ! CAUTION: set to zero to avoid error with some compilers that
117      pff_t(:,:) = 0._wp            !             require an initialization of INTENT(out) arguments
118      !
119   END SUBROUTINE usr_def_hgr
120
121   !!======================================================================
122END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.