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

source: NEMO/trunk/tests/ISOMIP/MY_SRC/usrdef_hgr.F90 @ 13286

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

trunk: merge extra halos branch in trunk, see #2366

  • Property svn:keywords set to Id
File size: 6.5 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
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   !! * Substitutions
30#  include "do_loop_substitute.h90"
31   !!----------------------------------------------------------------------
32   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
33   !! $Id$
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, 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      !                       !==  grid point position  ==!   (in degrees)
79      DO_2D_11_11
80         !                       ! longitude   (west coast at lon=0°)
81         plamt(ji,jj) = rn_e1deg * (  - 0.5 + REAL( mig0_oldcmp(ji)-1 , wp )  ) 
82         plamu(ji,jj) = rn_e1deg * (          REAL( mig0_oldcmp(ji)-1 , wp )  )
83         plamv(ji,jj) = plamt(ji,jj)
84         plamf(ji,jj) = plamu(ji,jj)
85         !                       ! latitude   (south coast at lat= 81°)
86         pphit(ji,jj) = rn_e2deg * (  - 0.5 + REAL( mjg0_oldcmp(jj)-1 , wp )  ) - 80._wp
87         pphiu(ji,jj) = pphit(ji,jj)
88         pphiv(ji,jj) = rn_e2deg * (          REAL( mjg0_oldcmp(jj)-1 , wp )  ) - 80_wp
89         pphif(ji,jj) = pphiv(ji,jj)
90      END_2D
91      !
92      !                       !==  Horizontal scale factors  ==!   (in meters)
93      DO_2D_11_11
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_2D
105      !                             ! NO reduction of grid size in some straits
106      ke1e2u_v    = 0               !    ==>> u_ & v_surfaces will be computed in dom_ghr routine
107      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
108      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
109      !
110      !
111      !                       !==  Coriolis parameter  ==!
112      kff = 0                       ! Coriolis parameter calculated on the sphere
113      pff_f(:,:) = 0._wp            ! CAUTION: set to zero to avoid error with some compilers that
114      pff_t(:,:) = 0._wp            !             require an initialization of INTENT(out) arguments
115      !
116   END SUBROUTINE usr_def_hgr
117
118   !!======================================================================
119END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.