source: palm/trunk/SOURCE/lpm_extend_tails.f90 @ 1117

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

last commit documented

  • Property svn:keywords set to Id
File size: 3.8 KB
RevLine 
[849]1 SUBROUTINE lpm_extend_tails
2
[1036]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!
[849]20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: lpm_extend_tails.f90 1037 2012-10-22 14:10:22Z suehring $
27!
[1037]28! 1036 2012-10-22 13:43:42Z raasch
29! code put under GPL (PALM 3.9)
30!
[850]31! 849 2012-03-15 10:35:09Z raasch
32! initial revision (former part of advec_particles)
[849]33!
[850]34!
[849]35! Description:
36! ------------
37! Add the current particle positions to the particle tails.
38!------------------------------------------------------------------------------!
39
40    USE control_parameters
41    USE particle_attributes
42
43    IMPLICIT NONE
44
45    INTEGER ::  i, n, nn
46
47    REAL ::  distance
48
49
50    distance = 0.0
51
52    DO  n = 1, number_of_particles
53
54       nn = particles(n)%tail_id
55
56       IF ( nn /= 0 )  THEN
57!
58!--       Calculate the distance between the actual particle position and the
59!--       next tailpoint
60          IF ( minimum_tailpoint_distance /= 0.0 )  THEN
61             distance = ( particle_tail_coordinates(1,1,nn) -      &
62                          particle_tail_coordinates(2,1,nn) )**2 + &
63                        ( particle_tail_coordinates(1,2,nn) -      &
64                          particle_tail_coordinates(2,2,nn) )**2 + &
65                        ( particle_tail_coordinates(1,3,nn) -      &
66                          particle_tail_coordinates(2,3,nn) )**2
67          ENDIF
68
69!
70!--       First, increase the index of all existings tailpoints by one
71          IF ( distance >= minimum_tailpoint_distance )  THEN
72
73             DO  i = particles(n)%tailpoints, 1, -1
74                particle_tail_coordinates(i+1,:,nn) = &
75                                               particle_tail_coordinates(i,:,nn)
76             ENDDO
77!
78!--          Increase the counter which contains the number of tailpoints.
79!--          This must always be smaller than the given maximum number of
80!--          tailpoints because otherwise the index bounds of
81!--          particle_tail_coordinates would be exceeded
82             IF ( particles(n)%tailpoints < maximum_number_of_tailpoints-1 ) &
83             THEN
84                particles(n)%tailpoints = particles(n)%tailpoints + 1
85             ENDIF
86          ENDIF
87!
88!--       In any case, store the new point at the beginning of the tail
89          particle_tail_coordinates(1,1,nn) = particles(n)%x
90          particle_tail_coordinates(1,2,nn) = particles(n)%y
91          particle_tail_coordinates(1,3,nn) = particles(n)%z
92          particle_tail_coordinates(1,4,nn) = particles(n)%class
93!
94!--       Increase the age of the tailpoints
95          IF ( minimum_tailpoint_distance /= 0.0 )  THEN
96             particle_tail_coordinates(2:particles(n)%tailpoints,5,nn) =    &
97               particle_tail_coordinates(2:particles(n)%tailpoints,5,nn) + dt_3d
98!
99!--          Delete the last tailpoint, if it has exceeded its maximum age
100             IF ( particle_tail_coordinates(particles(n)%tailpoints,5,nn) > &
101                  maximum_tailpoint_age )  THEN
102                particles(n)%tailpoints = particles(n)%tailpoints - 1
103             ENDIF
104          ENDIF
105
106       ENDIF
107
108    ENDDO
109
110
111 END SUBROUTINE lpm_extend_tails
Note: See TracBrowser for help on using the repository browser.