source: palm/trunk/SOURCE/lpm_extend_particle_array.f90 @ 1079

Last change on this file since 1079 was 1037, checked in by raasch, 12 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 2.6 KB
RevLine 
[849]1 SUBROUTINE lpm_extend_particle_array( number_of_new_particles )
2
[1036]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-2012  Leibniz University Hannover
18!--------------------------------------------------------------------------------!
19!
[849]20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: lpm_extend_particle_array.f90 1037 2012-10-22 14:10:22Z maronga $
27!
[1037]28! 1036 2012-10-22 13:43:42Z raasch
29! code put under GPL (PALM 3.9)
30!
[850]31! 849 2012-03-15 10:35:09Z raasch
32! initial revision (former part of advec_particles)
[849]33!
[850]34!
[849]35! Description:
36! ------------
37! Allocates more memory for the particle array.
38!------------------------------------------------------------------------------!
39
40    USE particle_attributes
41
42    IMPLICIT NONE
43
44    INTEGER ::  new_maximum_number, number_of_new_particles
45
46    LOGICAL, DIMENSION(:), ALLOCATABLE ::  tmp_particle_mask
47
48    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  tmp_particles
49
50
51
52    new_maximum_number = maximum_number_of_particles + &
53                   MAX( 5*number_of_new_particles, number_of_initial_particles )
54
55    IF ( write_particle_statistics )  THEN
56       CALL check_open( 80 )
57       WRITE ( 80, '(''*** Request: '', I7, '' new_maximum_number(prt)'')' ) &
58                            new_maximum_number
59       CALL close_file( 80 )
60    ENDIF
61
62    ALLOCATE( tmp_particles(maximum_number_of_particles), &
63              tmp_particle_mask(maximum_number_of_particles) )
64
65    tmp_particles     = particles
66    tmp_particle_mask = particle_mask
67
68    DEALLOCATE( particles, particle_mask )
69    ALLOCATE( particles(new_maximum_number), particle_mask(new_maximum_number) )
70
71    maximum_number_of_particles = new_maximum_number
72
73    particles(1:number_of_particles) = tmp_particles(1:number_of_particles)
74    particle_mask(1:number_of_particles) = &
75                                       tmp_particle_mask(1:number_of_particles)
76    particle_mask(number_of_particles+1:maximum_number_of_particles) = .TRUE.
77
78    DEALLOCATE( tmp_particles, tmp_particle_mask )
79
80
81 END SUBROUTINE lpm_extend_particle_array
Note: See TracBrowser for help on using the repository browser.