tem_eval_miescatter_displz Function

public function tem_eval_miescatter_displz(me, coord, time, n) result(res)

Evaluate displacement field (z component) for Mie-Scattering of electromagnetic wave at dielectric cylinder.

Arguments

Type IntentOptional Attributes Name
type(tem_miescatter_field_type), intent(in) :: me

The function to evaluate

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

real(kind=rk), intent(in) :: time

The time to evaluate the function at.

integer, intent(in) :: n

Number of points to evaluate the function for.

Return Value real(kind=rk), (n)

return value of the function


Calls

proc~~tem_eval_miescatter_displz~~CallsGraph proc~tem_eval_miescatter_displz tem_eval_miescatter_displz proc~cart2polar~2 cart2polar proc~tem_eval_miescatter_displz->proc~cart2polar~2 proc~hankel2_n hankel2_n proc~tem_eval_miescatter_displz->proc~hankel2_n

Called by

proc~~tem_eval_miescatter_displz~~CalledByGraph proc~tem_eval_miescatter_displz tem_eval_miescatter_displz proc~tem_spatial_for_coord tem_spatial_for_coord proc~tem_spatial_for_coord->proc~tem_eval_miescatter_displz proc~tem_spacetime_for_coord tem_spacetime_for_coord proc~tem_spacetime_for_coord->proc~tem_eval_miescatter_displz proc~tem_spatial_scalar_for_index tem_spatial_scalar_for_index proc~tem_spatial_scalar_for_index->proc~tem_spatial_for_coord proc~tem_spacetime_for_stcoord tem_spacetime_for_stcoord proc~tem_spacetime_for_stcoord->proc~tem_spacetime_for_coord interface~tem_spatial_for tem_spatial_for interface~tem_spatial_for->proc~tem_spatial_for_coord interface~tem_spacetime_for tem_spacetime_for interface~tem_spacetime_for->proc~tem_spacetime_for_coord proc~tem_spacetime_scalar_for_index tem_spacetime_scalar_for_index proc~tem_spacetime_scalar_for_index->proc~tem_spacetime_for_coord

Contents


Source Code

  function tem_eval_miescatter_displz(me, coord, time, n) result(res)
    ! ---------------------------------------------------------------------------
    !> The function to evaluate
    type(tem_miescatter_field_type), intent(in) :: me
    !> Number of points to evaluate the function for.
    integer, intent(in) :: n
    !> 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)
    !> The time to evaluate the function at.
    real(kind=rk), intent( in )  :: time
    !> return value of the function
    real(kind=rk) :: res(n)
    ! ---------------------------------------------------------------------------
    integer :: iPoint, iCoeff
    ! Polar coordinate vector in x-y plane.
    ! First entry: radius \n
    ! Second entry: angle
    real(kind=rk) :: polar(2)
    complex(kind=rk) :: tmp
    ! ---------------------------------------------------------------------------

    do iPoint = 1, n

      ! Convert to polar coordinates (relative to the center of the
      ! cylinder.
      polar = cart2polar( coord(iPoint,1)-me%miescatter%center(1), &
                        & coord(iPoint,2)-me%miescatter%center(2)  )

      ! Inside the cylinder
      if(polar(1).le.me%miescatter%radius) then

        tmp = (0.0_rk, 0.0_rk)
        do iCoeff = -me%mieexpansion%nCoeffs , me%mieexpansion%nCoeffs
          tmp = tmp                                                           &
            & + me%mieexpansion%c_tot(iCoeff)                                 &
            & * bessel_jn(iCoeff, me%miescatter%wavenumber_cylinder*polar(1)) &
            & * exp( (0.0_rk,1.0_rk) * iCoeff * polar(2)  )
        end do
        ! Twiddle by phase and get the real part
        res(iPoint) = real( tmp * exp( (0.0_rk,1.0_rk) * me%miescatter%omega  &
          &                * time ) )

        ! Multiply with permitivity to get the displacement field
        res(iPoint) = me%miescatter%permitivity_cylinder * res(iPoint)

      ! Outside the cylinder
      else

        ! Add up incoming and scattered field
        tmp = (0.0_rk, 0.0_rk)
        do iCoeff = -me%mieexpansion%nCoeffs , me%mieexpansion%nCoeffs
          tmp = tmp +                                                     &
            & ( (0.0_rk,1.0_rk)**(-iCoeff)                                &
            &   * bessel_jn(iCoeff,                                       &
            &               me%miescatter%wavenumber_background*polar(1)) &
            &   + me%mieexpansion%c_scat(iCoeff)                          &
            &   * hankel2_n(iCoeff,                                       &
            &               me%miescatter%wavenumber_background*polar(1)) &
            & ) * exp( (0.0_rk,1.0_rk) * iCoeff * polar(2)  )
        end do
        ! Twiddle by phase and get the real part
        res(iPoint) = real(tmp * exp( (0.0_rk,1.0_rk) * &
          &                me%miescatter%omega * time ) )

        ! Multiply with permitivity to get the displacement field
        res(iPoint) = me%miescatter%permitivity_background * res(iPoint)

      end if

    end do

  end function tem_eval_miescatter_displz