Changeset 2232 for palm/trunk/SOURCE/lpm_init.f90
- Timestamp:
- May 30, 2017 5:47:52 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/lpm_init.f90
r2224 r2232 20 20 ! Current revisions: 21 21 ! ----------------- 22 ! Adjustments according to new topography realization 22 23 ! 23 24 ! … … 146 147 147 148 USE arrays_3d, & 148 ONLY: de_dx, de_dy, de_dz, zu, zw , z0149 ONLY: de_dx, de_dy, de_dz, zu, zw 149 150 150 151 USE control_parameters, & … … 157 158 USE indices, & 158 159 ONLY: nx, nxl, nxlg, nxrg, nxr, ny, nyn, nys, nyng, nysg, nz, nzb, & 159 nzb_ w_inner, nzt160 nzb_max, nzt, wall_flags_0 160 161 161 162 USE kinds … … 196 197 ONLY: random_function 197 198 199 USE surface_mod, & 200 ONLY: surf_def_h, surf_lsm_h, surf_usm_h 201 198 202 IMPLICIT NONE 199 203 … … 287 291 number_of_particle_groups = max_number_of_particle_groups 288 292 ENDIF 293 ! 294 !-- Check if downward-facing walls exist. This case, reflection boundary 295 !-- conditions (as well as subgrid-scale velocities) may do not work 296 !-- propably (not realized so far). 297 IF ( surf_def_h(1)%ns >= 1 ) THEN 298 WRITE( message_string, * ) 'Overhanging topograpyh do not work '// & 299 'with particles' 300 CALL message( 'lpm_init', 'PA0212', 0, 1, 0, 6, 0 ) 301 302 ENDIF 289 303 290 304 ! … … 355 369 356 370 ALLOCATE ( log_z_z0(0:number_of_sublayers) ) 357 z_p 371 z_p = zu(nzb+1) - zw(nzb) 358 372 359 373 ! … … 362 376 !-- However, sensitivity studies showed that the effect is 363 377 !-- negligible. 364 z0_av_local = SUM( z0(nys:nyn,nxl:nxr) ) 378 z0_av_local = SUM( surf_def_h(0)%z0 ) + SUM( surf_lsm_h%z0 ) + & 379 SUM( surf_usm_h%z0 ) 365 380 z0_av_global = 0.0_wp 366 381 … … 577 592 INTEGER(iwp) :: j !< loop variable ( particles per point ) 578 593 INTEGER(iwp) :: jp !< index variable along y 594 INTEGER(iwp) :: k !< index variable along z 595 INTEGER(iwp) :: k_surf !< index of surface grid point 579 596 INTEGER(iwp) :: kp !< index variable along z 580 597 INTEGER(iwp) :: loop_stride !< loop variable for initialization … … 679 696 ! 680 697 !-- Determine the grid indices of the particle position 681 ip = ( tmp_particle%x + 0.5_wp * dx ) * ddx698 ip = ( tmp_particle%x + 0.5_wp * dx ) * ddx 682 699 jp = ( tmp_particle%y + 0.5_wp * dy ) * ddy 683 700 kp = tmp_particle%z / dz + 1 + offset_ocean_nzt 701 ! 702 !-- Determine surface level. Therefore, check for 703 !-- upward-facing wall on w-grid. MAXLOC will return 704 !-- the index of the lowest upward-facing wall. 705 k_surf = MAXLOC( & 706 MERGE( 1, 0, & 707 BTEST( wall_flags_0(nzb:nzb_max,jp,ip), 18 )& 708 ), DIM = 1 & 709 ) - 1 684 710 685 711 IF ( seed_follows_topography ) THEN 686 712 ! 687 713 !-- Particle height is given relative to topography 688 kp = kp + nzb_w_inner(jp,ip) 689 tmp_particle%z = tmp_particle%z + & 690 zw(nzb_w_inner(jp,ip)) 691 IF ( kp > nzt ) THEN 714 kp = kp + k_surf 715 tmp_particle%z = tmp_particle%z + zw(k_surf) 716 !-- Skip particle release if particle position is 717 !-- above model top, or within topography in case 718 !-- of overhanging structures. 719 IF ( kp > nzt .OR. & 720 .NOT. BTEST( wall_flags_0(kp,jp,ip), 0 ) ) THEN 692 721 pos_x = pos_x + pdx(i) 693 722 CYCLE xloop 694 723 ENDIF 724 ! 725 !-- Skip particle release if particle position is 726 !-- below surface, or within topography in case 727 !-- of overhanging structures. 695 728 ELSEIF ( .NOT. seed_follows_topography .AND. & 696 tmp_particle%z <= zw(nzb_w_inner(jp,ip)) ) THEN 729 tmp_particle%z <= zw(k_surf) .OR. & 730 .NOT. BTEST( wall_flags_0(kp,jp,ip), 0 ) )& 731 THEN 697 732 pos_x = pos_x + pdx(i) 698 733 CYCLE xloop … … 820 855 pdx(particles(n)%group) 821 856 particles(n)%x = particles(n)%x + & 822 MERGE( rand_contr, SIGN( dx, rand_contr ), &857 MERGE( rand_contr, SIGN( dx, rand_contr ), & 823 858 ABS( rand_contr ) < dx & 824 859 ) … … 828 863 pdy(particles(n)%group) 829 864 particles(n)%y = particles(n)%y + & 830 MERGE( rand_contr, SIGN( dy, rand_contr ), &865 MERGE( rand_contr, SIGN( dy, rand_contr ), & 831 866 ABS( rand_contr ) < dy & 832 867 ) … … 836 871 pdz(particles(n)%group) 837 872 particles(n)%z = particles(n)%z + & 838 MERGE( rand_contr, SIGN( dz, rand_contr ), &873 MERGE( rand_contr, SIGN( dz, rand_contr ), & 839 874 ABS( rand_contr ) < dz & 840 875 ) … … 854 889 i = ( particles(n)%x + 0.5_wp * dx ) * ddx 855 890 j = ( particles(n)%y + 0.5_wp * dy ) * ddy 856 IF ( particles(n)%z <= zw(nzb_w_inner(j,i)) ) THEN 891 k = particles(n)%z / dz + 1 + offset_ocean_nzt 892 ! 893 !-- Check if particle is within topography 894 IF ( .NOT. BTEST( wall_flags_0(k,j,i), 0 ) ) THEN 857 895 particles(n)%particle_mask = .FALSE. 858 896 deleted_particles = deleted_particles + 1 859 897 ENDIF 898 860 899 ENDDO 861 900 ENDDO
Note: See TracChangeset
for help on using the changeset viewer.