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

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