tem_eval_acoustic_pulse Function

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

Evaluate the acoustic pulse at given points in space for one point in time.

Exact solution for an acoustic wave from a Gaussian pulse in pressure. See Tam: Computational Acoustics, a wave number approach. Appendix G.3. Any point may be probed, the solution at the center is properly defined with a finite value.

Arguments

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

Definition of the acoustic pulse to evaluate

real(kind=rk), intent(in) :: coord(n,3)

3D Coordinates of all points.

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

Point in time to evaluate the points at.

integer, intent(in) :: n

Number of different points to evaluate the acoustic pulse at.

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

Analytical solution in all n points.


Called by

proc~~tem_eval_acoustic_pulse~~CalledByGraph proc~tem_eval_acoustic_pulse tem_eval_acoustic_pulse proc~tem_spacetime_for_coord tem_spacetime_for_coord proc~tem_spacetime_for_coord->proc~tem_eval_acoustic_pulse interface~tem_spacetime_for tem_spacetime_for interface~tem_spacetime_for->proc~tem_spacetime_for_coord proc~tem_spacetime_for_stcoord tem_spacetime_for_stcoord interface~tem_spacetime_for->proc~tem_spacetime_for_stcoord proc~tem_spacetime_scalar_for_index tem_spacetime_scalar_for_index interface~tem_spacetime_for->proc~tem_spacetime_scalar_for_index proc~tem_spacetime_for_stcoord->proc~tem_spacetime_for_coord proc~tem_spacetime_scalar_for_index->proc~tem_spacetime_for_coord proc~evaluate_add_spacetime_scalarbycoordinate evaluate_add_spacetime_scalarByCoordinate proc~evaluate_add_spacetime_scalarbycoordinate->interface~tem_spacetime_for proc~evaluate_add_spacetime_scalarbytreeid evaluate_add_spacetime_scalarByTreeID proc~evaluate_add_spacetime_scalarbytreeid->interface~tem_spacetime_for proc~evaluate_add_spacetime_vectorbycoordinate evaluate_add_spacetime_vectorByCoordinate proc~evaluate_add_spacetime_vectorbycoordinate->interface~tem_spacetime_for proc~evaluate_add_spacetime_vectorbytreeid evaluate_add_spacetime_vectorByTreeID proc~evaluate_add_spacetime_vectorbytreeid->interface~tem_spacetime_for proc~evaluate_first_spacetime_scalarbycoordinate evaluate_first_spacetime_scalarByCoordinate proc~evaluate_first_spacetime_scalarbycoordinate->interface~tem_spacetime_for proc~evaluate_first_spacetime_scalarbytreeid evaluate_first_spacetime_scalarByTreeID proc~evaluate_first_spacetime_scalarbytreeid->interface~tem_spacetime_for proc~evaluate_first_spacetime_vectorbycoordinate evaluate_first_spacetime_vectorByCoordinate proc~evaluate_first_spacetime_vectorbycoordinate->interface~tem_spacetime_for proc~evaluate_first_spacetime_vectorbytreeid evaluate_first_spacetime_vectorByTreeID proc~evaluate_first_spacetime_vectorbytreeid->interface~tem_spacetime_for proc~evaluate_foag_spacetime_scalarbycoordinate evaluate_FOAG_spacetime_scalarByCoordinate proc~evaluate_foag_spacetime_scalarbycoordinate->interface~tem_spacetime_for proc~evaluate_foag_spacetime_scalarbytreeid evaluate_FOAG_spacetime_scalarByTreeID proc~evaluate_foag_spacetime_scalarbytreeid->interface~tem_spacetime_for proc~evaluate_foag_spacetime_vectorbycoordinate evaluate_FOAG_spacetime_vectorByCoordinate proc~evaluate_foag_spacetime_vectorbycoordinate->interface~tem_spacetime_for proc~evaluate_foag_spacetime_vectorbytreeid evaluate_FOAG_spacetime_vectorByTreeID proc~evaluate_foag_spacetime_vectorbytreeid->interface~tem_spacetime_for proc~get_valofindex_add_scalar_spacetime get_valOfIndex_add_scalar_spacetime proc~get_valofindex_add_scalar_spacetime->interface~tem_spacetime_for proc~get_valofindex_add_vector_spacetime get_valOfIndex_add_vector_spacetime proc~get_valofindex_add_vector_spacetime->interface~tem_spacetime_for proc~get_valofindex_first_scalar_spacetime get_valOfIndex_first_scalar_spacetime proc~get_valofindex_first_scalar_spacetime->interface~tem_spacetime_for proc~get_valofindex_first_vector_spacetime get_valOfIndex_first_vector_spacetime proc~get_valofindex_first_vector_spacetime->interface~tem_spacetime_for proc~get_valofindex_foag_scalar_spacetime get_valOfIndex_FOAG_scalar_spacetime proc~get_valofindex_foag_scalar_spacetime->interface~tem_spacetime_for proc~get_valofindex_foag_vector_spacetime get_valOfIndex_FOAG_vector_spacetime proc~get_valofindex_foag_vector_spacetime->interface~tem_spacetime_for proc~tem_update_surfpos tem_update_surfPos proc~tem_update_surfpos->interface~tem_spacetime_for

Source Code

  function tem_eval_acoustic_pulse(me, coord, time, n) result(res)
    !> Definition of the acoustic pulse to evaluate
    type(tem_acoustic_pulse_type), intent(in) :: me

    !> Number of different points to evaluate the acoustic pulse at.
    integer, intent(in) :: n

    !> 3D Coordinates of all points.
    real(kind=rk), intent(in) :: coord(n,3)

    !> Point in time to evaluate the points at.
    real(kind=rk), intent(in) :: time

    !> Analytical solution in all n points.
    real(kind=rk) :: res(n)
    ! -------------------------------------------------------------------- !
    real(kind=rk) :: radius(n)
    real(kind=rk), parameter :: zero_rad = 16.0_rk * tiny(time)
    real(kind=rk) :: wavepos
    real(kind=rk) :: ampfact
    real(kind=rk) :: expfact
    ! -------------------------------------------------------------------- !

    radius = sqrt( (coord(:,1)-me%center(1))**2  &
      &           + (coord(:,2)-me%center(2))**2 &
      &           + (coord(:,3)-me%center(3))**2 )

    wavepos = me%speed_of_sound * time
    ampfact = 0.5_rk * me%amplitude
    expfact = -log(2.0_rk) / me%halfwidth**2

    where (radius > zero_rad)
      res = me%background &
        & + (ampfact/radius) * ( (radius-wavepos)                   &
        &                        * exp(expfact*(radius-wavepos)**2) &
        &                      + (radius+wavepos)                   &
        &                        * exp(expfact*(radius+wavepos)**2) )
    elsewhere
      res = me%background + me%amplitude * exp(expfact*wavepos**2)       &
        &                                * (1.0_rk + 2*expfact*wavepos**2)
    end where

  end function tem_eval_acoustic_pulse