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

Last change on this file since 1320 was 1320, checked in by raasch, 7 years ago

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1 SUBROUTINE lpm_extend_particle_array( number_of_new_particles )
2
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-2014 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22! ONLY-attribute added to USE-statements,
23! kind-parameters added to all INTEGER and REAL declaration statements,
24! kinds are defined in new module kinds,
25! comment fields (!:) to be used for variable explanations added to
26! all variable declaration statements
27!
28! Former revisions:
29! -----------------
30! $Id: lpm_extend_particle_array.f90 1320 2014-03-20 08:40:49Z raasch $
31!
32! 1036 2012-10-22 13:43:42Z raasch
33! code put under GPL (PALM 3.9)
34!
35! 849 2012-03-15 10:35:09Z raasch
36! initial revision (former part of advec_particles)
37!
38!
39! Description:
40! ------------
41! Allocates more memory for the particle array.
42!------------------------------------------------------------------------------!
43
44    USE kinds
45
46    USE particle_attributes,                                                   &
47        ONLY:  number_of_initial_particles, number_of_particles,               &
48               maximum_number_of_particles, particles, particle_mask,          &
49               particle_type, write_particle_statistics
50
51    IMPLICIT NONE
52
53    INTEGER(iwp) ::  new_maximum_number                              !:
54    INTEGER(iwp) ::  number_of_new_particles                         !:
55
56
57    LOGICAL, DIMENSION(:), ALLOCATABLE ::  tmp_particle_mask         !:
58
59    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  tmp_particles !:
60
61
62
63    new_maximum_number = maximum_number_of_particles + &
64                   MAX( 5*number_of_new_particles, number_of_initial_particles )
65
66    IF ( write_particle_statistics )  THEN
67       CALL check_open( 80 )
68       WRITE ( 80, '(''*** Request: '', I7, '' new_maximum_number(prt)'')' ) &
69                            new_maximum_number
70       CALL close_file( 80 )
71    ENDIF
72
73    ALLOCATE( tmp_particles(maximum_number_of_particles), &
74              tmp_particle_mask(maximum_number_of_particles) )
75
76    tmp_particles     = particles
77    tmp_particle_mask = particle_mask
78
79    DEALLOCATE( particles, particle_mask )
80    ALLOCATE( particles(new_maximum_number), particle_mask(new_maximum_number) )
81
82    maximum_number_of_particles = new_maximum_number
83
84    particles(1:number_of_particles) = tmp_particles(1:number_of_particles)
85    particle_mask(1:number_of_particles) = &
86                                       tmp_particle_mask(1:number_of_particles)
87    particle_mask(number_of_particles+1:maximum_number_of_particles) = .TRUE.
88
89    DEALLOCATE( tmp_particles, tmp_particle_mask )
90
91
92 END SUBROUTINE lpm_extend_particle_array
Note: See TracBrowser for help on using the repository browser.