ic_gausspulse_for Function

public function ic_gausspulse_for(me, coord, n) result(res)

This function defines gauss pulse

This function computes gauss pulse for given array co-ordinate points and defined gauss parameters in LUA file. Gauss function: where,

 a - pulse height,
 x - pulse center,
 c - pulse widthn,
 b - position along x

Arguments

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

global gauss pulse data

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

coordinate of an element

integer, intent(in) :: n

number of return values

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

return value which is sent to state variable


Source Code

  function ic_gausspulse_for(me, coord, n) result(res)
    ! ---------------------------------------------------------------------------
    !> number of return values
    integer, intent(in) :: n
    !> global gauss pulse data
    type(ic_gausspulse_type), intent(in) :: me
    !> coordinate of an element
    real(kind=rk), intent(in) :: coord(n, 3)
    !> return value which is sent to state variable
    real(kind=rk) :: res(n)
    ! ---------------------------------------------------------------------------
    real(kind=rk) :: distsquare(n)
    real(kind=rk) :: fact
    ! ---------------------------------------------------------------------------

    fact = -log(2.0_rk)/(me%halfwidth**2)

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

    distsquare = fact*distsquare

    res = me%background + (me%amplitude * exp(distsquare))

  end function ic_gausspulse_for