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