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/BENCH/MY_SRC – NEMO

source: NEMO/trunk/tests/BENCH/MY_SRC/usrdef_nam.F90

Last change on this file was 14433, checked in by smasson, 3 years ago

trunk: merge dev_r14312_MPI_Interface into the trunk, #2598

File size: 5.5 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, ldIperio, ldJperio, ldNFold, cdNFtype )
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      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
47      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
48      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
49      !
50      INTEGER ::   ios         ! Local integer
51      !                              !!* namusr_def namelist *!!
52      INTEGER ::   nn_isize    ! number of point in i-direction of global(local) domain if >0 (<0) 
53      INTEGER ::   nn_jsize    ! number of point in j-direction of global(local) domain if >0 (<0) 
54      INTEGER ::   nn_ksize    ! total number of point in k-direction
55      !                              !!* nammpp namelist *!!
56      INTEGER          ::   jpni, jpnj
57      LOGICAL          ::   ln_listonly
58      LOGICAL          ::   ln_Iperio, ln_Jperio
59      LOGICAL          ::   ln_NFold
60      character(len=1) ::   cn_NFtype
61      !!
62      NAMELIST/namusr_def/ nn_isize, nn_jsize, nn_ksize, ln_Iperio, ln_Jperio, ln_NFold, cn_NFtype
63      NAMELIST/nammpp/ jpni, jpnj, nn_hls, ln_nnogather, ln_listonly, nn_comm
64      !!----------------------------------------------------------------------     
65      !
66      READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 903 )
67903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
68      !
69      IF(lwm)   WRITE( numond, namusr_def )     
70      !
71      cd_cfg = 'BENCH'             ! name & resolution (not used)
72      kk_cfg = 0
73      !
74      IF( nn_isize < 0 .AND. nn_jsize < 0 ) THEN
75      !
76         READ  ( numnam_ref, nammpp, IOSTAT = ios, ERR = 901)
77901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist' )
78         !
79         READ  ( numnam_cfg, nammpp, IOSTAT = ios, ERR = 902 )
80902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist' )
81
82         kpi = -nn_isize * jpni
83         kpj = -nn_jsize * jpnj
84      ELSE
85         kpi = nn_isize
86         kpj = nn_jsize
87      ENDIF
88      kpk = nn_ksize
89      !
90      ldIperio = ln_Iperio   ;   ldJperio = ln_Jperio
91      ldNFold  = ln_NFold    ;   cdNFtype = cn_NFtype
92      !
93      !                             ! control print
94      IF(lwp) THEN
95         WRITE(numout,*) '   '
96         WRITE(numout,*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'
97         WRITE(numout,*) '~~~~~~~~~~~ '
98         WRITE(numout,*) '   Namelist namusr_def : BENCH test case'
99         IF( nn_isize > 0 ) THEN
100            WRITE(numout,*) '      global domain size-x            nn_isize = ',  nn_isize
101         ELSE
102            WRITE(numout,*) '                                          jpni = ', jpni
103            WRITE(numout,*) '       local domain size-x           -nn_isize = ', -nn_isize
104            WRITE(numout,*) '      global domain size-x                 kpi = ', kpi
105         ENDIF
106         IF( nn_jsize > 0 ) THEN
107            WRITE(numout,*) '      global domain size-y            nn_jsize = ', nn_jsize
108         ELSE
109            WRITE(numout,*) '                                          jpnj = ', jpnj
110            WRITE(numout,*) '       local domain size-y           -nn_jsize = ', -nn_jsize
111            WRITE(numout,*) '      global domain size-y                 kpj = ', kpj
112         ENDIF
113         WRITE(numout,*) '      global domain size-z            nn_ksize = ', nn_ksize
114         WRITE(numout,*) '   '
115      ENDIF
116      !
117   END SUBROUTINE usr_def_nam
118
119   !!======================================================================
120END MODULE usrdef_nam
Note: See TracBrowser for help on using the repository browser.