102 行
6.0 KiB
Fortran
102 行
6.0 KiB
Fortran
!Copyright (c) 2022 by LEEE under guide of Huaifeng Sun(sunhuaifeng@email.sdu.edu.cn)
|
|
!written by Shangbin Liu(lsbin87@126.com)
|
|
|
|
SUBROUTINE Get_Receiver_Gridlabel
|
|
!This subroutine is used to calculate the global coordinates and grid dispersion at the receiving point
|
|
USE CONSTANTPARAMETERS
|
|
USE OMP_LIB
|
|
IMPLICIT NONE
|
|
INTEGER ii,i,j,k
|
|
INTEGER(KIND=4) ::x_pined,y_pined,z_pined
|
|
REAL(KIND=8) ::volu(8),volu_total
|
|
|
|
! -------------------------points_observer_gridlabel-------------------------------------------!
|
|
!$OMP PARALLEL DO PRIVATE(i,j,k,x_pined,y_pined,z_pined,volu,volu_total)
|
|
DO ii=1,point_num
|
|
DO i=1,NX
|
|
IF(Points_Observer(ii)%Local_Coord_To_Source%Coord_X < Coord_HZ_X(i))THEN
|
|
x_pined = i-1
|
|
EXIT !Find the corresponding grid
|
|
ENDIF
|
|
ENDDO
|
|
x_pined = MAX(1,MIN(x_pined,NX-1)) !clamp: keep the index in [1,NX-1] even if the receiver is outside the grid
|
|
DO j=1,NY
|
|
IF(Points_Observer(ii)%Local_Coord_To_Source%Coord_Y < Coord_HZ_Y(j))THEN
|
|
y_pined = j-1
|
|
EXIT
|
|
ENDIF
|
|
ENDDO
|
|
y_pined = MAX(1,MIN(y_pined,NY-1)) !clamp
|
|
DO k=1,NZB
|
|
IF(Points_Observer(ii)%Local_Coord_To_Source%Coord_Z < Coord_HZ_Z(k))THEN
|
|
z_pined = k-1
|
|
EXIT
|
|
ENDIF
|
|
ENDDO
|
|
z_pined = MAX(1,MIN(z_pined,NZB-1)) !clamp
|
|
!The position of the first HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(1)%Coordmesh_X = x_pined
|
|
Points_Observer(ii)%Global_Coordmesh(1)%Coordmesh_Y = y_pined
|
|
Points_Observer(ii)%Global_Coordmesh(1)%Coordmesh_Z = z_pined
|
|
!The position of the second HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(2)%Coordmesh_X = x_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(2)%Coordmesh_Y = y_pined
|
|
Points_Observer(ii)%Global_Coordmesh(2)%Coordmesh_Z = z_pined
|
|
!The position of the 3th HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(3)%Coordmesh_X = x_pined
|
|
Points_Observer(ii)%Global_Coordmesh(3)%Coordmesh_Y = y_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(3)%Coordmesh_Z = z_pined
|
|
!The position of the 4th HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(4)%Coordmesh_X = x_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(4)%Coordmesh_Y = y_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(4)%Coordmesh_Z = z_pined
|
|
!The position of the 5th HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(5)%Coordmesh_X = x_pined
|
|
Points_Observer(ii)%Global_Coordmesh(5)%Coordmesh_Y = y_pined
|
|
Points_Observer(ii)%Global_Coordmesh(5)%Coordmesh_Z = z_pined + 1
|
|
!The position of the 6th HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(6)%Coordmesh_X = x_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(6)%Coordmesh_Y = y_pined
|
|
Points_Observer(ii)%Global_Coordmesh(6)%Coordmesh_Z = z_pined + 1
|
|
!The position of the 7th HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(7)%Coordmesh_X = x_pined
|
|
Points_Observer(ii)%Global_Coordmesh(7)%Coordmesh_Y = y_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(7)%Coordmesh_Z = z_pined + 1
|
|
!The position of the 8th HZ corresponding to the observation point
|
|
Points_Observer(ii)%Global_Coordmesh(8)%Coordmesh_X = x_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(8)%Coordmesh_Y = y_pined + 1
|
|
Points_Observer(ii)%Global_Coordmesh(8)%Coordmesh_Z = z_pined + 1
|
|
|
|
volu(1) = (Points_Observer(ii)%Local_Coord_To_Source%Coord_X - Coord_HZ_X(x_pined)) * (Points_Observer(ii)%Local_Coord_To_Source%Coord_Y- Coord_HZ_Y(y_pined)) *&
|
|
(Points_Observer(ii)%Local_Coord_To_Source%Coord_Z - Coord_HZ_Z(z_pined))
|
|
volu(2) = (Coord_HZ_X(x_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_X) * (Points_Observer(ii)%Local_Coord_To_Source%Coord_Y- Coord_HZ_Y(y_pined)) *&
|
|
(Points_Observer(ii)%Local_Coord_To_Source%Coord_Z - Coord_HZ_Z(z_pined))
|
|
volu(3) = (Points_Observer(ii)%Local_Coord_To_Source%Coord_X - Coord_HZ_X(x_pined)) * (Coord_HZ_Y(y_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Y) *&
|
|
(Points_Observer(ii)%Local_Coord_To_Source%Coord_Z - Coord_HZ_Z(z_pined))
|
|
volu(4) = (Coord_HZ_X(x_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_X) * (Coord_HZ_Y(y_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Y) *&
|
|
(Points_Observer(ii)%Local_Coord_To_Source%Coord_Z - Coord_HZ_Z(z_pined))
|
|
volu(5) = (Points_Observer(ii)%Local_Coord_To_Source%Coord_X - Coord_HZ_X(x_pined)) * (Points_Observer(ii)%Local_Coord_To_Source%Coord_Y- Coord_HZ_Y(y_pined)) *&
|
|
(Coord_HZ_Z(z_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Z)
|
|
volu(6) = (Coord_HZ_X(x_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_X) * (Points_Observer(ii)%Local_Coord_To_Source%Coord_Y- Coord_HZ_Y(y_pined)) *&
|
|
(Coord_HZ_Z(z_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Z)
|
|
volu(7) = (Points_Observer(ii)%Local_Coord_To_Source%Coord_X - Coord_HZ_X(x_pined)) * (Coord_HZ_Y(y_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Y) *&
|
|
(Coord_HZ_Z(z_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Z)
|
|
volu(8) = (Coord_HZ_X(x_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_X) * (Coord_HZ_Y(y_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Y) *&
|
|
(Coord_HZ_Z(z_pined+1) - Points_Observer(ii)%Local_Coord_To_Source%Coord_Z)
|
|
|
|
volu_total = (Coord_HZ_X(x_pined+1) - Coord_HZ_X(x_pined)) * (Coord_HZ_Y(y_pined+1) - Coord_HZ_Y(y_pined)) * (Coord_HZ_Z(z_pined+1) - Coord_HZ_Z(z_pined))
|
|
|
|
Points_Observer(ii)%Coeff(1) = volu(8)/volu_total
|
|
Points_Observer(ii)%Coeff(2) = volu(7)/volu_total
|
|
Points_Observer(ii)%Coeff(3) = volu(6)/volu_total
|
|
Points_Observer(ii)%Coeff(4) = volu(5)/volu_total
|
|
Points_Observer(ii)%Coeff(5) = volu(4)/volu_total
|
|
Points_Observer(ii)%Coeff(6) = volu(3)/volu_total
|
|
Points_Observer(ii)%Coeff(7) = volu(2)/volu_total
|
|
Points_Observer(ii)%Coeff(8) = volu(1)/volu_total
|
|
ENDDO
|
|
!$OMP END PARALLEL DO
|
|
!------------------------------------------------------------------------------------------!
|
|
RETURN
|
|
ENDSUBROUTINE Get_Receiver_Gridlabel
|