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

Last change on this file since 1734 was 1683, checked in by knoop, 9 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1!> @file lpm_extend_tail_array.f90
2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2014 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------!
18!
19! Current revisions:
20! ------------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: lpm_extend_tail_array.f90 1683 2015-10-07 23:57:51Z raasch $
26!
27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29!
30! 1359 2014-04-11 17:15:14Z hoffmann
31! New particle structure integrated.
32! Kind definition added to all floating point numbers.
33!
34! 1320 2014-03-20 08:40:49Z raasch
35! ONLY-attribute added to USE-statements,
36! kind-parameters added to all INTEGER and REAL declaration statements,
37! kinds are defined in new module kinds,
38! comment fields (!:) to be used for variable explanations added to
39! all variable declaration statements
40!
41! 1036 2012-10-22 13:43:42Z raasch
42! code put under GPL (PALM 3.9)
43!
44! 849 2012-03-15 10:35:09Z raasch
45! initial revision (former part of advec_particles)
46!
47!
48! Description:
49! ------------
50!> Allocates more memory for the particle tail array.
51!------------------------------------------------------------------------------!
52 SUBROUTINE lpm_extend_tail_array( number_of_new_tails )
53 
54
55    USE kinds
56
57    USE particle_attributes,                                                   &
58        ONLY:  maximum_number_of_tails, maximum_number_of_tailpoints,          &
59               new_tail_id, number_of_initial_tails, number_of_tails,          &
60               particle_tail_coordinates, tail_mask, write_particle_statistics
61
62    IMPLICIT NONE
63
64    INTEGER(iwp) ::  new_maximum_number                           !<
65    INTEGER(iwp) ::  number_of_new_tails                          !<
66
67    LOGICAL, DIMENSION(maximum_number_of_tails) ::  tmp_tail_mask !<
68
69    REAL(wp), DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: &
70                                                    tmp_tail      !<
71
72
73    new_maximum_number = maximum_number_of_tails + &
74                         MAX( 5*number_of_new_tails, number_of_initial_tails )
75
76    IF ( write_particle_statistics )  THEN
77       CALL check_open( 80 )
78       WRITE ( 80, '(''*** Request: '', I5, '' new_maximum_number(tails)'')' ) &
79                            new_maximum_number
80       CALL close_file( 80 )
81    ENDIF
82    WRITE (9,*) '*** Request: ',new_maximum_number,' new_maximum_number(tails)'
83
84    tmp_tail(:,:,1:number_of_tails)  = &
85                                particle_tail_coordinates(:,:,1:number_of_tails)
86    tmp_tail_mask(1:number_of_tails) = tail_mask(1:number_of_tails)
87
88    DEALLOCATE( new_tail_id, particle_tail_coordinates, tail_mask )
89    ALLOCATE( new_tail_id(new_maximum_number),                          &
90              particle_tail_coordinates(maximum_number_of_tailpoints,5, &
91              new_maximum_number),                                      &
92              tail_mask(new_maximum_number) )
93
94    maximum_number_of_tails = new_maximum_number
95
96    particle_tail_coordinates = 0.0_wp
97    particle_tail_coordinates(:,:,1:number_of_tails) = &
98                                                 tmp_tail(:,:,1:number_of_tails)
99    tail_mask(1:number_of_tails) = tmp_tail_mask(1:number_of_tails)
100    tail_mask(number_of_tails+1:maximum_number_of_tails) = .TRUE.
101
102
103 END SUBROUTINE lpm_extend_tail_array
Note: See TracBrowser for help on using the repository browser.