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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | SurfNum | ||||
real(kind=r64) | :: | CosDirSun(3) | ||||
integer | :: | HorOrVert | ||||
real(kind=r64) | :: | ProfileAng |
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 ProfileAngle(SurfNum,CosDirSun,HorOrVert,ProfileAng)
! SUBROUTINE INFORMATION:
! AUTHOR Fred Winkelmann
! DATE WRITTEN May 2001
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Calculates profile angle for a surface.
! REFERENCES: na
! USE STATEMENTS:
USE DataGlobals
USE DataSurfaces
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER :: SurfNum ! Surface number
REAL(r64) :: CosDirSun(3) ! Solar direction cosines
INTEGER :: HorOrVert ! If HORIZONTAL, calculates ProfileAngHor
REAL(r64) :: ProfileAng ! Solar profile angle (radians).
! For HorOrVert = HORIZONTAL,
! this is the incidence angle in a plane that is normal to the window
! and parallel to the Y-axis of the window (the axis along
! which the height of the window is measured).
! For HorOrVert = VERTICAL,
! this is the incidence angle in a plane that is normal to the window
! and parallel to the X-axis of the window (the axis along
! which the width of the window is measured).
! If VERTICAL, calculates ProfileAngVert
! SUBROUTINE PARAMETER DEFINITIONS: na
! INTERFACE BLOCK SPECIFICATIONS: na
! DERIVED TYPE DEFINITIONS: na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: ElevSun ! Sun elevation; angle between sun and horizontal (radians)
REAL(r64) :: ElevWin ! Window elevation: angle between window outward normal and horizontal (radians)
REAL(r64) :: AzimWin ! Window azimuth (radians)
REAL(r64) :: AzimSun ! Sun azimuth (radians)
REAL(r64) :: WinNorm(3) ! Window outward normal unit vector
REAL(r64) :: ThWin ! Azimuth angle of WinNorm
REAL(r64) :: SunPrime(3) ! Projection of sun vector onto plane (perpendicular to
! window plane) determined by WinNorm and vector along
! baseline of window
REAL(r64) :: WinNormCrossBase(3) ! Cross product of WinNorm and vector along window baseline
! INTEGER :: IComp ! Vector component index
! FLOW:
IF (HorOrVert == Horizontal) THEN ! Profile angle for horizontal structures
ElevWin = Piovr2 - Surface(SurfNum)%Tilt * DegToRadians
AzimWin = (90.d0 - Surface(SurfNum)%Azimuth) * DegToRadians
ElevSun = ASIN(CosDirSun(3))
AzimSun = ATAN2(CosDirSun(2),CosDirSun(1))
ProfileAng = ATAN(SIN(ElevSun)/ABS(COS(ElevSun) * COS(AzimWin-AzimSun))) - ElevWin
ELSE ! Profile angle for vertical structures
ElevWin = Piovr2 - Surface(SurfNum)%Tilt * DegToRadians
AzimWin = Surface(SurfNum)%Azimuth * DegToRadians ! 7952
AzimSun = ATAN2(CosDirSun(1),CosDirSun(2)) ! 7952
IF (ABS(ElevWin) < 0.1d0) THEN ! Near-vertical window
ProfileAng = AzimWin - AzimSun !CR7952 allow sign changes.
ELSE
WinNorm=Surface(SurfNum)%OutNormVec
ThWin = AzimWin - PiOvr2
WinNormCrossBase(1) = -SIN(ElevWin) * COS(ThWin)
WinNormCrossBase(2) = SIN(ElevWin) * SIN(ThWin)
WinNormCrossBase(3) = COS(ElevWin)
SunPrime = CosDirSun - WinNormCrossBase * DOT_PRODUCT(CosDirSun,WinNormCrossBase)
ProfileAng = ABS(ACOS(DOT_PRODUCT(WinNorm,SunPrime)/SQRT(DOT_PRODUCT(SunPrime,SunPrime))))
!CR7952 correct sign of result for vertical slats
IF ((AzimWin - AzimSun) < 0.0D0) ProfileAng = -1.0D0 * ProfileAng
END IF
! Constrain to 0 to pi
IF (ProfileAng > Pi) ProfileAng = 2.d0 * Pi - ProfileAng
END IF
RETURN
END SUBROUTINE ProfileAngle