temporal_smooth_for Function

private pure function temporal_smooth_for(me, t) result(res)

This function returns value of smooth sin function which is defined by from_time, to_time, min_factor and max_factor

Arguments

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

temporal smooth type

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

current time

Return Value real(kind=rk)

return value of a function


Source Code

  pure function temporal_smooth_for( me, t ) result(res)
    ! --------------------------------------------------------------------------
    !> temporal smooth type
    type(tem_linear_type), intent(in) :: me
    !> current time
    real(kind=rk), intent(in) :: t
    !> return value of a function
    real(kind=rk) :: res
    ! --------------------------------------------------------------------------

    if (t <= me%from_time) then
      res = me%min_factor
    else if (t >= me%to_time) then
      res = me%max_factor
    else
      res = me%min_factor                                                      &
        & + (me%max_factor - me%min_factor)                                    &
        & * sin( PI * 0.5_rk * (t          - me%from_time)&
        &                    / (me%to_time - me%from_time))
    end if
  end function temporal_smooth_for