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 | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | PressureCurveIndex | |||
real(kind=r64), | intent(in) | :: | MassFlow | |||
real(kind=r64), | intent(in) | :: | Density | |||
real(kind=r64), | intent(in) | :: | Viscosity |
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 PressureCurveValue(PressureCurveIndex, MassFlow, Density, Viscosity)
! FUNCTION INFORMATION:
! AUTHOR Edwin Lee
! DATE WRITTEN August 2009
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This will evaluate the pressure drop for components which use pressure information
! METHODOLOGY EMPLOYED:
! Friction factor pressure drop equation:
! DP = [f*(L/D) + K] * (rho * V^2) / 2
! REFERENCES:
! na
! USE STATEMENTS:
Use DataGlobals, ONLY : Pi
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: PressureCurveIndex
REAL(r64), INTENT(IN) :: MassFlow
REAL(r64), INTENT(IN) :: Density
REAL(r64), INTENT(IN) :: Viscosity
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: Diameter
REAL(r64) :: MinorLossCoeff
REAL(r64) :: Length
REAL(r64) :: Roughness
LOGICAL :: IsConstFPresent
REAL(r64) :: ConstantF
REAL(r64) :: FrictionFactor
REAL(r64) :: CrossSectArea
REAL(r64) :: Velocity
REAL(r64) :: ReynoldsNumber
REAL(r64) :: RoughnessRatio
!Retrieve data from structure
Diameter = PressureCurve(PressureCurveIndex)%EquivDiameter
MinorLossCoeff = PressureCurve(PressureCurveIndex)%MinorLossCoeff
Length = PressureCurve(PressureCurveIndex)%EquivLength
Roughness = PressureCurve(PressureCurveIndex)%EquivRoughness
IsConstFPresent = PressureCurve(PressureCurveIndex)%ConstantFPresent
ConstantF = PressureCurve(PressureCurveIndex)%ConstantF
!Intermediate calculations
CrossSectArea = (Pi / 4.0d0) * Diameter**2
Velocity = MassFlow / (Density * CrossSectArea)
ReynoldsNumber = Density * Diameter * Velocity / Viscosity !assuming mu here
RoughnessRatio = Roughness / Diameter
!If we don't have any flow then exit out
IF (MassFlow .LT. MassFlowTolerance) THEN
PressureCurveValue = 0.0d0
PressureCurve(PressureCurveIndex)%CurveInput1=MassFlow
PressureCurve(PressureCurveIndex)%CurveInput2=Density
PressureCurve(PressureCurveIndex)%CurveInput3=Velocity
PressureCurve(PressureCurveIndex)%CurveOutput=0.0d0
RETURN
END IF
!Calculate the friction factor
IF (IsConstFPresent) THEN !use the constant value
FrictionFactor = ConstantF
ELSE ! must calculate f
FrictionFactor = CalculateMoodyFrictionFactor(ReynoldsNumber,RoughnessRatio)
END IF
!Pressure drop calculation
PressureCurveValue = (FrictionFactor * (Length / Diameter) + MinorLossCoeff) * (Density * Velocity**2) / 2.0d0
IF (PressureCurve(PressureCurveIndex)%EMSOverrideOn) &
PressureCurveValue = PressureCurve(PressureCurveIndex)%EMSOverrideCurveValue
PressureCurve(PressureCurveIndex)%CurveInput1=MassFlow
PressureCurve(PressureCurveIndex)%CurveInput2=Density
PressureCurve(PressureCurveIndex)%CurveInput3=Velocity
PressureCurve(PressureCurveIndex)%CurveOutput=PressureCurveValue
END FUNCTION PressureCurveValue