Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | ReynoldsNumber | |||
real(kind=r64), | intent(in) | :: | RoughnessRatio |
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.
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 CalculateMoodyFrictionFactor(ReynoldsNumber, RoughnessRatio)
! FUNCTION INFORMATION:
! AUTHOR Edwin Lee
! DATE WRITTEN August 2009
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This will evaluate the moody friction factor based on Reynolds number and roughness ratio
! METHODOLOGY EMPLOYED:
! General empirical correlations for friction factor based on Moody Chart data
! REFERENCES:
! Haaland, SE (1983). "Simple and Explicit Formulas for the Friction Factor in Turbulent Flow".
! Trans. ASIVIE, J. of Fluids Engineering 103: 89-90.
! USE STATEMENTS:
USE General, ONLY: RoundSigDigits
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
REAL(r64), INTENT(IN) :: ReynoldsNumber
REAL(r64), INTENT(IN) :: RoughnessRatio
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: Term1, Term2, Term3
CHARACTER(len=MaxNameLength) :: RR, Re
LOGICAL, SAVE :: FrictionFactorErrorHasOccurred = .FALSE.
!Check for no flow before calculating values
IF (ReynoldsNumber .EQ. 0.0d0) THEN
CalculateMoodyFrictionFactor = 0.0d0
RETURN
END IF
!Check for no roughness also here
IF (RoughnessRatio .EQ. 0.0d0) THEN
CalculateMoodyFrictionFactor = 0.0d0
RETURN
END IF
!Calculate the friction factor
Term1 = (RoughnessRatio/3.7d0)**(1.11d0)
Term2 = 6.9d0/ReynoldsNumber
Term3 = -1.8d0 * LOG10(Term1 + Term2)
IF (Term3 .NE. 0.0d0) THEN
CalculateMoodyFrictionFactor = Term3 ** (-2.0d0)
ELSE
IF (.NOT. FrictionFactorErrorHasOccurred) THEN
RR=RoundSigDigits(RoughnessRatio,7)
Re=RoundSigDigits(ReynoldsNumber,1)
CALL ShowSevereError('Plant Pressure System: Error in moody friction factor calculation')
CALL ShowContinueError('Current Conditions: Roughness Ratio='//TRIM(RR)//'; Reynolds Number='//TRIM(Re))
CALL ShowContinueError('These conditions resulted in an unhandled numeric issue.')
CALL ShowContinueError('Please contact EnergyPlus support/development team to raise an alert about this issue')
CALL ShowContinueError('This issue will occur only one time. The friction factor has been reset to 0.04 for calculations')
FrictionFactorErrorHasOccurred = .TRUE.
END IF
CalculateMoodyFrictionFactor = 0.04d0
END IF
RETURN
END FUNCTION CalculateMoodyFrictionFactor