uEMEP_grid_receptor_data Subroutine

public subroutine uEMEP_grid_receptor_data()

Uses

  • proc~~uemep_grid_receptor_data~~UsesGraph proc~uemep_grid_receptor_data uEMEP_grid_receptor_data module~uemep_definitions uEMEP_definitions proc~uemep_grid_receptor_data->module~uemep_definitions

Arguments

None

Called by

proc~~uemep_grid_receptor_data~~CalledByGraph proc~uemep_grid_receptor_data uEMEP_grid_receptor_data program~uemep uEMEP program~uemep->proc~uemep_grid_receptor_data

Source Code

    subroutine uEMEP_grid_receptor_data

        use uEMEP_definitions

        implicit none

        integer i,j,k
        integer count
        logical use_receptor_temp
        !integer :: use_region=2 ! +/- number of grids to loop around so that receptor positions can be interpolated linearly

        if (use_receptor_positions_for_auto_subgrid_flag.or.use_multiple_receptor_grids_flag) then
        else
            return
        endif

        write(unit_logfile,'(A)') ''
        write(unit_logfile,'(A)') '================================================================'
        write(unit_logfile,'(A)') 'Gridding receptor positions (uEMEP_grid_receptor_data)'
        write(unit_logfile,'(A)') '================================================================'


        !Find the target grid positions of the receptor points
        use_subgrid=.false.
        count=0

        do k=1,n_receptor
            !Always true when using use_multiple_receptor_grids_flag as this is inside the use_receptor loop
            if (use_multiple_receptor_grids_flag) then
                use_receptor_temp=.true.
            else
                use_receptor_temp=use_receptor(k)
            endif
            if (use_receptor_temp) then
                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(*,*) 'HERE2: ',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

            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_grid_receptor_data