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