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

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

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

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