## 2.9.6. Numerical implementation[¶](#numerical-implementation "Permalink to this headline") ------------------------------------------------------------------------------------------ The CO2 partial pressure at the leaf surface, \\(c\_{s}\\) (Pa), and the vapor pressure at the leaf surface, \\(e\_{s}\\) (Pa), needed for the stomatal resistance model in equation [(2.9.1)](#equation-9-1), and the internal leaf CO2 partial pressure \\(c\_{i}\\) (Pa), needed for the photosynthesis model in equations [(2.9.3)](#equation-9-3)\-[(2.9.5)](#equation-9-5), are calculated assuming there is negligible capacity to store CO2 and water vapor at the leaf surface so that (2.9.19)[¶](#equation-9-19 "Permalink to this equation")\\\[A\_{n} =\\frac{c\_{a} -c\_{i} }{\\left(1.4r\_{b} +1.6r\_{s} \\right)P\_{atm} } =\\frac{c\_{a} -c\_{s} }{1.4r\_{b} P\_{atm} } =\\frac{c\_{s} -c\_{i} }{1.6r\_{s} P\_{atm} }\\\] and the transpiration fluxes are related as (2.9.20)[¶](#equation-9-20 "Permalink to this equation")\\\[\\frac{e\_{a} -e\_{i} }{r\_{b} +r\_{s} } =\\frac{e\_{a} -e\_{s} }{r\_{b} } =\\frac{e\_{s} -e\_{i} }{r\_{s} }\\\] where \\(r\_{b}\\) is leaf boundary layer resistance (s m2 \\(\\mu\\) mol\-1) (section [2.5.3](https://escomp.github.io/ctsm-docs/versions/master/html/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.html#sensible-and-latent-heat-fluxes-and-temperature-for-vegetated-surfaces)), the terms 1.4 and 1.6 are the ratios of diffusivity of CO2 to H2O for the leaf boundary layer resistance and stomatal resistance, \\(c\_{a} ={\\rm CO}\_{{\\rm 2}} \\left({\\rm mol\\; mol}^{{\\rm -1}} \\right)\\), \\(P\_{atm}\\) is the atmospheric pressure (Pa), \\(e\_{i}\\) is the saturation vapor pressure (Pa) evaluated at the leaf temperature \\(T\_{v}\\), and \\(e\_{a}\\) is the vapor pressure of air (Pa). The vapor pressure of air in the plant canopy \\(e\_{a}\\) (Pa) is determined from (2.9.21)[¶](#equation-9-21 "Permalink to this equation")\\\[e\_{a} =\\frac{P\_{atm} q\_{s} }{0.622}\\\] where \\(q\_{s}\\) is the specific humidity of canopy air (kg kg\-1, section [2.5.3](https://escomp.github.io/ctsm-docs/versions/master/html/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.html#sensible-and-latent-heat-fluxes-and-temperature-for-vegetated-surfaces)). Equations [(2.9.19)](#equation-9-19) and [(2.9.20)](#equation-9-20) are solved for \\(c\_{s}\\) and \\(e\_{s}\\) (2.9.22)[¶](#equation-9-34 "Permalink to this equation")\\\[c\_{s} =c\_{a} -1.4r\_{b} P\_{atm} A\_{n}\\\] (2.9.23)[¶](#equation-9-35 "Permalink to this equation")\\\[e\_{s} =\\frac{e\_{a} r\_{s} +e\_{i} r\_{b} }{r\_{b} +r\_{s} }\\\] In terms of conductance with \\(g\_{s} =1/r\_{s}\\) and \\(g\_{b} =1/r\_{b}\\) (2.9.24)[¶](#equation-9-36 "Permalink to this equation")\\\[e\_{s} =\\frac{e\_{a} g\_{b} +e\_{i} g\_{s} }{g\_{b} +g\_{s} } .\\\] Substitution of equation [(2.9.24)](#equation-9-36) into equation [(2.9.1)](#equation-9-1) gives an expression for the stomatal resistance (\\(r\_{s}\\)) as a function of photosynthesis (\\(A\_{n}\\) ) (2.9.25)[¶](#equation-9-37 "Permalink to this equation")\\\[ag\_{s}^{2} + bg\_{s} + c = 0\\\] where (2.9.26)[¶](#equation-9-38 "Permalink to this equation")\\\[\\begin{split}\\begin{array}{l} a = 1 \\\\ b = -\[2(g\_{o} \* 10^{-6} + d) + \\frac{(g\_{1}d)^{2}}{g\_{b}\*10^{-6}D\_{l}}\] \\\\ c = (g\_{o}\*10^{-6})^{2} + \[2g\_{o}\*10^{-6} + d (1-\\frac{g\_{1}^{2}} {D\_{l}})\]d \\end{array}\\end{split}\\\] and (2.9.27)[¶](#equation-9-39 "Permalink to this equation")\\\[ \\begin{align}\\begin{aligned}d = \\frac {1.6 A\_{n}} {c\_{s} / P\_{atm} \* 10^{6}}\\\\D\_{l} = \\frac {max(e\_{i} - e\_{a},50)} {1000}\\end{aligned}\\end{align} \\\] Stomatal conductance, as solved by equation [(2.9.24)](#equation-9-36) (mol m \-2 s \-1), is the larger of the two roots that satisfy the quadratic equation. Values for \\(c\_{i}\\) are given by (2.9.28)[¶](#equation-9-40 "Permalink to this equation")\\\[c\_{i} =c\_{a} -\\left(1.4r\_{b} +1.6r\_{s} \\right)P\_{atm} A{}\_{n}\\\] The equations for \\(c\_{i}\\), \\(c\_{s}\\), \\(r\_{s}\\), and \\(A\_{n}\\) are solved iteratively until \\(c\_{i}\\) converges. [Sun et al. (2012)](https://escomp.github.io/ctsm-docs/versions/master/html/tech_note/References/CLM50_Tech_Note_References.html#sunetal2012) pointed out that the CLM4 numerical approach does not always converge. Therefore, the model uses a hybrid algorithm that combines the secant method and Brent’s method to solve for \\(c\_{i}\\). The equation set is solved separately for sunlit (\\(A\_{n}^{sun}\\), \\(r\_{s}^{sun}\\) ) and shaded (\\(A\_{n}^{sha}\\), \\(r\_{s}^{sha}\\) ) leaves.