Changeset 2606 for palm/trunk/SOURCE/lpm_pack_arrays.f90
- Timestamp:
- Nov 10, 2017 10:36:31 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/lpm_pack_arrays.f90
r2417 r2606 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Changed particle box locations: center of particle box now coincides 28 ! with scalar grid point of same index. 29 ! Renamed module and subroutines: lpm_pack_arrays_mod -> lpm_pack_and_sort_mod 30 ! lpm_pack_all_arrays -> lpm_sort_in_subboxes, lpm_pack_arrays -> lpm_pack 31 ! lpm_sort -> lpm_sort_timeloop_done 32 ! 33 ! 2417 2017-09-06 15:22:27Z suehring 27 34 ! New routine which sorts particles into particles that completed and not 28 35 ! completed the LES timestep. … … 68 75 !> its timestep. 69 76 !------------------------------------------------------------------------------! 70 MODULE lpm_pack_a rrays_mod77 MODULE lpm_pack_and_sort_mod 71 78 72 79 … … 76 83 77 84 PRIVATE 78 PUBLIC lpm_ pack_all_arrays, lpm_pack_arrays, lpm_sort79 80 INTERFACE lpm_ pack_all_arrays81 MODULE PROCEDURE lpm_ pack_all_arrays82 END INTERFACE lpm_ pack_all_arrays83 84 INTERFACE lpm_pack _arrays85 MODULE PROCEDURE lpm_pack _arrays86 END INTERFACE lpm_pack _arrays87 88 INTERFACE lpm_sort 89 MODULE PROCEDURE lpm_sort 90 END INTERFACE lpm_sort 85 PUBLIC lpm_sort_in_subboxes, lpm_pack, lpm_sort_timeloop_done 86 87 INTERFACE lpm_sort_in_subboxes 88 MODULE PROCEDURE lpm_sort_in_subboxes 89 END INTERFACE lpm_sort_in_subboxes 90 91 INTERFACE lpm_pack 92 MODULE PROCEDURE lpm_pack 93 END INTERFACE lpm_pack 94 95 INTERFACE lpm_sort_timeloop_done 96 MODULE PROCEDURE lpm_sort_timeloop_done 97 END INTERFACE lpm_sort_timeloop_done 91 98 92 99 93 100 CONTAINS 101 102 !------------------------------------------------------------------------------! 103 ! Description: 104 ! ----------- 105 !> Routine for the whole processor 106 !> Sort all particles into the 8 respective subgrid boxes 107 !------------------------------------------------------------------------------! 108 SUBROUTINE lpm_sort_in_subboxes 109 110 USE cpulog, & 111 ONLY: cpu_log, log_point_s 112 113 USE indices, & 114 ONLY: nxl, nxr, nys, nyn, nzb, nzt 115 116 USE kinds 117 118 USE control_parameters, & 119 ONLY: dz 120 121 USE grid_variables, & 122 ONLY: dx,dy,ddx, ddy 123 124 IMPLICIT NONE 125 126 INTEGER(iwp) :: ip !< 127 INTEGER(iwp) :: jp !< 128 INTEGER(iwp) :: kp !< 129 130 CALL cpu_log( log_point_s(51), 'lpm_sort_in_subboxes', 'start' ) 131 DO ip = nxl, nxr 132 DO jp = nys, nyn 133 DO kp = nzb+1, nzt 134 number_of_particles = prt_count(kp,jp,ip) 135 IF ( number_of_particles <= 0 ) CYCLE 136 particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles) 137 138 CALL lpm_pack_and_sort(ip,jp,kp) 139 140 prt_count(kp,jp,ip) = number_of_particles 141 ENDDO 142 ENDDO 143 ENDDO 144 CALL cpu_log( log_point_s(51), 'lpm_sort_in_subboxes', 'stop' ) 145 RETURN 146 147 END SUBROUTINE lpm_sort_in_subboxes 94 148 95 149 !------------------------------------------------------------------------------! 96 150 ! Description: 97 151 ! ------------ 98 !> @todo Missing subroutine description. 99 !------------------------------------------------------------------------------! 100 SUBROUTINE lpm_pack_all_arrays 101 102 USE cpulog, & 103 ONLY: cpu_log, log_point_s 104 105 USE indices, & 106 ONLY: nxl, nxr, nys, nyn, nzb, nzt 107 108 USE kinds 109 110 IMPLICIT NONE 111 112 INTEGER(iwp) :: i !< 113 INTEGER(iwp) :: j !< 114 INTEGER(iwp) :: k !< 115 116 CALL cpu_log( log_point_s(51), 'lpm_pack_all_arrays', 'start' ) 117 DO i = nxl, nxr 118 DO j = nys, nyn 119 DO k = nzb+1, nzt 120 number_of_particles = prt_count(k,j,i) 121 IF ( number_of_particles <= 0 ) CYCLE 122 particles => grid_particles(k,j,i)%particles(1:number_of_particles) 123 CALL lpm_pack_and_sort(i,j,k) 124 prt_count(k,j,i) = number_of_particles 125 ENDDO 126 ENDDO 127 ENDDO 128 CALL cpu_log( log_point_s(51), 'lpm_pack_all_arrays', 'stop' ) 129 RETURN 130 131 END SUBROUTINE lpm_pack_all_arrays 132 133 !------------------------------------------------------------------------------! 134 ! Description: 135 ! ------------ 136 !> @todo Missing subroutine description. 137 !------------------------------------------------------------------------------! 138 SUBROUTINE lpm_pack_arrays 152 !> Move all particles not marked for deletion to lowest indices (packing) 153 !------------------------------------------------------------------------------! 154 SUBROUTINE lpm_pack 139 155 140 156 USE kinds … … 173 189 number_of_particles = nn 174 190 175 END SUBROUTINE lpm_pack_arrays 176 177 !------------------------------------------------------------------------------! 178 ! Description: 179 ! ------------ 180 !> @todo Missing subroutine description. 181 !------------------------------------------------------------------------------! 191 END SUBROUTINE lpm_pack 192 182 193 SUBROUTINE lpm_pack_and_sort (ip,jp,kp) 183 194 184 USE control_parameters,&185 ONLY: dz186 187 USE kinds188 189 USE grid_variables,&190 ONLY:ddx, ddy191 192 IMPLICIT NONE193 194 INTEGER(iwp), INTENT(IN) :: ip195 INTEGER(iwp), INTENT(IN) :: jp196 INTEGER(iwp), INTENT(IN) :: kp197 198 INTEGER(iwp) :: i199 INTEGER(iwp) :: is200 INTEGER(iwp) :: j201 INTEGER(iwp) :: k202 INTEGER(iwp) :: n203 INTEGER(iwp) :: nn204 INTEGER(iwp) :: m205 INTEGER(iwp) :: sort_index206 207 INTEGER(iwp), DIMENSION(0:7) :: sort_count208 209 TYPE(particle_type), DIMENSION(number_of_particles,0:7) :: sort_particles210 195 USE control_parameters, & 196 ONLY: dz 197 198 USE kinds 199 200 USE grid_variables, & 201 ONLY: dx,dy,ddx, ddy 202 203 IMPLICIT NONE 204 205 INTEGER(iwp), INTENT(IN) :: ip 206 INTEGER(iwp), INTENT(IN) :: jp 207 INTEGER(iwp), INTENT(IN) :: kp 208 209 INTEGER(iwp) :: i 210 INTEGER(iwp) :: is 211 INTEGER(iwp) :: j 212 INTEGER(iwp) :: k 213 INTEGER(iwp) :: n 214 INTEGER(iwp) :: nn 215 INTEGER(iwp) :: m 216 INTEGER(iwp) :: sort_index 217 218 INTEGER(iwp), DIMENSION(0:7) :: sort_count 219 220 TYPE(particle_type), DIMENSION(number_of_particles,0:7) :: sort_particles 221 211 222 nn = 0 212 223 sort_count = 0 213 224 214 225 DO n = 1, number_of_particles 215 226 sort_index = 0 … … 217 228 IF ( particles(n)%particle_mask ) THEN 218 229 nn = nn + 1 219 i = particles(n)%x * ddx 220 j = particles(n)%y * ddy 221 k = ( particles(n)%z + 0.5_wp * dz ) / dz + offset_ocean_nzt 222 IF ( i == ip ) sort_index = sort_index+4 223 IF ( j == jp ) sort_index = sort_index+2 224 IF ( k == kp ) sort_index = sort_index+1 225 sort_count(sort_index) = sort_count(sort_index)+1 230 ! 231 !-- Sorting particles with a binary scheme 232 !-- sort_index=111_2=7_10 -> particle at the left,south,bottom subgridbox 233 !-- sort_index=000_2=0_10 -> particle at the right,north,top subgridbox 234 !-- For this the center of the gridbox is calculated 235 i = (particles(n)%x + 0.5_wp * dx) * ddx 236 j = (particles(n)%y + 0.5_wp * dy) * ddy 237 k = ( particles(n)%z+ 0.5_wp *dz ) / dz+1 + offset_ocean_nzt 238 239 IF ( i == ip ) sort_index = sort_index + 4 240 IF ( j == jp ) sort_index = sort_index + 2 241 IF ( k == kp ) sort_index = sort_index + 1 242 243 sort_count(sort_index) = sort_count(sort_index) + 1 226 244 m = sort_count(sort_index) 227 245 sort_particles(m,sort_index) = particles(n) … … 236 254 grid_particles(kp,jp,ip)%start_index(is) = nn + 1 237 255 DO n = 1,sort_count(is) 238 nn = nn +1256 nn = nn + 1 239 257 particles(nn) = sort_particles(n,is) 240 ENDDO 241 grid_particles(kp,jp,ip)%end_index(is) = nn 242 ENDDO 243 244 number_of_particles = nn 245 RETURN 246 258 ENDDO 259 grid_particles(kp,jp,ip)%end_index(is) = nn 260 ENDDO 261 262 number_of_particles = nn 263 247 264 END SUBROUTINE lpm_pack_and_sort 248 265 249 266 !------------------------------------------------------------------------------! 250 267 ! Description: … … 254 271 !> complete the LES timestep. 255 272 !------------------------------------------------------------------------------! 256 SUBROUTINE lpm_sort 273 SUBROUTINE lpm_sort_timeloop_done 257 274 258 275 USE control_parameters, & … … 342 359 ENDDO 343 360 344 END SUBROUTINE lpm_sort 345 346 347 END module lpm_pack_a rrays_mod361 END SUBROUTINE lpm_sort_timeloop_done 362 363 364 END module lpm_pack_and_sort_mod
Note: See TracChangeset
for help on using the changeset viewer.