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 InitMundtModel
! SUBROUTINE INFORMATION:
! AUTHOR Chanvit Chantrasrisalai
! DATE WRITTEN February 2004
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! initialize Mundt-model variables
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE DataGlobals, ONLY : NumOfZones
USE DataInterfaces, ONLY : SetupOutputVariable
USE DataRoomAirModel, ONLY : TotNumOfAirNodes, TotNumOfZoneAirNodes, AirModel, &
AirNode, RoomAirModel_Mundt, MundtRoomAirNode, FloorAirNode
USE DataSurfaces, ONLY : Surface
USE DataHeatBalance, ONLY : Zone
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: SurfNum ! index for surfaces
INTEGER :: SurfFirst ! index number for the first surface in the specified zone
INTEGER :: NumOfSurfs ! number of the first surface in the specified zone
INTEGER :: NodeNum ! index for air nodes
INTEGER :: ZoneIndex ! index for zones
INTEGER :: NumOfAirNodes ! total number of nodes in each zone
INTEGER :: NumOfMundtZones ! number of zones using the Mundt model
INTEGER :: MundtZoneIndex ! index for zones using the Mundt model
INTEGER :: MaxNumOfSurfs ! maximum of number of surfaces
INTEGER :: MaxNumOfFloorSurfs ! maximum of number of surfaces
INTEGER :: MaxNumOfAirNodes ! maximum of number of air nodes
INTEGER :: MaxNumOfRoomNodes ! maximum of number of nodes connected to walls
INTEGER :: RoomNodesCount ! number of nodes connected to walls
INTEGER :: FloorSurfCount ! number of nodes connected to walls
INTEGER :: AirNodeBeginNum ! index number of the first air node for this zone
INTEGER :: AirNodeNum ! index for air nodes
LOGICAL :: AirNodeFoundFlag ! flag used for error check
LOGICAL :: ErrorsFound ! true if errors found in init
! FLOW:
! allocate and initialize zone data
ALLOCATE (ZoneData(NumOfZones))
ZoneData%SurfFirst = 0
ZoneData%NumOfSurfs = 0
ZoneData%MundtZoneIndex = 0
! get zone data
NumOfMundtZones = 0
MaxNumOfSurfs = 0
MaxNumOfFloorSurfs = 0
MaxNumOfAirNodes = 0
MaxNumOfRoomNodes = 0
ErrorsFound=.false.
DO ZoneIndex =1, NumOfZones
IF (AirModel(ZoneIndex)%AirModelType.EQ.RoomAirModel_Mundt) THEN
! find number of zones using the Mundt model
NumOfMundtZones = NumOfMundtZones + 1
! find maximum number of surfaces in zones using the Mundt model
SurfFirst = Zone(ZoneIndex)%SurfaceFirst
NumOfSurfs = Zone(ZoneIndex)%SurfaceLast - SurfFirst + 1
MaxNumOfSurfs = MAX(MaxNumOfSurfs, NumOfSurfs)
! fine maximum number of air nodes in zones using the Mundt model
NumOfAirNodes = TotNumOfZoneAirNodes(ZoneIndex)
MaxNumOfAirNodes = MAX(MaxNumOfAirNodes, NumOfAirNodes)
! assign zone data
ZoneData(ZoneIndex)%SurfFirst = SurfFirst
ZoneData(ZoneIndex)%NumOfSurfs = NumOfSurfs
ZoneData(ZoneIndex)%MundtZoneIndex = NumOfMundtZones
END IF
END DO
! allocate and initialize surface and air-node data
ALLOCATE (ID1dSurf(MaxNumOfSurfs))
ALLOCATE(TheseSurfIDs(MaxNumOfSurfs))
ALLOCATE (MundtAirSurf(NumOfMundtZones,MaxNumOfSurfs))
ALLOCATE (LineNode(NumOfMundtZones,MaxNumOfAirNodes))
ID1dSurf=(/ (SurfNum, SurfNum = 1, MaxNumOfSurfs) /)
MundtAirSurf%Area = 0.0d0
MundtAirSurf%Temp = 25.0d0
MundtAirSurf%Hc = 0.0d0
MundtAirSurf%TMeanAir = 25.0d0
LineNode%AirNodeName = ' '
LineNode%ClassType = -1
LineNode%Height = 0.0d0
LineNode%Temp = 25.0d0
! get constant data (unchanged over time) for surfaces and air nodes
DO MundtZoneIndex =1, NumOfMundtZones
Zone_Loop: DO ZoneIndex =1, NumOfZones
IF (ZoneData(ZoneIndex)%MundtZoneIndex.EQ.MundtZoneIndex) THEN
! get surface data
DO SurfNum = 1, ZoneData(ZoneIndex)%NumOfSurfs
MundtAirSurf(MundtZoneIndex,SurfNum)%Area = Surface(ZoneData(ZoneIndex)%SurfFirst+SurfNum-1)%Area
ENDDO
! get air node data
RoomNodesCount = 0
FloorSurfCount = 0
DO NodeNum = 1, TotNumOfZoneAirNodes(ZoneIndex)
ALLOCATE (LineNode(MundtZoneIndex,NodeNum)%SurfMask(ZoneData(ZoneIndex)%NumOfSurfs))
IF (NodeNum.EQ.1) THEN
AirNodeBeginNum = NodeNum
END IF
! error check for debugging
IF (AirNodeBeginNum.GT.TotNumOfAirNodes) THEN
CALL ShowFatalError('An array bound exceeded. Error in InitMundtModel subroutine of MundtSimMgr.')
END IF
AirNodeFoundFlag = .FALSE.
DO AirNodeNum = AirNodeBeginNum, TotNumOfAirNodes
IF (SameString(AirNode(AirNodeNum)%ZoneName,Zone(ZoneIndex)%Name)) THEN
LineNode(MundtZoneIndex,NodeNum)%ClassType = AirNode(AirNodeNum)%ClassType
LineNode(MundtZoneIndex,NodeNum)%AirNodeName = AirNode(AirNodeNum)%Name
LineNode(MundtZoneIndex,NodeNum)%Height = AirNode(AirNodeNum)%Height
LineNode(MundtZoneIndex,NodeNum)%SurfMask = AirNode(AirNodeNum)%SurfMask
CALL SetupOutputVariable('Room Air Node Air Temperature [C]', &
LineNode(MundtZoneIndex,NodeNum)%Temp,'HVAC','Average', &
LineNode(MundtZoneIndex,NodeNum)%AirNodeName)
AirNodeBeginNum = AirNodeNum + 1
AirNodeFoundFlag = .TRUE.
EXIT
END IF
END DO
! error check for debugging
IF (.NOT.AirNodeFoundFlag) THEN
CALL ShowSevereError('InitMundtModel: Air Node in Zone="'//TRIM(Zone(ZoneIndex)%Name)//'" is not found.')
ErrorsFound=.true.
CYCLE
END IF
! count air nodes connected to walls in each zone
IF (LineNode(MundtZoneIndex,NodeNum)%ClassType.EQ.MundtRoomAirNode) THEN
RoomNodesCount = RoomNodesCount + 1
END IF
! count floors in each zone
IF (LineNode(MundtZoneIndex,NodeNum)%ClassType.EQ.FloorAirNode) THEN
FloorSurfCount = FloorSurfCount + COUNT(LineNode(MundtZoneIndex,NodeNum)%SurfMask)
END IF
END DO
! got data for this zone so exit the zone loop
IF (AirNodeFoundFlag) THEN
EXIT Zone_Loop
ENDIF
END IF
END DO Zone_Loop
MaxNumOfRoomNodes = MAX(MaxNumOfRoomNodes,RoomNodesCount)
MaxNumOfFloorSurfs = MAX(MaxNumOfFloorSurfs,FloorSurfCount)
END DO
IF (ErrorsFound) CALL ShowFatalError('InitMundtModel: Preceding condition(s) cause termination.')
! allocate arrays
ALLOCATE (RoomNodeIDS(MaxNumOfRoomNodes))
ALLOCATE(FloorSurfSetIDs(MaxNumOfFloorSurfs))
ALLOCATE(FloorSurf(MaxNumOfFloorSurfs))
RETURN
END SUBROUTINE InitMundtModel