[849] | 1 | SUBROUTINE lpm_extend_tail_array( number_of_new_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 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[849] | 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
[1360] | 22 | ! |
---|
| 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: lpm_extend_tail_array.f90 1360 2014-04-11 17:20:32Z keck $ |
---|
| 27 | ! |
---|
[1360] | 28 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 29 | ! New particle structure integrated. |
---|
| 30 | ! Kind definition added to all floating point numbers. |
---|
| 31 | ! |
---|
[1321] | 32 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 33 | ! ONLY-attribute added to USE-statements, |
---|
| 34 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 35 | ! kinds are defined in new module kinds, |
---|
| 36 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 37 | ! all variable declaration statements |
---|
[849] | 38 | ! |
---|
[1037] | 39 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 40 | ! code put under GPL (PALM 3.9) |
---|
| 41 | ! |
---|
[850] | 42 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 43 | ! initial revision (former part of advec_particles) |
---|
[849] | 44 | ! |
---|
[850] | 45 | ! |
---|
[849] | 46 | ! Description: |
---|
| 47 | ! ------------ |
---|
| 48 | ! Allocates more memory for the particle tail array. |
---|
| 49 | !------------------------------------------------------------------------------! |
---|
| 50 | |
---|
[1320] | 51 | USE kinds |
---|
[849] | 52 | |
---|
[1320] | 53 | USE particle_attributes, & |
---|
| 54 | ONLY: maximum_number_of_tails, maximum_number_of_tailpoints, & |
---|
| 55 | new_tail_id, number_of_initial_tails, number_of_tails, & |
---|
| 56 | particle_tail_coordinates, tail_mask, write_particle_statistics |
---|
| 57 | |
---|
[849] | 58 | IMPLICIT NONE |
---|
| 59 | |
---|
[1320] | 60 | INTEGER(iwp) :: new_maximum_number !: |
---|
| 61 | INTEGER(iwp) :: number_of_new_tails !: |
---|
[849] | 62 | |
---|
[1320] | 63 | LOGICAL, DIMENSION(maximum_number_of_tails) :: tmp_tail_mask !: |
---|
[849] | 64 | |
---|
[1320] | 65 | REAL(wp), DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: & |
---|
| 66 | tmp_tail !: |
---|
[849] | 67 | |
---|
| 68 | |
---|
| 69 | new_maximum_number = maximum_number_of_tails + & |
---|
| 70 | MAX( 5*number_of_new_tails, number_of_initial_tails ) |
---|
| 71 | |
---|
| 72 | IF ( write_particle_statistics ) THEN |
---|
| 73 | CALL check_open( 80 ) |
---|
| 74 | WRITE ( 80, '(''*** Request: '', I5, '' new_maximum_number(tails)'')' ) & |
---|
| 75 | new_maximum_number |
---|
| 76 | CALL close_file( 80 ) |
---|
| 77 | ENDIF |
---|
| 78 | WRITE (9,*) '*** Request: ',new_maximum_number,' new_maximum_number(tails)' |
---|
| 79 | |
---|
| 80 | tmp_tail(:,:,1:number_of_tails) = & |
---|
| 81 | particle_tail_coordinates(:,:,1:number_of_tails) |
---|
| 82 | tmp_tail_mask(1:number_of_tails) = tail_mask(1:number_of_tails) |
---|
| 83 | |
---|
| 84 | DEALLOCATE( new_tail_id, particle_tail_coordinates, tail_mask ) |
---|
| 85 | ALLOCATE( new_tail_id(new_maximum_number), & |
---|
| 86 | particle_tail_coordinates(maximum_number_of_tailpoints,5, & |
---|
| 87 | new_maximum_number), & |
---|
| 88 | tail_mask(new_maximum_number) ) |
---|
| 89 | |
---|
| 90 | maximum_number_of_tails = new_maximum_number |
---|
| 91 | |
---|
[1359] | 92 | particle_tail_coordinates = 0.0_wp |
---|
[849] | 93 | particle_tail_coordinates(:,:,1:number_of_tails) = & |
---|
| 94 | tmp_tail(:,:,1:number_of_tails) |
---|
| 95 | tail_mask(1:number_of_tails) = tmp_tail_mask(1:number_of_tails) |
---|
| 96 | tail_mask(number_of_tails+1:maximum_number_of_tails) = .TRUE. |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | END SUBROUTINE lpm_extend_tail_array |
---|