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) | :: | PattrnID | |||
integer, | intent(in) | :: | ZoneNum |
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.
SUBROUTINE FigureTwoGradInterpPattern(PattrnID, ZoneNum)
! SUBROUTINE INFORMATION:
! AUTHOR B Griffith
! DATE WRITTEN Aug 2005
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! calculate two gradient interpolation pattern
! METHODOLOGY EMPLOYED:
! Case statement controls how interpolations are done
! based on user selected mode.
! calculations vary by mode
! REFERENCES:
! na
! USE STATEMENTS:
! na
USE DataHeatBalance, ONLY: Zone, SNLoadCoolRate, SNLoadHeatRate
USE DataGlobals, ONLY: NumOfZones
USE DataInterfaces, ONLY: SetupOutputVariable
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: PattrnID
INTEGER, INTENT(IN) :: ZoneNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: Tmean ! MAT deg C
REAL(r64) :: Grad ! vertical temperature gradient C/m
REAL(r64) :: DeltaT ! temperature difference
REAL(r64) :: CoolLoad ! sensible cooling load
REAL(r64) :: HeatLoad ! sensible heating load
REAL(r64) :: ZetaTmean ! non-dimensional height for mean air temp
INTEGER :: I ! do loop index
REAL(r64) :: thisZeta !non-dimensional height
REAL(r64) :: DeltaHeight ! height difference in m
REAL(r64) :: tempDeltaTai ! temporary temperature difference
LOGICAL, DIMENSION(:), ALLOCATABLE, SAVE :: SetupOutputFlag !flag to set up output variable one-time if 2-grad model used
Logical, Save :: MyOneTimeFlag = .TRUE.
IF (MyOneTimeFlag) THEN
ALLOCATE(SetupOutputFlag(NumOfZones))
SetupOutputFlag = .TRUE. ! init
MyOneTimeFlag = .FALSE.
ENDIF
IF (SetupOutputFlag(ZoneNum)) THEN
CALL SetupOutputVariable('Room Air Zone Vertical Temperature Gradient [K/m]', &
AirPatternZoneInfo(ZoneNum)%Gradient,'HVAC','State',&
AirPatternZoneInfo(ZoneNum)%ZoneName)
SetupOutputFlag(ZoneNum) = .FALSE.
ENDIF
Tmean = AirPatternZoneInfo(ZoneNum)%TairMean
!determine gradient depending on mode
SELECT CASE (RoomAirPattern(PattrnID)%TwoGradPatrn%InterpolationMode)
CASE(OutdoorDrybulbMode)
IF (Zone(ZoneNum)%OutDryBulbTemp >= RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient
ELSEIF (Zone(ZoneNum)%OutDryBulbTemp <= RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE ! interpolate
IF ((RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) /= 0.0d0) then
! bad user input. should be trapped during get input in RoomAirManager.f90
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient &
+ ( (Zone(ZoneNum)%OutDryBulbTemp - RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) &
/ (RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) ) &
* (RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient - RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient)
ENDIF
ENDIF
CASE(ZoneAirTempMode)
IF ( Tmean >= RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient
ELSEIF ( Tmean <= RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE ! interpolate
IF ((RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) == 0.0d0) then
! bad user input, trapped during get input
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient &
+ ( (Tmean - RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) &
/ (RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) ) &
* (RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient - RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient)
ENDIF
ENDIF
CASE(DeltaOutdoorZone)
DeltaT = Zone(ZoneNum)%OutDryBulbTemp - Tmean
IF ( DeltaT >= RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient
ELSEIF ( DeltaT <= RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE ! interpolate
IF ((RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) == 0.0d0) then
! bad user input, trapped during get input
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient &
+ ( (DeltaT - RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) &
/ (RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundTempScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundTempScale) ) &
* (RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient - RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient)
ENDIF
ENDIF
CASE(SensibleCoolingMode)
CoolLoad = SNLoadCoolRate(ZoneNum)
IF ( CoolLoad >= RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundHeatRateScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient
ELSEIF ( CoolLoad <= RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE ! interpolate
IF ((RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundHeatRateScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) == 0.0d0) then
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient &
+ ( (CoolLoad - RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) &
/ (RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundHeatRateScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) ) &
* (RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient - RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient)
ENDIF
ENDIF
CASE(SensibleHeatingMode)
HeatLoad = SNLoadHeatRate(ZoneNum)
IF ( HeatLoad >= RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundHeatRateScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient
ELSEIF ( HeatLoad <= RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) THEN
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE ! interpolate
IF ((RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundHeatRateScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) == 0.0d0) then
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient
ELSE
Grad = RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient &
+ ( (HeatLoad - RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) &
/ (RoomAirPattern(PattrnID)%TwoGradPatrn%UpperBoundHeatRateScale - &
RoomAirPattern(PattrnID)%TwoGradPatrn%LowerBoundHeatRateScale) ) &
* (RoomAirPattern(PattrnID)%TwoGradPatrn%HiGradient - RoomAirPattern(PattrnID)%TwoGradPatrn%LowGradient)
ENDIF
ENDIF
END SELECT
ZetaTmean = 0.5d0 ! by definition,
DO i=1, AirPatternZoneInfo(ZoneNum)%totNumSurfs
thisZeta = AirPatternZoneInfo(ZoneNum)%surf(i)%zeta
DeltaHeight = -1.0d0*(ZetaTmean - thisZeta)* AirPatternZoneInfo(ZoneNum)%ZoneHeight
tempDeltaTai = DeltaHeight * Grad
AirPatternZoneInfo(ZoneNum)%surf(i)%TadjacentAir = tempDeltaTai + Tmean
ENDDO
AirPatternZoneInfo(ZoneNum)%Tstat = -1.0d0*(0.5d0*AirPatternZoneInfo(ZoneNum)%ZoneHeight- &
RoomAirPattern(PattrnID)%TwoGradPatrn%TstatHeight) &
* Grad + Tmean
AirPatternZoneInfo(ZoneNum)%Tleaving = -1.0d0*(0.5d0*AirPatternZoneInfo(ZoneNum)%ZoneHeight- &
RoomAirPattern(PattrnID)%TwoGradPatrn%TleavingHeight) &
* Grad + Tmean
AirPatternZoneInfo(ZoneNum)%Texhaust = -1.0d0*(0.5d0*AirPatternZoneInfo(ZoneNum)%ZoneHeight- &
RoomAirPattern(PattrnID)%TwoGradPatrn%TexhaustHeight) &
* Grad + Tmean
AirPatternZoneInfo(ZoneNum)%Gradient = Grad
RETURN
END SUBROUTINE FigureTwoGradInterpPattern