source: palm/trunk/SOURCE/lpm_write_restart_file.f90 @ 1822

Last change on this file since 1822 was 1822, checked in by hoffmann, 8 years ago

changes in LPM and bulk cloud microphysics

  • Property svn:keywords set to Id
File size: 4.4 KB
RevLine 
[1682]1!> @file lpm_write_restart_file.f90
[1036]2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
[1818]16! Copyright 1997-2016 Leibniz Universitaet Hannover
[1036]17!--------------------------------------------------------------------------------!
18!
[849]19! Current revisions:
20! ------------------
[1822]21! Tails removed. Unused variables removed.
[1360]22!
[1321]23! Former revisions:
24! -----------------
25! $Id: lpm_write_restart_file.f90 1822 2016-04-07 07:49:42Z hoffmann $
26!
[1683]27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29!
[1360]30! 1359 2014-04-11 17:15:14Z hoffmann
31! New particle structure integrated.
32!
[1321]33! 1320 2014-03-20 08:40:49Z raasch
[1320]34! ONLY-attribute added to USE-statements,
35! kind-parameters added to all INTEGER and REAL declaration statements,
36! kinds are defined in new module kinds,
37! comment fields (!:) to be used for variable explanations added to
38! all variable declaration statements
[849]39!
[1037]40! 1036 2012-10-22 13:43:42Z raasch
41! code put under GPL (PALM 3.9)
42!
[850]43! 849 2012-03-15 10:35:09Z raasch
44! initial revision (former part of advec_particles)
[849]45!
[850]46!
[849]47! Description:
48! ------------
[1682]49!> Write particle data in FORTRAN binary format on restart file
[849]50!------------------------------------------------------------------------------!
[1682]51 SUBROUTINE lpm_write_restart_file
[849]52
[1320]53
[1359]54    USE indices,                                                               &
55        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
56
[1320]57    USE kinds
58
59    USE particle_attributes,                                                   &
[1359]60        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, grid_particles,       &
61               number_of_particles, number_of_particle_groups,                 &
[1822]62               particles, particle_groups, prt_count, time_prel,               &
63               time_write_particle_data, uniform_particles
[1320]64
[849]65    USE pegrid
66
67    IMPLICIT NONE
68
[1682]69    CHARACTER (LEN=10) ::  particle_binary_version   !<
[1359]70
[1682]71    INTEGER(iwp) ::  ip                              !<
72    INTEGER(iwp) ::  jp                              !<
73    INTEGER(iwp) ::  kp                              !<
[849]74
75!
76!-- First open the output unit.
77    IF ( myid_char == '' )  THEN
78       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT'//myid_char, &
79                  FORM='UNFORMATTED')
80    ELSE
81       IF ( myid == 0 )  CALL local_system( 'mkdir PARTICLE_RESTART_DATA_OUT' )
82#if defined( __parallel )
83!
84!--    Set a barrier in order to allow that thereafter all other processors
85!--    in the directory created by PE0 can open their file
86       CALL MPI_BARRIER( comm2d, ierr )
87#endif
88       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT/'//myid_char, &
89                  FORM='UNFORMATTED' )
90    ENDIF
91
92!
[1822]93!-- Write the version number of the binary format.
94!-- Attention: After changes to the following output commands the version
95!-- ---------  number of the variable particle_binary_version must be
96!--            changed! Also, the version number and the list of arrays
97!--            to be read in lpm_read_restart_file must be adjusted
98!--            accordingly.
99    particle_binary_version = '4.0'
100    WRITE ( 90 )  particle_binary_version
[849]101
102!
[1822]103!-- Write some particle parameters, the size of the particle arrays as
104!-- well as other dvrp-plot variables.
105    WRITE ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,              &
106                  number_of_particle_groups, particle_groups, time_prel, &
107                  time_write_particle_data, uniform_particles
[849]108
[1822]109    WRITE ( 90 )  prt_count
[1359]110         
[1822]111    DO  ip = nxl, nxr
112       DO  jp = nys, nyn
113          DO  kp = nzb+1, nzt
114             number_of_particles = prt_count(kp,jp,ip)
115             particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles)
116             IF ( number_of_particles <= 0 )  CYCLE
117             WRITE ( 90 )  particles
[1359]118          ENDDO
[1822]119       ENDDO
120    ENDDO
[849]121
[1822]122    CLOSE ( 90 )
[849]123
124#if defined( __parallel )
125       CALL MPI_BARRIER( comm2d, ierr )
126#endif
127
128
129 END SUBROUTINE lpm_write_restart_file
Note: See TracBrowser for help on using the repository browser.