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

Last change on this file since 849 was 849, checked in by raasch, 10 years ago

Changed:


Original routine advec_particles split into several new subroutines and renamed
lpm.
init_particles renamed lpm_init
user_advec_particles renamed user_lpm_advec,
particle_boundary_conds renamed lpm_boundary_conds,
set_particle_attributes renamed lpm_set_attributes,
user_init_particles renamed user_lpm_init,
user_particle_attributes renamed user_lpm_set_attributes
(Makefile, lpm_droplet_collision, lpm_droplet_condensation, init_3d_model, modules, palm, read_var_list, time_integration, write_var_list, deleted: advec_particles, init_particles, particle_boundary_conds, set_particle_attributes, user_advec_particles, user_init_particles, user_particle_attributes, new: lpm, lpm_advec, lpm_boundary_conds, lpm_calc_liquid_water_content, lpm_data_output_particles, lpm_droplet_collision, lpm_drollet_condensation, lpm_exchange_horiz, lpm_extend_particle_array, lpm_extend_tails, lpm_extend_tail_array, lpm_init, lpm_init_sgs_tke, lpm_pack_arrays, lpm_read_restart_file, lpm_release_set, lpm_set_attributes, lpm_sort_arrays, lpm_write_exchange_statistics, lpm_write_restart_file, user_lpm_advec, user_lpm_init, user_lpm_set_attributes

  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
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.