Changeset 2628 for palm/trunk/SOURCE/lpm_exchange_horiz.f90
- Timestamp:
- Nov 20, 2017 12:40:38 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/lpm_exchange_horiz.f90
r2606 r2628 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Enabled particle advection with grid stretching. Furthermore, the CFL- 28 ! criterion is checked for every particle at every time step. 29 ! 30 ! 2606 2017-11-10 10:36:31Z schwenkel 27 31 ! Changed particle box locations: center of particle box now coincides 28 32 ! with scalar grid point of same index. … … 124 128 125 129 USE, INTRINSIC :: ISO_C_BINDING 126 130 131 USE arrays_3d, & 132 ONLY: zw 133 127 134 USE control_parameters, & 128 135 ONLY: dz, message_string, simulated_time … … 887 894 jp = particle_array(n)%y * ddy 888 895 kp = particle_array(n)%z / dz + 1 + offset_ocean_nzt 896 ! 897 !-- In case of grid stretching a particle might be above or below the 898 !-- previously calculated particle grid box (indices). 899 DO WHILE( zw(kp) < particle_array(n)%z ) 900 kp = kp + 1 901 ENDDO 902 903 DO WHILE( zw(kp-1) > particle_array(n)%z ) 904 kp = kp - 1 905 ENDDO 889 906 890 907 IF ( ip >= nxl .AND. ip <= nxr .AND. jp >= nys .AND. jp <= nyn & … … 1022 1039 !------------------------------------------------------------------------------! 1023 1040 SUBROUTINE lpm_move_particle 1024 1041 1025 1042 IMPLICIT NONE 1026 1043 … … 1038 1055 1039 1056 CALL cpu_log( log_point_s(41), 'lpm_move_particle', 'start' ) 1040 1057 CALL lpm_check_cfl 1041 1058 DO ip = nxl, nxr 1042 1059 DO jp = nys, nyn … … 1050 1067 i = particles_before_move(n)%x * ddx 1051 1068 j = particles_before_move(n)%y * ddy 1052 k = particles_before_move(n)%z / dz + 1 + offset_ocean_nzt 1053 1069 k = kp 1070 ! 1071 !-- Find correct vertical particle grid box (necessary in case of grid stretching) 1072 !-- Due to the CFL limitations only the neighbouring grid boxes are considered. 1073 IF( zw(k) < particles_before_move(n)%z ) k = k + 1 1074 IF( zw(k-1) > particles_before_move(n)%z ) k = k - 1 1075 1054 1076 !-- For lpm_exchange_horiz to work properly particles need to be moved to the outermost gridboxes 1055 1077 !-- of the respective processor. If the particle index is inside the processor the following lines … … 1059 1081 j = MIN ( j , nyn ) 1060 1082 j = MAX ( j , nys ) 1083 1061 1084 k = MIN ( k , nzt ) 1062 1085 k = MAX ( k , nzb+1 ) 1086 1063 1087 ! 1064 1088 !-- Check, if particle has moved to another grid cell. … … 1092 1116 1093 1117 END SUBROUTINE lpm_move_particle 1094 1118 1119 !------------------------------------------------------------------------------! 1120 ! Description: 1121 ! ------------ 1122 !> Check CFL-criterion for each particle. If one particle violated the 1123 !> criterion the particle will be deleted and a warning message is given. 1124 !------------------------------------------------------------------------------! 1125 SUBROUTINE lpm_check_cfl 1126 1127 IMPLICIT NONE 1128 1129 INTEGER(iwp) :: i 1130 INTEGER(iwp) :: j 1131 INTEGER(iwp) :: k 1132 INTEGER(iwp) :: n 1133 1134 DO i = nxl, nxr 1135 DO j = nys, nyn 1136 DO k = nzb+1, nzt 1137 number_of_particles = prt_count(k,j,i) 1138 IF ( number_of_particles <= 0 ) CYCLE 1139 particles => grid_particles(k,j,i)%particles(1:number_of_particles) 1140 DO n = 1, number_of_particles 1141 1142 IF(ABS(particles(n)%speed_x) > & 1143 (dx/(particles(n)%age-particles(n)%age_m)) .OR. & 1144 ABS(particles(n)%speed_y) > & 1145 (dx/(particles(n)%age-particles(n)%age_m)) .OR. & 1146 ABS(particles(n)%speed_z) > & 1147 ((zw(k)-zw(k-1))/(particles(n)%age-particles(n)%age_m))) THEN 1148 WRITE( message_string, * ) 'PARTICLE VIOLATED CFL CRITERION'& 1149 ': particle with id ',particles(n)%id,' will be deleted!' 1150 CALL message( 'lpm_check_cfl', 'PA0500', 0, 1, 0, 6, 0 ) 1151 particles(n)%particle_mask= .FALSE. 1152 ENDIF 1153 ENDDO 1154 ENDDO 1155 ENDDO 1156 ENDDO 1157 1158 END SUBROUTINE lpm_check_cfl 1159 1095 1160 !------------------------------------------------------------------------------! 1096 1161 ! Description:
Note: See TracChangeset
for help on using the changeset viewer.