Script Library: 1238 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Archive version of: cla-cla.r ... version: 1 ... crazyaxe 25-Jun-2010

Amendment note: new script || Publicly available? Yes

REBOL [ Title: "Unit converter" 
	Author: "Massimiliano Vessi" 
	Email: maxint@tiscali.it 
	Date: 25-Jun-2010 
	version: 1.0.0 
	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."} 
	
	;following data are for www.rebol.org library 
	;you can find a lot of rebol script there 
	library: [ 
		level: 'beginner 
		platform: 'all 
		type: [tutorial tool] 
		domain: [scientific ] 
		tested-under: [windows linux] 
		support: none 
		license: [gpl] 
		see-also: none ] ] 

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
        return pressione_vap
    ]
    
 p_vap: cla t       
 
 
 print reform ["Vapor pressure is: "  p_vap " bar"]
 
 either p < p_vap [ print "So it's STEAM."] [print "No it's WATER."
 	 while [p >= p_vap] [
 	    t: t + 1
 	    p_vap: cla t
 	   	]
 	 print reform ["to obtain water, you need to reach al least " t "°C"]
	 ]
 
print {
************
************
}	

do %cla-cla.r