source: palm/trunk/SOURCE/lpm_extend_tail_array.f90 @ 1346

Last change on this file since 1346 was 1321, checked in by raasch, 10 years ago

last commit documented

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