Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | dw | |||
real(kind=r64), | intent(in) | :: | T | |||
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 PsyCpAirFnWTdb(dw,T,calledfrom) result(cpa)
! FUNCTION INFORMATION:
! AUTHOR J. C. VanderZee
! DATE WRITTEN Feb. 1994
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This function provides the heat capacity of air {J/kg-C} as function of humidity ratio.
! METHODOLOGY EMPLOYED:
! take numerical derivative of PsyHFnTdbW function
! REFERENCES:
! see PsyHFnTdbW ref. to ASHRAE Fundamentals
! USAGE: cpa = PsyCpAirFnWTdb(w,T)
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
REAL(r64), intent(in) :: dw ! humidity ratio {kgWater/kgDryAir}
REAL(r64), intent(in) :: T ! input temperature {Celsius}
character(len=*), intent(in), optional :: calledfrom ! routine this function was called from (error messages)
REAL(r64) :: cpa ! result => heat capacity of air {J/kg-C}
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) h1 ! PsyHFnTdbW result of input parameters
REAL(r64) tt ! input temperature (T) + .1
REAL(r64) h2 ! PsyHFnTdbW result of input humidity ratio and tt
REAL(r64) w ! humidity ratio
REAL(r64), SAVE :: dwSave = -100.0d0
REAL(r64), SAVE :: Tsave = -100.0d0
REAL(r64), SAVE :: cpaSave = -100.0d0
!check if last call had the same input and if it did just use the
!saved output.
IF (Tsave .EQ. T) THEN
IF (dwSave .EQ. dw) THEN
cpa = cpaSave
RETURN
END IF
END IF
w=MAX(dw,1.0d-5)
h1 = PsyHFnTdbW(T,w,calledfrom)
tt = T + 0.1d0
h2 = PsyHFnTdbW(tt,w,calledfrom)
cpa = (h2-h1)/0.1d0
!save values for next call
dwSave = dw
Tsave = T
cpaSave = cpa
return
end function PsyCpAirFnWTdb