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 | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | RayVect | |||
integer, | intent(in) | :: | RadType | |||
real(kind=r64), | intent(in) | :: | Gamma | |||
real(kind=r64), | intent(in) | :: | Alpha | |||
real(kind=r64), | intent(out) | :: | Theta | |||
real(kind=r64), | intent(out) | :: | Phi |
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 W6CoordsFromWorldVect (RayVect, RadType, Gamma, Alpha,Theta, Phi)
! SUBROUTINE INFORMATION:
! AUTHOR Joe Klems
! DATE WRITTEN August 2011
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! Invert the transformation from W6 to world coordinates to
! calculate the theta, phi corresponding to a given ray direction
! in the world coordinate system, for a window with a
! given rotation and tilt (Gamma and Alpha)
! (needed for locating the sun direction in the local coordinate system)
! METHODOLOGY EMPLOYED:
! <n/a>
! REFERENCES:
! na
! USE STATEMENTS:
USE vectors
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
TYPE(vector), INTENT(IN) :: RayVect !Ray vector direction in world CS
INTEGER, INTENT(IN) :: RadType !Type of radiation: Front_Incident, etc.
REAL(r64), INTENT(IN) :: Gamma !Surface tilt angle, world coordinate system
REAL(r64), INTENT(IN) :: Alpha !Surface azimuth, world coordinate system
REAL(r64), INTENT(OUT) :: Theta !Polar angle in W6 Coords
REAL(r64), INTENT(OUT) :: Phi !Azimuthal angle in W6 Coords
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
TYPE (vector) :: W6x !W6 x coordinate unit vector
TYPE (vector) :: W6y !W6 y coordinate unit vector
TYPE (vector) :: W6z !W6 z coordinate unit vector
REAL(r64) :: Cost !Temp for cos theta
REAL(r64) :: Sint !Temp for sin theta
REAL(r64) :: Psi !Temp for phi before rotation adjustment
REAL(r64) :: RdotX !Temp variable for manipulating .dot. produt
REAL(r64) :: RdotY !Temp variable for manipulating .dot. produt
REAL(r64) :: RdotZ !Temp variable for manipulating .dot. produt
! define the local W6 coordinate vectors
W6x%x = COS(Alpha)
W6x%y = -SIN(Alpha)
W6x%z = 0.0d0
W6y%x = -COS(Gamma)*SIN(Alpha)
W6y%y = -COS(Gamma)*COS(Alpha)
W6y%z = SIN(Gamma)
W6z%x = -SIN(Gamma)*SIN(Alpha)
W6z%y = -SIN(Gamma)*COS(Alpha)
W6z%z = -COS(Gamma)
SELECT CASE (RadType)
CASE (Front_Incident)
RdotZ =W6z.dot.RayVect
Cost = -RdotZ
Sint = SQRT(1.0d0 - Cost**2)
Theta = ACOS(Cost)
RdotY = W6y.dot.RayVect
RdotX = W6x.dot.RayVect
Psi = ATAN2(-RdotY/Sint , -RdotX/Sint)
IF (Psi < 0.0d0) THEN
Phi = 2.0d0*Pi + Psi
ELSE
Phi = Psi
ENDIF
CASE (Front_Transmitted)
Cost = W6z.dot.RayVect
Sint = SQRT(1.0d0 - Cost**2)
Theta = ACOS(Cost)
RdotY = W6y.dot.RayVect
RdotX = W6x.dot.RayVect
Psi = ATAN2(RdotY/Sint , RdotX/Sint)
IF (Psi < 0.0d0) THEN
Phi = 2.0d0*Pi + Psi
ELSE
Phi = Psi
ENDIF
CASE (Front_Reflected)
RdotZ =W6z.dot.RayVect
Cost = -RdotZ
Sint = SQRT(1.0d0 - Cost**2)
Theta = ACOS(Cost)
RdotY = W6y.dot.RayVect
RdotX = W6x.dot.RayVect
Psi = ATAN2(RdotY/Sint , RdotX/Sint)
IF (Psi < 0.0d0) THEN
Phi = 2.0d0*Pi + Psi
ELSE
Phi = Psi
ENDIF
CASE (Back_Incident)
Cost = W6z.dot.RayVect
Sint = SQRT(1.0d0 - Cost**2)
Theta = ACOS(Cost)
RdotY = W6y.dot.RayVect
RdotX = W6x.dot.RayVect
Psi = ATAN2(-RdotY/Sint , -RdotX/Sint)
IF (Psi < 0.0d0) THEN
Phi = 2*Pi + Psi
ELSE
Phi = Psi
ENDIF
CASE (Back_Transmitted) !This is same as front reflected
RdotZ = W6z.dot.RayVect
Cost = -RdotZ
Sint = SQRT(1.0d0 - Cost**2)
Theta = ACOS(Cost)
RdotY = W6y.dot.RayVect
RdotX = W6x.dot.RayVect
Psi = ATAN2(RdotY/Sint , RdotX/Sint)
IF (Psi < 0.0d0) THEN
Phi = 2.0d0*Pi + Psi
ELSE
Phi = Psi
ENDIF
CASE (Back_Reflected) !This is same as front transmitted
Cost = W6z.dot.RayVect
Sint = SQRT(1.0d0 - Cost**2)
Theta = ACOS(Cost)
RdotY = W6y.dot.RayVect
RdotX = W6x.dot.RayVect
Psi = ATAN2(RdotY/Sint , RdotX/Sint)
IF (Psi < 0.0d0) THEN
Phi = 2.0d0*Pi + Psi
ELSE
Phi = Psi
ENDIF
END SELECT
IF(ABS(Cost) < rTinyValue)Cost = 0.0d0
IF(Cost < 0.0d0 ) Theta = Pi - Theta !This signals ray out of hemisphere
RETURN
END SUBROUTINE W6CoordsFromWorldVect