source: palm/trunk/SOURCE/lpm_read_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: 4.3 KB
Line 
1 SUBROUTINE lpm_read_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_read_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 init_particles)
30!
31!
32! Description:
33! ------------
34! Read particle data from the restart file.
35!------------------------------------------------------------------------------!
36
37    USE control_parameters
38    USE indices
39    USE particle_attributes
40    USE pegrid
41
42    IMPLICIT NONE
43
44    CHARACTER (LEN=10) ::  particle_binary_version, version_on_file
45
46!
47!-- Read particle data from previous model run.
48!-- First open the input unit.
49    IF ( myid_char == '' )  THEN
50       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN'//myid_char, &
51                  FORM='UNFORMATTED' )
52    ELSE
53       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN/'//myid_char, &
54                  FORM='UNFORMATTED' )
55    ENDIF
56
57!
58!-- First compare the version numbers
59    READ ( 90 )  version_on_file
60    particle_binary_version = '3.0'
61    IF ( TRIM( version_on_file ) /= TRIM( particle_binary_version ) )  THEN
62       message_string = 'version mismatch concerning data from prior ' // &
63                        'run &version on file    = "' //                  &
64                                      TRIM( version_on_file ) //          &
65                        '&version in program = "' //                      &
66                                      TRIM( particle_binary_version ) // '"'
67       CALL message( 'lpm_read_restart_file', 'PA0214', 1, 2, 0, 6, 0 )
68    ENDIF
69
70!
71!-- Read some particle parameters and the size of the particle arrays,
72!-- allocate them and read their contents.
73    READ ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,                  &
74                 maximum_number_of_particles, maximum_number_of_tailpoints, &
75                 maximum_number_of_tails, number_of_initial_particles,      &
76                 number_of_particles, number_of_particle_groups,            &
77                 number_of_tails, particle_groups, time_prel,               &
78                 time_write_particle_data, uniform_particles
79
80    IF ( number_of_initial_particles /= 0 )  THEN
81       ALLOCATE( initial_particles(1:number_of_initial_particles) )
82       READ ( 90 )  initial_particles
83    ENDIF
84
85    ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg),       &
86              prt_start_index(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
87              particle_mask(maximum_number_of_particles),     &
88              part_1(maximum_number_of_particles),            &
89              part_2(maximum_number_of_particles) )
90
91    part_1 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
92                            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
93                            0.0, 0, 0, 0, 0 )
94
95    part_2 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
96                            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
97                            0.0, 0, 0, 0, 0 )
98
99    sort_count = 0
100
101    particles => part_1
102
103    READ ( 90 )  prt_count, prt_start_index
104    READ ( 90 )  particles
105
106    IF ( use_particle_tails )  THEN
107       ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, &
108                 maximum_number_of_tails),                                 &
109                 new_tail_id(maximum_number_of_tails),                     &
110                 tail_mask(maximum_number_of_tails) )
111       READ ( 90 )  particle_tail_coordinates
112    ENDIF
113
114    CLOSE ( 90 )
115
116
117 END SUBROUTINE lpm_read_restart_file
Note: See TracBrowser for help on using the repository browser.