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

Last change on this file since 1353 was 1321, checked in by raasch, 10 years ago

last commit documented

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