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/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/tests/BENCH/MY_SRC – NEMO

source: NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/tests/BENCH/MY_SRC/usrdef_nam.F90 @ 11671

Last change on this file since 11671 was 11671, checked in by acc, 5 years ago

Branch 2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles. Final, non-substantive changes to complete this branch. These changes remove all REWIND statements on the old namelist fortran units (now character variables for internal files). These changes have been left until last since they are easily repeated via a script and it may be preferable to use the previous revision for merge purposes and reapply these last changes separately. This branch has been fully SETTE tested.

File size: 5.3 KB
Line 
1MODULE usrdef_nam
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_nam  ***
4   !!
5   !!                      ===  BENCH configuration  ===
6   !!
7   !! User defined : set the domain characteristics of a user configuration
8   !!======================================================================
9   !! History :  NEMO !
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_nam   : read user defined namelist and set global domain size
14   !!----------------------------------------------------------------------
15   USE par_oce        ! ocean space and time domain
16   USE in_out_manager ! I/O manager
17   USE lib_mpp        ! to get ctl_nam
18   
19   IMPLICIT NONE
20   PRIVATE
21
22   PUBLIC   usr_def_nam   ! called by nemogcm.F90
23   
24   !!----------------------------------------------------------------------
25   !! NEMO/OPA 4.0 , NEMO Consortium (2016)
26   !! $Id$
27   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
28   !!----------------------------------------------------------------------
29CONTAINS
30
31   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
32      !!----------------------------------------------------------------------
33      !!                     ***  ROUTINE dom_nam  ***
34      !!                   
35      !! ** Purpose :   read user defined namelist and define the domain size
36      !!
37      !! ** Method  :   read in namusr_def containing all the user specific namelist parameter
38      !!
39      !!                Here EW_CANAL configuration
40      !!
41      !! ** input   : - namusr_def namelist found in namelist_cfg
42      !!----------------------------------------------------------------------
43      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
44      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
45      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes
46      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c.
47      !
48      !
49      INTEGER ::   ios         ! Local integer
50      !                              !!* namusr_def namelist *!!
51      INTEGER ::   nn_isize    ! number of point in i-direction of global(local) domain if >0 (<0) 
52      INTEGER ::   nn_jsize    ! number of point in j-direction of global(local) domain if >0 (<0) 
53      INTEGER ::   nn_ksize    ! total number of point in k-direction
54      INTEGER ::   nn_perio    ! periodicity
55      !                              !!* nammpp namelist *!!
56      INTEGER          ::   jpni, jpnj
57      LOGICAL          ::   ln_nnogather
58      !!
59      NAMELIST/namusr_def/ nn_isize, nn_jsize, nn_ksize, nn_perio
60      NAMELIST/nammpp/ jpni, jpnj, ln_nnogather
61      !!----------------------------------------------------------------------     
62      !
63      READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 903 )
64903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
65      !
66      IF(lwm)   WRITE( numond, namusr_def )     
67      !
68      cd_cfg = 'BENCH'             ! name & resolution (not used)
69      kk_cfg = 0
70      !
71      IF( nn_isize < 0 .AND. nn_jsize < 0 ) THEN
72      !
73         READ  ( numnam_ref, nammpp, IOSTAT = ios, ERR = 901)
74901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist' )
75         !
76         READ  ( numnam_cfg, nammpp, IOSTAT = ios, ERR = 902 )
77902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist' )
78
79         kpi = ( -nn_isize - 2*nn_hls ) * jpni + 2*nn_hls
80         kpj = ( -nn_jsize - 2*nn_hls ) * jpnj + 2*nn_hls
81      ELSE
82         kpi = nn_isize
83         kpj = nn_jsize
84      ENDIF
85      !
86      kpk = nn_ksize
87      kperio = nn_perio
88      !                             ! control print
89      IF(lwp) THEN
90         WRITE(numout,*) '   '
91         WRITE(numout,*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'
92         WRITE(numout,*) '~~~~~~~~~~~ '
93         WRITE(numout,*) '   Namelist namusr_def : BENCH test case'
94         IF( nn_isize > 0 ) THEN
95            WRITE(numout,*) '      global domain size-x            nn_isize = ',  nn_isize
96         ELSE
97            WRITE(numout,*) '                                          jpni = ', jpni
98            WRITE(numout,*) '       local domain size-x           -nn_isize = ', -nn_isize
99            WRITE(numout,*) '      global domain size-x                 kpi = ', kpi
100         ENDIF
101         IF( nn_jsize > 0 ) THEN
102            WRITE(numout,*) '      global domain size-y            nn_jsize = ', nn_jsize
103         ELSE
104            WRITE(numout,*) '                                          jpnj = ', jpnj
105            WRITE(numout,*) '       local domain size-y           -nn_jsize = ', -nn_jsize
106            WRITE(numout,*) '      global domain size-y                 kpj = ', kpj
107         ENDIF
108         WRITE(numout,*) '      global domain size-z            nn_ksize = ', nn_ksize
109         WRITE(numout,*) '      LBC of the global domain          kperio = ', kperio
110      ENDIF
111      !
112   END SUBROUTINE usr_def_nam
113
114   !!======================================================================
115END MODULE usrdef_nam
Note: See TracBrowser for help on using the repository browser.