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/2020/dev_r12472_ASINTER-05_Masson_CurrentFeedback/tests/VORTEX/MY_SRC – NEMO

source: NEMO/branches/2020/dev_r12472_ASINTER-05_Masson_CurrentFeedback/tests/VORTEX/MY_SRC/usrdef_hgr.F90 @ 13189

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

dev_r12472_ASINTER-05_Masson_CurrentFeedback: update with trunk@13136, see #2156

  • Property svn:keywords set to Id
File size: 6.9 KB
Line 
1MODULE usrdef_hgr
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_hgr  ***
4   !!
5   !!                      ===  VORTEX 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 VORTEX 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_ppgphi0   ! horizontal resolution in meters
19   !                                                  and reference latitude
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$
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      !!                VORTEX 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, zbeta, zf0
67      REAL(wp) ::   zti, zui, ztj, zvj   ! local scalars
68      !!-------------------------------------------------------------------------------
69      !
70      IF(lwp) WRITE(numout,*)
71      IF(lwp) WRITE(numout,*) 'usr_def_hgr : VORTEX configuration bassin'
72      IF(lwp) WRITE(numout,*)
73      IF(lwp) WRITE(numout,*) '          Beta-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 = -(jpiglo-1)/2 * 1.e-3 * rn_dx
80      zphi0 = -(jpjglo-1)/2 * 1.e-3 * rn_dy 
81
82#if defined key_agrif
83      ! ! let lower left longitude and latitude from parent
84      IF (.NOT.Agrif_root()) THEN
85          zlam0 = (0.5_wp-(Agrif_parent(jpiglo)-1)/2)*1.e-3*Agrif_irhox()*rn_dx &
86             &+(Agrif_Ix()+nbghostcells-1)*Agrif_irhox()*rn_dx*1.e-3-(0.5_wp+nbghostcells)*rn_dx*1.e-3
87          zphi0 = (0.5_wp-(Agrif_parent(jpjglo)-1)/2)*1.e-3*Agrif_irhoy()*rn_dy &
88             &+(Agrif_Iy()+nbghostcells-1)*Agrif_irhoy()*rn_dy*1.e-3-(0.5_wp+nbghostcells)*rn_dy*1.e-3
89      ENDIF 
90#endif
91         
92      DO_2D_11_11
93         zti = FLOAT( ji - 1 + nimpp - 1 )          ;  ztj = FLOAT( jj - 1 + njmpp - 1 )
94         zui = FLOAT( ji - 1 + nimpp - 1 ) + 0.5_wp ;  zvj = FLOAT( jj - 1 + njmpp - 1 ) + 0.5_wp
95         
96         plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 * zti
97         plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * zui
98         plamv(ji,jj) = plamt(ji,jj) 
99         plamf(ji,jj) = plamu(ji,jj) 
100         
101         pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 * ztj
102         pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * zvj
103         pphiu(ji,jj) = pphit(ji,jj) 
104         pphif(ji,jj) = pphiv(ji,jj) 
105      END_2D
106      !     
107      ! Horizontal scale factors (in meters)
108      !                              ======
109      pe1t(:,:) = rn_dx  ;   pe2t(:,:) = rn_dy 
110      pe1u(:,:) = rn_dx  ;   pe2u(:,:) = rn_dy 
111      pe1v(:,:) = rn_dx  ;   pe2v(:,:) = rn_dy 
112      pe1f(:,:) = rn_dx  ;   pe2f(:,:) = rn_dy 
113
114      !                             ! NO reduction of grid size in some straits
115      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_hgr routine
116      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
117      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
118      !
119      !
120      !                       !==  Coriolis parameter  ==!
121      kff = 1                       !  indicate not to compute Coriolis parameter afterward
122      !
123      zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra
124      zf0   = 2._wp * omega * SIN( rad * rn_ppgphi0 )
125      pff_f(:,:) = zf0 + zbeta * pphif(:,:) * 1.e+3
126      pff_t(:,:) = zf0 + zbeta * pphit(:,:) * 1.e+3
127      !
128   END SUBROUTINE usr_def_hgr
129
130   !!======================================================================
131END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.