Calculate damping functions times normal and derivatives times normal for the PML evaluation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_pmlLayer_type) | :: | me |
Spacetime function to evaluate |
|||
integer, | intent(in) | :: | ncomp |
Number of entrys in each array |
||
real(kind=rk), | intent(in) | :: | coord(n,3) |
barycentric Ids of an elements. 1st index goes over number of elements and 2nd index goes over x,y,z coordinates |
||
integer, | intent(in) | :: | n |
Number of arrays to return |
return value
function tem_evaluate_pml(me, nComp, coord, n) & & result(res) !> Spacetime function to evaluate type(tem_pmlLayer_type) :: me !> Number of arrays to return integer, intent(in) :: n !> Number of entrys in each array integer, intent(in) :: ncomp !> barycentric Ids of an elements. !! 1st index goes over number of elements and !! 2nd index goes over x,y,z coordinates real(kind=rk), intent( in ) :: coord(n,3) !> return value real(kind=rk) :: res(n,ncomp) ! --------------------------------------------------------------------------- integer :: i real(kind=rk) :: origin(3), normal(3), vec(3), projection ! --------------------------------------------------------------------------- origin(:) = me%plane_origin normal(:) = me%plane_normal select case(ncomp) ! 2D case case(4) do i = 1,n vec (:) = coord(i,:) - origin(:) projection = vec(1)*normal(1)+vec(2)*normal(2) if(projection > 0.0_rk) then res(i,1:2) = me%dampFactor*abs(normal(1:2))*((coord(i,1:2) - origin(1:2))**me%dampExponent)/sqrt(sum(normal**2)) res(i,3:4) = me%dampExponent*me%dampFactor*abs(normal(1:2))*((coord(i,1:2)& & - origin(1:2))**(me%dampExponent-1))/sqrt(sum(normal**2)) else res(i,1:4) = 0.0_rk end if enddo ! 3D case case(6) do i = 1,n vec (:) = coord(i,:) - origin(:) projection = vec(1)*normal(1)+vec(2)*normal(2)+vec(3)*normal(3) if(projection > 0.0_rk) then res(i,1:3) = me%dampFactor*abs(normal(1:3))*(((coord(i,1:3) - origin(1:3))/sqrt(sum(normal**2)))**me%dampExponent) res(i,4:6) = me%dampExponent*me%dampFactor*abs(normal(1:3))*(((coord(i,1:3)& & - origin(1:3))/sqrt(sum(normal**2)))**(me%dampExponent-1)) / sqrt(sum(normal**2)) else res(i,1:6) = 0.0_rk end if enddo case default write(*,*) 'ERROR in tem_evaluate_pml: Unknown number of components, stopping ...' stop end select end function tem_evaluate_pml