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 branches/2017/dev_merge_2017/NEMOGCM/CONFIG/TEST_CASES/ISOMIP/MY_SRC – NEMO

source: branches/2017/dev_merge_2017/NEMOGCM/CONFIG/TEST_CASES/ISOMIP/MY_SRC/usrdef_hgr.F90 @ 9089

Last change on this file since 9089 was 9089, checked in by gm, 6 years ago

dev_merge_2017: bug correction in zdfdrg + ISOMIP cfg

File size: 6.7 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_e1deg, rn_e2deg   ! horizontal resolution in meters
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   !!----------------------------------------------------------------------
30   !! NEMO/OPA 4.0 , NEMO Consortium (2017)
31   !! $Id$
32   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
33   !!----------------------------------------------------------------------
34CONTAINS
35
36   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
37      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
38      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
39      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
40      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
41      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
42      !!----------------------------------------------------------------------
43      !!                  ***  ROUTINE usr_def_hgr  ***
44      !!
45      !! ** Purpose :   user defined mesh and Coriolis parameter
46      !!
47      !! ** Method  :   set all intent(out) argument to a proper value
48      !!                ISOMIP configuration
49      !!
50      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
51      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
52      !!              - define u- & v-surfaces (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) ::   zfact, zti, zui, zvi, zfi, ztj, zuj, zvj, zfj      ! local scalars
65      !!-------------------------------------------------------------------------------
66      !
67      IF(lwp) THEN
68         WRITE(numout,*)
69         WRITE(numout,*) 'usr_def_hgr : ISOMIP configuration'
70         WRITE(numout,*) '~~~~~~~~~~~'
71         WRITE(numout,*)
72         WRITE(numout,*) '   ===>>  geographical mesh on the sphere with regular grid-spacing'
73         WRITE(numout,*) '          given by rn_e1deg and rn_e2deg'
74      ENDIF
75      !
76      !                       !==  grid point position  ==!   (in degrees)
77      DO jj = 1, jpj
78         DO ji = 1, jpi             ! longitude   (west coast at lon=0°)
79            plamt(ji,jj) = rn_e1deg * (  - 0.5 + REAL( ji-1 + nimpp-1 , wp )  ) 
80            plamu(ji,jj) = rn_e1deg * (          REAL( ji-1 + nimpp-1 , wp )  )
81            plamv(ji,jj) = plamt(ji,jj)
82            plamf(ji,jj) = plamu(ji,jj)
83            !                       ! latitude   (south coast at lat= 81°)
84            pphit(ji,jj) = rn_e2deg * (  - 0.5 + REAL( jj-1 + njmpp-1 , wp )  ) - 80._wp
85            pphiu(ji,jj) = pphit(ji,jj)
86            pphiv(ji,jj) = rn_e2deg * (          REAL( jj-1 + njmpp-1 , wp )  ) - 80_wp
87            pphif(ji,jj) = pphiv(ji,jj)
88         END DO
89      END DO
90      !
91      !                       !==  Horizontal scale factors  ==!   (in meters)
92      DO jj = 1, jpj
93         DO ji = 1, jpi
94            !                       ! e1   (zonal)
95            pe1t(ji,jj) = ra * rad * COS( rad * pphit(ji,jj) ) * rn_e1deg
96            pe1u(ji,jj) = ra * rad * COS( rad * pphiu(ji,jj) ) * rn_e1deg
97            pe1v(ji,jj) = ra * rad * COS( rad * pphiv(ji,jj) ) * rn_e1deg
98            pe1f(ji,jj) = ra * rad * COS( rad * pphif(ji,jj) ) * rn_e1deg
99            !                       ! e2   (meridional)
100            pe2t(ji,jj) = ra * rad * rn_e2deg
101            pe2u(ji,jj) = ra * rad * rn_e2deg
102            pe2v(ji,jj) = ra * rad * rn_e2deg
103            pe2f(ji,jj) = ra * rad * rn_e2deg
104         END DO
105      END DO
106      !                             ! NO reduction of grid size in some straits
107      ke1e2u_v    = 0               !    ==>> u_ & v_surfaces will be computed in dom_ghr routine
108      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
109      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
110      !
111      !
112      !                       !==  Coriolis parameter  ==!
113      kff = 0                       ! Coriolis parameter calculated on the sphere
114      pff_f(:,:) = 0._wp            ! CAUTION: set to zero to avoid error with some compilers that
115      pff_t(:,:) = 0._wp            !             require an initialization of INTENT(out) arguments
116      !
117   END SUBROUTINE usr_def_hgr
118
119   !!======================================================================
120END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.