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

Last change on this file since 1036 was 1036, checked in by raasch, 9 years ago

code has been put under the GNU General Public License (v3)

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