SUBROUTINE lpm_extend_tail_array( number_of_new_tails ) !--------------------------------------------------------------------------------! ! 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-2014 Leibniz Universitaet Hannover !--------------------------------------------------------------------------------! ! ! Current revisions: ! ------------------ ! ! ! Former revisions: ! ----------------- ! $Id: lpm_extend_tail_array.f90 1321 2014-03-20 09:40:40Z maronga $ ! ! 1320 2014-03-20 08:40:49Z raasch ! ONLY-attribute added to USE-statements, ! kind-parameters added to all INTEGER and REAL declaration statements, ! kinds are defined in new module kinds, ! comment fields (!:) to be used for variable explanations added to ! all variable declaration statements ! ! 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 tail array. !------------------------------------------------------------------------------! USE kinds USE particle_attributes, & ONLY: maximum_number_of_tails, maximum_number_of_tailpoints, & new_tail_id, number_of_initial_tails, number_of_tails, & particle_tail_coordinates, tail_mask, write_particle_statistics IMPLICIT NONE INTEGER(iwp) :: new_maximum_number !: INTEGER(iwp) :: number_of_new_tails !: LOGICAL, DIMENSION(maximum_number_of_tails) :: tmp_tail_mask !: REAL(wp), DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: & tmp_tail !: new_maximum_number = maximum_number_of_tails + & MAX( 5*number_of_new_tails, number_of_initial_tails ) IF ( write_particle_statistics ) THEN CALL check_open( 80 ) WRITE ( 80, '(''*** Request: '', I5, '' new_maximum_number(tails)'')' ) & new_maximum_number CALL close_file( 80 ) ENDIF WRITE (9,*) '*** Request: ',new_maximum_number,' new_maximum_number(tails)' tmp_tail(:,:,1:number_of_tails) = & particle_tail_coordinates(:,:,1:number_of_tails) tmp_tail_mask(1:number_of_tails) = tail_mask(1:number_of_tails) DEALLOCATE( new_tail_id, particle_tail_coordinates, tail_mask ) ALLOCATE( new_tail_id(new_maximum_number), & particle_tail_coordinates(maximum_number_of_tailpoints,5, & new_maximum_number), & tail_mask(new_maximum_number) ) maximum_number_of_tails = new_maximum_number particle_tail_coordinates = 0.0 particle_tail_coordinates(:,:,1:number_of_tails) = & tmp_tail(:,:,1:number_of_tails) tail_mask(1:number_of_tails) = tmp_tail_mask(1:number_of_tails) tail_mask(number_of_tails+1:maximum_number_of_tails) = .TRUE. END SUBROUTINE lpm_extend_tail_array