temporal_linear_for Function

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

This function returns value of linear 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 linear type

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

current time

Return Value real(kind=rk)

return value of a function


Source Code

  pure function temporal_linear_for( me, t ) result(res)
    ! --------------------------------------------------------------------------
    !> temporal linear 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)                    &
        & * (  (t - me%from_time) / (me%to_time - me%from_time) )
    end if
  end function temporal_linear_for