Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | TDB | |||
real(kind=r64), | intent(in) | :: | RH | |||
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 PsyWFnTdbRhPb(TDB,RH,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,
! relative humidty (value) and barometric pressure.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 22
! 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) :: RH ! relative humidity value (0.0-1.0)
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) PDRY ! Pressure at dry-bulb temperature {Pascals}
REAL(r64) PDEW ! Pressure at dew-point temperature {Pascals}
# 2054
IF (PRESENT(calledfrom)) THEN
PDRY=PsyPsatFnTemp(TDB,calledfrom)
ELSE
PDRY=PsyPsatFnTemp(TDB,'PsyWFnTdbRhPb')
ENDIF
PDEW=RH*PDRY
!Numeric error check when the temperature and RH values cause Pdew to equal or exceed
!barometric pressure which is physically impossible. An approach limit of 1000 pascals
!was chosen to keep the numerics stable as the denominator approaches 0.
If((PB-PDEW) <= 1000.0d0) Then
W=PDEW*0.62198d0/1000.0d0
Else
W=PDEW*0.62198d0/(PB-PDEW)
End If
! THIS EQUATION IN SI UNIT IS FROM
! VALIDITY TEST.
! ASHRAE HANDBOOK OF FUNDAMENTALS
! PAGE 99 EQUATION 22
IF (W < 1.0d-5) THEN
IF (W <= -.0001d0) THEN
IF (.not. WarmupFlag) THEN
IF (iPsyErrIndex(iPsyWFnTdbRhPb) == 0) THEN
String=' Dry-Bulb= '//TRIM(TrimSigDigits(TDB,2))//' Relative Humidity [%]= '// &
TRIM(TrimSigDigits(RH*100.d0,2))//' Pressure= '//TRIM(TrimSigDigits(PB,2))
CALL ShowWarningMessage('Calculated Humidity Ratio is invalid (PsyWFnTdbRhPb)')
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))
CALL ShowContinueError(TRIM(String)//' ... Humidity Ratio set to .00001')
ENDIF
CALL ShowRecurringWarningErrorAtEnd('Calculated Humidity Ratio Invalid (PsyWFnTdbTwbPb)', &
iPsyErrIndex(iPsyWFnTdbRhPb),ReportMinOf=W,ReportMaxOf=W,ReportMinUnits='[]',ReportMaxUnits='[]')
ENDIF
ENDIF
W=1.d-5
ENDIF
! W is the result
RETURN
END FUNCTION PsyWFnTdbRhPb