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.
in_out_manager.F90 in trunk/NEMO/OPA_SRC/IOM – NEMO

source: trunk/NEMO/OPA_SRC/IOM/in_out_manager.F90 @ 1146

Last change on this file since 1146 was 1146, checked in by rblod, 16 years ago

Add svn Id (first try), see ticket #210

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.3 KB
Line 
1MODULE in_out_manager   
2   !!======================================================================
3   !!                       ***  MODULE  in_out_manager  ***
4   !! Ocean physics:  vertical mixing coefficient compute from the tke
5   !!                 turbulent closure parameterization
6   !!=====================================================================
7   !! History :   1.0  !  2002-06  (G. Madec)  original code
8   !!             2.0  !  2006-07  (S. Masson)  iom, add ctl_stop, ctl_warn
9   !!             3.0  !  2008-06  (G. Madec)  add ctmp4 to ctmp10
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   ctl_stop   : update momentum and tracer Kz from a tke scheme
14   !!   ctl_warn   : initialization, namelist read, and parameters control
15   !!   getunit    : give the index of an unused logical unit
16   !!----------------------------------------------------------------------
17   USE par_kind        ! kind definition
18   USE par_oce         ! ocean parameter
19   USE lib_print       ! formated print library
20
21   IMPLICIT NONE
22   PUBLIC
23
24   !!----------------------------------------------------------------------
25   !!                   namrun namelist parameters
26   !!----------------------------------------------------------------------
27   CHARACTER (len=16) ::   cexper     = "exp0"    !: experiment name used for output filename
28   LOGICAL            ::   ln_rstart  = .FALSE.   !: start from (F) rest or (T) a restart file
29   INTEGER            ::   no         = 0         !: job number
30   INTEGER            ::   nrstdt     = 0         !: control of the time step (0, 1 or 2)
31   INTEGER            ::   nn_rstssh  = 0         !: hand made initilization of ssh or not (1/0)
32   INTEGER            ::   nit000     = 1         !: index of the first time step
33   INTEGER            ::   nitend     = 10        !: index of the last time step
34   INTEGER            ::   ndate0     = 961115    !: initial calendar date aammjj
35   INTEGER            ::   nleapy     = 0         !: Leap year calendar flag (0/1 or 30)
36   INTEGER            ::   ninist     = 0         !: initial state output flag (0/1)
37   LOGICAL            ::   ln_dimgnnn = .FALSE.   !: type of dimgout. (F): 1 file for all proc
38                                                  !:                  (T): 1 file per proc
39   !!----------------------------------------------------------------------
40   !! was in restart but moved here because of the OFF line... better solution should be found...
41   !!----------------------------------------------------------------------
42   INTEGER            ::   nitrst                 !: time step at which restart file should be written
43   !!----------------------------------------------------------------------
44   !!                    output monitoring
45   !!----------------------------------------------------------------------
46   LOGICAL            ::   ln_ctl     = .FALSE.   !: run control for debugging
47   INTEGER            ::   nstock     =   10      !: restart file frequency
48   INTEGER            ::   nprint     =    0      !: level of print (0 no print)
49   INTEGER            ::   nwrite     =   10      !: restart file frequency
50   INTEGER            ::   nictls     =    0      !: Start i indice for the SUM control
51   INTEGER            ::   nictle     =    0      !: End   i indice for the SUM control
52   INTEGER            ::   njctls     =    0      !: Start j indice for the SUM control
53   INTEGER            ::   njctle     =    0      !: End   j indice for the SUM control
54   INTEGER            ::   isplt      =    1      !: number of processors following i
55   INTEGER            ::   jsplt      =    1      !: number of processors following j
56   INTEGER            ::   ijsplt     =    1      !: nb of local domain = nb of processors
57   INTEGER            ::   nbench     =    0      !: benchmark parameter (0/1)
58   INTEGER            ::   nbit_cmp   =    0      !: bit reproducibility  (0/1)
59   !!----------------------------------------------------------------------
60   !!                        logical units
61   !!----------------------------------------------------------------------
62   INTEGER            ::   numstp                 !: logical unit for time step
63   INTEGER            ::   numout                 !: logical unit for output print
64   INTEGER            ::   numnam                 !: logical unit for namelist
65   INTEGER            ::   numnam_ice             !: logical unit for ice namelist
66   INTEGER            ::   numevo_ice             !: logical unit for ice variables (temp. evolution)
67   INTEGER            ::   numsol                 !: logical unit for solver statistics
68   INTEGER            ::   numwri                 !: logical unit for output write
69   INTEGER            ::   numisp                 !: logical unit for island statistics
70   INTEGER            ::   numgap                 !: logical unit for differences diagnostic
71   INTEGER            ::   numbol                 !: logical unit for "bol" diagnostics
72   INTEGER            ::   numptr                 !: logical unit for Poleward TRansports
73   INTEGER            ::   numflo                 !: logical unit for drifting floats
74
75   !!----------------------------------------------------------------------
76   !!                          Run control 
77   !!----------------------------------------------------------------------
78
79   INTEGER            ::   nstop = 0                !: error flag (=number of reason for a premature stop run)
80   INTEGER            ::   nwarn = 0                !: warning flag (=number of warning found during the run)
81   CHARACTER(len=200) ::   ctmp1, ctmp2, ctmp3      !: temporary characters 1 to 3
82   CHARACTER(len=200) ::   ctmp4, ctmp5, ctmp6      !: temporary characters 4 to 6
83   CHARACTER(len=200) ::   ctmp7, ctmp8, ctmp9      !: temporary characters 7 to 9
84   CHARACTER(len=200) ::   ctmp10                   !: temporary character 10
85   CHARACTER (len=64) ::   cform_err = "(/,' ===>>> : E R R O R',     /,'         ===========',/)"       !:
86   CHARACTER (len=64) ::   cform_war = "(/,' ===>>> : W A R N I N G', /,'         ===============',/)"   !:
87   LOGICAL            ::   lwp                      !: boolean : true on the 1st processor only
88   LOGICAL            ::   lsp_area = .TRUE.        !: to make a control print over a specific area
89   !!----------------------------------------------------------------------
90   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)
91   !! $Id$
92   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
93   !!----------------------------------------------------------------------
94
95CONTAINS
96
97   SUBROUTINE ctl_stop( cd1, cd2, cd3, cd4, cd5,   &
98      &                 cd6, cd7, cd8, cd9, cd10 )
99      !!----------------------------------------------------------------------
100      !!                  ***  ROUTINE  stop_opa  ***
101      !!
102      !! ** Purpose :   print in ocean.outpput file a error message and
103      !!                increment the error number (nstop) by one.
104      !!----------------------------------------------------------------------
105      CHARACTER(len=*), INTENT(in), OPTIONAL ::  cd1, cd2, cd3, cd4, cd5
106      CHARACTER(len=*), INTENT(in), OPTIONAL ::  cd6, cd7, cd8, cd9, cd10
107      !!----------------------------------------------------------------------
108      !
109      nstop = nstop + 1 
110      IF(lwp) THEN
111         WRITE(numout,"(/,' ===>>> : E R R O R',     /,'         ===========',/)") 
112         IF( PRESENT(cd1 ) ) WRITE(numout,*) cd1
113         IF( PRESENT(cd2 ) ) WRITE(numout,*) cd2
114         IF( PRESENT(cd3 ) ) WRITE(numout,*) cd3
115         IF( PRESENT(cd4 ) ) WRITE(numout,*) cd4
116         IF( PRESENT(cd5 ) ) WRITE(numout,*) cd5
117         IF( PRESENT(cd6 ) ) WRITE(numout,*) cd6
118         IF( PRESENT(cd7 ) ) WRITE(numout,*) cd7
119         IF( PRESENT(cd8 ) ) WRITE(numout,*) cd8
120         IF( PRESENT(cd9 ) ) WRITE(numout,*) cd9
121         IF( PRESENT(cd10) ) WRITE(numout,*) cd10
122      ENDIF
123      CALL FLUSH(numout)
124      !
125   END SUBROUTINE ctl_stop
126
127
128   SUBROUTINE ctl_warn( cd1, cd2, cd3, cd4, cd5,   &
129      &                 cd6, cd7, cd8, cd9, cd10 )
130      !!----------------------------------------------------------------------
131      !!                  ***  ROUTINE  stop_warn  ***
132      !!
133      !! ** Purpose :   print in ocean.outpput file a error message and
134      !!                increment the warning number (nwarn) by one.
135      !!----------------------------------------------------------------------
136      CHARACTER(len=*), INTENT(in), OPTIONAL ::  cd1, cd2, cd3, cd4, cd5
137      CHARACTER(len=*), INTENT(in), OPTIONAL ::  cd6, cd7, cd8, cd9, cd10
138      !!----------------------------------------------------------------------
139      !
140      nwarn = nwarn + 1 
141      IF(lwp) THEN
142         WRITE(numout,"(/,' ===>>> : W A R N I N G', /,'         ===============',/)") 
143         IF( PRESENT(cd1 ) ) WRITE(numout,*) cd1
144         IF( PRESENT(cd2 ) ) WRITE(numout,*) cd2
145         IF( PRESENT(cd3 ) ) WRITE(numout,*) cd3
146         IF( PRESENT(cd4 ) ) WRITE(numout,*) cd4
147         IF( PRESENT(cd5 ) ) WRITE(numout,*) cd5
148         IF( PRESENT(cd6 ) ) WRITE(numout,*) cd6
149         IF( PRESENT(cd7 ) ) WRITE(numout,*) cd7
150         IF( PRESENT(cd8 ) ) WRITE(numout,*) cd8
151         IF( PRESENT(cd9 ) ) WRITE(numout,*) cd9
152         IF( PRESENT(cd10) ) WRITE(numout,*) cd10
153      ENDIF
154      CALL FLUSH(numout)
155      !
156   END SUBROUTINE ctl_warn
157
158
159   FUNCTION getunit()
160      !!----------------------------------------------------------------------
161      !!                  ***  FUNCTION  getunit  ***
162      !!
163      !! ** Purpose :   return the index of an unused logical unit
164      !!----------------------------------------------------------------------
165      INTEGER :: getunit
166      LOGICAL :: llopn 
167      !!----------------------------------------------------------------------
168      !
169      getunit = 15   ! choose a unit that is big enough then it is not already used in NEMO
170      llopn = .TRUE.
171      DO WHILE( (getunit < 998) .AND. llopn )
172         getunit = getunit + 1
173         INQUIRE( unit = getunit, opened = llopn )
174      END DO
175      IF( (getunit == 999) .AND. llopn ) THEN
176         CALL ctl_stop( 'getunit: All logical units until 999 are used...' )
177         getunit = -1
178      ENDIF
179      !
180   END FUNCTION getunit
181
182   !!=====================================================================
183END MODULE in_out_manager
Note: See TracBrowser for help on using the repository browser.