Wednesday 1 February 2012

Clausius Clapeyron equation

This script checks if a water steam  is steam or liquid water, and give the temperature for boiling water. It uses the Clausius-Clapeyron equation and give the flow in the tube to reach the atmosfere.
Example:

***Check phase using Clausius-Clapeyron****
Temperature? (°C) 30
Pressure? (bar) 1
Vapor pressure is: 4E-2 bar
It's WATER,
to obtain steam, you need to reach al least 100.0 °C
********************************
*if you need to contact author:*
*maxint@tiscali.it *
********************************


Here the source:
REBOL [Title: "Clausius Clapeyron"
    Author: "Massimiliano Vessi"
    Email: maxint@tiscali.it
    Date: 25-Jun-2010
    version: 1.0.6
    file: %cla-cla.r
    Purpose: {"Given the data, check if it's steam or water,
    and give the temperature for boiling water.
    It usese the Clausius-Clapeyron equation and give the flow in the tube to reach the atmosfere."}
   ]
print "***Check phase using Clausius-Clapeyron****"    
t: ask "Temperature? (°C) "
t: to-decimal t
p: ask "Pressure? (bar) "
p: to-decimal p
cla: func [temperatura] [
        ;Clausius-Clapeyron equation, result in millibar!
        pressione_vap: 6.11 * (10 ** ( ( 7.5 * temperatura) / (237.7 + temperatura)))
        pressione_vap: pressione_vap / 1000
        pressione_vap: round/to pressione_vap 0.01
        return pressione_vap
    ]
   
p_vap: cla t      


print reform ["Vapor pressure is: "   p_vap " bar"]

either p < p_vap [print "It's STEAM."
    Q: 24 * ( square-root (   p / 2.5 ) )
    Q: round/to Q 0.01
    print rejoin ["STEAM flow is: " Q " kg/h"]
    ] [print "It's WATER,"
    while [p >= p_vap] [
        t: t + 1
        p_vap: cla t
        ]
    print reform ["to obtain steam, you need to reach al least " t "°C"]
    ]
   

print rejoin [
"********************************^/"
"*if you need to contact author:*^/"
"*maxint" "@" "tiscali.it             *^/"
"********************************^/"]
do %cla-cla.r

No comments:

Post a Comment