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