The usthht subroutine is used to encapsulate a simple enthalpy-temperature conversion law and its inverse.
Introduction
The usthht function allows one to define a simple enthalpy-temperature conversion law and its inverse. The parameters mode
allows one to know in which direction the conversion will be made.
Examples
The following code blocks show two examples of entahlpy-temperature conversion law.
Example 1
The first example corresponds to a simple law :
if (mode .eq. 1) then
temper = enthal / 4000.d0
else
enthal = temper * 4000.d0
endif
Example 2
The second example corresponds to a simple interpolation based on a tabulation defined hereafter and declared as a variable :
integer ntab
parameter(ntab=5)
double precision ht(ntab),
th(ntab)
data ht /100000.d0,200000.d0,300000.d0, &
400000.d0,500000.d0 /
data th / 100.d0, 200.d0, 300.d0, &
400.d0, 500.d0 /
The enthalpy-temperature conversion law is then defined :
if (mode .eq. 1) then
temper = 0.d0
if (enthal.le.ht(1)) then
else if (enthal.ge.ht(ntab)) then
else
do it = 2, ntab
if(enthal.le.ht(it)) then
+(enthal-ht(it-1))*(
th(it)-
th(it-1))/(ht(it)-ht(it-1))
endif
enddo
endif
else
enthal = 0.d0
if (temper.le.
th(1))
then
enthal = ht(1)
else if (temper.ge.
th(ntab))
then
enthal = ht(ntab)
else
do it = 2, ntab
if(temper.le.
th(it))
then
enthal = ht(it-1) &
+(temper-
th(it-1))*(ht(it)-ht(it-1))/(
th(it)-
th(it-1))
endif
enddo
endif
endif