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

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

last commit documented

  • Property svn:keywords set to Id
File size: 3.0 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-2012  Leibniz University Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: lpm_extend_tail_array.f90 1037 2012-10-22 14:10:22Z witha $
27!
28! 1036 2012-10-22 13:43:42Z raasch
29! code put under GPL (PALM 3.9)
30!
31! 849 2012-03-15 10:35:09Z raasch
32! initial revision (former part of advec_particles)
33!
34!
35! Description:
36! ------------
37! Allocates more memory for the particle tail array.
38!------------------------------------------------------------------------------!
39
40    USE particle_attributes
41
42    IMPLICIT NONE
43
44    INTEGER ::  new_maximum_number, number_of_new_tails
45
46    LOGICAL, DIMENSION(maximum_number_of_tails) ::  tmp_tail_mask
47
48    REAL, DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: &
49                                                    tmp_tail
50
51
52    new_maximum_number = maximum_number_of_tails + &
53                         MAX( 5*number_of_new_tails, number_of_initial_tails )
54
55    IF ( write_particle_statistics )  THEN
56       CALL check_open( 80 )
57       WRITE ( 80, '(''*** Request: '', I5, '' new_maximum_number(tails)'')' ) &
58                            new_maximum_number
59       CALL close_file( 80 )
60    ENDIF
61    WRITE (9,*) '*** Request: ',new_maximum_number,' new_maximum_number(tails)'
62
63    tmp_tail(:,:,1:number_of_tails)  = &
64                                particle_tail_coordinates(:,:,1:number_of_tails)
65    tmp_tail_mask(1:number_of_tails) = tail_mask(1:number_of_tails)
66
67    DEALLOCATE( new_tail_id, particle_tail_coordinates, tail_mask )
68    ALLOCATE( new_tail_id(new_maximum_number),                          &
69              particle_tail_coordinates(maximum_number_of_tailpoints,5, &
70              new_maximum_number),                                      &
71              tail_mask(new_maximum_number) )
72
73    maximum_number_of_tails = new_maximum_number
74
75    particle_tail_coordinates = 0.0
76    particle_tail_coordinates(:,:,1:number_of_tails) = &
77                                                 tmp_tail(:,:,1:number_of_tails)
78    tail_mask(1:number_of_tails) = tmp_tail_mask(1:number_of_tails)
79    tail_mask(number_of_tails+1:maximum_number_of_tails) = .TRUE.
80
81
82 END SUBROUTINE lpm_extend_tail_array
Note: See TracBrowser for help on using the repository browser.