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

Last change on this file since 1026 was 850, checked in by raasch, 13 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 3.5 KB
RevLine 
[849]1 SUBROUTINE lpm_read_restart_file
2
3!------------------------------------------------------------------------------!
4! Current revisions:
5! ------------------
6!
7!
8! Former revisions:
9! -----------------
10! $Id: lpm_read_restart_file.f90 850 2012-03-15 12:09:25Z letzel $
11!
[850]12! 849 2012-03-15 10:35:09Z raasch
13! initial revision (former part of init_particles)
[849]14!
[850]15!
[849]16! Description:
17! ------------
18! Read particle data from the restart file.
19!------------------------------------------------------------------------------!
20
21    USE control_parameters
22    USE indices
23    USE particle_attributes
24    USE pegrid
25
26    IMPLICIT NONE
27
28    CHARACTER (LEN=10) ::  particle_binary_version, version_on_file
29
30!
31!-- Read particle data from previous model run.
32!-- First open the input unit.
33    IF ( myid_char == '' )  THEN
34       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN'//myid_char, &
35                  FORM='UNFORMATTED' )
36    ELSE
37       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN/'//myid_char, &
38                  FORM='UNFORMATTED' )
39    ENDIF
40
41!
42!-- First compare the version numbers
43    READ ( 90 )  version_on_file
44    particle_binary_version = '3.0'
45    IF ( TRIM( version_on_file ) /= TRIM( particle_binary_version ) )  THEN
46       message_string = 'version mismatch concerning data from prior ' // &
47                        'run &version on file    = "' //                  &
48                                      TRIM( version_on_file ) //          &
49                        '&version in program = "' //                      &
50                                      TRIM( particle_binary_version ) // '"'
51       CALL message( 'lpm_read_restart_file', 'PA0214', 1, 2, 0, 6, 0 )
52    ENDIF
53
54!
55!-- Read some particle parameters and the size of the particle arrays,
56!-- allocate them and read their contents.
57    READ ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,                  &
58                 maximum_number_of_particles, maximum_number_of_tailpoints, &
59                 maximum_number_of_tails, number_of_initial_particles,      &
60                 number_of_particles, number_of_particle_groups,            &
61                 number_of_tails, particle_groups, time_prel,               &
62                 time_write_particle_data, uniform_particles
63
64    IF ( number_of_initial_particles /= 0 )  THEN
65       ALLOCATE( initial_particles(1:number_of_initial_particles) )
66       READ ( 90 )  initial_particles
67    ENDIF
68
69    ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg),       &
70              prt_start_index(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
71              particle_mask(maximum_number_of_particles),     &
72              part_1(maximum_number_of_particles),            &
73              part_2(maximum_number_of_particles) )
74
75    part_1 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
76                            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
77                            0.0, 0, 0, 0, 0 )
78
79    part_2 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
80                            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
81                            0.0, 0, 0, 0, 0 )
82
83    sort_count = 0
84
85    particles => part_1
86
87    READ ( 90 )  prt_count, prt_start_index
88    READ ( 90 )  particles
89
90    IF ( use_particle_tails )  THEN
91       ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, &
92                 maximum_number_of_tails),                                 &
93                 new_tail_id(maximum_number_of_tails),                     &
94                 tail_mask(maximum_number_of_tails) )
95       READ ( 90 )  particle_tail_coordinates
96    ENDIF
97
98    CLOSE ( 90 )
99
100
101 END SUBROUTINE lpm_read_restart_file
Note: See TracBrowser for help on using the repository browser.