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 @ 14976

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

#2638, merge dev_14608_AGRIF_domcfg branch into trunk

File size: 6.9 KB
Line 
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   REAL(wp) :: roffsetx, roffsety ! Offset in km to first f-point
27
28   PUBLIC   usr_def_hgr   ! called by domhgr.F90
29
30   !! * Substitutions
31#  include "do_loop_substitute.h90"
32   !!----------------------------------------------------------------------
33   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
34   !! $Id: usrdef_hgr.F90 13295 2020-07-10 18:24:21Z acc $
35   !! Software governed by the CeCILL license (see ./LICENSE)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
40      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
41      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
42      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
43      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
44      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
45      !!----------------------------------------------------------------------
46      !!                  ***  ROUTINE usr_def_hgr  ***
47      !!
48      !! ** Purpose :   user defined mesh and Coriolis parameter
49      !!
50      !! ** Method  :   set all intent(out) argument to a proper value
51      !!                DOME configuration : beta-plance with uniform grid spacing (rn_dx)
52      !!
53      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
54      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
55      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
56      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
57      !!----------------------------------------------------------------------
58      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
59      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
60      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
61      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
62      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
63      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
64      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
65      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
66      !
67      INTEGER  ::   ji, jj     ! dummy loop indices
68      REAL(wp) ::   zti, ztj   ! local scalars
69      !!-------------------------------------------------------------------------------
70      !
71      IF(lwp) WRITE(numout,*)
72      IF(lwp) WRITE(numout,*) 'usr_def_hgr : DOME configuration bassin'
73      IF(lwp) WRITE(numout,*)
74      IF(lwp) WRITE(numout,*) '          f-plane with regular grid-spacing'
75      IF(lwp) WRITE(numout,*) '          given by rn_dx and rn_dy' 
76      !
77      !                         
78      ! Position coordinates (in kilometers)
79      !                          ==========
80      ! Offsets in km of the first south west f-point:
81      roffsetx = -1700._wp
82      roffsety =  -800._wp 
83#if defined key_agrif
84      IF( .NOT.Agrif_Root() ) THEN
85         ! deduce offset from parent:
86         roffsetx = Agrif_Parent(roffsetx) &
87              & + (-(nbghostcells_x   - 1) + (Agrif_Parent(nbghostcells_x  ) &
88              & + Agrif_Ix()-2)*Agrif_Rhox()) * 1.e-3 * rn_dx
89         roffsety = Agrif_Parent(roffsety) &
90              & + (-(nbghostcells_y_s - 1) + (Agrif_Parent(nbghostcells_y_s) &
91              & + Agrif_Iy()-2)*Agrif_Rhoy()) * 1.e-3 * rn_dy
92      ENDIF
93#endif
94         
95      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
96         zti = REAL( mig0(ji) - 1, wp )   ! start at i=0 in the global grid without halos
97         ztj = REAL( mjg0(jj) - 1, wp )   ! start at j=0 in the global grid without halos
98         
99         plamt(ji,jj) = roffsetx + rn_dx * 1.e-3 * ( zti - 0.5_wp )
100         plamu(ji,jj) = roffsetx + rn_dx * 1.e-3 *   zti 
101         plamv(ji,jj) = plamt(ji,jj) 
102         plamf(ji,jj) = plamu(ji,jj) 
103         
104         pphit(ji,jj) = roffsety + rn_dy * 1.e-3 * ( ztj - 0.5_wp )
105         pphiv(ji,jj) = roffsety + rn_dy * 1.e-3 *   ztj
106         pphiu(ji,jj) = pphit(ji,jj) 
107         pphif(ji,jj) = pphiv(ji,jj) 
108      END_2D
109      !     
110      ! Horizontal scale factors (in meters)
111      !                              ======
112      pe1t(:,:) = rn_dx  ;   pe2t(:,:) = rn_dy 
113      pe1u(:,:) = rn_dx  ;   pe2u(:,:) = rn_dy 
114      pe1v(:,:) = rn_dx  ;   pe2v(:,:) = rn_dy 
115      pe1f(:,:) = rn_dx  ;   pe2f(:,:) = rn_dy 
116
117      !                             ! NO reduction of grid size in some straits
118      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_hgr routine
119      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
120      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
121      !
122      !
123      !                       !==  Coriolis parameter  ==!
124      kff = 1                       !  indicate not to compute Coriolis parameter afterward
125      !
126      pff_f(:,:) = rn_f0
127      pff_t(:,:) = rn_f0
128      !
129   END SUBROUTINE usr_def_hgr
130
131   !!======================================================================
132END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.