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-2012 Leibniz University Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: write_3d_binary.f90 1116 2013-03-26 18:49:55Z witha $ |
---|
27 | ! |
---|
28 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
29 | ! qr and nr are restricted to precipitation |
---|
30 | ! |
---|
31 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
32 | ! necessary expansions according to the two new prognostic equations (nr, qr) |
---|
33 | ! of the two-moment cloud physics scheme: |
---|
34 | ! +prr, prr_av, *, *_av, *s, *sws, *swst |
---|
35 | ! |
---|
36 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
37 | ! code put under GPL (PALM 3.9) |
---|
38 | ! |
---|
39 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
40 | ! all actions concerning leapfrog- and ups-scheme removed |
---|
41 | ! |
---|
42 | ! 978 2012-08-09 08:28:32Z fricke |
---|
43 | ! +z0h, z0h_av |
---|
44 | ! |
---|
45 | ! 790 2011-11-29 03:11:20Z raasch |
---|
46 | ! bugfix: output of 'ql' also if cloud droplets are used |
---|
47 | ! |
---|
48 | ! 776 2011-10-31 08:02:51Z heinze |
---|
49 | ! bugfix: increase binary_version due to last commit |
---|
50 | ! |
---|
51 | ! 771 2011-10-27 10:56:21Z heinze |
---|
52 | ! +lpt |
---|
53 | ! |
---|
54 | ! 759 2011-09-15 13:58:31Z raasch |
---|
55 | ! cpu measurement and file opening moved to main program |
---|
56 | ! |
---|
57 | ! 587 2010-10-27 08:36:51Z helmke |
---|
58 | ! nothing done but text written for "Current revisions" by mistake |
---|
59 | ! |
---|
60 | ! 367 2009-08-25 08:35:52Z maronga |
---|
61 | ! +shf_av, qsws_av |
---|
62 | ! |
---|
63 | ! 145 2008-01-09 08:17:38Z raasch |
---|
64 | ! write_var_list is only called for pe0, -dopr_time_count, |
---|
65 | ! hom_sum moved, volume_flow_area, volume_flow_initial moved to write_var_list, |
---|
66 | ! writing of old profil parameters (cross_..., dopr_crossindex, profile_***) |
---|
67 | ! removed |
---|
68 | ! |
---|
69 | ! 102 2007-07-27 09:09:17Z raasch |
---|
70 | ! +uswst, uswst_m, vswst, vswst_m |
---|
71 | ! |
---|
72 | ! 96 2007-06-04 08:07:41Z raasch |
---|
73 | ! +rho_av, sa, sa_av, saswsb, saswst |
---|
74 | ! |
---|
75 | ! 75 2007-03-22 09:54:05Z raasch |
---|
76 | ! +precipitation_amount, precipitation_rate_av, rif_wall, u_m_l, u_m_r, etc., |
---|
77 | ! z0_av, moisture renamed humidity |
---|
78 | ! |
---|
79 | ! 19 2007-02-23 04:53:48Z raasch |
---|
80 | ! +qswst, qswst_m, tswst, tswst_m |
---|
81 | ! |
---|
82 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
83 | ! |
---|
84 | ! Revision 1.21 2006/08/04 15:05:11 raasch |
---|
85 | ! +iran, iran_part |
---|
86 | ! |
---|
87 | ! Revision 1.1 1998/03/18 20:20:21 raasch |
---|
88 | ! Initial revision |
---|
89 | ! |
---|
90 | ! |
---|
91 | ! Description: |
---|
92 | ! ------------ |
---|
93 | ! Binary output of variables and arrays for restarts. |
---|
94 | !------------------------------------------------------------------------------! |
---|
95 | |
---|
96 | USE arrays_3d |
---|
97 | USE averaging |
---|
98 | USE cloud_parameters |
---|
99 | USE control_parameters |
---|
100 | USE cpulog |
---|
101 | USE indices |
---|
102 | USE interfaces |
---|
103 | USE particle_attributes |
---|
104 | USE pegrid |
---|
105 | USE profil_parameter |
---|
106 | USE random_function_mod |
---|
107 | USE statistics |
---|
108 | |
---|
109 | IMPLICIT NONE |
---|
110 | |
---|
111 | CHARACTER (LEN=10) :: binary_version |
---|
112 | |
---|
113 | |
---|
114 | ! |
---|
115 | !-- Write control parameters and other variables for restart. |
---|
116 | IF ( myid == 0 ) CALL write_var_list |
---|
117 | |
---|
118 | ! |
---|
119 | !-- Write arrays. |
---|
120 | binary_version = '3.4' |
---|
121 | |
---|
122 | WRITE ( 14 ) binary_version |
---|
123 | |
---|
124 | WRITE ( 14 ) numprocs, myid, nxl, nxr, nys, nyn, nzb, nzt |
---|
125 | |
---|
126 | ! |
---|
127 | !-- Attention: After changes to the following output commands the version number |
---|
128 | !-- --------- of the variable binary_version must be changed! |
---|
129 | !-- Also, the list of arrays to be read in read_3d_binary must be |
---|
130 | !-- adjusted accordingly. |
---|
131 | |
---|
132 | WRITE ( 14 ) 'e '; WRITE ( 14 ) e |
---|
133 | IF ( ALLOCATED( e_av ) ) THEN |
---|
134 | WRITE ( 14 ) 'e_av '; WRITE ( 14 ) e_av |
---|
135 | ENDIF |
---|
136 | WRITE ( 14 ) 'iran '; WRITE ( 14 ) iran, iran_part |
---|
137 | WRITE ( 14 ) 'kh '; WRITE ( 14 ) kh |
---|
138 | WRITE ( 14 ) 'km '; WRITE ( 14 ) km |
---|
139 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
140 | WRITE ( 14 ) 'lpt_av '; WRITE ( 14 ) lpt_av |
---|
141 | ENDIF |
---|
142 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
143 | WRITE ( 14 ) 'lwp_av '; WRITE ( 14 ) lwp_av |
---|
144 | ENDIF |
---|
145 | WRITE ( 14 ) 'p '; WRITE ( 14 ) p |
---|
146 | IF ( ALLOCATED( p_av ) ) THEN |
---|
147 | WRITE ( 14 ) 'p_av '; WRITE ( 14 ) p_av |
---|
148 | ENDIF |
---|
149 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
150 | WRITE ( 14 ) 'pc_av '; WRITE ( 14 ) pc_av |
---|
151 | ENDIF |
---|
152 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
153 | WRITE ( 14 ) 'pr_av '; WRITE ( 14 ) pr_av |
---|
154 | ENDIF |
---|
155 | IF ( ALLOCATED( prr ) ) THEN |
---|
156 | WRITE ( 14 ) 'prr '; WRITE ( 14 ) prr |
---|
157 | ENDIF |
---|
158 | IF ( ALLOCATED( prr_av ) ) THEN |
---|
159 | WRITE ( 14 ) 'prr_av '; WRITE ( 14 ) prr_av |
---|
160 | ENDIF |
---|
161 | IF ( ALLOCATED( precipitation_amount ) ) THEN |
---|
162 | WRITE ( 14 ) 'precipitation_amount'; WRITE ( 14 ) precipitation_amount |
---|
163 | ENDIF |
---|
164 | IF ( ALLOCATED( precipitation_rate_av ) ) THEN |
---|
165 | WRITE ( 14 ) 'precipitation_rate_a'; WRITE ( 14 ) & |
---|
166 | precipitation_rate_av |
---|
167 | ENDIF |
---|
168 | WRITE ( 14 ) 'pt '; WRITE ( 14 ) pt |
---|
169 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
170 | WRITE ( 14 ) 'pt_av '; WRITE ( 14 ) pt_av |
---|
171 | ENDIF |
---|
172 | IF ( humidity .OR. passive_scalar ) THEN |
---|
173 | WRITE ( 14 ) 'q '; WRITE ( 14 ) q |
---|
174 | IF ( ALLOCATED( q_av ) ) THEN |
---|
175 | WRITE ( 14 ) 'q_av '; WRITE ( 14 ) q_av |
---|
176 | ENDIF |
---|
177 | IF ( cloud_physics .OR. cloud_droplets ) THEN |
---|
178 | WRITE ( 14 ) 'ql '; WRITE ( 14 ) ql |
---|
179 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
180 | WRITE ( 14 ) 'ql_av '; WRITE ( 14 ) ql_av |
---|
181 | ENDIF |
---|
182 | IF ( icloud_scheme == 0 ) THEN |
---|
183 | WRITE ( 14 ) 'qc '; WRITE ( 14 ) qc |
---|
184 | IF ( ALLOCATED( qc_av ) ) THEN |
---|
185 | WRITE ( 14 ) 'qc_av '; WRITE ( 14 ) qc_av |
---|
186 | ENDIF |
---|
187 | IF ( precipitation ) THEN |
---|
188 | WRITE ( 14 ) 'nr '; WRITE ( 14 ) nr |
---|
189 | IF ( ALLOCATED( nr_av ) ) THEN |
---|
190 | WRITE ( 14 ) 'nr_av '; WRITE ( 14 ) nr_av |
---|
191 | ENDIF |
---|
192 | WRITE ( 14 ) 'nrs '; WRITE ( 14 ) nrs |
---|
193 | WRITE ( 14 ) 'nrsws '; WRITE ( 14 ) nrsws |
---|
194 | WRITE ( 14 ) 'nrswst '; WRITE ( 14 ) nrswst |
---|
195 | WRITE ( 14 ) 'qr '; WRITE ( 14 ) qr |
---|
196 | IF ( ALLOCATED( qr_av ) ) THEN |
---|
197 | WRITE ( 14 ) 'qr_av '; WRITE ( 14 ) qr_av |
---|
198 | ENDIF |
---|
199 | WRITE ( 14 ) 'qrs '; WRITE ( 14 ) qrs |
---|
200 | WRITE ( 14 ) 'qrsws '; WRITE ( 14 ) qrsws |
---|
201 | WRITE ( 14 ) 'qrswst '; WRITE ( 14 ) qrswst |
---|
202 | ENDIF |
---|
203 | ENDIF |
---|
204 | ENDIF |
---|
205 | WRITE ( 14 ) 'qs '; WRITE ( 14 ) qs |
---|
206 | WRITE ( 14 ) 'qsws '; WRITE ( 14 ) qsws |
---|
207 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
208 | WRITE ( 14 ) 'qsws_av '; WRITE ( 14 ) qsws_av |
---|
209 | ENDIF |
---|
210 | WRITE ( 14 ) 'qswst '; WRITE ( 14 ) qswst |
---|
211 | ENDIF |
---|
212 | IF ( ocean ) THEN |
---|
213 | IF ( ALLOCATED( rho_av ) ) THEN |
---|
214 | WRITE ( 14 ) 'rho_av '; WRITE ( 14 ) rho_av |
---|
215 | ENDIF |
---|
216 | WRITE ( 14 ) 'sa '; WRITE ( 14 ) sa |
---|
217 | IF ( ALLOCATED( sa_av ) ) THEN |
---|
218 | WRITE ( 14 ) 'sa_av '; WRITE ( 14 ) sa_av |
---|
219 | ENDIF |
---|
220 | WRITE ( 14 ) 'saswsb '; WRITE ( 14 ) saswsb |
---|
221 | WRITE ( 14 ) 'saswst '; WRITE ( 14 ) saswst |
---|
222 | ENDIF |
---|
223 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
224 | WRITE ( 14 ) 'ql_c_av '; WRITE ( 14 ) ql_c_av |
---|
225 | ENDIF |
---|
226 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
227 | WRITE ( 14 ) 'ql_v_av '; WRITE ( 14 ) ql_v_av |
---|
228 | ENDIF |
---|
229 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
230 | WRITE ( 14 ) 'ql_vp_av '; WRITE ( 14 ) ql_vp_av |
---|
231 | ENDIF |
---|
232 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
233 | WRITE ( 14 ) 'qv_av '; WRITE ( 14 ) qv_av |
---|
234 | ENDIF |
---|
235 | WRITE ( 14 ) 'random_iv '; WRITE ( 14 ) random_iv |
---|
236 | WRITE ( 14 ) random_iy |
---|
237 | WRITE ( 14 ) 'rif '; WRITE ( 14 ) rif |
---|
238 | IF ( topography /= 'flat' ) THEN |
---|
239 | WRITE ( 14 ) 'rif_wall '; WRITE ( 14 ) rif_wall |
---|
240 | ENDIF |
---|
241 | IF ( ALLOCATED( s_av ) ) THEN |
---|
242 | WRITE ( 14 ) 's_av '; WRITE ( 14 ) s_av |
---|
243 | ENDIF |
---|
244 | WRITE ( 14 ) 'shf '; WRITE ( 14 ) shf |
---|
245 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
246 | WRITE ( 14 ) 'shf_av '; WRITE ( 14 ) shf_av |
---|
247 | ENDIF |
---|
248 | IF ( ALLOCATED( spectrum_x ) ) THEN |
---|
249 | WRITE ( 14 ) 'spectrum_x '; WRITE ( 14 ) spectrum_x |
---|
250 | WRITE ( 14 ) 'spectrum_y '; WRITE ( 14 ) spectrum_y |
---|
251 | ENDIF |
---|
252 | WRITE ( 14 ) 'ts '; WRITE ( 14 ) ts |
---|
253 | IF ( ALLOCATED( ts_av ) ) THEN |
---|
254 | WRITE ( 14 ) 'ts_av '; WRITE ( 14 ) ts_av |
---|
255 | ENDIF |
---|
256 | WRITE ( 14 ) 'tswst '; WRITE ( 14 ) tswst |
---|
257 | WRITE ( 14 ) 'u '; WRITE ( 14 ) u |
---|
258 | IF ( ALLOCATED( u_av ) ) THEN |
---|
259 | WRITE ( 14 ) 'u_av '; WRITE ( 14 ) u_av |
---|
260 | ENDIF |
---|
261 | IF ( ALLOCATED( u_m_l ) ) THEN |
---|
262 | WRITE ( 14 ) 'u_m_l '; WRITE ( 14 ) u_m_l |
---|
263 | ENDIF |
---|
264 | IF ( ALLOCATED( u_m_n ) ) THEN |
---|
265 | WRITE ( 14 ) 'u_m_n '; WRITE ( 14 ) u_m_n |
---|
266 | ENDIF |
---|
267 | IF ( ALLOCATED( u_m_r ) ) THEN |
---|
268 | WRITE ( 14 ) 'u_m_r '; WRITE ( 14 ) u_m_r |
---|
269 | ENDIF |
---|
270 | IF ( ALLOCATED( u_m_s ) ) THEN |
---|
271 | WRITE ( 14 ) 'u_m_s '; WRITE ( 14 ) u_m_s |
---|
272 | ENDIF |
---|
273 | WRITE ( 14 ) 'us '; WRITE ( 14 ) us |
---|
274 | WRITE ( 14 ) 'usws '; WRITE ( 14 ) usws |
---|
275 | WRITE ( 14 ) 'uswst '; WRITE ( 14 ) uswst |
---|
276 | IF ( ALLOCATED( us_av ) ) THEN |
---|
277 | WRITE ( 14 ) 'us_av '; WRITE ( 14 ) us_av |
---|
278 | ENDIF |
---|
279 | WRITE ( 14 ) 'v '; WRITE ( 14 ) v |
---|
280 | IF ( ALLOCATED( v_av ) ) THEN |
---|
281 | WRITE ( 14 ) 'v_av '; WRITE ( 14 ) v_av |
---|
282 | ENDIF |
---|
283 | IF ( ALLOCATED( v_m_l ) ) THEN |
---|
284 | WRITE ( 14 ) 'v_m_l '; WRITE ( 14 ) v_m_l |
---|
285 | ENDIF |
---|
286 | IF ( ALLOCATED( v_m_n ) ) THEN |
---|
287 | WRITE ( 14 ) 'v_m_n '; WRITE ( 14 ) v_m_n |
---|
288 | ENDIF |
---|
289 | IF ( ALLOCATED( v_m_r ) ) THEN |
---|
290 | WRITE ( 14 ) 'v_m_r '; WRITE ( 14 ) v_m_r |
---|
291 | ENDIF |
---|
292 | IF ( ALLOCATED( v_m_s ) ) THEN |
---|
293 | WRITE ( 14 ) 'v_m_s '; WRITE ( 14 ) v_m_s |
---|
294 | ENDIF |
---|
295 | IF ( humidity ) THEN |
---|
296 | WRITE ( 14 ) 'vpt '; WRITE ( 14 ) vpt |
---|
297 | IF ( ALLOCATED( vpt_av ) ) THEN |
---|
298 | WRITE ( 14 ) 'vpt_av '; WRITE ( 14 ) vpt_av |
---|
299 | ENDIF |
---|
300 | ENDIF |
---|
301 | WRITE ( 14 ) 'vsws '; WRITE ( 14 ) vsws |
---|
302 | WRITE ( 14 ) 'vswst '; WRITE ( 14 ) vswst |
---|
303 | WRITE ( 14 ) 'w '; WRITE ( 14 ) w |
---|
304 | IF ( ALLOCATED( w_av ) ) THEN |
---|
305 | WRITE ( 14 ) 'w_av '; WRITE ( 14 ) w_av |
---|
306 | ENDIF |
---|
307 | IF ( ALLOCATED( w_m_l ) ) THEN |
---|
308 | WRITE ( 14 ) 'w_m_l '; WRITE ( 14 ) w_m_l |
---|
309 | ENDIF |
---|
310 | IF ( ALLOCATED( w_m_n ) ) THEN |
---|
311 | WRITE ( 14 ) 'w_m_n '; WRITE ( 14 ) w_m_n |
---|
312 | ENDIF |
---|
313 | IF ( ALLOCATED( w_m_r ) ) THEN |
---|
314 | WRITE ( 14 ) 'w_m_r '; WRITE ( 14 ) w_m_r |
---|
315 | ENDIF |
---|
316 | IF ( ALLOCATED( w_m_s ) ) THEN |
---|
317 | WRITE ( 14 ) 'w_m_s '; WRITE ( 14 ) w_m_s |
---|
318 | ENDIF |
---|
319 | WRITE ( 14 ) 'z0 '; WRITE ( 14 ) z0 |
---|
320 | IF ( ALLOCATED( z0_av ) ) THEN |
---|
321 | WRITE ( 14 ) 'z0_av '; WRITE ( 14 ) z0_av |
---|
322 | ENDIF |
---|
323 | WRITE ( 14 ) 'z0h '; WRITE ( 14 ) z0h |
---|
324 | IF ( ALLOCATED( z0h_av ) ) THEN |
---|
325 | WRITE ( 14 ) 'z0h_av '; WRITE ( 14 ) z0h_av |
---|
326 | ENDIF |
---|
327 | |
---|
328 | ! |
---|
329 | !-- Write end label. Unit 14 is closed in the main program. |
---|
330 | WRITE ( 14 ) '*** end *** ' |
---|
331 | |
---|
332 | END SUBROUTINE write_3d_binary |
---|