source:
palm/trunk/SOURCE/lpm_extend_tails.f90
@
849
Last change on this file since 849 was 849, checked in by raasch, 12 years ago | |
---|---|
|
|
File size: 2.9 KB |
Rev | Line | |
---|---|---|
[849] | 1 | SUBROUTINE lpm_extend_tails |
2 | ||
3 | !------------------------------------------------------------------------------! | |
4 | ! Current revisions: | |
5 | ! ------------------ | |
6 | ! | |
7 | ! | |
8 | ! Former revisions: | |
9 | ! ----------------- | |
10 | ! $Id: lpm_extend_tails.f90 849 2012-03-15 10:35:09Z raasch $ | |
11 | ! | |
12 | ! | |
13 | ! Description: | |
14 | ! ------------ | |
15 | ! Add the current particle positions to the particle tails. | |
16 | !------------------------------------------------------------------------------! | |
17 | ||
18 | USE control_parameters | |
19 | USE particle_attributes | |
20 | ||
21 | IMPLICIT NONE | |
22 | ||
23 | INTEGER :: i, n, nn | |
24 | ||
25 | REAL :: distance | |
26 | ||
27 | ||
28 | distance = 0.0 | |
29 | ||
30 | DO n = 1, number_of_particles | |
31 | ||
32 | nn = particles(n)%tail_id | |
33 | ||
34 | IF ( nn /= 0 ) THEN | |
35 | ! | |
36 | !-- Calculate the distance between the actual particle position and the | |
37 | !-- next tailpoint | |
38 | IF ( minimum_tailpoint_distance /= 0.0 ) THEN | |
39 | distance = ( particle_tail_coordinates(1,1,nn) - & | |
40 | particle_tail_coordinates(2,1,nn) )**2 + & | |
41 | ( particle_tail_coordinates(1,2,nn) - & | |
42 | particle_tail_coordinates(2,2,nn) )**2 + & | |
43 | ( particle_tail_coordinates(1,3,nn) - & | |
44 | particle_tail_coordinates(2,3,nn) )**2 | |
45 | ENDIF | |
46 | ||
47 | ! | |
48 | !-- First, increase the index of all existings tailpoints by one | |
49 | IF ( distance >= minimum_tailpoint_distance ) THEN | |
50 | ||
51 | DO i = particles(n)%tailpoints, 1, -1 | |
52 | particle_tail_coordinates(i+1,:,nn) = & | |
53 | particle_tail_coordinates(i,:,nn) | |
54 | ENDDO | |
55 | ! | |
56 | !-- Increase the counter which contains the number of tailpoints. | |
57 | !-- This must always be smaller than the given maximum number of | |
58 | !-- tailpoints because otherwise the index bounds of | |
59 | !-- particle_tail_coordinates would be exceeded | |
60 | IF ( particles(n)%tailpoints < maximum_number_of_tailpoints-1 ) & | |
61 | THEN | |
62 | particles(n)%tailpoints = particles(n)%tailpoints + 1 | |
63 | ENDIF | |
64 | ENDIF | |
65 | ! | |
66 | !-- In any case, store the new point at the beginning of the tail | |
67 | particle_tail_coordinates(1,1,nn) = particles(n)%x | |
68 | particle_tail_coordinates(1,2,nn) = particles(n)%y | |
69 | particle_tail_coordinates(1,3,nn) = particles(n)%z | |
70 | particle_tail_coordinates(1,4,nn) = particles(n)%class | |
71 | ! | |
72 | !-- Increase the age of the tailpoints | |
73 | IF ( minimum_tailpoint_distance /= 0.0 ) THEN | |
74 | particle_tail_coordinates(2:particles(n)%tailpoints,5,nn) = & | |
75 | particle_tail_coordinates(2:particles(n)%tailpoints,5,nn) + dt_3d | |
76 | ! | |
77 | !-- Delete the last tailpoint, if it has exceeded its maximum age | |
78 | IF ( particle_tail_coordinates(particles(n)%tailpoints,5,nn) > & | |
79 | maximum_tailpoint_age ) THEN | |
80 | particles(n)%tailpoints = particles(n)%tailpoints - 1 | |
81 | ENDIF | |
82 | ENDIF | |
83 | ||
84 | ENDIF | |
85 | ||
86 | ENDDO | |
87 | ||
88 | ||
89 | END SUBROUTINE lpm_extend_tails |
Note: See TracBrowser
for help on using the repository browser.