Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | Ti | |||
real(kind=r64), | intent(in) | :: | Ta | |||
real(kind=r64), | intent(in) | :: | T1 | |||
real(kind=r64), | intent(in) | :: | T2 | |||
real(kind=r64), | intent(in) | :: | m | |||
real(kind=r64), | intent(in) | :: | Cp | |||
real(kind=r64), | intent(in) | :: | m1 | |||
real(kind=r64), | intent(in) | :: | m2 | |||
real(kind=r64), | intent(in) | :: | UA | |||
real(kind=r64), | intent(in) | :: | Q | |||
real(kind=r64), | intent(in) | :: | t |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
REAL(r64) FUNCTION CalcTankTemp(Ti, Ta, T1, T2, m, Cp, m1, m2, UA, Q, t)
! SUBROUTINE INFORMATION:
! AUTHOR Peter Graham Ellis
! DATE WRITTEN February 2005
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Calculates the final tank temperature Tf after time t has elapsed given heat loss,
! mass flow rates and temperatures, and net heat transfer due to heater and parasitics.
! METHODOLOGY EMPLOYED:
! Equations are derived by solving the differential equation governing the tank energy balance.
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
REAL(r64), INTENT(IN) :: Ti ! Initial tank temperature (C)
REAL(r64), INTENT(IN) :: Ta ! Ambient environment temperature (C)
REAL(r64), INTENT(IN) :: T1 ! Temperature of flow 1 (C)
REAL(r64), INTENT(IN) :: T2 ! Temperature of flow 2 (C)
REAL(r64), INTENT(IN) :: m ! Mass of tank fluid (kg)
REAL(r64), INTENT(IN) :: Cp ! Specific heat of fluid (J/kg deltaC)
REAL(r64), INTENT(IN) :: m1 ! Mass flow rate 1 (kg/s)
REAL(r64), INTENT(IN) :: m2 ! Mass flow rate 2 (kg/s)
REAL(r64), INTENT(IN) :: UA ! Heat loss coefficient to ambient environment (W/deltaC)
REAL(r64), INTENT(IN) :: Q ! Net heating rate for non-temp dependent sources, i.e. heater and parasitics (W)
REAL(r64), INTENT(IN) :: t ! Time elapsed from Ti to Tf (s)
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: a ! Intermediate variable
REAL(r64) :: b ! Intermediate variable
REAL(r64) :: Tf ! Final tank temperature (C)
! FLOW:
IF (UA / Cp + m1 + m2 == 0.0d0) THEN
a = Q / (m * Cp)
Tf = a * t + Ti
ELSE
a = (Q / Cp + UA * Ta / Cp + m1 * T1 + m2 * T2) / m
b = -(UA / Cp + m1 + m2) / m
Tf = (a / b + Ti) * EXP(b * t) - a / b
END IF
CalcTankTemp = Tf
RETURN
END FUNCTION CalcTankTemp