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.
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 CalcThermalChimney
! SUBROUTINE INFORMATION:
! AUTHOR Kwang Ho Lee
! DATE WRITTEN April 2008
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine simulates the components making up the ThermalChimney.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE ScheduleManager, ONLY: GetCurrentScheduleValue
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
INTEGER, PARAMETER :: NTC=15 ! Number of subregions in thermal chimney air channel for FINITE DIFFERENCE
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
! To be obtained from other modules and subroutines
REAL(r64) :: SurfTempAbsorberWall ! Absorber wall surface temperature (K)
REAL(r64) :: SurfTempGlassCover ! Glass cover surface temperature (K)
REAL(r64) :: ConvTransCoeffWallFluid ! Absorber wall convection trasnfer coefficient
REAL(r64) :: ConvTransCoeffGlassFluid ! Glass cover convection trasnfer coefficient
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
! Real local vaiables
INTEGER :: Loop ! DO loop counter
INTEGER :: SurfNum ! DO loop counter for surfaces
INTEGER :: ZoneNum ! DO loop counter for zones
INTEGER :: TCZoneNumCounter
INTEGER :: TCZoneNum
REAL(r64) :: minorW ! width of enclosure (narrow dimension)
REAL(r64) :: majorW ! width of major surface
REAL(r64) :: TempmajorW
REAL(r64) :: RoomAirTemp
REAL(r64) :: AirSpecHeatThermalChim ! (J/kg*C) or (J/kg*K)
REAL(r64) :: AbsorberWallWidthTC
REAL(r64) :: TCVolumeAirFlowRate ! (m^3/s)
REAL(r64) :: TCMassAirFlowRate ! (kg/s)
REAL(r64) :: DischargeCoeffTC
REAL(r64) :: AirOutletCrossAreaTC
REAL(r64) :: AirInletCrossArea
REAL(r64) :: AirRelativeCrossArea
! REAL(r64) :: OutletAirTempThermalChim
REAL(r64) :: OverallThermalChimLength
REAL(r64) :: ThermChimTolerance
REAL(r64), DIMENSION(10) :: TempTCMassAirFlowRate ! Temporary Value of Thermal Chimney Mass Flow Rate ()
REAL(r64), DIMENSION(10) :: TempTCVolumeAirFlowRate ! Temporary Value of Thermal Chimney Volume Flow Rate ()
INTEGER :: IterationLoop
REAL(r64) :: Process1 ! Temporary Variable Used in the Middle of the Calculation
REAL(r64) :: Process2 ! Temporary Variable Used in the Middle of the Calculation
REAL(r64) :: Process3 ! Temporary Variable Used in the Middle of the Calculation
!unused1208 REAL(r64) :: Process4 ! Temporary Variable Used in the Middle of the Calculation
REAL(r64) :: AirDensityThermalChim ! (kg/m^3)
REAL(r64) :: AirDensity ! (kg/m^3)
REAL(r64) :: CpAir
REAL(r64) :: TemporaryWallSurfTemp
REAL(r64) :: DeltaL ! OverallThermalChimLength / NTC
INTEGER :: ThermChimLoop1
INTEGER :: ThermChimLoop2
REAL(r64), DIMENSION(NTC, NTC) :: EquaCoef ! Coefficients in Linear Algebraic Euqation for FINITE DIFFERENCE
REAL(r64), DIMENSION(NTC) :: EquaConst ! Constants in Linear Algebraic Equation for FINITE DIFFERENCE
REAL(r64), DIMENSION(NTC) :: ThermChimSubTemp ! Air temperature of each thermal chimney air channel subregion
DO Loop=1, TotThermalChimney
ZoneNum = ThermalChimneySys(Loop)%RealZonePtr
! start off with first surface in zone widths
majorW = Surface(Zone(ZoneNum)%SurfaceFirst)%Width
minorW = majorW
TempmajorW = 0.0d0
TemporaryWallSurfTemp = -10000.0d0
! determine major width and minor width
DO SurfNum = Zone(ZoneNum)%SurfaceFirst+1,Zone(ZoneNum)%SurfaceLast
IF (Surface(SurfNum)%Class .NE. SurfaceClass_Wall) CYCLE
IF (Surface(SurfNum)%Width > majorW) THEN
majorW = Surface(SurfNum)%Width
END IF
IF (Surface(SurfNum)%Width < minorW) THEN
minorW = Surface(SurfNum)%Width
END IF
END DO
DO SurfNum = Zone(ZoneNum)%SurfaceFirst,Zone(ZoneNum)%SurfaceLast
IF (Surface(SurfNum)%Width == majorW) THEN
IF (TempSurfIn(SurfNum) > TemporaryWallSurfTemp) THEN
TemporaryWallSurfTemp = TempSurfIn(SurfNum)
ConvTransCoeffWallFluid = HConvIn(SurfNum)
SurfTempAbsorberWall = TempSurfIn(SurfNum) + KelvinConv
END IF
END IF
END DO
DO SurfNum = Zone(ZoneNum)%SurfaceFirst,Zone(ZoneNum)%SurfaceLast
IF (.NOT. Surface(SurfNum)%HeatTransSurf) CYCLE ! Skip non-heat transfer surfaces
IF (Surface(SurfNum)%Class == SurfaceClass_Window) THEN
IF (Surface(SurfNum)%Width > TempmajorW) THEN
TempmajorW = Surface(SurfNum)%Width
ConvTransCoeffGlassFluid = HConvIn(SurfNum)
SurfTempGlassCover = TempSurfIn(SurfNum) + KelvinConv
END IF
END IF
END DO
AbsorberWallWidthTC = majorW
IF (ThermalChimneySys(Loop)%AbsorberWallWidth /= majorW) THEN
AbsorberWallWidthTC = ThermalChimneySys(Loop)%AbsorberWallWidth
END IF
AirDensityThermalChim = PsyRhoAirFnPbTdbW(OutBaroPress,MAT(ZoneNum),ZoneAirHumRat(ZoneNum))
AirSpecHeatThermalChim = PsyCpAirFnWTdb(ZoneAirHumRat(ZoneNum),MAT(ZoneNum))
AirOutletCrossAreaTC = ThermalChimneySys(Loop)%AirOutletCrossArea
DischargeCoeffTC = ThermalChimneySys(Loop)%DischargeCoeff
AirInletCrossArea = 0.0d0
DO TCZoneNum = 1, ThermalChimneySys(Loop)%TotZoneToDistrib
AirInletCrossArea = AirInletCrossArea + ThermalChimneySys(Loop)%EachAirInletCrossArea(TCZoneNum)
END DO
RoomAirTemp = 0.0d0
DO TCZoneNum = 1, ThermalChimneySys(Loop)%TotZoneToDistrib
TCZoneNumCounter = ThermalChimneySys(Loop)%ZonePtr(TCZoneNum)
RoomAirTemp = RoomAirTemp + ThermalChimneySys(Loop)%RatioThermChimAirFlow(TCZoneNum) * MAT(TCZoneNumCounter)
END DO
RoomAirTemp = RoomAirTemp + KelvinConv
Process1 = 0.0d0
Process2 = 0.0d0
DO TCZoneNum = 1, ThermalChimneySys(Loop)%TotZoneToDistrib
TCZoneNumCounter = ThermalChimneySys(Loop)%ZonePtr(TCZoneNum)
Process1 = Process1 + PsyHFnTdbW(MAT(TCZoneNumCounter),ZoneAirHumRat(TCZoneNumCounter)) * &
ThermalChimneySys(Loop)%DistanceThermChimInlet(TCZoneNum) * ThermalChimneySys(Loop)%RatioThermChimAirFlow(TCZoneNum)
Process2 = Process2 + ThermalChimneySys(Loop)%RatioThermChimAirFlow(TCZoneNum) * &
PsyHFnTdbW(MAT(TCZoneNumCounter),ZoneAirHumRat(TCZoneNumCounter))
END DO
OverallThermalChimLength = Process1 / Process2
DeltaL = OverallThermalChimLength / NTC
! Starting the iteration for mass and volumetric flow rate calculation
ThermChimTolerance = 10000000.0d0 ! An impossibly big tolerance
DO IterationLoop = 1,10
IF (IterationLoop == 1) THEN
TempTCMassAirFlowRate(IterationLoop) = 0.05d0 ! Inital Guess
ELSE
TempTCMassAirFlowRate(IterationLoop) = TempTCVolumeAirFlowRate(IterationLoop-1) * AirDensityThermalChim
IF (ABS( TempTCMassAirFlowRate(IterationLoop)-TempTCMassAirFlowRate(IterationLoop-1) ) < ThermChimTolerance) THEN
ThermChimTolerance = ABS( TempTCMassAirFlowRate(IterationLoop)-TempTCMassAirFlowRate(IterationLoop-1) )
TCMassAirFlowRate = TempTCMassAirFlowRate(IterationLoop)
TCVolumeAirFlowRate = TempTCVolumeAirFlowRate(IterationLoop)
END IF
END IF ! IF (IterationLoop == 1) THEN
! Calculation of Thermal Chimney Discharge Air Temperature
Process1= AbsorberWallWidthTC*DeltaL*ConvTransCoeffGlassFluid + AbsorberWallWidthTC*DeltaL*ConvTransCoeffWallFluid - &
2.d0*TempTCMassAirFlowRate(IterationLoop)*AirSpecHeatThermalChim
Process2= AbsorberWallWidthTC*DeltaL*ConvTransCoeffGlassFluid + AbsorberWallWidthTC*DeltaL*ConvTransCoeffWallFluid + &
2.d0*TempTCMassAirFlowRate(IterationLoop)*AirSpecHeatThermalChim
Process3= 2.d0*AbsorberWallWidthTC*DeltaL*ConvTransCoeffGlassFluid*SurfTempGlassCover &
+ 2.d0*AbsorberWallWidthTC*DeltaL*ConvTransCoeffWallFluid*SurfTempAbsorberWall
DO ThermChimLoop1=1, NTC
DO ThermChimLoop2=1, NTC
EquaCoef(ThermChimLoop1, ThermChimLoop2)=0.0d0
END DO
END DO
EquaCoef(1,1)=Process2
EquaConst(1)=Process3-Process1*RoomAirTemp
DO ThermChimLoop1=2, NTC
EquaCoef(ThermChimLoop1, (ThermChimLoop1-1))=Process1
EquaCoef(ThermChimLoop1, ThermChimLoop1)=Process2
EquaConst(ThermChimLoop1)=PRocess3
END DO
CALL GaussElimination(EquaCoef, EquaConst, ThermChimSubTemp, NTC)
AirRelativeCrossArea = AirOutletCrossAreaTC / AirInletCrossArea
IF (ThermChimSubTemp(NTC) <= RoomAirTemp) THEN
TempTCVolumeAirFlowRate(IterationLoop) = 0.0d0
ELSE
TempTCVolumeAirFlowRate(IterationLoop) = DischargeCoeffTC * AirOutletCrossAreaTC * &
(( 2.d0*((ThermChimSubTemp(NTC)-RoomAirTemp)/RoomAirTemp) &
* 9.8d0 * OverallThermalChimLength / ((1.d0+AirRelativeCrossArea)**2) )**0.5d0)
END IF
END DO ! DO IterationLoop = 1,10
! Calculation of Thermal Chimney Discharge Temperature
Process1= AbsorberWallWidthTC*DeltaL*ConvTransCoeffGlassFluid + AbsorberWallWidthTC*DeltaL*ConvTransCoeffWallFluid - &
2.d0*TCMassAirFlowRate*AirSpecHeatThermalChim
Process2= AbsorberWallWidthTC*DeltaL*ConvTransCoeffGlassFluid + AbsorberWallWidthTC*DeltaL*ConvTransCoeffWallFluid + &
2.d0*TCMassAirFlowRate*AirSpecHeatThermalChim
Process3= 2.d0*AbsorberWallWidthTC*DeltaL*ConvTransCoeffGlassFluid*SurfTempGlassCover &
+ 2.d0*AbsorberWallWidthTC*DeltaL*ConvTransCoeffWallFluid*SurfTempAbsorberWall
DO ThermChimLoop1=1, NTC
DO ThermChimLoop2=1, NTC
EquaCoef(ThermChimLoop1, ThermChimLoop2)=0.0d0
END DO
END DO
EquaCoef(1,1)=Process2
EquaConst(1)=Process3-Process1*RoomAirTemp
DO ThermChimLoop1=2, NTC
EquaCoef(ThermChimLoop1, (ThermChimLoop1-1))=Process1
EquaCoef(ThermChimLoop1, ThermChimLoop1)=Process2
EquaConst(ThermChimLoop1)=PRocess3
END DO
CALL GaussElimination(EquaCoef, EquaConst, ThermChimSubTemp, NTC)
AirRelativeCrossArea = AirOutletCrossAreaTC / AirInletCrossArea
IF (ThermChimSubTemp(NTC) <= RoomAirTemp) THEN
TCVolumeAirFlowRate = 0.0d0
ELSE
TCVolumeAirFlowRate = DischargeCoeffTC * AirOutletCrossAreaTC * &
(( 2.d0*((ThermChimSubTemp(NTC)-RoomAirTemp)/RoomAirTemp) &
* 9.8d0 * OverallThermalChimLength / ((1.d0+AirRelativeCrossArea)**2) )**0.5d0)
END IF
! Now assignment of the overall mass flow rate into each zone
DO TCZoneNum = 1, ThermalChimneySys(Loop)%TotZoneToDistrib
TCZoneNumCounter = ThermalChimneySys(Loop)%ZonePtr(TCZoneNum)
AirDensity = PsyRhoAirFnPbTdbW(OutBaroPress,MAT(TCZoneNumCounter),ZoneAirHumRat(TCZoneNumCounter))
CpAir = PsyCpAirFnWTdb(ZoneAirHumRat(TCZoneNumCounter),MAT(TCZoneNumCounter))
MCPThermChim(TCZoneNumCounter) = TCVolumeAirFlowRate * AirDensity * CpAir * &
ThermalChimneySys(Loop)%RatioThermChimAirFlow(TCZoneNum)
IF (MCPThermChim(TCZoneNumCounter) <= 0.0d0) THEN
MCPThermChim(TCZoneNumCounter) = 0.0d0
END IF
ThermChimAMFL(TCZoneNumCounter) = MCPThermChim(TCZoneNumCounter) / CpAir
MCPTThermChim(TCZoneNumCounter) = MCPThermChim(TCZoneNumCounter) * Zone(TCZoneNumCounter)%OutDryBulbTemp
END DO
MCPThermChim(ZoneNum) = TCVolumeAirFlowRate * AirDensity * CpAir
IF (MCPThermChim(ZoneNum) <= 0.0d0) THEN
MCPThermChim(ZoneNum) = 0.0d0
END IF
ThermChimAMFL(ZoneNum) = MCPThermChim(ZoneNum) / CpAir
MCPTThermChim(ZoneNum) = MCPThermChim(ZoneNum) * Zone(ZoneNum)%OutDryBulbTemp
ThermalChimneyReport(Loop)%OverallTCVolumeFlow = TCVolumeAirFlowRate
ThermalChimneyReport(Loop)%OverallTCMassFlow = TCMassAirFlowRate
IF ( ThermalChimneyReport(Loop)%OverallTCMassFlow /= (TCVolumeAirFlowRate*AirDensityThermalChim) ) THEN
ThermalChimneyReport(Loop)%OverallTCMassFlow = ThermalChimneyReport(Loop)%OverallTCVolumeFlow * AirDensityThermalChim
END IF
ThermalChimneyReport(Loop)%OutletAirTempThermalChim = ThermChimSubTemp(NTC) - KelvinConv
IF (GetCurrentScheduleValue(ThermalChimneySys(Loop)%SchedPtr) <= 0.0d0) THEN
DO TCZoneNum = 1, ThermalChimneySys(Loop)%TotZoneToDistrib
TCZoneNumCounter = ThermalChimneySys(Loop)%ZonePtr(TCZoneNum)
MCPThermChim(TCZoneNumCounter) = 0.0d0
ThermChimAMFL(TCZoneNumCounter) = 0.0d0
MCPTThermChim(TCZoneNumCounter) = 0.0d0
END DO
MCPThermChim(ZoneNum) = 0.0d0
ThermChimAMFL(ZoneNum) = 0.0d0
MCPTThermChim(ZoneNum) = 0.0d0
ThermalChimneyReport(Loop)%OverallTCVolumeFlow = 0.0d0
ThermalChimneyReport(Loop)%OverallTCMassFlow = 0.0d0
ThermalChimneyReport(Loop)%OutletAirTempThermalChim = MAT(ZoneNum)
END IF
END DO ! DO Loop=1, TotThermalChimney
RETURN
END SUBROUTINE CalcThermalChimney