[Arjen Markus] (4 may 2006) It occurred to me that we do not yet have a decent module in Tcllib yet that collects the various physical empirical formulae. So, right now, if I want to compute the water content of air, I have to hunt the Internet for the right formula. Similarly, the density of water as a function of temperature and salinity. I am probably not the only one with that little problem, so I propose to collect such formulae here (with a reference) so that later we can simply wrap them up in a package/module for Tcllib. ---- # Auxiliary procedure proc check {descr var range} { foreach {min max} $range break if { $var < $min || $var > $max } { return -code error "Range error: $descr should be between $min and $max" } } ---- A formula for the humidity content of air: check "dew-point temperature" $td {-20 100} set vapordens [expr {5.018+0.32321*$td+8.1847e-3*$td*$td+3.1243e-4*$td*$td*$td}] Symbols: * td the dewpoint temperature in degrees C - between -20 and +100 degrees * vapordens the water vapour density in g water/m3 Reference: http://hyperphysics.phy-astr.gsu.edu/hbase/kinetic/relhum.html#c3 ---- [TR] - Here comes a formula for the density of seawater as a function of salinity, temperature, and pressure: proc rho {S T P} { # # compute the density of seawater in kg/m3 # as a function of: # # S -> salinity (in psu, practical salinity units) # T > Temperature (in °C, degrees Celsius) # P -> pressure (in bar) # check Temperature $T {-2 40} check Salinity $S {0 40} check Pressure $P {0 12000} set rhow [expr {999.842594 + 0.06793952 * $T - 0.00909529 * pow($T,2) + 0.0001001685 * pow($T,3) - 1.120083e-06 * pow($T,4) + 6.536332e-09 * pow($T,5)}] set A [expr {0.824493 - 0.0040899 * $T + 7.6438e-05 * pow($T,2) - 8.2467e-07 * pow($T,3) + 5.3875e-09 * pow($T,4)}] set B [expr {-0.00572466 + 0.00010227 * $T - 1.6546e-06 * pow($T,2)}] set C 0.00048314 set rho0 [expr {$rhow + $A * $S + $B * pow($S,3.0/2) + $C * pow($S,2)}] set Ksbmw [expr {19652.21 + 148.4206 * $T - 2.327105 * pow($T,2) + 0.01360477 * pow($T,3) - 5.155288e-05 * pow($T,4)}] set Ksbm0 [expr {$Ksbmw + $S * (54.6746 - 0.603459 * $T + 0.0109987 * pow($T,2) - 6.167e-05 * pow($T,3)) + pow($S,3.0/2) * (0.07944 + 0.016483 * $T - 0.00053009 * pow($T,2))}] set Ksbm [expr {$Ksbm0 + $P * (3.239908 + 0.00143713 * $T + 0.000116092 * pow($T,2) - 5.77905e-07 * pow($T,3)) + $P * $S * (0.0022838 - 1.0981e-05 * $T - 1.6078e-06 * pow($T,2)) + $P * pow($S,3.0/2) * 0.000191075 + $P * $P * (8.50935e-05 - 6.12293e-06 * $T + 5.2787e-08 * pow($T,2)) + pow($P,2) * $S * (-9.9348e-07 + 2.0816e-08 * $T + 9.1697e-10 * pow($T,2))}] return [expr {$rho0/double(1 - double($P)/$Ksbm)}] } References: * Millero, F. J. and Poisson, A. 1981 International one-atmosphere equation of state of seawater. Deep-Sea Research 28A, 625-629. * http://cran.r-project.org/src/contrib/Descriptions/seacarb.html Note: I am not totally sure about the ranges of the three parameters, so I added some reasonable defaults Example: [[rho 35 10 0]] = 1026.95 (quite standard seawater with a salinity of 35 psu, temperature of 10 °C and pressure of 0 bar (surface water)) ---- [IDG] May 04 2006: All empirical formulae need to have their range of validity stated. Note what happens to the above as td -> infinity :-) [AM] Ah! Good thinking! I have added the valid range. [TR] - Perhaps we should also add something like accuracy. It is often not good to give a result like 3.24345643 when the formula only has significance for 3.24 ---- [[ [Category Physics] ]]