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

source: NEMO/trunk/tests/DOME/MY_SRC/usrdef_hgr.F90 @ 14254

Last change on this file since 14254 was 14254, checked in by jchanut, 3 years ago

#2222, DOME test case: for completeness, add online domain definition. input parameters changes

File size: 6.7 KB
RevLine 
[14254]1MODULE usrdef_hgr
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_hgr  ***
4   !!
5   !!                      ===  DOME configuration  ===
6   !!
7   !! User defined :   mesh and Coriolis parameter of a user configuration
8   !!======================================================================
9   !! History :  NEMO  ! 2017-11  (J. Chanut)  Original code
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_hgr    : initialize the horizontal mesh for DOME 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 usrdef_nam, ONLY: rn_dx, rn_dy, rn_f0   ! horizontal resolution in meters
19   !                                             and Coriolis freq.
20   USE in_out_manager  ! I/O manager
21   USE lib_mpp         ! MPP library
22   
23   IMPLICIT NONE
24   PRIVATE
25
26   PUBLIC   usr_def_hgr   ! called by domhgr.F90
27
28   !! * Substitutions
29#  include "do_loop_substitute.h90"
30   !!----------------------------------------------------------------------
31   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
32   !! $Id: usrdef_hgr.F90 13295 2020-07-10 18:24:21Z acc $
33   !! Software governed by the CeCILL license (see ./LICENSE)
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      !!                DOME configuration : beta-plance with uniform grid spacing (rn_dx)
50      !!
51      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
52      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
53      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
54      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (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) ::   zphi0, zlam0 
67      REAL(wp) ::   zti, ztj   ! local scalars
68      !!-------------------------------------------------------------------------------
69      !
70      IF(lwp) WRITE(numout,*)
71      IF(lwp) WRITE(numout,*) 'usr_def_hgr : DOME configuration bassin'
72      IF(lwp) WRITE(numout,*)
73      IF(lwp) WRITE(numout,*) '          f-plane with regular grid-spacing'
74      IF(lwp) WRITE(numout,*) '          given by rn_dx and rn_dy' 
75      !
76      !                         
77      ! Position coordinates (in kilometers)
78      !                          ==========
79      zlam0 = -REAL( 0.5 + 1700._wp * 1.e3 / rn_dx)
80      zphi0 = -REAL( 0.5 +  800._wp * 1.e3 / rn_dy)
81#if defined key_agrif
82      IF( .NOT.Agrif_Root() ) THEN
83         zlam0 = - REAL( 0.5 + 1700._wp * 1.e3 / rn_dx + nbghostcells) &
84               & + REAL((nbghostcells + Agrif_Ix() - 1)*Agrif_irhox()) 
85         zphi0 = - REAL( 0.5 +  800._wp * 1.e3 / rn_dy + nbghostcells) &
86               & + REAL((nbghostcells + Agrif_Iy() - 1)*Agrif_irhoy()) 
87      ENDIF 
88#endif
89         
90      DO_2D( 1, 1, 1, 1 )
91         zti = REAL( mig0_oldcmp(ji) - 1, wp )   ! start at i=0 in the global grid without halos
92         ztj = REAL( mjg0_oldcmp(jj) - 1, wp )   ! start at j=0 in the global grid without halos
93         
94         plamt(ji,jj) = rn_dx * 1.e-3 * ( zlam0 + zti )
95         plamu(ji,jj) = rn_dx * 1.e-3 * ( zlam0 + zti + 0.5_wp )
96         plamv(ji,jj) = plamt(ji,jj) 
97         plamf(ji,jj) = plamu(ji,jj) 
98         
99         pphit(ji,jj) = rn_dy * 1.e-3 * ( zphi0 + ztj )
100         pphiv(ji,jj) = rn_dy * 1.e-3 * ( zphi0 + ztj + 0.5_wp )
101         pphiu(ji,jj) = pphit(ji,jj) 
102         pphif(ji,jj) = pphiv(ji,jj) 
103      END_2D
104      !     
105      ! Horizontal scale factors (in meters)
106      !                              ======
107      pe1t(:,:) = rn_dx  ;   pe2t(:,:) = rn_dy 
108      pe1u(:,:) = rn_dx  ;   pe2u(:,:) = rn_dy 
109      pe1v(:,:) = rn_dx  ;   pe2v(:,:) = rn_dy 
110      pe1f(:,:) = rn_dx  ;   pe2f(:,:) = rn_dy 
111
112      !                             ! NO reduction of grid size in some straits
113      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_hgr routine
114      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
115      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
116      !
117      !
118      !                       !==  Coriolis parameter  ==!
119      kff = 1                       !  indicate not to compute Coriolis parameter afterward
120      !
121      pff_f(:,:) = rn_f0
122      pff_t(:,:) = rn_f0
123      !
124   END SUBROUTINE usr_def_hgr
125
126   !!======================================================================
127END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.