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

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

last commit documented

  • Property svn:keywords set to Id
File size: 5.5 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-2014 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: lpm_read_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! comment fields (!:) to be used for variable explanations added to
31! all variable declaration statements
32!
33! 1036 2012-10-22 13:43:42Z raasch
34! code put under GPL (PALM 3.9)
35!
36! 849 2012-03-15 10:35:09Z raasch
37! initial revision (former part of init_particles)
38!
39!
40! Description:
41! ------------
42! Read particle data from the restart file.
43!------------------------------------------------------------------------------!
44
45    USE control_parameters,                                                    &
46        ONLY:  message_string
47
48    USE indices,                                                               &
49        ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz, nzb, nzt
50
51    USE particle_attributes,                                                   &
52        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, initial_particles,    &
53               number_of_initial_particles, maximum_number_of_particles,       &
54               maximum_number_of_tailpoints, maximum_number_of_tails,          &
55               new_tail_id, number_of_particles, number_of_particle_groups,    &
56               number_of_tails, particles, particle_groups, particle_mask,     &
57               particle_tail_coordinates, particle_type, part_1, part_2,       &
58               prt_count, prt_start_index,  sort_count, tail_mask, time_prel,  &
59               time_write_particle_data, uniform_particles, use_particle_tails
60
61
62    USE pegrid
63
64    IMPLICIT NONE
65
66    CHARACTER (LEN=10) ::  particle_binary_version    !:
67    CHARACTER (LEN=10) ::  version_on_file            !:
68
69!
70!-- Read particle data from previous model run.
71!-- First open the input unit.
72    IF ( myid_char == '' )  THEN
73       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN'//myid_char, &
74                  FORM='UNFORMATTED' )
75    ELSE
76       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN/'//myid_char, &
77                  FORM='UNFORMATTED' )
78    ENDIF
79
80!
81!-- First compare the version numbers
82    READ ( 90 )  version_on_file
83    particle_binary_version = '3.0'
84    IF ( TRIM( version_on_file ) /= TRIM( particle_binary_version ) )  THEN
85       message_string = 'version mismatch concerning data from prior ' // &
86                        'run &version on file    = "' //                  &
87                                      TRIM( version_on_file ) //          &
88                        '&version in program = "' //                      &
89                                      TRIM( particle_binary_version ) // '"'
90       CALL message( 'lpm_read_restart_file', 'PA0214', 1, 2, 0, 6, 0 )
91    ENDIF
92
93!
94!-- Read some particle parameters and the size of the particle arrays,
95!-- allocate them and read their contents.
96    READ ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,                  &
97                 maximum_number_of_particles, maximum_number_of_tailpoints, &
98                 maximum_number_of_tails, number_of_initial_particles,      &
99                 number_of_particles, number_of_particle_groups,            &
100                 number_of_tails, particle_groups, time_prel,               &
101                 time_write_particle_data, uniform_particles
102
103    IF ( number_of_initial_particles /= 0 )  THEN
104       ALLOCATE( initial_particles(1:number_of_initial_particles) )
105       READ ( 90 )  initial_particles
106    ENDIF
107
108    ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg),       &
109              prt_start_index(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
110              particle_mask(maximum_number_of_particles),     &
111              part_1(maximum_number_of_particles),            &
112              part_2(maximum_number_of_particles) )
113
114    part_1 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
115                            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
116                            0.0, 0, 0, 0, 0 )
117
118    part_2 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
119                            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
120                            0.0, 0, 0, 0, 0 )
121
122    sort_count = 0
123
124    particles => part_1
125
126    READ ( 90 )  prt_count, prt_start_index
127    READ ( 90 )  particles
128
129    IF ( use_particle_tails )  THEN
130       ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, &
131                 maximum_number_of_tails),                                 &
132                 new_tail_id(maximum_number_of_tails),                     &
133                 tail_mask(maximum_number_of_tails) )
134       READ ( 90 )  particle_tail_coordinates
135    ENDIF
136
137    CLOSE ( 90 )
138
139
140 END SUBROUTINE lpm_read_restart_file
Note: See TracBrowser for help on using the repository browser.