1 | SUBROUTINE lpm_extend_particle_array( number_of_new_particles ) |
---|
2 | |
---|
3 | !------------------------------------------------------------------------------! |
---|
4 | ! Current revisions: |
---|
5 | ! ------------------ |
---|
6 | ! |
---|
7 | ! |
---|
8 | ! Former revisions: |
---|
9 | ! ----------------- |
---|
10 | ! $Id: lpm_extend_particle_array.f90 850 2012-03-15 12:09:25Z letzel $ |
---|
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 array. |
---|
19 | !------------------------------------------------------------------------------! |
---|
20 | |
---|
21 | USE particle_attributes |
---|
22 | |
---|
23 | IMPLICIT NONE |
---|
24 | |
---|
25 | INTEGER :: new_maximum_number, number_of_new_particles |
---|
26 | |
---|
27 | LOGICAL, DIMENSION(:), ALLOCATABLE :: tmp_particle_mask |
---|
28 | |
---|
29 | TYPE(particle_type), DIMENSION(:), ALLOCATABLE :: tmp_particles |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | new_maximum_number = maximum_number_of_particles + & |
---|
34 | MAX( 5*number_of_new_particles, number_of_initial_particles ) |
---|
35 | |
---|
36 | IF ( write_particle_statistics ) THEN |
---|
37 | CALL check_open( 80 ) |
---|
38 | WRITE ( 80, '(''*** Request: '', I7, '' new_maximum_number(prt)'')' ) & |
---|
39 | new_maximum_number |
---|
40 | CALL close_file( 80 ) |
---|
41 | ENDIF |
---|
42 | |
---|
43 | ALLOCATE( tmp_particles(maximum_number_of_particles), & |
---|
44 | tmp_particle_mask(maximum_number_of_particles) ) |
---|
45 | |
---|
46 | tmp_particles = particles |
---|
47 | tmp_particle_mask = particle_mask |
---|
48 | |
---|
49 | DEALLOCATE( particles, particle_mask ) |
---|
50 | ALLOCATE( particles(new_maximum_number), particle_mask(new_maximum_number) ) |
---|
51 | |
---|
52 | maximum_number_of_particles = new_maximum_number |
---|
53 | |
---|
54 | particles(1:number_of_particles) = tmp_particles(1:number_of_particles) |
---|
55 | particle_mask(1:number_of_particles) = & |
---|
56 | tmp_particle_mask(1:number_of_particles) |
---|
57 | particle_mask(number_of_particles+1:maximum_number_of_particles) = .TRUE. |
---|
58 | |
---|
59 | DEALLOCATE( tmp_particles, tmp_particle_mask ) |
---|
60 | |
---|
61 | |
---|
62 | END SUBROUTINE lpm_extend_particle_array |
---|