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