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

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

trunk: simplify TSUNAMI test case

File size: 6.4 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_0xratio =    0.5 ! x domain ratio of the 0
36   REAL(wp), PUBLIC ::   rn_0yratio =    0.5 ! x domain ratio of the 0
37   INTEGER , PUBLIC ::   nn_fcase   =    1   ! F computation (0:f0, 1:Beta, 2:real)
38   REAL(wp), PUBLIC ::   rn_ppgphi0 =   38.5 ! reference latitude for beta-plane
39   INTEGER , PUBLIC ::   nn_perio   =    0   ! periodicity of the channel (0=closed, 1=E-W)
40
41   !!----------------------------------------------------------------------
42   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
43   !! $Id: usrdef_nam.F90 13472 2020-09-16 13:05:19Z smasson $
44   !! Software governed by the CeCILL license (see ./LICENSE)
45   !!----------------------------------------------------------------------
46CONTAINS
47
48   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
49      !!----------------------------------------------------------------------
50      !!                     ***  ROUTINE dom_nam  ***
51      !!                   
52      !! ** Purpose :   read user defined namelist and define the domain size
53      !!
54      !! ** Method  :   read in namusr_def containing all the user specific namelist parameter
55      !!
56      !!                Here TSUNAMI configuration
57      !!
58      !! ** input   : - namusr_def namelist found in namelist_cfg
59      !!----------------------------------------------------------------------
60      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
61      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
62      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes
63      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c.
64      !
65      INTEGER ::   ios      ! Local integer
66      !!
67      NAMELIST/namusr_def/  rn_domszx, rn_domszy, rn_domszz, rn_dx, rn_dy, rn_0xratio, rn_0yratio   &
68         &                 , nn_fcase, rn_ppgphi0, nn_perio
69      !!----------------------------------------------------------------------
70      !
71      READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
72902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
73      !
74      IF(lwm)   WRITE( numond, namusr_def )
75      !
76#if defined key_agrif 
77      ! Domain parameters are taken from parent:
78      IF( .NOT. Agrif_Root() ) THEN
79         rn_dx = Agrif_Parent(rn_dx)/Agrif_Rhox()
80         rn_dy = Agrif_Parent(rn_dy)/Agrif_Rhoy()
81         rn_ppgphi0 = Agrif_Parent(rn_ppgphi0)
82      ENDIF
83      rn_0xratio = 0.5   ! not really working I guess...
84      rn_0yratio = 0.5
85#endif
86      !
87      IF(lwm)   WRITE( numond, namusr_def )
88      !
89      cd_cfg = 'TSUNAMI'             ! name & resolution (not used)
90      kk_cfg = INT( rn_dx )
91      !
92      IF( Agrif_Root() ) THEN        ! Global Domain size:  TSUNAMI global domain is  1800 km x 1800 Km x 5000 m
93         kpi = NINT( rn_domszx / rn_dx ) + 1
94         kpj = NINT( rn_domszy / rn_dy ) + 3
95      ELSE                           ! Global Domain size: add nbghostcells + 1 "land" point on each side
96         kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2
97         kpj  = nbcellsy + nbghostcells_y_s + nbghostcells_y_n + 2
98      ENDIF
99      kpk = 2
100      !                             ! Set the lateral boundary condition of the global domain
101      kperio = 1                    ! TSUNAMI configuration : closed basin
102      !                             ! control print
103      IF(lwp) THEN
104         WRITE(numout,*) '   '
105         WRITE(numout,*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'
106         WRITE(numout,*) '~~~~~~~~~~~ '
107         WRITE(numout,*) '   Namelist namusr_def : TSUNAMI test case'
108         WRITE(numout,*) '      horizontal domain size-x          rn_domszx  = ', rn_domszx, ' km'
109         WRITE(numout,*) '      horizontal domain size-y          rn_domszy  = ', rn_domszy, ' km'
110         WRITE(numout,*) '      vertical   domain size-z          rn_domszz  = ', rn_domszz, '  m'
111         WRITE(numout,*) '      horizontal x-resolution           rn_dx      = ',     rn_dx, ' km'
112         WRITE(numout,*) '      horizontal y-resolution           rn_dy      = ',     rn_dy, ' km'
113         WRITE(numout,*) '      x-domain ratio of the 0           rn_0xratio = ', rn_0xratio
114         WRITE(numout,*) '      y-domain ratio of the 0           rn_0yratio = ', rn_0yratio
115         WRITE(numout,*) '      F computation                     nn_fcase   = ',   nn_fcase
116         WRITE(numout,*) '      Reference latitude                rn_ppgphi0 = ', rn_ppgphi0
117         WRITE(numout,*) '      Periodicity of the basin            nn_perio = ', nn_perio
118      ENDIF
119      !                             ! Set the lateral boundary condition of the global domain
120      kperio = nn_perio                    ! TSUNAMI configuration : closed basin
121      !
122   END SUBROUTINE usr_def_nam
123
124   !!======================================================================
125END MODULE usrdef_nam
Note: See TracBrowser for help on using the repository browser.