SUBROUTINE write_3d_binary !--------------------------------------------------------------------------------! ! This file is part of PALM. ! ! PALM is free software: you can redistribute it and/or modify it under the terms ! of the GNU General Public License as published by the Free Software Foundation, ! either version 3 of the License, or (at your option) any later version. ! ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License along with ! PALM. If not, see . ! ! Copyright 1997-2014 Leibniz Universitaet Hannover !--------------------------------------------------------------------------------! ! ! Current revisions: ! ----------------- ! ! ! Former revisions: ! ----------------- ! $Id: write_3d_binary.f90 1401 2014-05-09 14:15:46Z hoffmann $ ! ! 1400 2014-05-09 14:03:54Z knoop ! writing of arrays for random_generator_parallel added ! ! 1359 2014-04-11 17:15:14Z hoffmann ! Bugfix using cloud_droplets solved. qc, qr*, nr* are no longer written in case ! of cloud_droplets = .TRUE. ! ! 1320 2014-03-20 08:40:49Z raasch ! ONLY-attribute added to USE-statements, ! revision history before 2012 removed, ! comment fields (!:) to be used for variable explanations added to ! all variable declaration statements ! ! 1318 2014-03-17 13:35:16Z raasch ! module interfaces removed ! ! 1115 2013-03-26 18:16:16Z hoffmann ! qr and nr are restricted to precipitation ! ! 1053 2012-11-13 17:11:03Z hoffmann ! necessary expansions according to the two new prognostic equations (nr, qr) ! of the two-moment cloud physics scheme: ! +prr, prr_av, *, *_av, *s, *sws, *swst ! ! 1036 2012-10-22 13:43:42Z raasch ! code put under GPL (PALM 3.9) ! ! 1001 2012-09-13 14:08:46Z raasch ! all actions concerning leapfrog- and ups-scheme removed ! ! 978 2012-08-09 08:28:32Z fricke ! +z0h, z0h_av ! ! Revision 1.1 1998/03/18 20:20:21 raasch ! Initial revision ! ! ! Description: ! ------------ ! Binary output of variables and arrays for restarts. !------------------------------------------------------------------------------! USE arrays_3d, & ONLY: e, kh, km, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr, qrs, & qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst, rif, & rif_wall, shf, ts, tswst, u, u_m_l, u_m_n, u_m_r, u_m_s, us, & usws, uswst, v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, vsws, vswst, & w, w_m_l, w_m_n, w_m_r, w_m_s, z0, z0h USE averaging USE cloud_parameters, & ONLY: prr, precipitation_amount USE control_parameters, & ONLY: iran, humidity, passive_scalar, cloud_physics, cloud_droplets, & icloud_scheme, precipitation, ocean, topography USE indices, & ONLY: nxl, nxr, nys, nyn, nzb, nzt USE particle_attributes, & ONLY: iran_part USE pegrid USE random_function_mod, & ONLY: random_iv, random_iy USE random_generator_parallel, & ONLY: id_random_array, seq_random_array USE statistics, & ONLY: spectrum_x, spectrum_y IMPLICIT NONE CHARACTER (LEN=10) :: binary_version !: ! !-- Write control parameters and other variables for restart. IF ( myid == 0 ) CALL write_var_list ! !-- Write arrays. binary_version = '3.4' WRITE ( 14 ) binary_version WRITE ( 14 ) numprocs, myid, nxl, nxr, nys, nyn, nzb, nzt ! !-- Attention: After changes to the following output commands the version number !-- --------- of the variable binary_version must be changed! !-- Also, the list of arrays to be read in read_3d_binary must be !-- adjusted accordingly. WRITE ( 14 ) 'e '; WRITE ( 14 ) e IF ( ALLOCATED( e_av ) ) THEN WRITE ( 14 ) 'e_av '; WRITE ( 14 ) e_av ENDIF WRITE ( 14 ) 'iran '; WRITE ( 14 ) iran, iran_part WRITE ( 14 ) 'kh '; WRITE ( 14 ) kh WRITE ( 14 ) 'km '; WRITE ( 14 ) km IF ( ALLOCATED( lpt_av ) ) THEN WRITE ( 14 ) 'lpt_av '; WRITE ( 14 ) lpt_av ENDIF IF ( ALLOCATED( lwp_av ) ) THEN WRITE ( 14 ) 'lwp_av '; WRITE ( 14 ) lwp_av ENDIF WRITE ( 14 ) 'p '; WRITE ( 14 ) p IF ( ALLOCATED( p_av ) ) THEN WRITE ( 14 ) 'p_av '; WRITE ( 14 ) p_av ENDIF IF ( ALLOCATED( pc_av ) ) THEN WRITE ( 14 ) 'pc_av '; WRITE ( 14 ) pc_av ENDIF IF ( ALLOCATED( pr_av ) ) THEN WRITE ( 14 ) 'pr_av '; WRITE ( 14 ) pr_av ENDIF IF ( ALLOCATED( prr ) ) THEN WRITE ( 14 ) 'prr '; WRITE ( 14 ) prr ENDIF IF ( ALLOCATED( prr_av ) ) THEN WRITE ( 14 ) 'prr_av '; WRITE ( 14 ) prr_av ENDIF IF ( ALLOCATED( precipitation_amount ) ) THEN WRITE ( 14 ) 'precipitation_amount'; WRITE ( 14 ) precipitation_amount ENDIF IF ( ALLOCATED( precipitation_rate_av ) ) THEN WRITE ( 14 ) 'precipitation_rate_a'; WRITE ( 14 ) & precipitation_rate_av ENDIF WRITE ( 14 ) 'pt '; WRITE ( 14 ) pt IF ( ALLOCATED( pt_av ) ) THEN WRITE ( 14 ) 'pt_av '; WRITE ( 14 ) pt_av ENDIF IF ( humidity .OR. passive_scalar ) THEN WRITE ( 14 ) 'q '; WRITE ( 14 ) q IF ( ALLOCATED( q_av ) ) THEN WRITE ( 14 ) 'q_av '; WRITE ( 14 ) q_av ENDIF IF ( cloud_physics .OR. cloud_droplets ) THEN WRITE ( 14 ) 'ql '; WRITE ( 14 ) ql IF ( ALLOCATED( ql_av ) ) THEN WRITE ( 14 ) 'ql_av '; WRITE ( 14 ) ql_av ENDIF IF ( icloud_scheme == 0 .AND. .NOT. cloud_droplets ) THEN WRITE ( 14 ) 'qc '; WRITE ( 14 ) qc IF ( ALLOCATED( qc_av ) ) THEN WRITE ( 14 ) 'qc_av '; WRITE ( 14 ) qc_av ENDIF IF ( precipitation ) THEN WRITE ( 14 ) 'nr '; WRITE ( 14 ) nr IF ( ALLOCATED( nr_av ) ) THEN WRITE ( 14 ) 'nr_av '; WRITE ( 14 ) nr_av ENDIF WRITE ( 14 ) 'nrs '; WRITE ( 14 ) nrs WRITE ( 14 ) 'nrsws '; WRITE ( 14 ) nrsws WRITE ( 14 ) 'nrswst '; WRITE ( 14 ) nrswst WRITE ( 14 ) 'qr '; WRITE ( 14 ) qr IF ( ALLOCATED( qr_av ) ) THEN WRITE ( 14 ) 'qr_av '; WRITE ( 14 ) qr_av ENDIF WRITE ( 14 ) 'qrs '; WRITE ( 14 ) qrs WRITE ( 14 ) 'qrsws '; WRITE ( 14 ) qrsws WRITE ( 14 ) 'qrswst '; WRITE ( 14 ) qrswst ENDIF ENDIF ENDIF WRITE ( 14 ) 'qs '; WRITE ( 14 ) qs WRITE ( 14 ) 'qsws '; WRITE ( 14 ) qsws IF ( ALLOCATED( qsws_av ) ) THEN WRITE ( 14 ) 'qsws_av '; WRITE ( 14 ) qsws_av ENDIF WRITE ( 14 ) 'qswst '; WRITE ( 14 ) qswst ENDIF IF ( ocean ) THEN IF ( ALLOCATED( rho_av ) ) THEN WRITE ( 14 ) 'rho_av '; WRITE ( 14 ) rho_av ENDIF WRITE ( 14 ) 'sa '; WRITE ( 14 ) sa IF ( ALLOCATED( sa_av ) ) THEN WRITE ( 14 ) 'sa_av '; WRITE ( 14 ) sa_av ENDIF WRITE ( 14 ) 'saswsb '; WRITE ( 14 ) saswsb WRITE ( 14 ) 'saswst '; WRITE ( 14 ) saswst ENDIF IF ( ALLOCATED( ql_c_av ) ) THEN WRITE ( 14 ) 'ql_c_av '; WRITE ( 14 ) ql_c_av ENDIF IF ( ALLOCATED( ql_v_av ) ) THEN WRITE ( 14 ) 'ql_v_av '; WRITE ( 14 ) ql_v_av ENDIF IF ( ALLOCATED( ql_vp_av ) ) THEN WRITE ( 14 ) 'ql_vp_av '; WRITE ( 14 ) ql_vp_av ENDIF IF ( ALLOCATED( qv_av ) ) THEN WRITE ( 14 ) 'qv_av '; WRITE ( 14 ) qv_av ENDIF WRITE ( 14 ) 'random_iv '; WRITE ( 14 ) random_iv WRITE ( 14 ) random_iy IF ( ALLOCATED( seq_random_array ) ) THEN WRITE ( 14 ) 'seq_random_array '; WRITE ( 14 ) id_random_array WRITE ( 14 ) seq_random_array ENDIF WRITE ( 14 ) 'rif '; WRITE ( 14 ) rif IF ( topography /= 'flat' ) THEN WRITE ( 14 ) 'rif_wall '; WRITE ( 14 ) rif_wall ENDIF IF ( ALLOCATED( s_av ) ) THEN WRITE ( 14 ) 's_av '; WRITE ( 14 ) s_av ENDIF WRITE ( 14 ) 'shf '; WRITE ( 14 ) shf IF ( ALLOCATED( shf_av ) ) THEN WRITE ( 14 ) 'shf_av '; WRITE ( 14 ) shf_av ENDIF IF ( ALLOCATED( spectrum_x ) ) THEN WRITE ( 14 ) 'spectrum_x '; WRITE ( 14 ) spectrum_x WRITE ( 14 ) 'spectrum_y '; WRITE ( 14 ) spectrum_y ENDIF WRITE ( 14 ) 'ts '; WRITE ( 14 ) ts IF ( ALLOCATED( ts_av ) ) THEN WRITE ( 14 ) 'ts_av '; WRITE ( 14 ) ts_av ENDIF WRITE ( 14 ) 'tswst '; WRITE ( 14 ) tswst WRITE ( 14 ) 'u '; WRITE ( 14 ) u IF ( ALLOCATED( u_av ) ) THEN WRITE ( 14 ) 'u_av '; WRITE ( 14 ) u_av ENDIF IF ( ALLOCATED( u_m_l ) ) THEN WRITE ( 14 ) 'u_m_l '; WRITE ( 14 ) u_m_l ENDIF IF ( ALLOCATED( u_m_n ) ) THEN WRITE ( 14 ) 'u_m_n '; WRITE ( 14 ) u_m_n ENDIF IF ( ALLOCATED( u_m_r ) ) THEN WRITE ( 14 ) 'u_m_r '; WRITE ( 14 ) u_m_r ENDIF IF ( ALLOCATED( u_m_s ) ) THEN WRITE ( 14 ) 'u_m_s '; WRITE ( 14 ) u_m_s ENDIF WRITE ( 14 ) 'us '; WRITE ( 14 ) us WRITE ( 14 ) 'usws '; WRITE ( 14 ) usws WRITE ( 14 ) 'uswst '; WRITE ( 14 ) uswst IF ( ALLOCATED( us_av ) ) THEN WRITE ( 14 ) 'us_av '; WRITE ( 14 ) us_av ENDIF WRITE ( 14 ) 'v '; WRITE ( 14 ) v IF ( ALLOCATED( v_av ) ) THEN WRITE ( 14 ) 'v_av '; WRITE ( 14 ) v_av ENDIF IF ( ALLOCATED( v_m_l ) ) THEN WRITE ( 14 ) 'v_m_l '; WRITE ( 14 ) v_m_l ENDIF IF ( ALLOCATED( v_m_n ) ) THEN WRITE ( 14 ) 'v_m_n '; WRITE ( 14 ) v_m_n ENDIF IF ( ALLOCATED( v_m_r ) ) THEN WRITE ( 14 ) 'v_m_r '; WRITE ( 14 ) v_m_r ENDIF IF ( ALLOCATED( v_m_s ) ) THEN WRITE ( 14 ) 'v_m_s '; WRITE ( 14 ) v_m_s ENDIF IF ( humidity ) THEN WRITE ( 14 ) 'vpt '; WRITE ( 14 ) vpt IF ( ALLOCATED( vpt_av ) ) THEN WRITE ( 14 ) 'vpt_av '; WRITE ( 14 ) vpt_av ENDIF ENDIF WRITE ( 14 ) 'vsws '; WRITE ( 14 ) vsws WRITE ( 14 ) 'vswst '; WRITE ( 14 ) vswst WRITE ( 14 ) 'w '; WRITE ( 14 ) w IF ( ALLOCATED( w_av ) ) THEN WRITE ( 14 ) 'w_av '; WRITE ( 14 ) w_av ENDIF IF ( ALLOCATED( w_m_l ) ) THEN WRITE ( 14 ) 'w_m_l '; WRITE ( 14 ) w_m_l ENDIF IF ( ALLOCATED( w_m_n ) ) THEN WRITE ( 14 ) 'w_m_n '; WRITE ( 14 ) w_m_n ENDIF IF ( ALLOCATED( w_m_r ) ) THEN WRITE ( 14 ) 'w_m_r '; WRITE ( 14 ) w_m_r ENDIF IF ( ALLOCATED( w_m_s ) ) THEN WRITE ( 14 ) 'w_m_s '; WRITE ( 14 ) w_m_s ENDIF WRITE ( 14 ) 'z0 '; WRITE ( 14 ) z0 IF ( ALLOCATED( z0_av ) ) THEN WRITE ( 14 ) 'z0_av '; WRITE ( 14 ) z0_av ENDIF WRITE ( 14 ) 'z0h '; WRITE ( 14 ) z0h IF ( ALLOCATED( z0h_av ) ) THEN WRITE ( 14 ) 'z0h_av '; WRITE ( 14 ) z0h_av ENDIF ! !-- Write end label. Unit 14 is closed in the main program. WRITE ( 14 ) '*** end *** ' END SUBROUTINE write_3d_binary