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

Last change on this file since 936 was 850, checked in by raasch, 13 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1 SUBROUTINE lpm_extend_tail_array( number_of_new_tails )
2
3!------------------------------------------------------------------------------!
4! Current revisions:
5! ------------------
6!
7!
8! Former revisions:
9! -----------------
10! $Id: lpm_extend_tail_array.f90 850 2012-03-15 12:09:25Z raasch $
11!
12! 849 2012-03-15 10:35:09Z raasch
13! initial revision (former part of advec_particles)
14!
15!
16! Description:
17! ------------
18! Allocates more memory for the particle tail array.
19!------------------------------------------------------------------------------!
20
21    USE particle_attributes
22
23    IMPLICIT NONE
24
25    INTEGER ::  new_maximum_number, number_of_new_tails
26
27    LOGICAL, DIMENSION(maximum_number_of_tails) ::  tmp_tail_mask
28
29    REAL, DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: &
30                                                    tmp_tail
31
32
33    new_maximum_number = maximum_number_of_tails + &
34                         MAX( 5*number_of_new_tails, number_of_initial_tails )
35
36    IF ( write_particle_statistics )  THEN
37       CALL check_open( 80 )
38       WRITE ( 80, '(''*** Request: '', I5, '' new_maximum_number(tails)'')' ) &
39                            new_maximum_number
40       CALL close_file( 80 )
41    ENDIF
42    WRITE (9,*) '*** Request: ',new_maximum_number,' new_maximum_number(tails)'
43
44    tmp_tail(:,:,1:number_of_tails)  = &
45                                particle_tail_coordinates(:,:,1:number_of_tails)
46    tmp_tail_mask(1:number_of_tails) = tail_mask(1:number_of_tails)
47
48    DEALLOCATE( new_tail_id, particle_tail_coordinates, tail_mask )
49    ALLOCATE( new_tail_id(new_maximum_number),                          &
50              particle_tail_coordinates(maximum_number_of_tailpoints,5, &
51              new_maximum_number),                                      &
52              tail_mask(new_maximum_number) )
53
54    maximum_number_of_tails = new_maximum_number
55
56    particle_tail_coordinates = 0.0
57    particle_tail_coordinates(:,:,1:number_of_tails) = &
58                                                 tmp_tail(:,:,1:number_of_tails)
59    tail_mask(1:number_of_tails) = tmp_tail_mask(1:number_of_tails)
60    tail_mask(number_of_tails+1:maximum_number_of_tails) = .TRUE.
61
62
63 END SUBROUTINE lpm_extend_tail_array
Note: See TracBrowser for help on using the repository browser.