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