SUBROUTINE lpm_extend_particle_array( number_of_new_particles ) !--------------------------------------------------------------------------------! ! 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_extend_particle_array.f90 1037 2012-10-22 14:10:22Z raasch $ ! ! 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 advec_particles) ! ! ! Description: ! ------------ ! Allocates more memory for the particle array. !------------------------------------------------------------------------------! USE particle_attributes IMPLICIT NONE INTEGER :: new_maximum_number, number_of_new_particles LOGICAL, DIMENSION(:), ALLOCATABLE :: tmp_particle_mask TYPE(particle_type), DIMENSION(:), ALLOCATABLE :: tmp_particles new_maximum_number = maximum_number_of_particles + & MAX( 5*number_of_new_particles, number_of_initial_particles ) IF ( write_particle_statistics ) THEN CALL check_open( 80 ) WRITE ( 80, '(''*** Request: '', I7, '' new_maximum_number(prt)'')' ) & new_maximum_number CALL close_file( 80 ) ENDIF ALLOCATE( tmp_particles(maximum_number_of_particles), & tmp_particle_mask(maximum_number_of_particles) ) tmp_particles = particles tmp_particle_mask = particle_mask DEALLOCATE( particles, particle_mask ) ALLOCATE( particles(new_maximum_number), particle_mask(new_maximum_number) ) maximum_number_of_particles = new_maximum_number particles(1:number_of_particles) = tmp_particles(1:number_of_particles) particle_mask(1:number_of_particles) = & tmp_particle_mask(1:number_of_particles) particle_mask(number_of_particles+1:maximum_number_of_particles) = .TRUE. DEALLOCATE( tmp_particles, tmp_particle_mask ) END SUBROUTINE lpm_extend_particle_array