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

Last change on this file since 1036 was 1036, checked in by raasch, 11 years ago

code has been put under the GNU General Public License (v3)

  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1 SUBROUTINE lpm_write_restart_file
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!
24! Former revisions:
25! -----------------
26! $Id: lpm_write_restart_file.f90 1036 2012-10-22 13:43:42Z raasch $
27!
28! 849 2012-03-15 10:35:09Z raasch
29! initial revision (former part of advec_particles)
30!
31!
32! Description:
33! ------------
34! Write particle data in FORTRAN binary format on restart file
35!------------------------------------------------------------------------------!
36
37    USE control_parameters
38    USE particle_attributes
39    USE pegrid
40
41    IMPLICIT NONE
42
43    CHARACTER (LEN=10) ::  particle_binary_version
44    INTEGER ::  i
45
46!
47!-- First open the output unit.
48    IF ( myid_char == '' )  THEN
49       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT'//myid_char, &
50                  FORM='UNFORMATTED')
51    ELSE
52       IF ( myid == 0 )  CALL local_system( 'mkdir PARTICLE_RESTART_DATA_OUT' )
53#if defined( __parallel )
54!
55!--    Set a barrier in order to allow that thereafter all other processors
56!--    in the directory created by PE0 can open their file
57       CALL MPI_BARRIER( comm2d, ierr )
58#endif
59       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT/'//myid_char, &
60                  FORM='UNFORMATTED' )
61    ENDIF
62
63    DO  i = 0, io_blocks-1
64
65       IF ( i == io_group )  THEN
66
67!
68!--       Write the version number of the binary format.
69!--       Attention: After changes to the following output commands the version
70!--       ---------  number of the variable particle_binary_version must be
71!--                  changed! Also, the version number and the list of arrays
72!--                  to be read in lpm_read_restart_file must be adjusted
73!--                  accordingly.
74          particle_binary_version = '3.0'
75          WRITE ( 90 )  particle_binary_version
76
77!
78!--       Write some particle parameters, the size of the particle arrays as
79!--       well as other dvrp-plot variables.
80          WRITE ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,              &
81                        maximum_number_of_particles,                           &
82                        maximum_number_of_tailpoints, maximum_number_of_tails, &
83                        number_of_initial_particles, number_of_particles,      &
84                        number_of_particle_groups, number_of_tails,            &
85                        particle_groups, time_prel, time_write_particle_data,  &
86                        uniform_particles
87
88          IF ( number_of_initial_particles /= 0 ) WRITE ( 90 ) initial_particles
89
90          WRITE ( 90 )  prt_count, prt_start_index
91          WRITE ( 90 )  particles
92
93          IF ( use_particle_tails )  THEN
94             WRITE ( 90 )  particle_tail_coordinates
95          ENDIF
96
97          CLOSE ( 90 )
98
99       ENDIF
100
101#if defined( __parallel )
102       CALL MPI_BARRIER( comm2d, ierr )
103#endif
104
105    ENDDO
106
107
108 END SUBROUTINE lpm_write_restart_file
Note: See TracBrowser for help on using the repository browser.