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 InitInteriorRadExchange
! SUBROUTINE INFORMATION:
! AUTHOR Rick Strand
! DATE WRITTEN September 2000
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Initializes the various parameters for Hottel's ScriptF method for
! the grey interchange between surfaces in an enclosure.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE DataIPShortCuts
USE InputProcessor, ONLY: GetNumObjectsFound,GetObjectItem,GetObjectDefMaxArgs
USE General, ONLY: RoundSigDigits,ScanForReports
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENTS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: NumOfZoneSurfaces ! total number of surfaces in the zone.
INTEGER :: SurfNum ! Counter within DO loop (refers to main surface derived type index)
INTEGER :: ZoneNum ! DO loop counter for zones
INTEGER :: ZoneSurfNum ! DO loop counter for surfaces within a zone (refers to local derived type arrays)
INTEGER :: Findex ! index to print view factors
INTEGER :: Vindex ! index for vertices
INTEGER :: NumZonesWithUserFbyS ! Zones with user input, used for flag here
LOGICAL :: NoUserInputF ! Logical flag signifying no input F's for zone
LOGICAL,SAVE :: ViewFactorReport ! Flag to output view factor report in eio file
LOGICAL :: ErrorsFound=.false.
REAL(r64) :: CheckValue1
REAL(r64) :: CheckValue2
REAL(r64) :: FinalCheckValue
REAL(r64), ALLOCATABLE, DIMENSION(:,:) :: SaveApproximateViewFactors ! Save for View Factor reporting
REAL(r64) :: RowSum
REAL(r64) :: FixedRowSum
INTEGER :: NumIterations
CHARACTER(len=MaxNameLength) :: Option1 ! view factor report option
! FLOW:
ALLOCATE(ZoneInfo(NumOfZones)) ! Allocate the entire derived type
CALL ScanForReports('ViewFactorInfo',ViewFactorReport,Option1=Option1)
IF (ViewFactorReport) THEN ! Print heading
WRITE(OutputFileInits,'(A)')'! <Surface View Factor and Grey Interchange Information>'
WRITE(OutputFileInits,'(A)')'! <View Factor - Zone Information>,Zone Name,Number of Surfaces'
WRITE(OutputFileInits,'(A)')'! <View Factor - Surface Information>,Surface Name,Surface Class,Area {m2},Azimuth,'// &
'Tilt,Thermal Emissivity,#Sides,Vertices'
WRITE(OutputFileInits,'(A)')'! <View Factor / Grey Interchange Type>,Surface Name(s)'
WRITE(OutputFileInits,'(A)')'! <View Factor>,Surface Name,Surface Class,Row Sum,View Factors for each Surface'
END IF
cCurrentModuleObject='ZoneProperty:UserViewFactors:bySurfaceName'
NumZonesWithUserFbyS = GetNumObjectsFound(cCurrentModuleObject)
MaxNumOfZoneSurfaces = 0
DO ZoneNum = 1, NumOfZones
IF (ZoneNum == 1) THEN
IF (DisplayAdvancedReportVariables) &
WRITE(OutputFileInits,'(A)')'! <Surface View Factor Check Values>,Zone Name,Original Check Value,'// &
'Calculated Fixed Check Value,Final Check Value,Number of Iterations,Fixed RowSum Convergence,'// &
'Used RowSum Convergence'
ENDIF
ZoneInfo(ZoneNum)%Name = Zone(ZoneNum)%Name
NumOfZoneSurfaces =0
DO SurfNum = Zone(ZoneNum)%SurfaceFirst, Zone(ZoneNum)%SurfaceLast
IF (Surface(SurfNum)%HeatTransSurf) NumOfZoneSurfaces = NumOfZoneSurfaces + 1
END DO
ZoneInfo(ZoneNum)%NumOfSurfaces = NumOfZoneSurfaces
MaxNumOfZoneSurfaces=MAX(MaxNumOfZoneSurfaces,NumOfZoneSurfaces)
IF (ZoneInfo(ZoneNum)%NumOfSurfaces < 1) CALL ShowFatalError('No surfaces in a zone in InitInteriorRadExchange')
! Allocate the parts of the derived type
ALLOCATE(ZoneInfo(ZoneNum)%F(ZoneInfo(ZoneNum)%NumOfSurfaces,ZoneInfo(ZoneNum)%NumOfSurfaces))
ZoneInfo(ZoneNum)%F=0.0d0
ALLOCATE(ZoneInfo(ZoneNum)%ScriptF(ZoneInfo(ZoneNum)%NumOfSurfaces,ZoneInfo(ZoneNum)%NumOfSurfaces))
ZoneInfo(ZoneNum)%ScriptF=0.0d0
ALLOCATE(ZoneInfo(ZoneNum)%Area(ZoneInfo(ZoneNum)%NumOfSurfaces))
ZoneInfo(ZoneNum)%Area=0.0d0
ALLOCATE(ZoneInfo(ZoneNum)%Emissivity(ZoneInfo(ZoneNum)%NumOfSurfaces))
ZoneInfo(ZoneNum)%Emissivity=0.0d0
ALLOCATE(ZoneInfo(ZoneNum)%Azimuth(ZoneInfo(ZoneNum)%NumOfSurfaces))
ZoneInfo(ZoneNum)%Azimuth=0.0d0
ALLOCATE(ZoneInfo(ZoneNum)%Tilt(ZoneInfo(ZoneNum)%NumOfSurfaces))
ZoneInfo(ZoneNum)%Tilt=0.0d0
ALLOCATE(ZoneInfo(ZoneNum)%SurfacePtr(ZoneInfo(ZoneNum)%NumOfSurfaces))
ZoneInfo(ZoneNum)%SurfacePtr=0
! Initialize the surface pointer array
ZoneSurfNum = 0
DO SurfNum = Zone(ZoneNum)%SurfaceFirst, Zone(ZoneNum)%SurfaceLast
IF (.NOT.Surface(SurfNum)%HeatTransSurf) CYCLE
ZoneSurfNum = ZoneSurfNum + 1
ZoneInfo(ZoneNum)%SurfacePtr(ZoneSurfNum) = SurfNum
END DO
! Initialize the area and emissivity arrays
DO ZoneSurfNum = 1, ZoneInfo(ZoneNum)%NumOfSurfaces
SurfNum = ZoneInfo(ZoneNum)%SurfacePtr(ZoneSurfNum)
!************************************************
IF (.not. Construct(Surface(SurfNum)%Construction)%TypeIsIRT) Then
ZoneInfo(ZoneNum)%Area(ZoneSurfNum) = Surface(SurfNum)%Area
ELSE
! Double area for infrared transparent (IRT) surfaces
ZoneInfo(ZoneNum)%Area(ZoneSurfNum) = 2.0d0* Surface(SurfNum)%Area
END IF
!***********************************************
ZoneInfo(ZoneNum)%Emissivity(ZoneSurfNum) = Construct(Surface(SurfNum)%Construction)%InsideAbsorpThermal
ZoneInfo(ZoneNum)%Azimuth(ZoneSurfNum) = Surface(SurfNum)%Azimuth
ZoneInfo(ZoneNum)%Tilt(ZoneSurfNum) = Surface(SurfNum)%Tilt
END DO
IF (ZoneInfo(ZoneNum)%NumOfSurfaces == 1) THEN
! If there is only one surface in a zone, then there is no radiant exchange
ZoneInfo(ZoneNum)%F = 0.0d0
ZoneInfo(ZoneNum)%ScriptF = 0.0d0
IF (DisplayAdvancedReportVariables) &
WRITE(OutputFileInits,'(A)')'Surface View Factor Check Values,'//trim(Zone(ZoneNum)%Name)// &
',0,0,0,-1,0,0'
CYCLE ! Go to the next zone in the ZoneNum DO loop
END IF
! Get user supplied view factors if available in idf.
NoUserInputF=.true.
IF (NumZonesWithUserFbyS > 0) THEN
CALL GetInputViewFactorsbyName(ZoneInfo(ZoneNum)%Name, & ! Obtains user input view factors from input file
ZoneInfo(ZoneNum)%NumOfSurfaces, &
ZoneInfo(ZoneNum)%F, &
ZoneInfo(ZoneNum)%SurfacePtr, &
NoUserInputF, &
ErrorsFound)
ENDIF
IF (NoUserInputF) Then
! Calculate the view factors and make sure they satisfy reciprocity
CALL CalcApproximateViewFactors(ZoneInfo(ZoneNum)%NumOfSurfaces, &
ZoneInfo(ZoneNum)%Area, &
ZoneInfo(ZoneNum)%Azimuth, &
ZoneInfo(ZoneNum)%Tilt, &
ZoneInfo(ZoneNum)%F, &
ZoneInfo(ZoneNum)%SurfacePtr)
END IF
IF (ViewFactorReport) THEN ! Allocate and save user or approximate view factors for reporting.
ALLOCATE(SaveApproximateViewFactors(ZoneInfo(ZoneNum)%NumOfSurfaces,ZoneInfo(ZoneNum)%NumOfSurfaces))
SaveApproximateViewFactors=ZoneInfo(ZoneNum)%F
ENDIF
CALL FixViewFactors(ZoneInfo(ZoneNum)%NumOfSurfaces, &
ZoneInfo(ZoneNum)%Area, &
ZoneInfo(ZoneNum)%F,ZoneNum, &
CheckValue1,CheckValue2,FinalCheckValue,NumIterations,FixedRowSum)
! Calculate the script F factors
CALL CalcScriptF(ZoneInfo(ZoneNum)%NumOfSurfaces, &
ZoneInfo(ZoneNum)%Area, &
ZoneInfo(ZoneNum)%F, &
ZoneInfo(ZoneNum)%Emissivity, &
ZoneInfo(ZoneNum)%ScriptF)
IF (ViewFactorReport) THEN ! Write to SurfInfo File
! Zone Surface Information Output
WRITE(OutputFileInits, '(A)') 'Surface View Factor - Zone Information,'//trim(ZoneInfo(ZoneNum)%Name)// &
','//trim(RoundSigDigits(ZoneInfo(ZoneNum)%NumOfSurfaces))
DO SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces
WRITE(OutputFileInits,'(A,200(",",A))') 'Surface View Factor - Surface Information,'// &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name)//','// &
trim(cSurfaceClass(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Class)), &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%Area(SurfNum),4))//','// &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%Azimuth(SurfNum),4))//','// &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%Tilt(SurfNum),4))//','// &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%Emissivity(SurfNum),4))//','// &
trim(RoundSigDigits(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%sides)), &
(trim(RoundSigDigits(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%vertex(vindex)%X,4)), &
trim(RoundSigDigits(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%vertex(vindex)%Y,4)), &
trim(RoundSigDigits(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%vertex(vindex)%Z,4)), &
vindex=1,Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%sides)
END DO
WRITE(OutputFileInits,'(A,A,200(",",A))') 'Approximate or User Input ViewFactors', &
',To Surface,Surface Class,RowSum', &
(trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name),SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces)
DO Findex = 1 , ZoneInfo(ZoneNum)%NumOfSurfaces
RowSum=SUM(SaveApproximateViewFactors(Findex,:))
WRITE(OutputFileInits, '(A,",",A,",",A,200(",",A))') &
'View Factor', &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Name), &
trim(cSurfaceClass(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Class)), &
trim(RoundSigDigits(RowSum,4)), &
(trim(RoundSigDigits(SaveApproximateViewFactors(Findex,SurfNum),4)),SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces)
END DO
ENDIF
IF (ViewFactorReport) THEN
WRITE(OutputFileInits,'(A,A,200(",",A))') 'Final ViewFactors', &
',To Surface,Surface Class,RowSum', &
(trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name),SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces)
DO Findex = 1 , ZoneInfo(ZoneNum)%NumOfSurfaces
RowSum=SUM(ZoneInfo(ZoneNum)%F(Findex,:))
WRITE(OutputFileInits, '(A,",",A,",",A,200(",",A))') &
'View Factor', &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Name), &
trim(cSurfaceClass(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Class)), &
trim(RoundSigDigits(RowSum,4)), &
(trim(RoundSigDigits(ZoneInfo(ZoneNum)%F(Findex,SurfNum),4)),SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces)
END DO
IF (Option1 == 'IDF') THEN
WRITE(OutputFileDebug,'(A)') '!======== original input factors ==========================='
WRITE(OutputFileDebug,'(A)') 'ZoneProperty:UserViewFactors:bySurfaceName,'//trim(ZoneInfo(ZoneNum)%Name)//','
DO SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces
DO Findex=1,ZoneInfo(ZoneNum)%NumOfSurfaces
IF (.not. (SurfNum == ZoneInfo(ZoneNum)%NumOfSurfaces .and. Findex == ZoneInfo(ZoneNum)%NumOfSurfaces) ) THEN
WRITE(OutputFileDebug,'(A)') ' '//trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name)//','// &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Name)//','// &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%F(SurfNum,Findex),6))//','
ELSE
WRITE(OutputFileDebug,'(A)') ' '//trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name)//','// &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Name)//','// &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%F(SurfNum,Findex),6))//';'
ENDIF
ENDDO
ENDDO
WRITE(OutputFileDebug,'(A)') '!============= end of data ======================'
WRITE(OutputFileDebug,'(A)') '!============ final view factors ======================='
WRITE(OutputFileDebug,'(A)') 'ZoneProperty:UserViewFactors:bySurfaceName,'//trim(ZoneInfo(ZoneNum)%Name)//','
DO SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces
DO Findex=1,ZoneInfo(ZoneNum)%NumOfSurfaces
IF (.not. (SurfNum == ZoneInfo(ZoneNum)%NumOfSurfaces .and. Findex == ZoneInfo(ZoneNum)%NumOfSurfaces) ) THEN
WRITE(OutputFileDebug,'(A)') ' '//trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name)//','// &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Name)//','// &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%F(SurfNum,Findex),6))//','
ELSE
WRITE(OutputFileDebug,'(A)') ' '//trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name)//','// &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Name)//','// &
trim(RoundSigDigits(ZoneInfo(ZoneNum)%F(SurfNum,Findex),6))//';'
ENDIF
ENDDO
ENDDO
WRITE(OutputFileDebug,'(A)') '!============= end of data ======================'
END IF
END IF
IF (ViewFactorReport) THEN
WRITE(OutputFileInits,'(A,A,200(",",A))') 'Script F Factors', &
',X Surface', &
(trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(SurfNum))%Name),SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces)
DO Findex = 1 , ZoneInfo(ZoneNum)%NumOfSurfaces
WRITE(OutputFileInits, '(A,",",A,200(",",A))') &
'Script F Factor', &
trim(Surface(ZoneInfo(ZoneNum)%SurfacePtr(Findex))%Name), &
(trim(RoundSigDigits(ZoneInfo(ZoneNum)%ScriptF(Findex,SurfNum),4)),SurfNum=1,ZoneInfo(ZoneNum)%NumOfSurfaces)
END DO
END IF
IF (ViewFactorReport) THEN ! Deallocate saved approximate/user view factors
DEALLOCATE(SaveApproximateViewFactors)
ENDIF
RowSum=0.0d0
DO Findex = 1 , ZoneInfo(ZoneNum)%NumOfSurfaces
RowSum=RowSum+SUM(ZoneInfo(ZoneNum)%F(Findex,:))
END DO
RowSum=ABS(RowSum-ZoneInfo(ZoneNum)%NumOfSurfaces)
FixedRowSum=ABS(FixedRowSum-ZoneInfo(ZoneNum)%NumOfSurfaces)
IF (DisplayAdvancedReportVariables) &
WRITE(OutputFileInits,'(A)')'Surface View Factor Check Values,'//trim(Zone(ZoneNum)%Name)//','// &
trim(RoundSigDigits(CheckValue1,6))//','//trim(RoundSigDigits(CheckValue2,6))//','// &
trim(RoundSigDigits(FinalCheckValue,6))//','//trim(RoundSigDigits(NumIterations))//','// &
trim(RoundSigDigits(FixedRowSum,6))//','//trim(RoundSigDigits(RowSum,6))
END DO
IF (ErrorsFound) THEN
CALL ShowFatalError('InitInteriorRadExchange: Errors found during initialization of radiant exchange. Program terminated.')
ENDIF
RETURN
END SUBROUTINE InitInteriorRadExchange