Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | R | |||
real(kind=r64), | intent(in) | :: | A | |||
real(kind=r64), | intent(in) | :: | Theta |
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.
REAL(r64) FUNCTION CalcPipeTransBeam(R, A, Theta)
! SUBROUTINE INFORMATION:
! AUTHOR Peter Graham Ellis
! DATE WRITTEN May 2003
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Calculates the numerical integral for the transmittance of a reflective cylinder with
! incident collimated beam radiation as described in Swift and Smith.
! METHODOLOGY EMPLOYED:
! Since this integral can be slow, a table of values is calculated and stored during
! initialization of the TDD. Intermediate values are calculated by interpolation.
! Transmittance of sky and ground diffuse radiation is done by other functions.
! REFERENCES:
! Swift, P. D., and Smith, G. B. "Cylindrical Mirror Light Pipes",
! Solar Energy Materials and Solar Cells 36 (1995), pp. 159-168.
! OTHER NOTES:
! The execution time of this function can be reduced by adjusting parameters N and xTol below.
! However, there is some penalty in accuracy for N < 100,000 and xTol > 150.
! USE STATEMENTS: na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
REAL(r64), INTENT(IN) :: R ! Reflectance of surface, constant (can be made R = f(theta) later)
REAL(r64), INTENT(IN) :: A ! Aspect ratio, L / d
REAL(r64), INTENT(IN) :: Theta ! Angle of entry in radians
! FUNCTION PARAMETER DEFINITIONS:
REAL(r64), PARAMETER :: N = 100000.0d0 ! Number of integration points
REAL(r64), PARAMETER :: xTol = 150.0d0 ! Tolerance factor to skip iterations where dT is approximately 0
! Must be >= 1.0, increase this number to decrease the execution time
REAL(r64), PARAMETER :: myLocalTiny = TINY(1.0D0)
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: i ! Integration interval between points
REAL(r64) :: s ! Entry point
REAL(r64) :: dT
REAL(r64) :: T ! Beam transmittance for collimated solar real
REAL(r64) :: x, c1, c2 ! Intermediate variables for speed optimization
REAL(r64) :: xLimit ! Limiting x value to prevent floating point underflow
! FLOW:
CalcPipeTransBeam = 0.0d0
T = 0.0d0
i = 1.0d0 / N
xLimit = (LOG(N**2.0d0*myLocalTiny)/LOG(R))/xTol
c1 = A * TAN(Theta)
c2 = 4.0d0 / Pi
s = i
DO WHILE (s < (1.0d0 - i))
x = c1 / s
IF (x < xLimit) THEN
dT = c2 * (R**INT(x)) * (1.0d0 - (1.0d0 - R) * (x - INT(x))) * (s**2) / SQRT(1.0d0 - s**2)
T = T + dT
END IF
s = s + i
END DO
T = T / (N - 1.0d0) ! - 1.0, because started on i, not 0
CalcPipeTransBeam = T
RETURN
END FUNCTION CalcPipeTransBeam