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

Last change on this file since 1248 was 1037, checked in by raasch, 12 years ago

last commit documented

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