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

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

last commit documented

  • Property svn:keywords set to Id
File size: 3.9 KB
RevLine 
[1682]1!> @file lpm_extend_tail_array.f90
[1036]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!
[1310]16! Copyright 1997-2014 Leibniz Universitaet Hannover
[1036]17!--------------------------------------------------------------------------------!
18!
[849]19! Current revisions:
20! ------------------
[1360]21!
[1683]22!
[1321]23! Former revisions:
24! -----------------
25! $Id: lpm_extend_tail_array.f90 1683 2015-10-07 23:57:51Z raasch $
26!
[1683]27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29!
[1360]30! 1359 2014-04-11 17:15:14Z hoffmann
31! New particle structure integrated.
32! Kind definition added to all floating point numbers.
33!
[1321]34! 1320 2014-03-20 08:40:49Z raasch
[1320]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
[849]40!
[1037]41! 1036 2012-10-22 13:43:42Z raasch
42! code put under GPL (PALM 3.9)
43!
[850]44! 849 2012-03-15 10:35:09Z raasch
45! initial revision (former part of advec_particles)
[849]46!
[850]47!
[849]48! Description:
49! ------------
[1682]50!> Allocates more memory for the particle tail array.
[849]51!------------------------------------------------------------------------------!
[1682]52 SUBROUTINE lpm_extend_tail_array( number_of_new_tails )
53 
[849]54
[1320]55    USE kinds
[849]56
[1320]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
[849]62    IMPLICIT NONE
63
[1682]64    INTEGER(iwp) ::  new_maximum_number                           !<
65    INTEGER(iwp) ::  number_of_new_tails                          !<
[849]66
[1682]67    LOGICAL, DIMENSION(maximum_number_of_tails) ::  tmp_tail_mask !<
[849]68
[1320]69    REAL(wp), DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: &
[1682]70                                                    tmp_tail      !<
[849]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
[1359]96    particle_tail_coordinates = 0.0_wp
[849]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.