calculate_time_coefficient Module Subroutine

module subroutine calculate_time_coefficient(time, arr_time, time_coefficient, idx)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: time
real(kind=real64), intent(in) :: arr_time(:)
real(kind=real64), intent(inout) :: time_coefficient
integer(kind=int32), intent(inout) :: idx

Called by

proc~~calculate_time_coefficient~~CalledByGraph proc~calculate_time_coefficient calculate_time_coefficient interface~calculate_time_coefficient calculate_time_coefficient interface~calculate_time_coefficient->proc~calculate_time_coefficient proc~apply_crs_thermal_dirichlet apply_crs_thermal_dirichlet proc~apply_crs_thermal_dirichlet->interface~calculate_time_coefficient interface~apply_crs_thermal_dirichlet type_bc_thermal_dirichlet%apply_crs_thermal_dirichlet interface~apply_crs_thermal_dirichlet->proc~apply_crs_thermal_dirichlet

Source Code

    module subroutine calculate_time_coefficient(time, arr_time, time_coefficient, idx)
        implicit none
        real(real64), intent(in) :: time
        real(real64), intent(in) :: arr_time(:)
        real(real64), intent(inout) :: time_coefficient
        integer(int32), intent(inout) :: idx

        integer(int32) :: i

        do i = 1, size(arr_time(:)) - 1
            if (arr_time(i) < time .and. time <= arr_time(i + 1)) then
                time_coefficient = (time - arr_time(i)) / (arr_time(i + 1) - arr_time(i))
                idx = i
                exit
            end if
        end do

        if (i > size(arr_time) - 1) then
            time_coefficient = 0.0d0
            idx = size(arr_time) - 1
        end if
    end subroutine calculate_time_coefficient