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

Last change on this file since 1359 was 1359, checked in by hoffmann, 11 years ago

new Lagrangian particle structure integrated

  • Property svn:keywords set to Id
File size: 5.1 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! New particle structure integrated.
23!
24! Former revisions:
25! -----------------
26! $Id: lpm_write_restart_file.f90 1359 2014-04-11 17:15:14Z hoffmann $
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 indices,                                                               &
51        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
52
53    USE kinds
54
55    USE particle_attributes,                                                   &
56        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, grid_particles,       &
57               maximum_number_of_tails, maximum_number_of_tailpoints,          &
58               number_of_particles, number_of_particle_groups,                 &
59               number_of_tails, particles, particle_groups,                    &
60               particle_tail_coordinates, prt_count, time_prel,                &
61               time_write_particle_data, uniform_particles,                    &
62               use_particle_tails, zero_particle
63
64    USE pegrid
65
66    IMPLICIT NONE
67
68    CHARACTER (LEN=10) ::  particle_binary_version   !:
69
70    INTEGER(iwp) ::  i                               !:
71    INTEGER(iwp) ::  ip                              !:
72    INTEGER(iwp) ::  jp                              !:
73    INTEGER(iwp) ::  kp                              !:
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!    DO  i = 0, io_blocks-1
93
94!       IF ( i == io_group )  THEN
95
96!
97!--       Write the version number of the binary format.
98!--       Attention: After changes to the following output commands the version
99!--       ---------  number of the variable particle_binary_version must be
100!--                  changed! Also, the version number and the list of arrays
101!--                  to be read in lpm_read_restart_file must be adjusted
102!--                  accordingly.
103          particle_binary_version = '3.2'
104          WRITE ( 90 )  particle_binary_version
105
106!
107!--       Write some particle parameters, the size of the particle arrays as
108!--       well as other dvrp-plot variables.
109          WRITE ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,              &
110                        maximum_number_of_tailpoints, maximum_number_of_tails, &
111                        number_of_particle_groups, number_of_tails,            &
112                        particle_groups, time_prel, time_write_particle_data,  &
113                        uniform_particles
114
115          WRITE ( 90 )  prt_count
116         
117          DO  ip = nxl, nxr
118             DO  jp = nys, nyn
119                DO  kp = nzb+1, nzt
120                   number_of_particles = prt_count(kp,jp,ip)
121                   particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles)
122                   IF ( number_of_particles <= 0 )  CYCLE
123                   WRITE ( 90 )  particles
124                ENDDO
125             ENDDO
126          ENDDO
127
128!
129!--       particle tails currently not available
130!          IF ( use_particle_tails )  THEN
131!             WRITE ( 90 )  particle_tail_coordinates
132!          ENDIF
133
134          CLOSE ( 90 )
135
136!       ENDIF
137
138#if defined( __parallel )
139       CALL MPI_BARRIER( comm2d, ierr )
140#endif
141
142 !   ENDDO
143
144
145 END SUBROUTINE lpm_write_restart_file
Note: See TracBrowser for help on using the repository browser.