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