1 | SUBROUTINE write_3d_binary |
---|
2 | |
---|
3 | !--------------------------------------------------------------------------------! |
---|
4 | ! This file is part of PALM. |
---|
5 | ! |
---|
6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
8 | ! either version 3 of the License, or (at your option) any later version. |
---|
9 | ! |
---|
10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | ! |
---|
14 | ! You should have received a copy of the GNU General Public License along with |
---|
15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | ! |
---|
17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: write_3d_binary.f90 1401 2014-05-09 14:15:46Z raasch $ |
---|
27 | ! |
---|
28 | ! 1400 2014-05-09 14:03:54Z knoop |
---|
29 | ! writing of arrays for random_generator_parallel added |
---|
30 | ! |
---|
31 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
32 | ! Bugfix using cloud_droplets solved. qc, qr*, nr* are no longer written in case |
---|
33 | ! of cloud_droplets = .TRUE. |
---|
34 | ! |
---|
35 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
36 | ! ONLY-attribute added to USE-statements, |
---|
37 | ! revision history before 2012 removed, |
---|
38 | ! comment fields (!:) to be used for variable explanations added to |
---|
39 | ! all variable declaration statements |
---|
40 | ! |
---|
41 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
42 | ! module interfaces removed |
---|
43 | ! |
---|
44 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
45 | ! qr and nr are restricted to precipitation |
---|
46 | ! |
---|
47 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
48 | ! necessary expansions according to the two new prognostic equations (nr, qr) |
---|
49 | ! of the two-moment cloud physics scheme: |
---|
50 | ! +prr, prr_av, *, *_av, *s, *sws, *swst |
---|
51 | ! |
---|
52 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
53 | ! code put under GPL (PALM 3.9) |
---|
54 | ! |
---|
55 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
56 | ! all actions concerning leapfrog- and ups-scheme removed |
---|
57 | ! |
---|
58 | ! 978 2012-08-09 08:28:32Z fricke |
---|
59 | ! +z0h, z0h_av |
---|
60 | ! |
---|
61 | ! Revision 1.1 1998/03/18 20:20:21 raasch |
---|
62 | ! Initial revision |
---|
63 | ! |
---|
64 | ! |
---|
65 | ! Description: |
---|
66 | ! ------------ |
---|
67 | ! Binary output of variables and arrays for restarts. |
---|
68 | !------------------------------------------------------------------------------! |
---|
69 | |
---|
70 | USE arrays_3d, & |
---|
71 | ONLY: e, kh, km, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr, qrs, & |
---|
72 | qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst, rif, & |
---|
73 | rif_wall, shf, ts, tswst, u, u_m_l, u_m_n, u_m_r, u_m_s, us, & |
---|
74 | usws, uswst, v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, vsws, vswst, & |
---|
75 | w, w_m_l, w_m_n, w_m_r, w_m_s, z0, z0h |
---|
76 | |
---|
77 | USE averaging |
---|
78 | |
---|
79 | USE cloud_parameters, & |
---|
80 | ONLY: prr, precipitation_amount |
---|
81 | |
---|
82 | USE control_parameters, & |
---|
83 | ONLY: iran, humidity, passive_scalar, cloud_physics, cloud_droplets, & |
---|
84 | icloud_scheme, precipitation, ocean, topography |
---|
85 | |
---|
86 | USE indices, & |
---|
87 | ONLY: nxl, nxr, nys, nyn, nzb, nzt |
---|
88 | |
---|
89 | USE particle_attributes, & |
---|
90 | ONLY: iran_part |
---|
91 | |
---|
92 | USE pegrid |
---|
93 | |
---|
94 | USE random_function_mod, & |
---|
95 | ONLY: random_iv, random_iy |
---|
96 | |
---|
97 | USE random_generator_parallel, & |
---|
98 | ONLY: id_random_array, seq_random_array |
---|
99 | |
---|
100 | USE statistics, & |
---|
101 | ONLY: spectrum_x, spectrum_y |
---|
102 | |
---|
103 | IMPLICIT NONE |
---|
104 | |
---|
105 | CHARACTER (LEN=10) :: binary_version !: |
---|
106 | |
---|
107 | |
---|
108 | ! |
---|
109 | !-- Write control parameters and other variables for restart. |
---|
110 | IF ( myid == 0 ) CALL write_var_list |
---|
111 | |
---|
112 | ! |
---|
113 | !-- Write arrays. |
---|
114 | binary_version = '3.4' |
---|
115 | |
---|
116 | WRITE ( 14 ) binary_version |
---|
117 | |
---|
118 | WRITE ( 14 ) numprocs, myid, nxl, nxr, nys, nyn, nzb, nzt |
---|
119 | |
---|
120 | ! |
---|
121 | !-- Attention: After changes to the following output commands the version number |
---|
122 | !-- --------- of the variable binary_version must be changed! |
---|
123 | !-- Also, the list of arrays to be read in read_3d_binary must be |
---|
124 | !-- adjusted accordingly. |
---|
125 | |
---|
126 | WRITE ( 14 ) 'e '; WRITE ( 14 ) e |
---|
127 | IF ( ALLOCATED( e_av ) ) THEN |
---|
128 | WRITE ( 14 ) 'e_av '; WRITE ( 14 ) e_av |
---|
129 | ENDIF |
---|
130 | WRITE ( 14 ) 'iran '; WRITE ( 14 ) iran, iran_part |
---|
131 | WRITE ( 14 ) 'kh '; WRITE ( 14 ) kh |
---|
132 | WRITE ( 14 ) 'km '; WRITE ( 14 ) km |
---|
133 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
134 | WRITE ( 14 ) 'lpt_av '; WRITE ( 14 ) lpt_av |
---|
135 | ENDIF |
---|
136 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
137 | WRITE ( 14 ) 'lwp_av '; WRITE ( 14 ) lwp_av |
---|
138 | ENDIF |
---|
139 | WRITE ( 14 ) 'p '; WRITE ( 14 ) p |
---|
140 | IF ( ALLOCATED( p_av ) ) THEN |
---|
141 | WRITE ( 14 ) 'p_av '; WRITE ( 14 ) p_av |
---|
142 | ENDIF |
---|
143 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
144 | WRITE ( 14 ) 'pc_av '; WRITE ( 14 ) pc_av |
---|
145 | ENDIF |
---|
146 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
147 | WRITE ( 14 ) 'pr_av '; WRITE ( 14 ) pr_av |
---|
148 | ENDIF |
---|
149 | IF ( ALLOCATED( prr ) ) THEN |
---|
150 | WRITE ( 14 ) 'prr '; WRITE ( 14 ) prr |
---|
151 | ENDIF |
---|
152 | IF ( ALLOCATED( prr_av ) ) THEN |
---|
153 | WRITE ( 14 ) 'prr_av '; WRITE ( 14 ) prr_av |
---|
154 | ENDIF |
---|
155 | IF ( ALLOCATED( precipitation_amount ) ) THEN |
---|
156 | WRITE ( 14 ) 'precipitation_amount'; WRITE ( 14 ) precipitation_amount |
---|
157 | ENDIF |
---|
158 | IF ( ALLOCATED( precipitation_rate_av ) ) THEN |
---|
159 | WRITE ( 14 ) 'precipitation_rate_a'; WRITE ( 14 ) & |
---|
160 | precipitation_rate_av |
---|
161 | ENDIF |
---|
162 | WRITE ( 14 ) 'pt '; WRITE ( 14 ) pt |
---|
163 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
164 | WRITE ( 14 ) 'pt_av '; WRITE ( 14 ) pt_av |
---|
165 | ENDIF |
---|
166 | IF ( humidity .OR. passive_scalar ) THEN |
---|
167 | WRITE ( 14 ) 'q '; WRITE ( 14 ) q |
---|
168 | IF ( ALLOCATED( q_av ) ) THEN |
---|
169 | WRITE ( 14 ) 'q_av '; WRITE ( 14 ) q_av |
---|
170 | ENDIF |
---|
171 | IF ( cloud_physics .OR. cloud_droplets ) THEN |
---|
172 | WRITE ( 14 ) 'ql '; WRITE ( 14 ) ql |
---|
173 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
174 | WRITE ( 14 ) 'ql_av '; WRITE ( 14 ) ql_av |
---|
175 | ENDIF |
---|
176 | IF ( icloud_scheme == 0 .AND. .NOT. cloud_droplets ) THEN |
---|
177 | WRITE ( 14 ) 'qc '; WRITE ( 14 ) qc |
---|
178 | IF ( ALLOCATED( qc_av ) ) THEN |
---|
179 | WRITE ( 14 ) 'qc_av '; WRITE ( 14 ) qc_av |
---|
180 | ENDIF |
---|
181 | IF ( precipitation ) THEN |
---|
182 | WRITE ( 14 ) 'nr '; WRITE ( 14 ) nr |
---|
183 | IF ( ALLOCATED( nr_av ) ) THEN |
---|
184 | WRITE ( 14 ) 'nr_av '; WRITE ( 14 ) nr_av |
---|
185 | ENDIF |
---|
186 | WRITE ( 14 ) 'nrs '; WRITE ( 14 ) nrs |
---|
187 | WRITE ( 14 ) 'nrsws '; WRITE ( 14 ) nrsws |
---|
188 | WRITE ( 14 ) 'nrswst '; WRITE ( 14 ) nrswst |
---|
189 | WRITE ( 14 ) 'qr '; WRITE ( 14 ) qr |
---|
190 | IF ( ALLOCATED( qr_av ) ) THEN |
---|
191 | WRITE ( 14 ) 'qr_av '; WRITE ( 14 ) qr_av |
---|
192 | ENDIF |
---|
193 | WRITE ( 14 ) 'qrs '; WRITE ( 14 ) qrs |
---|
194 | WRITE ( 14 ) 'qrsws '; WRITE ( 14 ) qrsws |
---|
195 | WRITE ( 14 ) 'qrswst '; WRITE ( 14 ) qrswst |
---|
196 | ENDIF |
---|
197 | ENDIF |
---|
198 | ENDIF |
---|
199 | WRITE ( 14 ) 'qs '; WRITE ( 14 ) qs |
---|
200 | WRITE ( 14 ) 'qsws '; WRITE ( 14 ) qsws |
---|
201 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
202 | WRITE ( 14 ) 'qsws_av '; WRITE ( 14 ) qsws_av |
---|
203 | ENDIF |
---|
204 | WRITE ( 14 ) 'qswst '; WRITE ( 14 ) qswst |
---|
205 | ENDIF |
---|
206 | IF ( ocean ) THEN |
---|
207 | IF ( ALLOCATED( rho_av ) ) THEN |
---|
208 | WRITE ( 14 ) 'rho_av '; WRITE ( 14 ) rho_av |
---|
209 | ENDIF |
---|
210 | WRITE ( 14 ) 'sa '; WRITE ( 14 ) sa |
---|
211 | IF ( ALLOCATED( sa_av ) ) THEN |
---|
212 | WRITE ( 14 ) 'sa_av '; WRITE ( 14 ) sa_av |
---|
213 | ENDIF |
---|
214 | WRITE ( 14 ) 'saswsb '; WRITE ( 14 ) saswsb |
---|
215 | WRITE ( 14 ) 'saswst '; WRITE ( 14 ) saswst |
---|
216 | ENDIF |
---|
217 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
218 | WRITE ( 14 ) 'ql_c_av '; WRITE ( 14 ) ql_c_av |
---|
219 | ENDIF |
---|
220 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
221 | WRITE ( 14 ) 'ql_v_av '; WRITE ( 14 ) ql_v_av |
---|
222 | ENDIF |
---|
223 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
224 | WRITE ( 14 ) 'ql_vp_av '; WRITE ( 14 ) ql_vp_av |
---|
225 | ENDIF |
---|
226 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
227 | WRITE ( 14 ) 'qv_av '; WRITE ( 14 ) qv_av |
---|
228 | ENDIF |
---|
229 | WRITE ( 14 ) 'random_iv '; WRITE ( 14 ) random_iv |
---|
230 | WRITE ( 14 ) random_iy |
---|
231 | IF ( ALLOCATED( seq_random_array ) ) THEN |
---|
232 | WRITE ( 14 ) 'seq_random_array '; WRITE ( 14 ) id_random_array |
---|
233 | WRITE ( 14 ) seq_random_array |
---|
234 | ENDIF |
---|
235 | WRITE ( 14 ) 'rif '; WRITE ( 14 ) rif |
---|
236 | IF ( topography /= 'flat' ) THEN |
---|
237 | WRITE ( 14 ) 'rif_wall '; WRITE ( 14 ) rif_wall |
---|
238 | ENDIF |
---|
239 | IF ( ALLOCATED( s_av ) ) THEN |
---|
240 | WRITE ( 14 ) 's_av '; WRITE ( 14 ) s_av |
---|
241 | ENDIF |
---|
242 | WRITE ( 14 ) 'shf '; WRITE ( 14 ) shf |
---|
243 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
244 | WRITE ( 14 ) 'shf_av '; WRITE ( 14 ) shf_av |
---|
245 | ENDIF |
---|
246 | IF ( ALLOCATED( spectrum_x ) ) THEN |
---|
247 | WRITE ( 14 ) 'spectrum_x '; WRITE ( 14 ) spectrum_x |
---|
248 | WRITE ( 14 ) 'spectrum_y '; WRITE ( 14 ) spectrum_y |
---|
249 | ENDIF |
---|
250 | WRITE ( 14 ) 'ts '; WRITE ( 14 ) ts |
---|
251 | IF ( ALLOCATED( ts_av ) ) THEN |
---|
252 | WRITE ( 14 ) 'ts_av '; WRITE ( 14 ) ts_av |
---|
253 | ENDIF |
---|
254 | WRITE ( 14 ) 'tswst '; WRITE ( 14 ) tswst |
---|
255 | WRITE ( 14 ) 'u '; WRITE ( 14 ) u |
---|
256 | IF ( ALLOCATED( u_av ) ) THEN |
---|
257 | WRITE ( 14 ) 'u_av '; WRITE ( 14 ) u_av |
---|
258 | ENDIF |
---|
259 | IF ( ALLOCATED( u_m_l ) ) THEN |
---|
260 | WRITE ( 14 ) 'u_m_l '; WRITE ( 14 ) u_m_l |
---|
261 | ENDIF |
---|
262 | IF ( ALLOCATED( u_m_n ) ) THEN |
---|
263 | WRITE ( 14 ) 'u_m_n '; WRITE ( 14 ) u_m_n |
---|
264 | ENDIF |
---|
265 | IF ( ALLOCATED( u_m_r ) ) THEN |
---|
266 | WRITE ( 14 ) 'u_m_r '; WRITE ( 14 ) u_m_r |
---|
267 | ENDIF |
---|
268 | IF ( ALLOCATED( u_m_s ) ) THEN |
---|
269 | WRITE ( 14 ) 'u_m_s '; WRITE ( 14 ) u_m_s |
---|
270 | ENDIF |
---|
271 | WRITE ( 14 ) 'us '; WRITE ( 14 ) us |
---|
272 | WRITE ( 14 ) 'usws '; WRITE ( 14 ) usws |
---|
273 | WRITE ( 14 ) 'uswst '; WRITE ( 14 ) uswst |
---|
274 | IF ( ALLOCATED( us_av ) ) THEN |
---|
275 | WRITE ( 14 ) 'us_av '; WRITE ( 14 ) us_av |
---|
276 | ENDIF |
---|
277 | WRITE ( 14 ) 'v '; WRITE ( 14 ) v |
---|
278 | IF ( ALLOCATED( v_av ) ) THEN |
---|
279 | WRITE ( 14 ) 'v_av '; WRITE ( 14 ) v_av |
---|
280 | ENDIF |
---|
281 | IF ( ALLOCATED( v_m_l ) ) THEN |
---|
282 | WRITE ( 14 ) 'v_m_l '; WRITE ( 14 ) v_m_l |
---|
283 | ENDIF |
---|
284 | IF ( ALLOCATED( v_m_n ) ) THEN |
---|
285 | WRITE ( 14 ) 'v_m_n '; WRITE ( 14 ) v_m_n |
---|
286 | ENDIF |
---|
287 | IF ( ALLOCATED( v_m_r ) ) THEN |
---|
288 | WRITE ( 14 ) 'v_m_r '; WRITE ( 14 ) v_m_r |
---|
289 | ENDIF |
---|
290 | IF ( ALLOCATED( v_m_s ) ) THEN |
---|
291 | WRITE ( 14 ) 'v_m_s '; WRITE ( 14 ) v_m_s |
---|
292 | ENDIF |
---|
293 | IF ( humidity ) THEN |
---|
294 | WRITE ( 14 ) 'vpt '; WRITE ( 14 ) vpt |
---|
295 | IF ( ALLOCATED( vpt_av ) ) THEN |
---|
296 | WRITE ( 14 ) 'vpt_av '; WRITE ( 14 ) vpt_av |
---|
297 | ENDIF |
---|
298 | ENDIF |
---|
299 | WRITE ( 14 ) 'vsws '; WRITE ( 14 ) vsws |
---|
300 | WRITE ( 14 ) 'vswst '; WRITE ( 14 ) vswst |
---|
301 | WRITE ( 14 ) 'w '; WRITE ( 14 ) w |
---|
302 | IF ( ALLOCATED( w_av ) ) THEN |
---|
303 | WRITE ( 14 ) 'w_av '; WRITE ( 14 ) w_av |
---|
304 | ENDIF |
---|
305 | IF ( ALLOCATED( w_m_l ) ) THEN |
---|
306 | WRITE ( 14 ) 'w_m_l '; WRITE ( 14 ) w_m_l |
---|
307 | ENDIF |
---|
308 | IF ( ALLOCATED( w_m_n ) ) THEN |
---|
309 | WRITE ( 14 ) 'w_m_n '; WRITE ( 14 ) w_m_n |
---|
310 | ENDIF |
---|
311 | IF ( ALLOCATED( w_m_r ) ) THEN |
---|
312 | WRITE ( 14 ) 'w_m_r '; WRITE ( 14 ) w_m_r |
---|
313 | ENDIF |
---|
314 | IF ( ALLOCATED( w_m_s ) ) THEN |
---|
315 | WRITE ( 14 ) 'w_m_s '; WRITE ( 14 ) w_m_s |
---|
316 | ENDIF |
---|
317 | WRITE ( 14 ) 'z0 '; WRITE ( 14 ) z0 |
---|
318 | IF ( ALLOCATED( z0_av ) ) THEN |
---|
319 | WRITE ( 14 ) 'z0_av '; WRITE ( 14 ) z0_av |
---|
320 | ENDIF |
---|
321 | WRITE ( 14 ) 'z0h '; WRITE ( 14 ) z0h |
---|
322 | IF ( ALLOCATED( z0h_av ) ) THEN |
---|
323 | WRITE ( 14 ) 'z0h_av '; WRITE ( 14 ) z0h_av |
---|
324 | ENDIF |
---|
325 | |
---|
326 | ! |
---|
327 | !-- Write end label. Unit 14 is closed in the main program. |
---|
328 | WRITE ( 14 ) '*** end *** ' |
---|
329 | |
---|
330 | END SUBROUTINE write_3d_binary |
---|
331 | |
---|