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_nam.F90 in NEMO/trunk/tests/TSUNAMI/MY_SRC – NEMO

source: NEMO/trunk/tests/TSUNAMI/MY_SRC/usrdef_nam.F90 @ 14225

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

trunk: add TSUNAMI test case

File size: 6.8 KB
Line 
1MODULE usrdef_nam
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_nam  ***
4   !!
5   !!                      ===  TSUNAMI configuration  ===
6   !!
7   !! User defined : set the domain characteristics of a user configuration
8   !!======================================================================
9   !! History :  NEMO ! 2017-10  (J. Chanut)  Original code
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_nam   : read user defined namelist and set global domain size
14   !!   usr_def_hgr   : initialize the horizontal mesh
15   !!----------------------------------------------------------------------
16   USE dom_oce
17   USE par_oce        ! ocean space and time domain
18   USE phycst         ! physical constants
19   !
20   USE in_out_manager ! I/O manager
21   USE lib_mpp        ! MPP library
22   USE timing         ! Timing
23   
24   IMPLICIT NONE
25   PRIVATE
26
27   PUBLIC   usr_def_nam   ! called by nemogcm.F90
28
29   !                              !!* namusr_def namelist *!!
30   REAL(wp)         ::   rn_domszx  = 1800.  ! x horizontal size         [km]
31   REAL(wp)         ::   rn_domszy  = 1800.  ! y horizontal size         [km]
32   REAL(wp), PUBLIC ::   rn_domszz  = 5000.  ! z horizontal size          [m]
33   REAL(wp), PUBLIC ::   rn_dx      =   30.  ! x horizontal resolution   [km]
34   REAL(wp), PUBLIC ::   rn_dy      =   30.  ! y horizontal resolution   [km]
35   REAL(wp), PUBLIC ::   rn_dz      =  500.  ! vertical resolution        [m]
36   REAL(wp), PUBLIC ::   rn_0xratio =    0.5 ! x domain ratio of the 0
37   REAL(wp), PUBLIC ::   rn_0yratio =    0.5 ! x domain ratio of the 0
38   INTEGER , PUBLIC ::   nn_fcase   =    1   ! F computation (0:f0, 1:Beta, 2:real)
39   REAL(wp), PUBLIC ::   rn_ppgphi0 =   38.5 ! reference latitude for beta-plane
40   INTEGER , PUBLIC ::   nn_perio   =    0   ! periodicity of the channel (0=closed, 1=E-W)
41
42   !!----------------------------------------------------------------------
43   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
44   !! $Id: usrdef_nam.F90 13472 2020-09-16 13:05:19Z smasson $
45   !! Software governed by the CeCILL license (see ./LICENSE)
46   !!----------------------------------------------------------------------
47CONTAINS
48
49   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
50      !!----------------------------------------------------------------------
51      !!                     ***  ROUTINE dom_nam  ***
52      !!                   
53      !! ** Purpose :   read user defined namelist and define the domain size
54      !!
55      !! ** Method  :   read in namusr_def containing all the user specific namelist parameter
56      !!
57      !!                Here TSUNAMI configuration
58      !!
59      !! ** input   : - namusr_def namelist found in namelist_cfg
60      !!----------------------------------------------------------------------
61      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
62      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
63      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes
64      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c.
65      !
66      INTEGER ::   ios      ! Local integer
67      REAL(wp)::   zh       ! Local scalars
68      !!
69      NAMELIST/namusr_def/  rn_domszx, rn_domszy, rn_domszz, rn_dx, rn_dy, rn_dz, rn_0xratio, rn_0yratio   &
70         &                 , nn_fcase, rn_ppgphi0, nn_perio
71      !!----------------------------------------------------------------------
72      !
73      READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
74902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
75      !
76      IF(lwm)   WRITE( numond, namusr_def )
77      !
78#if defined key_agrif 
79      ! Domain parameters are taken from parent:
80      IF( .NOT. Agrif_Root() ) THEN
81         rn_dx = Agrif_Parent(rn_dx)/Agrif_Rhox()
82         rn_dy = Agrif_Parent(rn_dy)/Agrif_Rhoy()
83         rn_dz = Agrif_Parent(rn_dz)
84         rn_ppgphi0 = Agrif_Parent(rn_ppgphi0)
85      ENDIF
86      rn_0xratio = 0.5
87      rn_0yratio = 0.5
88#endif
89      !
90      IF(lwm)   WRITE( numond, namusr_def )
91      !
92      cd_cfg = 'TSUNAMI'             ! name & resolution (not used)
93      kk_cfg = INT( rn_dx )
94      !
95      IF( Agrif_Root() ) THEN        ! Global Domain size:  TSUNAMI global domain is  1800 km x 1800 Km x 5000 m
96         kpi = NINT( rn_domszx / rn_dx ) + 1
97         kpj = NINT( rn_domszy / rn_dy ) + 3
98      ELSE                           ! Global Domain size: add nbghostcells + 1 "land" point on each side
99         kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2
100         kpj  = nbcellsy + nbghostcells_y_s + nbghostcells_y_n + 2
101      ENDIF
102      kpk = MAX( 2, NINT( rn_domszz / rn_dz ) + 1 )
103      !
104      zh  = (kpk-1)*rn_dz
105      !                             ! Set the lateral boundary condition of the global domain
106      kperio = 1                    ! TSUNAMI configuration : closed basin
107      !                             ! control print
108      IF(lwp) THEN
109         WRITE(numout,*) '   '
110         WRITE(numout,*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'
111         WRITE(numout,*) '~~~~~~~~~~~ '
112         WRITE(numout,*) '   Namelist namusr_def : TSUNAMI test case'
113         WRITE(numout,*) '      horizontal domain size-x          rn_domszx  = ', rn_domszx, ' km'
114         WRITE(numout,*) '      horizontal domain size-y          rn_domszy  = ', rn_domszy, ' km'
115         WRITE(numout,*) '      vertical   domain size-z          rn_domszz  = ', rn_domszz, '  m'
116         WRITE(numout,*) '      horizontal x-resolution           rn_dx      = ',     rn_dx, ' km'
117         WRITE(numout,*) '      horizontal y-resolution           rn_dy      = ',     rn_dy, ' km'
118         WRITE(numout,*) '      vertical resolution               rn_dz      = ',     rn_dz, '  m'
119         WRITE(numout,*) '      x-domain ratio of the 0           rn_0xratio = ', rn_0xratio
120         WRITE(numout,*) '      y-domain ratio of the 0           rn_0yratio = ', rn_0yratio
121         WRITE(numout,*) '          H [m] : ', zh
122         WRITE(numout,*) '      F computation                     nn_fcase   = ',   nn_fcase
123         WRITE(numout,*) '      Reference latitude                rn_ppgphi0 = ', rn_ppgphi0
124         WRITE(numout,*) '      Periodicity of the basin            nn_perio = ', nn_perio
125      ENDIF
126      !                             ! Set the lateral boundary condition of the global domain
127      kperio = nn_perio                    ! TSUNAMI configuration : closed basin
128      !
129   END SUBROUTINE usr_def_nam
130
131   !!======================================================================
132END MODULE usrdef_nam
Note: See TracBrowser for help on using the repository browser.