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/UKMO/r8395_coupling_sequence/NEMOGCM/CONFIG/TEST_CASES/ISOMIP/MY_SRC – NEMO

source: NEMO/branches/UKMO/r8395_coupling_sequence/NEMOGCM/CONFIG/TEST_CASES/ISOMIP/MY_SRC/usrdef_hgr.F90 @ 10762

Last change on this file since 10762 was 10762, checked in by jcastill, 5 years ago

Revert previous changes as the removal of keywords was not uncoupled of the actual changes

File size: 6.9 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_lam0, rn_phi0, rn_e1deg, rn_e2deg   ! horizontal resolution in meters
20   !
21   USE in_out_manager  ! I/O manager
22   USE lib_mpp         ! MPP library
23   USE timing          ! Timing
24   
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   usr_def_hgr   ! called by domhgr.F90
29
30   !!----------------------------------------------------------------------
31   !! NEMO/OPA 4.0 , NEMO Consortium (2016)
32   !! $Id$
33   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
34   !!----------------------------------------------------------------------
35CONTAINS
36
37   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
38      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
39      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
40      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
41      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
42      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
43      !!----------------------------------------------------------------------
44      !!                  ***  ROUTINE usr_def_hgr  ***
45      !!
46      !! ** Purpose :   user defined mesh and Coriolis parameter
47      !!
48      !! ** Method  :   set all intent(out) argument to a proper value
49      !!                ISOMIP configuration
50      !!
51      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
52      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
53      !!              - define u- & v-surfaces (in m2)
54      !!----------------------------------------------------------------------
55      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
56      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
57      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
58      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
59      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
60      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
61      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
62      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
63      !
64      INTEGER  ::   ji, jj   ! dummy loop indices
65      REAL(wp) ::   zfact, zti, zui, zvi, zfi, ztj, zuj, zvj, zfj      ! local scalars
66      !!-------------------------------------------------------------------------------
67      !
68      IF( nn_timing == 1 )  CALL timing_start('usr_def_hgr')
69      !
70      IF(lwp) WRITE(numout,*)
71      IF(lwp) WRITE(numout,*) 'usr_def_hgr : ISOMIP configuration'
72      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
73      !
74      !                       !==  grid point position  ==!   (in kilometers)
75
76      IF(lwp) WRITE(numout,*)
77      IF(lwp) WRITE(numout,*) '          geographical mesh on the sphere with regular grid-spacing'
78      IF(lwp) WRITE(numout,*) '          given by rn_e1deg and rn_e2deg'
79
80      DO jj = 1, jpj
81         DO ji = 1, jpi
82            zti = FLOAT( ji - 1 + nimpp - 1 )         ;   ztj = FLOAT( jj - 1 + njmpp - 1 )
83            zui = FLOAT( ji - 1 + nimpp - 1 ) + 0.5   ;   zuj = FLOAT( jj - 1 + njmpp - 1 )
84            zvi = FLOAT( ji - 1 + nimpp - 1 )         ;   zvj = FLOAT( jj - 1 + njmpp - 1 ) + 0.5
85            zfi = FLOAT( ji - 1 + nimpp - 1 ) + 0.5   ;   zfj = FLOAT( jj - 1 + njmpp - 1 ) + 0.5
86     ! Longitude
87            plamt(ji,jj) = rn_lam0 + rn_e1deg * zti
88            plamu(ji,jj) = rn_lam0 + rn_e1deg * zui
89            plamv(ji,jj) = rn_lam0 + rn_e1deg * zvi
90            plamf(ji,jj) = rn_lam0 + rn_e1deg * zfi
91     ! Latitude
92            pphit(ji,jj) = rn_phi0 + rn_e2deg * ztj
93            pphiu(ji,jj) = rn_phi0 + rn_e2deg * zuj
94            pphiv(ji,jj) = rn_phi0 + rn_e2deg * zvj
95            pphif(ji,jj) = rn_phi0 + rn_e2deg * zfj
96     !                       !==  Horizontal scale factors  ==!   (in meters)
97     ! e1
98            pe1t(ji,jj) = ra * rad * COS( rad * pphit(ji,jj) ) * rn_e1deg
99            pe1u(ji,jj) = ra * rad * COS( rad * pphiu(ji,jj) ) * rn_e1deg
100            pe1v(ji,jj) = ra * rad * COS( rad * pphiv(ji,jj) ) * rn_e1deg
101            pe1f(ji,jj) = ra * rad * COS( rad * pphif(ji,jj) ) * rn_e1deg
102     ! e2
103            pe2t(ji,jj) = ra * rad * rn_e2deg
104            pe2u(ji,jj) = ra * rad * rn_e2deg
105            pe2v(ji,jj) = ra * rad * rn_e2deg
106            pe2f(ji,jj) = ra * rad * rn_e2deg
107         END DO
108      END DO
109      !                             ! NO reduction of grid size in some straits
110      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_ghr 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 = 0                       ! Coriolis parameter calculated on the sphere
117      !
118      !
119      pff_f(:,:) = 0._wp            ! CAUTION: set to zero to avoid error with some compilers that
120      pff_t(:,:) = 0._wp            !             require an initialization of INTENT(out) arguments
121      !
122      IF( nn_timing == 1 )  CALL timing_stop('usr_def_hgr')
123      !
124   END SUBROUTINE usr_def_hgr
125
126   !!======================================================================
127END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.