SUBROUTINE lpm_read_restart_file !--------------------------------------------------------------------------------! ! This file is part of PALM. ! ! PALM is free software: you can redistribute it and/or modify it under the terms ! of the GNU General Public License as published by the Free Software Foundation, ! either version 3 of the License, or (at your option) any later version. ! ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License along with ! PALM. If not, see . ! ! Copyright 1997-2012 Leibniz University Hannover !--------------------------------------------------------------------------------! ! ! Current revisions: ! ------------------ ! ! ! Former revisions: ! ----------------- ! $Id: lpm_read_restart_file.f90 1037 2012-10-22 14:10:22Z eckhard $ ! ! 1036 2012-10-22 13:43:42Z raasch ! code put under GPL (PALM 3.9) ! ! 849 2012-03-15 10:35:09Z raasch ! initial revision (former part of init_particles) ! ! ! Description: ! ------------ ! Read particle data from the restart file. !------------------------------------------------------------------------------! USE control_parameters USE indices USE particle_attributes USE pegrid IMPLICIT NONE CHARACTER (LEN=10) :: particle_binary_version, version_on_file ! !-- Read particle data from previous model run. !-- First open the input unit. IF ( myid_char == '' ) THEN OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN'//myid_char, & FORM='UNFORMATTED' ) ELSE OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN/'//myid_char, & FORM='UNFORMATTED' ) ENDIF ! !-- First compare the version numbers READ ( 90 ) version_on_file particle_binary_version = '3.0' IF ( TRIM( version_on_file ) /= TRIM( particle_binary_version ) ) THEN message_string = 'version mismatch concerning data from prior ' // & 'run &version on file = "' // & TRIM( version_on_file ) // & '&version in program = "' // & TRIM( particle_binary_version ) // '"' CALL message( 'lpm_read_restart_file', 'PA0214', 1, 2, 0, 6, 0 ) ENDIF ! !-- Read some particle parameters and the size of the particle arrays, !-- allocate them and read their contents. READ ( 90 ) bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, & maximum_number_of_particles, maximum_number_of_tailpoints, & maximum_number_of_tails, number_of_initial_particles, & number_of_particles, number_of_particle_groups, & number_of_tails, particle_groups, time_prel, & time_write_particle_data, uniform_particles IF ( number_of_initial_particles /= 0 ) THEN ALLOCATE( initial_particles(1:number_of_initial_particles) ) READ ( 90 ) initial_particles ENDIF ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & prt_start_index(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & particle_mask(maximum_number_of_particles), & part_1(maximum_number_of_particles), & part_2(maximum_number_of_particles) ) part_1 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 0.0, 0, 0, 0, 0 ) part_2 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 0.0, 0, 0, 0, 0 ) sort_count = 0 particles => part_1 READ ( 90 ) prt_count, prt_start_index READ ( 90 ) particles IF ( use_particle_tails ) THEN ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, & maximum_number_of_tails), & new_tail_id(maximum_number_of_tails), & tail_mask(maximum_number_of_tails) ) READ ( 90 ) particle_tail_coordinates ENDIF CLOSE ( 90 ) END SUBROUTINE lpm_read_restart_file