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

source: NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/BENCH/MY_SRC/usrdef_nam.F90 @ 10166

Last change on this file since 10166 was 9762, checked in by smasson, 6 years ago

dev_r9759_HPC09_ESIWACE: add BENCH test

File size: 6.2 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( ldtxt, ldnam, 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=*), DIMENSION(:), INTENT(out) ::   ldtxt, ldnam    ! stored print information
44      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
45      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
46      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes
47      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c.
48      !
49      !
50      INTEGER ::   ios, ii      ! 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      INTEGER ::   nn_perio    ! periodicity
56      !                              !!* nammpp namelist *!!
57      CHARACTER(len=1) ::   cn_mpi_send
58      INTEGER          ::   nn_buffer, jpni, jpnj, jpnij
59      LOGICAL          ::   ln_nnogather
60      !!
61      NAMELIST/namusr_def/ nn_isize, nn_jsize, nn_ksize, nn_perio
62      NAMELIST/nammpp/ cn_mpi_send, nn_buffer, jpni, jpnj, jpnij, ln_nnogather
63      !!----------------------------------------------------------------------     
64      !
65      REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
66      READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 903 )
67903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist', .TRUE. )
68      WRITE( ldnam(:), namusr_def )     
69      !
70      cd_cfg = 'BENCH'             ! name & resolution (not used)
71      kk_cfg = 0
72
73      IF( nn_isize < 0 .AND. nn_jsize < 0 ) THEN
74      !
75         REWIND( numnam_ref )              ! Namelist nammpp in reference namelist: mpi variables
76         READ  ( numnam_ref, nammpp, IOSTAT = ios, ERR = 901)
77901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist', lwp )
78         !
79         REWIND( numnam_cfg )              ! Namelist nammpp in configuration namelist: mpi variables
80         READ  ( numnam_cfg, nammpp, IOSTAT = ios, ERR = 902 )
81902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist', lwp )
82
83         kpi = ( -nn_isize - 2*nn_hls ) * jpni + 2*nn_hls
84         kpj = ( -nn_jsize - 2*nn_hls ) * jpnj + 2*nn_hls
85      ELSE
86         kpi = nn_isize
87         kpj = nn_jsize
88      ENDIF
89 
90      kpk = nn_ksize
91      kperio = nn_perio
92
93      !                             ! control print
94      ii = 1
95      WRITE(ldtxt(ii),*) '   '                                                                          ;   ii = ii + 1
96      WRITE(ldtxt(ii),*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'   ;   ii = ii + 1
97      WRITE(ldtxt(ii),*) '~~~~~~~~~~~ '                                                                 ;   ii = ii + 1
98      WRITE(ldtxt(ii),*) '   Namelist namusr_def : BENCH test case'                                     ;   ii = ii + 1
99      IF( nn_isize > 0 ) THEN
100         WRITE(ldtxt(ii),*) '      global domain size-x            nn_isize = ',  nn_isize              ;   ii = ii + 1
101      ELSE
102         WRITE(ldtxt(ii),*) '                                          jpni = ', jpni                   ;   ii = ii + 1
103         WRITE(ldtxt(ii),*) '       local domain size-x           -nn_isize = ', -nn_isize              ;   ii = ii + 1
104         WRITE(ldtxt(ii),*) '      global domain size-x                 kpi = ', kpi                    ;   ii = ii + 1
105      ENDIF
106      IF( nn_jsize > 0 ) THEN
107         WRITE(ldtxt(ii),*) '      global domain size-y            nn_jsize = ', nn_jsize               ;   ii = ii + 1
108      ELSE
109         WRITE(ldtxt(ii),*) '                                          jpnj = ', jpnj                   ;   ii = ii + 1
110         WRITE(ldtxt(ii),*) '       local domain size-y           -nn_jsize = ', -nn_jsize              ;   ii = ii + 1
111         WRITE(ldtxt(ii),*) '      global domain size-y                 kpj = ', kpj                    ;   ii = ii + 1
112      ENDIF
113      WRITE(ldtxt(ii),*) '      global domain size-z            nn_ksize = ', nn_ksize                  ;   ii = ii + 1
114      WRITE(ldtxt(ii),*) '      LBC of the global domain          kperio = ', kperio                    ;   ii = ii + 1
115      !
116   END SUBROUTINE usr_def_nam
117
118   !!======================================================================
119END MODULE usrdef_nam
Note: See TracBrowser for help on using the repository browser.