source: palm/trunk/SOURCE/lpm_read_restart_file.f90 @ 1215

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

last commit documented

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