subroutine uEMEP_set_loop_receptor_grid use uEMEP_definitions implicit none integer k integer count !integer :: use_region=2 ! +/- number of grids to loop around so that receptor positions can be interpolated linearly real x_ref,y_ref if (.not.use_multiple_receptor_grids_flag) then return endif !if (g_loop.eq.start_grid_loop_index) then write(unit_logfile,'(A)') '' write(unit_logfile,'(A)') '================================================================' write(unit_logfile,'(A)') 'Starting receptor loop (uEMEP_set_loop_receptor_grid)' write(unit_logfile,'(A)') '================================================================' ! endif k=1 if (use_multiple_receptor_grids_flag) then name_receptor(k,:)=name_receptor_in(g_loop,:) lon_receptor(k)=lon_receptor_in(g_loop) lat_receptor(k)=lat_receptor_in(g_loop) x_receptor(k)=x_receptor_in(g_loop) y_receptor(k)=y_receptor_in(g_loop) height_receptor(k)=height_receptor_in(g_loop) endif !Set lowest left edge of subgrid receptor position would be in x_ref=(floor((x_receptor(k)-subgrid_receptor_offset(x_dim_index))/subgrid_delta(x_dim_index)+0.0))*subgrid_delta(x_dim_index)+subgrid_receptor_offset(x_dim_index) y_ref=(floor((y_receptor(k)-subgrid_receptor_offset(y_dim_index))/subgrid_delta(y_dim_index)+0.0))*subgrid_delta(y_dim_index)+subgrid_receptor_offset(y_dim_index) !Set limits subgrid_min(x_dim_index)=x_ref-subgrid_delta(x_dim_index)*(use_receptor_region)*1.0 subgrid_min(y_dim_index)=y_ref-subgrid_delta(y_dim_index)*(use_receptor_region)*1.0 subgrid_max(x_dim_index)=x_ref+subgrid_delta(x_dim_index)*(use_receptor_region+1)*1.0 subgrid_max(y_dim_index)=y_ref+subgrid_delta(y_dim_index)*(use_receptor_region+1)*1.0 subgrid_dim(x_dim_index)=floor((subgrid_max(x_dim_index)-subgrid_min(x_dim_index))/subgrid_delta(x_dim_index))+1 subgrid_dim(y_dim_index)=floor((subgrid_max(y_dim_index)-subgrid_min(y_dim_index))/subgrid_delta(y_dim_index))+1 z_rec=height_receptor(k) write(unit_logfile,'(a,i12,a)') ' Receptor loop number = ', g_loop,' '//trim(name_receptor(k,1)) write(unit_logfile,'(a,4f12.1)') ' Receptor and grid positions (x,y) = ', x_receptor(k),x_ref,y_receptor(k),y_ref write(unit_logfile,'(a,2i)') ' Number of receptor subgrids = ', subgrid_dim(x_dim_index),subgrid_dim(y_dim_index) write(unit_logfile,'(a,f12.1)') ' Receptor height (m) = ', z_rec(allsource_index,1) !Find the target grid positions of the receptor points count=0 !do k=1,n_receptor i_receptor_subgrid(k)=1+floor((x_receptor(k)-subgrid_min(x_dim_index))/subgrid_delta(x_dim_index)) j_receptor_subgrid(k)=1+floor((y_receptor(k)-subgrid_min(y_dim_index))/subgrid_delta(y_dim_index)) write(unit_logfile,'(a,2i)') ' Receptor subgrid index = ', i_receptor_subgrid(k),j_receptor_subgrid(k) !Set subgrid use or not. At grid and surrounding grids in case of interpolation later if (i_receptor_subgrid(k).gt.use_receptor_region.and.i_receptor_subgrid(k).lt.subgrid_dim(x_dim_index)-use_receptor_region+1.and.j_receptor_subgrid(k).gt.use_receptor_region.and.j_receptor_subgrid(k).lt.subgrid_dim(y_dim_index)-use_receptor_region+1) then use_subgrid(i_receptor_subgrid(k)-use_receptor_region:i_receptor_subgrid(k)+use_receptor_region,j_receptor_subgrid(k)-use_receptor_region:j_receptor_subgrid(k)+use_receptor_region,:)=.true. !write(*,*) trim(name_receptor(k,1)),i_receptor_subgrid(k),j_receptor_subgrid(k) count=count+1 endif !enddo write(unit_logfile,'(a,i)') ' Number of receptor points available in region = ', count !count=0 !do j=1,subgrid_dim(y_dim_index) !do i=1,subgrid_dim(x_dim_index) ! if (use_subgrid(i,j,allsource_index)) count=count+1 !enddo !enddo !write(unit_logfile,'(a,i)') ' Number of subgrids to be calculated = ', count end subroutine uEMEP_set_loop_receptor_grid