SUBROUTINE DynamicIntConvSurfaceClassification(SurfNum)
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN Aug 2010
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! collects dynamic updates needed for adaptive convectin algorithm
! METHODOLOGY EMPLOYED:
! Decide flow regime to set IntConvClassification
! done by zone using the following rules
!
! Using zone flow regime, and surface's characteristics assign IntConvHcModelEq
! REFERENCES:
! na
! USE STATEMENTS:
USE DataZoneEquipment
USE DataHeatBalSurface, ONLY: TH
USE DataHeatBalFanSys, ONLY: MAT
USE DataEnvironment, ONLY: OutBaroPress
USE Psychrometrics, ONLY: PsyRhoAirFnPbTdbW, PsyWFnTdpPb
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: SurfNum ! surface number
! SUBROUTINE PARAMETER DEFINITIONS:
REAL(r64), PARAMETER :: g = 9.81d0 ! gravity constant (m/s**2)
REAL(r64), PARAMETER :: v = 15.89d-6 ! kinematic viscosity (m**2/s) for air at 300 K
REAL(r64), PARAMETER :: ActiveDelTempThreshold = 1.5d0 ! deg C, temperature difference for surfaces to be considered "active"
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: ZoneNum = 0
INTEGER :: PriorityEquipOn = 0
INTEGER, DIMENSION(0:10) :: HeatingPriorityStack = 0
INTEGER, DIMENSION(0:10) :: CoolingPriorityStack = 0
INTEGER, DIMENSION(0:10) :: FlowRegimeStack = 0
INTEGER :: EquipNum = 0
INTEGER :: ZoneNode = 0
INTEGER :: EquipOnCount = 0
INTEGER :: EquipOnLoop = 0
INTEGER :: thisZoneInletNode = 0
! INTEGER :: thisZnEqInletNode = 0
INTEGER :: FinalFlowRegime = 0
REAL(r64) :: Tmin = 0.0d0 ! temporary min surf temp
REAL(r64) :: Tmax = 0.0d0 ! temporary max surf temp
REAL(r64) :: GrH = 0.d0 ! Grashof number for zone height H
REAL(r64) :: Re = 0.d0 ! Reynolds number for zone air system flow
REAL(r64) :: Ri = 0.d0 ! Richardson Number, Gr/Re**2 for determining mixed regime
REAL(r64) :: AirDensity = 0.d0 ! temporary zone air density
REAL(r64) :: DeltaTemp = 0.d0 ! temporary temperature difference (Tsurf - Tair)
INTEGER :: SurfLoop ! local for separate looping across surfaces in the zone that has SurfNum
EquipOnCount = 0
ZoneNum = Surface(SurfNum)%Zone
ZoneNode = Zone(ZoneNum)%SystemZoneNodeNumber
FlowRegimeStack = 0
!HVAC connections
IF (.NOT. Zone(ZoneNum)%IsControlled) Then ! no HVAC control
FlowRegimeStack(0) = InConvFlowRegime_A3
ELSE ! is controlled, lets see by how and if that means is currently active
IF (.NOT. (ZoneEquipConfig(ZoneNum)%EquipListIndex > 0) ) THEN
FlowRegimeStack(0) = InConvFlowRegime_A3
ELSE
DO EquipNum = 1, ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%NumOfEquipTypes
SELECT CASE (ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%EquipType_Num(EquipNum))
CASE (AirDistUnit_Num,DirectAir_Num, PurchasedAir_Num) ! central air equipment
IF (.NOT. (ALLOCATED( ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%EquipData(EquipNum)%OutletNodeNums))) CYCLE
!get inlet node, not zone node if possible
thisZoneInletNode = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%EquipData(EquipNum)%OutletNodeNums(1)
IF (thisZoneInletNode > 0) THEN
IF (Node(thisZoneInletNode)%MassFlowRate > 0.d0) THEN
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_C
HeatingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ENDIF
ELSE
IF (Node(ZoneNode)%MassFlowRate > 0.d0) THEN
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_C
HeatingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ENDIF
ENDIF
CASE (WindowAC_Num, PkgTermHPAirToAir_Num, PkgTermACAirToAir_Num, ZoneDXDehumidifier_Num, &
PkgTermHPWaterToAir_Num, FanCoil4Pipe_Num, UnitVentilator_Num, UnitHeater_Num, &
OutdoorAirUnit_Num)
IF (.NOT. (ALLOCATED( ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%EquipData(EquipNum)%OutletNodeNums))) CYCLE
thisZoneInletNode = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%EquipData(EquipNum)%OutletNodeNums(1)
IF (thisZoneInletNode > 0) THEN
IF (Node(thisZoneInletNode)%MassFlowRate > 0.d0) THEN
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_D
HeatingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ENDIF
ELSE
IF (Node(ZoneNode)%MassFlowRate > 0.d0) THEN
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_D
HeatingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ENDIF
ENDIF
CASE ( BBSteam_Num, BBWaterConvective_Num, BBElectricConvective_Num, BBWater_Num)
IF (ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%EquipData(EquipNum)%ON) THEN
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_B
HeatingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ENDIF
CASE (BBElectric_Num, HiTempRadiant_Num)
IF (ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%EquipData(EquipNum)%ON) THEN
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_B
HeatingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) = ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ENDIF
CASE (VentilatedSlab_Num, LoTempRadiant_Num)
IF (ZoneEquipConfig(ZoneNum)%InFloorActiveElement) THEN
DO SurfLoop = Zone(ZoneNum)%SurfaceFirst, Zone(ZoneNum)%SurfaceLast
IF (.NOT. Surface(SurfLoop)%IntConvSurfHasActiveInIt) CYCLE
IF (Surface(SurfLoop)%Class == SurfaceClass_Floor) THEN
DeltaTemp = TH(SurfLoop,1,2) - MAT(ZoneNum)
IF (DeltaTemp > ActiveDelTempThreshold) then ! assume heating with floor
! system ON is not enough because floor surfaces can continue to heat because of thermal capacity
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_A1
HeatingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
EXIT
ENDIF
ENDIF
ENDDO
ENDIF
IF (ZoneEquipConfig(ZoneNum)%InCeilingActiveElement) THEN
DO SurfLoop = Zone(ZoneNum)%SurfaceFirst, Zone(ZoneNum)%SurfaceLast
IF (.NOT. Surface(SurfLoop)%IntConvSurfHasActiveInIt) CYCLE
IF (Surface(SurfLoop)%Class == SurfaceClass_Roof) THEN
DeltaTemp = TH(SurfLoop,1,2) - MAT(ZoneNum)
IF (DeltaTemp < ActiveDelTempThreshold) then ! assume cooling with ceiling
! system ON is not enough because surfaces can continue to cool because of thermal capacity
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_A1
HeatingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
EXIT
ENDIF
ENDIF
ENDDO
ENDIF
IF (ZoneEquipConfig(ZoneNum)%InWallActiveElement) THEN
DO SurfLoop = Zone(ZoneNum)%SurfaceFirst, Zone(ZoneNum)%SurfaceLast
IF (.NOT. Surface(SurfLoop)%IntConvSurfHasActiveInIt) CYCLE
IF (Surface(SurfLoop)%Class == SurfaceClass_Wall &
.OR. Surface(SurfLoop)%Class == SurfaceClass_Door) THEN
DeltaTemp = TH(SurfLoop,1,2) - MAT(ZoneNum)
IF (DeltaTemp > ActiveDelTempThreshold) then ! assume heating with wall panel
! system ON is not enough because surfaces can continue to heat because of thermal capacity
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_A2
HeatingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ELSE ! not heating, no special models wall cooling so use simple bouyancy
EquipOnCount = MIN(EquipOnCount + 1, 10)
FlowRegimeStack(EquipOnCount) = InConvFlowRegime_A3
HeatingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%HeatingPriority(EquipNum)
CoolingPriorityStack(EquipOnCount) &
= ZoneEquipList(ZoneEquipConfig(ZoneNum)%EquipListIndex)%CoolingPriority(EquipNum)
ENDIF
ENDIF
ENDDO
ENDIF
END SELECT
ENDDO !loop over equipment for this zone
ENDIF
ENDIF
! now select which equipment type is dominant compared to all those that are ON
IF (EquipOnCount > 0) THEN
If (SNLoadPredictedRate(ZoneNum) >= 0.d0 ) Then ! heating load
PriorityEquipOn = 1
DO EquipOnLoop = 1, EquipOnCount
!assume highest priority/first sim order is dominant for flow regime
IF (HeatingPriorityStack(EquipOnLoop) < HeatingPriorityStack(PriorityEquipOn)) THEN
PriorityEquipOn = EquipOnLoop
ENDIF
ENDDO
ELSEIF (SNLoadPredictedRate(ZoneNum) < 0.d0) THEN ! cooling load
PriorityEquipOn = 1
DO EquipOnLoop = 1, EquipOnCount
!assume highest priority/first sim order is dominant for flow regime
IF (CoolingPriorityStack(EquipOnLoop) < CoolingPriorityStack(PriorityEquipOn)) THEN
PriorityEquipOn = EquipOnLoop
ENDIF
ENDDO
ENDIF
FinalFlowRegime = FlowRegimeStack(PriorityEquipOn)
ELSE
! no equipment on, so simple bouyancy flow regime
FinalFlowRegime = InConvFlowRegime_A3
ENDIF
! now if flow regimes C or D, then check for Mixed regime or very low flow rates
IF ((FinalFlowRegime == InConvFlowRegime_C) .or. &
(FinalFlowRegime == InConvFlowRegime_D) ) THEN
!Calculate Grashof, Reynolds, and Richardson numbers for the zone
!
!Grashof for zone air based on largest delta T between surfaces and zone height
Tmin = MINVAL(TH(Zone(ZoneNum)%SurfaceFirst:Zone(ZoneNum)%SurfaceLast,1, 2))
Tmax = MAXVAL(TH(Zone(ZoneNum)%SurfaceFirst:Zone(ZoneNum)%SurfaceLast,1, 2))
GrH = (g * (Tmax - Tmin) * (Zone(ZoneNum)%CeilingHeight**3)) &
/((MAT(ZoneNum) + KelvinConv) * (v**2))
! Reynolds number = Vdot supply / v * cube root of zone volume (Goldstein and Noveselac 2010)
IF (Node(ZoneNode)%MassFlowRate > 0.d0) THEN
AirDensity = PsyRhoAirFnPbTdbW(OutBaroPress,Node(ZoneNode)%Temp,PsyWFnTdpPb(Node(ZoneNode)%Temp,OutBaroPress))
Re = Node(ZoneNode)%MassFlowRate /(v *AirDensity *(Zone(ZoneNum)%Volume**OneThird))
ELSE
Re = 0.d0
ENDIF
IF (Re > 0.d0) THEN
Ri = GrH/(Re**2) !Richardson Number
IF (Ri > 10.d0 ) Then ! natural convection expected
FinalFlowRegime = InConvFlowRegime_A3
ELSEIF (Ri < 0.1d0) THEN !forced
! no change, already a forced regime
ELSE ! mixed
FinalFlowRegime = InConvFlowRegime_E
ENDIF
ELSE ! natural convection expected
FinalFlowRegime = InConvFlowRegime_A3
ENDIF
ENDIF
! now finish out specific model eq for this surface
!Surface(SurfNum)%IntConvClassification = 0 !init/check
SELECT CASE (FinalFlowRegime)
CASE (InConvFlowRegime_A1)
DeltaTemp = TH(SurfNum,1,2) - MAT(ZoneNum)
IF (Surface(SurfNum)%Class == SurfaceClass_Wall &
.OR. Surface(SurfNum)%Class == SurfaceClass_Door ) THEN
IF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_A1_VertWalls
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableTilted
ENDIF
ELSEIF (Surface(SurfNum)%Tilt <= 85.d0 ) THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Roof) THEN
IF (Surface(SurfNum)%IntConvSurfHasActiveInIt) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_ChilledCeil
ELSEIF (Surface(SurfNum)%Tilt < 5.0d0) THEN
IF (DeltaTemp <0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableHoriz
Else
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt >= 5.d0) .AND. ((Surface(SurfNum)%Tilt < 95.d0)))THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableTilted
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_A1_VertWalls
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Floor) THEN
IF (Surface(SurfNum)%IntConvSurfHasActiveInIt) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_HeatedFloor
ELSEIF (Surface(SurfNum)%Tilt > 175.d0) THEN !floor
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt <= 175.d0) .AND. (Surface(SurfNum)%Tilt >= 95.d0)) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableTilted
ENDIF
ENDIF
ELSEIF ((Surface(SurfNum)%Class == SurfaceClass_Window) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_GlassDoor) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_TDD_Diffuser)) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_Windows
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_IntMass) THEN
! assume horizontal upwards.
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A1_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A1_StableHoriz
ENDIF
ENDIF
IF (Surface(SurfNum)%IntConvClassification == 0) THEN
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to resolve Hc model for A1 surface named'&
//Trim(Surface(SurfNum)%Name) )
ENDIF
CASE (InConvFlowRegime_A2)
DeltaTemp = TH(SurfNum,1,2) - MAT(ZoneNum)
IF (Surface(SurfNum)%Class == SurfaceClass_Wall &
.OR. Surface(SurfNum)%Class == SurfaceClass_Door ) THEN
IF (Surface(SurfNum)%IntConvSurfHasActiveInIt) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_HeatedVerticalWall
ELSEIF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_A2_VertWallsNonHeated
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableTilted
ENDIF
ELSEIF (Surface(SurfNum)%Tilt <= 85.d0 ) THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Roof) THEN
IF (Surface(SurfNum)%Tilt < 5.0d0) THEN
IF (DeltaTemp <0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableHoriz
Else
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt >= 5.d0) .AND. ((Surface(SurfNum)%Tilt < 95.d0)))THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableTilted
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_A2_VertWallsNonHeated
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Floor) THEN
IF (Surface(SurfNum)%Tilt > 175.d0) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt <= 175.d0) .AND. (Surface(SurfNum)%Tilt >= 95.d0)) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableTilted
ENDIF
ENDIF
ELSEIF ((Surface(SurfNum)%Class == SurfaceClass_Window) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_GlassDoor) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_TDD_Diffuser)) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_Windows
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_IntMass) THEN
! assume horizontal upwards.
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A2_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A2_StableHoriz
ENDIF
ENDIF
IF (Surface(SurfNum)%IntConvClassification == 0) THEN
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to resolve Hc model for A2 surface named'&
//Trim(Surface(SurfNum)%Name) )
ENDIF
CASE (InConvFlowRegime_A3)
DeltaTemp = TH(SurfNum,1,2) - MAT(ZoneNum)
IF (Surface(SurfNum)%Class == SurfaceClass_Wall &
.OR. Surface(SurfNum)%Class == SurfaceClass_Door) THEN
IF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_A3_VertWalls
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableTilted
ENDIF
ELSEIF (Surface(SurfNum)%Tilt <= 85.d0 ) THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Roof) THEN
IF (Surface(SurfNum)%Tilt < 5.0d0) THEN
IF (DeltaTemp <0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableHoriz
Else
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt > 5.d0) .AND. ((Surface(SurfNum)%Tilt < 85.d0)))THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableTilted
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_A3_VertWalls
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Floor) THEN
IF (Surface(SurfNum)%Tilt > 175.d0) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt <= 175.d0) .AND. (Surface(SurfNum)%Tilt >= 95.d0)) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableTilted
ENDIF
ENDIF
ELSEIF ((Surface(SurfNum)%Class == SurfaceClass_Window) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_GlassDoor) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_TDD_Diffuser)) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_Windows
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_IntMass) THEN
! assume horizontal upwards.
IF (DeltaTemp >= 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_A3_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_A3_StableHoriz
ENDIF
ENDIF
IF (Surface(SurfNum)%IntConvClassification == 0) THEN
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to resolve Hc model for A3 surface named'&
//Trim(Surface(SurfNum)%Name) )
ENDIF
CASE (InConvFlowRegime_B)
DeltaTemp = TH(SurfNum,1,2) - MAT(ZoneNum)
IF (Surface(SurfNum)%Class == SurfaceClass_Wall &
.OR. Surface(SurfNum)%Class == SurfaceClass_Door) THEN
IF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
IF (Surface(SurfNum)%IntConvSurfGetsRadiantHeat) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_VertWallsNearHeat
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_VertWalls
ENDIF
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableTilted
ENDIF
ELSEIF (Surface(SurfNum)%Tilt <= 85.d0 ) THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Roof) THEN
IF (Surface(SurfNum)%Tilt < 5.0d0) THEN
IF (DeltaTemp <0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableHoriz
Else
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt >= 5.d0) .AND. ((Surface(SurfNum)%Tilt < 85.d0)))THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableTilted
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
IF (Surface(SurfNum)%IntConvSurfGetsRadiantHeat) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_VertWallsNearHeat
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_VertWalls
ENDIF
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Floor) THEN
IF (Surface(SurfNum)%Tilt > 175.d0) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt <= 175.d0) .AND. (Surface(SurfNum)%Tilt >= 95.d0)) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableTilted
ENDIF
ENDIF
ELSEIF ( (Surface(SurfNum)%Class == SurfaceClass_Window) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_GlassDoor) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_TDD_Diffuser)) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_Windows
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_IntMass) THEN
! assume horizontal upwards.
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_B_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_B_StableHoriz
ENDIF
ENDIF
IF (Surface(SurfNum)%IntConvClassification == 0) THEN
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to resolve Hc model for B surface named'&
//Trim(Surface(SurfNum)%Name) )
ENDIF
CASE (InConvFlowRegime_C)
IF (Surface(SurfNum)%Class == SurfaceClass_Wall &
.OR. Surface(SurfNum)%Class == SurfaceClass_Door) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_C_Walls
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Roof) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_C_Ceiling
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Floor) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_C_Floor
ELSEIF ( (Surface(SurfNum)%Class == SurfaceClass_Window) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_GlassDoor) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_TDD_Diffuser)) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_C_Windows
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_IntMass) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_C_Floor
ENDIF
IF (Surface(SurfNum)%IntConvClassification == 0) THEN
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to resolve Hc model for C surface named'&
//Trim(Surface(SurfNum)%Name) )
ENDIF
CASE (InConvFlowRegime_D)
DeltaTemp = TH(SurfNum,1,2) - MAT(ZoneNum)
IF (Surface(SurfNum)%Class == SurfaceClass_Wall &
.OR. Surface(SurfNum)%Class == SurfaceClass_Door) THEN
IF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_D_Walls
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableTilted
ENDIF
ELSEIF (Surface(SurfNum)%Tilt <= 85.d0 ) THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Roof) THEN
IF (Surface(SurfNum)%Tilt < 5.0d0) THEN
IF (DeltaTemp <0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableHoriz
Else
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt >= 5.d0) .AND. ((Surface(SurfNum)%Tilt <= 85.d0)))THEN !tilted downwards
IF (DeltaTemp < 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableTilted
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt > 85.d0) .AND. (Surface(SurfNum)%Tilt < 95.d0 ) ) THEN !vertical wall
Surface(SurfNum)%IntConvClassification = InConvClass_D_Walls
ELSEIF (Surface(SurfNum)%Tilt >= 95.d0) THEN !tilted upwards
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableTilted
ENDIF
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Floor) THEN
IF (Surface(SurfNum)%Tilt > 175.d0) THEN !floor
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableHoriz
ENDIF
ELSEIF ((Surface(SurfNum)%Tilt <= 175.d0) .AND. (Surface(SurfNum)%Tilt >= 95.d0)) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableTilted
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableTilted
ENDIF
ENDIF
ELSEIF ( (Surface(SurfNum)%Class == SurfaceClass_Window) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_GlassDoor) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_TDD_Diffuser)) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_Windows
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_IntMass) THEN
! assume horizontal upwards.
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_D_UnstableHoriz
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_D_StableHoriz
ENDIF
ENDIF
IF (Surface(SurfNum)%IntConvClassification == 0) THEN
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to resolve Hc model for D surface named'&
//Trim(Surface(SurfNum)%Name) )
ENDIF
CASE (InConvFlowRegime_E)
DeltaTemp = TH(SurfNum,1,2) - MAT(ZoneNum)
IF (Surface(SurfNum)%Class == SurfaceClass_Wall &
.OR. Surface(SurfNum)%Class == SurfaceClass_Door) THEN
!mixed regime, but need to know what regime it was before it was mixed
SELECT CASE (FlowRegimeStack(PriorityEquipOn))
CASE (InConvFlowRegime_C)
!assume forced flow is down along wall (ceiling diffuser)
IF (DeltaTemp > 0.d0) THEN ! surface is hotter so plume upwards and forces oppose
Surface(SurfNum)%IntConvClassification = InConvClass_E_OpposFlowWalls
ELSE ! surface is cooler so plume down and forces assist
Surface(SurfNum)%IntConvClassification = InConvClass_E_AssistFlowWalls
ENDIF
CASE (InConvFlowRegime_D)
! assume forced flow is upward along wall (perimeter zone HVAC with fan)
IF (DeltaTemp > 0.d0) THEN ! surface is hotter so plume up and forces assist
Surface(SurfNum)%IntConvClassification = InConvClass_E_AssistFlowWalls
ELSE ! surface is cooler so plume downward and forces oppose
Surface(SurfNum)%IntConvClassification = InConvClass_E_OpposFlowWalls
ENDIF
END SELECT
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Roof) THEN
IF (DeltaTemp > 0.d0) THEN !surface is hotter so stable
Surface(SurfNum)%IntConvClassification = InConvClass_E_StableCeiling
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_E_UnstableCieling
ENDIF
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_Floor) THEN
IF (DeltaTemp > 0.d0) THEN !surface is hotter so unstable
Surface(SurfNum)%IntConvClassification = InConvClass_E_UnstableFloor
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_E_StableFloor
ENDIF
ELSEIF ( (Surface(SurfNum)%Class == SurfaceClass_Window) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_GlassDoor) &
.OR. (Surface(SurfNum)%Class == SurfaceClass_TDD_Diffuser)) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_E_Windows
ELSEIF (Surface(SurfNum)%Class == SurfaceClass_IntMass) THEN
IF (DeltaTemp > 0.d0) THEN
Surface(SurfNum)%IntConvClassification = InConvClass_E_UnstableFloor
ELSE
Surface(SurfNum)%IntConvClassification = InConvClass_E_StableFloor
ENDIF
ENDIF
IF (Surface(SurfNum)%IntConvClassification == 0) THEN
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to resolve Hc model for D surface named '&
//Trim(Surface(SurfNum)%Name) )
ENDIF
CASE DEFAULT
CALL ShowSevereError('DynamicIntConvSurfaceClassification: failed to deterime zone flow regime for surface named ' &
//Trim(Surface(SurfNum)%Name) )
END SELECT
RETURN
END SUBROUTINE DynamicIntConvSurfaceClassification