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 CalcMinIntWinSolidAngs
          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Fred Winkelmann
          !       DATE WRITTEN   Feb. 2004
          !       MODIFIED:na
          !       RE-ENGINEERED  na
          ! PURPOSE OF THIS SUBROUTINE:
          ! For each Daylighting:Detailed zone finds the minimum solid angle subtended
          ! by interior windows through which daylight can pass from adjacent zones with
          ! exterior windows.
          ! METHODOLOGY EMPLOYED:na
          ! REFERENCES:na
          ! USE STATEMENTS:
  USE Vectors
  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   :: ZoneNum            ! Zone number
  INTEGER   :: ZoneNumAdj         ! Adjacent zone number
  INTEGER   :: IWin               ! Window surface number
  INTEGER   :: IL                 ! Reference point number
  INTEGER   :: loop               ! DO loop index
  LOGICAL   :: Triangle           ! True if window is a triangle
  LOGICAL   :: Rectangle          ! True if window is a rectangle
  LOGICAL   :: IntWinNextToIntWinAdjZone  ! True if an interior window is next to a zone with
                                         ! one or more exterior windows
  REAL(r64) :: IntWinSolidAng     ! Approximation to solid angle subtended by an interior window
                             ! from a point a distance sqrt(zone floor area) away.
  REAL(r64) :: W1(3),W2(3),W3(3)  ! Window vertices
  REAL(r64) :: WC(3)              ! Center point of window
  REAL(r64) :: W21(3),W23(3)      ! Unit vectors from window vertex 2 to 1 and 2 to 3
  REAL(r64) :: HW,WW              ! Window height and width (m)
  REAL(r64) :: RREF(3)            ! Location of a reference point in absolute coordinate system
  REAL(r64) :: RAY(3)             ! Unit vector along ray from reference point to window center
  REAL(r64) :: REFWC(3)           ! Vector from reference point to center of window
  REAL(r64) :: WNORM(3)           ! Unit vector normal to window (pointing away from room)
  REAL(r64) :: DIS                ! Distance from ref point to window center (m)
  REAL(r64) :: COSB               ! Cosine of angle between ray from ref pt to center of window
                                  !  and window outward normal
          ! FLOW:
DO ZoneNum = 1,NumOfZones
  ZoneDaylight(ZoneNum)%MinIntWinSolidAng = 2.d0*Pi
  IF(ZoneDaylight(ZoneNum)%TotalDaylRefPoints == 0) CYCLE
  IF(ZoneDaylight(ZoneNum)%NumOfIntWinAdjZones == 0) CYCLE
  DO IWin = Zone(ZoneNum)%SurfaceFirst,Zone(ZoneNum)%SurfaceLast
    IF(Surface(IWin)%Class == SurfaceClass_Window .and. Surface(IWin)%ExtBoundCond >= 1) THEN
      ZoneNumAdj = Surface(Surface(IWin)%ExtBoundCond)%Zone
      IntWinNextToIntWinAdjZone = .FALSE.
      DO loop = 1,ZoneDaylight(ZoneNum)%NumOfIntWinAdjZones
        IF(ZoneNumAdj == ZoneDaylight(ZoneNum)%AdjIntWinZoneNums(loop)) THEN
          IntWinNextToIntWinAdjZone = .TRUE.
          EXIT
        END IF
      END DO
      IF(IntWinNextToIntWinAdjZone) THEN
        DO IL = 1,ZoneDaylight(ZoneNum)%TotalDaylRefPoints
          ! Reference point in absolute coordinate system
          RREF(1:3) = ZoneDaylight(ZoneNum)%DaylRefPtAbsCoord(IL,1:3)
          Rectangle = .FALSE.
          Triangle = .FALSE.
          IF (Surface(IWin)%Sides == 3) Triangle = .TRUE.
          IF (Surface(IWin)%Sides == 4) Rectangle = .TRUE.
          IF (Rectangle) THEN
            ! Vertices of window numbered counter-clockwise starting at upper left as viewed
            ! from inside of room. Assumes original vertices are numbered counter-clockwise from
            ! upper left as viewed from outside.
            W3 = Surface(IWin)%Vertex(2)
            W2 = Surface(IWin)%Vertex(3)
            W1 = Surface(IWin)%Vertex(4)
          ELSE IF (Triangle) THEN
            W3 = Surface(IWin)%Vertex(2)
            W2 = Surface(IWin)%Vertex(3)
            W1 = Surface(IWin)%Vertex(1)
          END IF
          ! Unit vectors from window vertex 2 to 1 and 2 to 3, center point of window,
          ! and vector from ref pt to center of window
          W21 = W1 - W2
          W23 = W3 - W2
          HW = SQRT(DOT_PRODUCT(W21,W21))
          WW = SQRT(DOT_PRODUCT(W23,W23))
          IF (Rectangle) THEN
            WC  = W2 + (W23 + W21)/2
          ELSE IF (Triangle) THEN
            WC  = W2 + (W23 + W21)/3
          END IF
          ! Vector from ref point to center of window
          REFWC = WC - RREF
          W21 = W21/HW
          W23 = W23/WW
          ! Unit vector normal to window (pointing away from room)
          WNORM = Surface(IWin)%OutNormVec
          ! Distance from ref point to center of window
          DIS = SQRT(DOT_PRODUCT(REFWC,REFWC))
          ! Unit vector from ref point to center of window
          RAY = REFWC/DIS
          ! Cosine of angle between ray from ref pt to center of window and window outward normal
          COSB = DOT_PRODUCT(WNORM, RAY)
          IF(COSB > 0.01765d0) THEN  ! 0 <= B < 89 deg
            ! Above test avoids case where ref point cannot receive daylight directly from the
            ! interior window
            IntWinSolidAng = COSB * Surface(IWin)%Area / (DIS**2 + 0.001d0)
            ZoneDaylight(ZoneNum)%MinIntWinSolidAng =  &
             MIN(ZoneDaylight(ZoneNum)%MinIntWinSolidAng,IntWinSolidAng)
          END IF
        END DO  ! End of loop over reference points
      END IF
    END IF
  END DO  ! End of loop over surfaces in zone
END DO  ! End of loop over zones
RETURN
END SUBROUTINE CalcMinIntWinSolidAngs