Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | TDB | |||
real(kind=r64), | intent(in) | :: | TWBin | |||
real(kind=r64), | intent(in) | :: | PB | |||
character(len=*), | intent(in), | optional | :: | calledfrom |
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.
FUNCTION PsyWFnTdbTwbPb(TDB,TWBin,PB,calledfrom) RESULT(W)
! FUNCTION INFORMATION:
! AUTHOR George Shih
! DATE WRITTEN May 1976
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This function provides the humidity ratio from dry-bulb temperature,
! wet-bulb temperature and barometric pressure.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQ 22,35
! USE STATEMENTS:
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
REAL(r64), intent(in) :: TDB ! dry-bulb temperature {C}
REAL(r64), intent(in) :: TWBin ! wet-bulb temperature {C}
REAL(r64), intent(in) :: PB ! barometric pressure {Pascals}
character(len=*), intent(in), optional :: calledfrom ! routine this function was called from (error messages)
REAL(r64) :: W ! result=> humidity ratio
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) PWET ! Pressure at wet-bulb temperature {Pascals}
REAL(r64) WET ! Humidity ratio at wet-bulb temperature
REAL(r64) TWB ! test wet-bulb temperature
# 1943
! VALIDITY CHECK.
TWB=TWBin
IF (TWB > TDB) THEN
IF (TWB > (TDB+0.01d0)) THEN
IF (ReportErrors .and. .not. WarmupFlag) THEN
IF (iPsyErrIndex(iPsyWFnTdbTwbPb) == 0) THEN
String=' Dry-Bulb= '//TRIM(TrimSigDigits(TDB,2))//' Pressure= '//TRIM(TrimSigDigits(PB,2))
CALL ShowWarningMessage('Given Wet Bulb Temperature invalid (PsyWFnTdbTwbPb)')
if (present(calledfrom)) then
CALL ShowContinueErrorTimeStamp(' Routine='//trim(calledfrom)//',')
else
CALL ShowContinueErrorTimeStamp(' Routine=Unknown,')
endif
CALL ShowContinueError(TRIM(String))
String='Calculated Wet-Bulb= '//TRIM(TrimSigDigits(TWB,2))
CALL ShowContinueError(TRIM(String)//' ... Since Dry Bulb < Wet Bulb, Wet Bulb set = to Dry Bulb')
ENDIF
CALL ShowRecurringWarningErrorAtEnd('Given Wet Bulb Temperature invalid (PsyWFnTdbTwbPb)', &
iPsyErrIndex(iPsyWFnTdbTwbPb),ReportMinOf=TWB,ReportMaxOf=TWB,ReportMinUnits='C',ReportMaxUnits='C')
ENDIF
ENDIF
TWB=TDB
ENDIF
! CALCULATION.
IF (PRESENT(calledfrom)) THEN
PWET=PsyPsatFnTemp(TWB,calledfrom)
ELSE
PWET=PsyPsatFnTemp(TWB,'PsyWFnTdbTwbPb')
ENDIF
WET=0.62198d0*PWET/(PB-PWET)
W=((2501.0d0-2.381d0*TWB)*WET-(TDB-TWB)) / &
(2501.0d0+1.805d0*TDB-4.186d0*TWB)
! VALIDITY CHECK.
IF (W < 0.0d0) THEN
IF (ReportErrors .and. .not. WarmupFlag) THEN
IF (iPsyErrIndex(iPsyWFnTdbTwbPb2) == 0) THEN
String=' Dry-Bulb= '//TRIM(TrimSigDigits(TDB,2))//' Wet-Bulb= '//TRIM(TrimSigDigits(TWB,2))// &
' Pressure= '//TRIM(TrimSigDigits(PB,2))
CALL ShowWarningMessage('Calculated Humidity Ratio Invalid (PsyWFnTdbTwbPb)')
if (present(calledfrom)) then
CALL ShowContinueErrorTimeStamp(' Routine='//trim(calledfrom)//',')
else
CALL ShowContinueErrorTimeStamp(' Routine=Unknown,')
endif
CALL ShowContinueError(TRIM(String))
String='Calculated Humidity Ratio= '//TRIM(TrimSigDigits(W,4))//', will recalculate Humidity Ratio'
CALL ShowContinueError(TRIM(String)//' using Relative Humidity .01% (and Dry-Bulb and Pressure as shown)')
ENDIF
CALL ShowRecurringWarningErrorAtEnd('Calculated Humidity Ratio Invalid (PsyWFnTdbTwbPb)', &
iPsyErrIndex(iPsyWFnTdbTwbPb2),ReportMinOf=W,ReportMaxOf=W,ReportMinUnits='[]',ReportMaxUnits='[]')
ENDIF
W=PsyWFnTdbRhPb(TDB,.0001d0,PB,calledfrom)
ENDIF
! W is the result
RETURN
END FUNCTION PsyWFnTdbTwbPb