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