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/2021/dev_r14318_RK3_stage1_tsplit/tests/SEICHE/MY_SRC – NEMO

source: NEMO/branches/2021/dev_r14318_RK3_stage1_tsplit/tests/SEICHE/MY_SRC/usrdef_hgr.F90 @ 14597

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

#2634: Implement Marsaleix (2008) and Demange (2019) test case (an external SEICHE over a 2DV stratified ocean and a seamount). One can optionnaly retrieve a standard external or 2 layer internal Seiche with a flat bottom.

File size: 6.2 KB
Line 
1MODULE usrdef_hgr
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_hgr  ***
4   !!
5   !!                       === SEICHE 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   !!                  ! 2021-01  (J. Chanut)             SEICHE test case
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   usr_def_hgr    : initialize the horizontal mesh for SEICHE 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_dx   ! 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: usrdef_hgr.F90 14223 2020-12-19 10:22:45Z smasson $
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      !!                SEICHE configuration : uniform grid spacing (rn_dx)
51      !!                without Coriolis force (f=0)
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) ::   zfact      ! local scalars
69      !!-------------------------------------------------------------------------------
70      !
71      IF(lwp) WRITE(numout,*)
72      IF(lwp) WRITE(numout,*) 'usr_def_hgr : SEICHE configuration bassin'
73      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   uniform grid spacing WITHOUT Coriolis force (f=0)'
74      !
75      !                       !==  grid point position  ==!   (in kilometers)
76      zfact = rn_dx * 1.e-3         ! conversion in km
77      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
78         !                       ! longitude   (U-point in the middle lon = 0km)
79         plamt(ji,jj) = zfact * (  - 0.5 + REAL( mig0(ji)-Ni0glo/2, wp )  ) 
80         plamu(ji,jj) = zfact * (          REAL( mig0(ji)-Ni0glo/2, wp )  )
81         plamv(ji,jj) = plamt(ji,jj)
82         plamf(ji,jj) = plamu(ji,jj)
83         !                       ! latitude    (T-point in the middle lat = 0km)
84         pphit(ji,jj) = zfact * (          REAL( mjg0(jj)-(Nj0glo-1)/2-1, wp )  )
85         pphiu(ji,jj) = pphit(ji,jj)
86         pphiv(ji,jj) = zfact * (    0.5 + REAL( mjg0(jj)-(Nj0glo-1)/2-1, wp )  )
87         pphif(ji,jj) = pphiv(ji,jj)
88      END_2D
89      !
90      !                       !==  Horizontal scale factors  ==!   (in meters)
91      pe1t(:,:) = rn_dx   ;   pe2t(:,:) = rn_dx
92      pe1u(:,:) = rn_dx   ;   pe2u(:,:) = rn_dx
93      pe1v(:,:) = rn_dx   ;   pe2v(:,:) = rn_dx
94      pe1f(:,:) = rn_dx   ;   pe2f(:,:) = rn_dx
95      !
96      !                             ! NO reduction of grid size in some straits
97      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_ghr routine
98      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
99      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
100      !
101      !
102      !                       !==  Coriolis parameter  ==!
103      kff = 1                       !  indicate not to compute Coriolis parameter afterward
104      !
105      pff_f(:,:) = 0._wp            ! here No earth rotation: f=0
106      pff_t(:,:) = 0._wp
107      !
108   END SUBROUTINE usr_def_hgr
109
110   !!======================================================================
111END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.