tem_evaluate_pml Function

public function tem_evaluate_pml(me, ncomp, coord, n) result(res)

Calculate damping functions times normal and derivatives times normal for the PML evaluation.

Arguments

Type IntentOptional 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 real(kind=rk), (n,ncomp)

return value


Called by

proc~~tem_evaluate_pml~~CalledByGraph proc~tem_evaluate_pml tem_evaluate_pml proc~tem_spatial_vector_for_coord tem_spatial_vector_for_coord proc~tem_spatial_vector_for_coord->proc~tem_evaluate_pml proc~tem_spatial_vector_for_index tem_spatial_vector_for_index proc~tem_spatial_vector_for_index->proc~tem_spatial_vector_for_coord interface~tem_spatial_for tem_spatial_for interface~tem_spatial_for->proc~tem_spatial_vector_for_coord interface~tem_spatial_for->proc~tem_spatial_vector_for_index proc~tem_spacetime_for_treeids tem_spacetime_for_treeIDs proc~tem_spacetime_for_treeids->interface~tem_spatial_for proc~tem_spacetime_vector_for_index tem_spacetime_vector_for_index proc~tem_spacetime_vector_for_index->interface~tem_spatial_for proc~tem_spacetime_vector_for_coord tem_spacetime_vector_for_coord proc~tem_spacetime_vector_for_index->proc~tem_spacetime_vector_for_coord proc~tem_spatial_scalar_storeval tem_spatial_scalar_storeVal proc~tem_spatial_scalar_storeval->interface~tem_spatial_for proc~tem_spacetime_for_coord tem_spacetime_for_coord proc~tem_spacetime_for_coord->interface~tem_spatial_for proc~tem_spacetime_scalar_for_index tem_spacetime_scalar_for_index proc~tem_spacetime_scalar_for_index->interface~tem_spatial_for proc~tem_spacetime_scalar_for_index->proc~tem_spacetime_for_coord proc~tem_spacetime_vector_for_treeids tem_spacetime_vector_for_treeIDs proc~tem_spacetime_vector_for_treeids->interface~tem_spatial_for proc~tem_spacetime_vector_for_coord->interface~tem_spatial_for proc~tem_spatial_vector_storeval tem_spatial_vector_storeVal proc~tem_spatial_vector_storeval->interface~tem_spatial_for interface~tem_spacetime_for tem_spacetime_for interface~tem_spacetime_for->proc~tem_spacetime_for_treeids interface~tem_spacetime_for->proc~tem_spacetime_vector_for_index interface~tem_spacetime_for->proc~tem_spacetime_for_coord interface~tem_spacetime_for->proc~tem_spacetime_scalar_for_index interface~tem_spacetime_for->proc~tem_spacetime_vector_for_treeids interface~tem_spacetime_for->proc~tem_spacetime_vector_for_coord proc~tem_spacetime_for_stcoord tem_spacetime_for_stcoord proc~tem_spacetime_for_stcoord->proc~tem_spacetime_for_coord interface~tem_spatial_storeval tem_spatial_storeVal interface~tem_spatial_storeval->proc~tem_spatial_scalar_storeval interface~tem_spatial_storeval->proc~tem_spatial_vector_storeval

Contents

Source Code


Source Code

  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