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

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

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

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