@@ -60,17 +60,17 @@ function Esat_slope(Tair::Number; Esat_formula=Sonntag1990(), constants=BigleafC
6060 Delta = Esat_from_Tair_deriv (Tair; Esat_formula, constants)
6161 Esat, Delta
6262end ,
63- function Esat_from_Tair (Tair; Esat_formula= Sonntag1990 (), constants= BigleafConstants ())
64- a,b,c = get_EsatCoef (Esat_formula)
65- Esat = a * exp ((b * Tair) / (c + Tair)) * constants. Pa2kPa
63+ function Esat_from_Tair (Tair:: FT ; Esat_formula= Sonntag1990 (), constants= BigleafConstants ()) where FT
64+ a,b,c = map (x -> convert (FT,x), get_EsatCoef (Esat_formula) )
65+ Esat = a * exp ((b * Tair) / (c + Tair)) * FT ( constants. Pa2kPa)
6666end ,
67- function Esat_from_Tair_deriv (Tair; Esat_formula= Sonntag1990 (), constants= BigleafConstants ())
67+ function Esat_from_Tair_deriv (Tair:: FT ; Esat_formula= Sonntag1990 (), constants= BigleafConstants ()) where FT
6868 # slope of the saturation vapor pressure curve
6969 # Delta = eval(D(expression(a * exp((b * Tair) / (c + Tair))),name="Tair"))
70- a,b,c = get_EsatCoef (Esat_formula)
70+ a,b,c = map (x -> convert (FT,x), get_EsatCoef (Esat_formula) )
7171 # Delta_Pa = @. a*(b / (Tair + c) + (-Tair*b) / ((Tair + c)^2))*exp((Tair*b) / (Tair + c))
72- Delta_Pa = @. a * (exp ((b * Tair)/ (c + Tair)) * (b/ (c + Tair) - (b * Tair)/ (c + Tair)^ 2 ))
73- Delta = Delta_Pa .* constants. Pa2kPa
72+ Delta_Pa = a * (exp ((b * Tair)/ (c + Tair)) * (b/ (c + Tair) - (b * Tair)/ (c + Tair)^ 2 ))
73+ Delta = Delta_Pa .* FT ( constants. Pa2kPa)
7474end
7575
7676get_EsatCoef (:: Sonntag1990 ) = (a= 611.2 ,b= 17.62 ,c= 243.12 )
@@ -145,12 +145,12 @@ true
145145"""
146146function ms_to_mol (G_ms,Tair,pressure; constants= BigleafConstants ())
147147 Tair = Tair + oftype (Tair,constants. Kelvin)
148- pressure = pressure * constants. kPa2Pa
148+ pressure = pressure * oftype (Tair, constants. kPa2Pa)
149149 G_mol = G_ms * pressure / (oftype (Tair, constants. Rgas) * Tair)
150150end ,
151151function mol_to_ms (G_mol,Tair,pressure; constants= BigleafConstants ())
152152 Tair = Tair + oftype (Tair,constants. Kelvin)
153- pressure = pressure * constants. kPa2Pa
153+ pressure = pressure * oftype (Tair, constants. kPa2Pa)
154154 G_ms = G_mol * (oftype (Tair, constants. Rgas) * Tair) / (pressure)
155155end
156156
0 commit comments