% Supplemental program 6.2% -----------------------------------------------------------% Use Harman & Finnigan (2007, 2008) roughness sublayer (RSL)% theory to obtain roughness lengths for momentum and scalars% -----------------------------------------------------------% --- Input parameters% von Karman constantvkc=0.4;% Leaf Nusselt number (heat) or Stanton number (scalar)% with values of 0.1-0.2%rc = 0.1;rc=0.2;% Leaf drag coefficientcd=0.25;% Canopy height (m)hc=20;% Leaf area index (m2/m2)LAI=5;% Leaf area densitylad=LAI/hc;% Canopy density length scale (m)Lc=1/(cd*lad);% Obukhov length (m)obu=-1000;% --- Determine beta_val = u* / u(h) for the current Obukhov length% Neutral value for beta = u* / u(h)beta_neutral=0.35;% Lc/obuLcL=Lc/obu;% The unstable case is a quadratic equation for beta^2 at LcLif(LcL<=0)a=1;b=16*LcL*beta_neutral^4;c=-beta_neutral^4;beta_val=sqrt((-b+sqrt(b^2-4*a*c))/(2*a));% Error checky=beta_val^2*LcL;fy=(1-16*y)^(-0.25);err=beta_val*fy-beta_neutral;if(abs(err)>1e-10)error('unstable case: error in beta')endend% The stable case is a cubic equation for beta at LcLif(LcL>0)a=5*LcL;b=0;c=1;d=-beta_neutral;q=(2*b^3-9*a*b*c+27*(a^2)*d)^2-4*(b^2-3*a*c)^3;q=sqrt(q);r=0.5*(q+2*b^3-9*a*b*c+27*(a^2)*d);r=r^(1/3);beta_val=-(b+r)/(3*a)-(b^2-3*a*c)/(3*a*r);% Error checky=beta_val^2*LcL;fy=1+5*y;err=beta_val*fy-beta_neutral;if(abs(err)>1e-10)error('stable case: error in beta')endend% --- For current beta = u*/u(h) determine displacement heightdp=beta_val^2*Lc;% dp = hc - dispdisp=max(hc-dp,0);% Displacement height (m)% Save canopy height (relative to displacement height),% because this is used many timeh_minus_d=hc-disp;% --- Turbulent Prandlt number (Pr) at canopy heightPrn=0.5;% Neutral value for PrPrvr=0.3;% Magnitude of variation of Pr with stabilityPrsc=2.0;% Scale of variation of Pr with stabilityPr=Prn+Prvr*tanh(Prsc*Lc/obu);% --- The "f" parameter relates the length scale of the scalar (heat) to that of momentum fval=(sqrt(1+4*rc*Pr)-1)/2;% --- Calculate the parameters c1 and c2 needed for the RSL function phi_hat% Evaluate Monin-Obukhov phi functions at (hc-disp)/obu[phi_m_hc]=phi_m_monin_obukhov(h_minus_d/obu);[phi_c_hc]=phi_c_monin_obukhov(h_minus_d/obu);% Roughness sublayer depth scale multiplier (dimensionless)c2=0.5;% c1 for momentum and scalars (dimensionless)c1m=(1-vkc/(2*beta_val*phi_m_hc))*exp(c2/2);c1c=(1-Pr*vkc/(2*beta_val*phi_c_hc))*exp(c2/2);% --- Evaluate the roughness sublayer psi_hat functions for momentum and scalars% These are calculated at the canopy height. Note that here the heights are adjusted% for the displacement height before the integration.[psi_m_rsl_hc]=psi_m_rsl(h_minus_d,h_minus_d,obu,c1m,c2);% momentum at (hc-disp)[psi_c_rsl_hc]=psi_c_rsl(h_minus_d,h_minus_d,obu,c1c,c2);% scalars at (hc-disp)% --- Evaluate the Monin-Obukhov psi functions for momentum and scalars at the canopy height[psi_m_hc]=psi_m_monin_obukhov(h_minus_d/obu);% momentum at (hc-disp)/obu[psi_c_hc]=psi_c_monin_obukhov(h_minus_d/obu);% scalars at (hc-disp)/obu% --- Roughness lengths z0m and z0c (m)% z0m - Use bisection to find z0m, which lies between aval and bval, and refine the% estimate until the difference is less than erraval=hc;bval=0;err=1e-12;[psi_m_z0m]=psi_m_monin_obukhov(aval/obu);z0m=h_minus_d*exp(-vkc/beta_val)*exp(-psi_m_hc+psi_m_z0m)*exp(psi_m_rsl_hc);fa=z0m-aval;[psi_m_z0m]=psi_m_monin_obukhov(bval/obu);z0m=h_minus_d*exp(-vkc/beta_val)*exp(-psi_m_hc+psi_m_z0m)*exp(psi_m_rsl_hc);fb=z0m-bval;if(fa*fb>0)error('RSL bisection error: f(a) and f(b) do not have opposite signs')endwhile(abs(bval-aval)>err)cval=(aval+bval)/2;[psi_m_z0m]=psi_m_monin_obukhov(cval/obu);z0m=h_minus_d*exp(-vkc/beta_val)*exp(-psi_m_hc+psi_m_z0m)*exp(psi_m_rsl_hc);fc=z0m-cval;if(fa*fc<0)bval=cval;fb=fc;elseaval=cval;fa=fc;endendz0m=cval;% z0c - Use bisection to find z0c, which lies between aval and bval, and refine the% estimate until the difference is less than erraval=hc;bval=0;[psi_c_z0c]=psi_c_monin_obukhov(aval/obu);z0c=h_minus_d*exp(-vkc/beta_val*Pr/fval)*exp(-psi_c_hc+psi_c_z0c)*exp(psi_c_rsl_hc);fa=z0c-aval;[psi_c_z0c]=psi_c_monin_obukhov(bval/obu);z0c=h_minus_d*exp(-vkc/beta_val*Pr/fval)*exp(-psi_c_hc+psi_c_z0c)*exp(psi_c_rsl_hc);fb=z0c-bval;if(fa*fb>0)error('RSL bisection error: f(a) and f(b) do not have opposite signs')endwhile(abs(bval-aval)>err)cval=(aval+bval)/2;[psi_c_z0c]=psi_c_monin_obukhov(cval/obu);z0c=h_minus_d*exp(-vkc/beta_val*Pr/fval)*exp(-psi_c_hc+psi_c_z0c)*exp(psi_c_rsl_hc);fc=z0c-cval;if(fa*fc<0)bval=cval;fb=fc;elseaval=cval;fa=fc;endendz0c=cval;% --- Write outputkbinv=log(z0m/z0c);fprintf('z0m = %15.3f\n',z0m)fprintf('z0c = %15.3f\n',z0c)fprintf('kB^{-1} = %15.3f\n',kbinv)
function[psi_c]=psi_c_monin_obukhov(x)% --- Evaluate the Monin-Obukhov psi function for scalars at xif(x<0)y=(1-16*x)^0.25;psi_c=2*log((1+y^2)/2);elsepsi_c=-5*x;end
function[psi_hat_c]=psi_c_rsl(z,h,L,c1,c2)% --- Evaluate the roughness sublayer (RSL) function psi_hat for scalars% at z. Note that z has already been adjusted for the displacement height% (i.e., using z - d).% ------------------------------------------------------% Input% z ! Vertical height - displacement height (m)% h ! Canopy height - displacement height (m)% L ! Obukhov length (m)% c1 ! Parameter for RSL function phi_hat (dimensionless)% c2 ! Parameter for RSL function phi_hat (dimensionless)%% Output% psi_hat_c ! RSL psi_hat function for scalars (dimensionless)% ------------------------------------------------------% The function to integrate depends on unstable (f1) or stable (f2)f1=@(x)(1-16*x/L).^(-0.5).*(1-(1-c1*exp(-c2*x/(2*h))))./x;f2=@(x)(1+5*x/L).*(1-(1-c1*exp(-c2*x/(2*h))))./x;% Numerically integrate the function from z to infinityif(L<0)psi_hat_c=integral(f1,z,inf);elsepsi_hat_c=integral(f2,z,inf);end
function[psi_m]=psi_m_monin_obukhov(x)% --- Evaluate the Monin-Obukhov psi function for momentum at xif(x<0)y=(1-16*x)^0.25;psi_m=2*log((1+y)/2)+log((1+y^2)/2)-2*atan(y)+pi/2;elsepsi_m=-5*x;end
function[psi_hat_m]=psi_m_rsl(z,h,L,c1,c2)% --- Evaluate the roughness sublayer (RSL) function psi_hat for momentum% at z. Note that z has already been adjusted for the displacement height% (i.e., using z - d).% ------------------------------------------------------% Input% z ! Vertical height - displacement height (m)% h ! Canopy height - displacement height (m)% L ! Obukhov length (m)% c1 ! Parameter for RSL function phi_hat (dimensionless)% c2 ! Parameter for RSL function phi_hat (dimensionless)%% Output% psi_hat_m ! RSL psi_hat function for momentum (dimensionless)% ------------------------------------------------------% The function to integrate depends on unstable (f1) or stable (f2)f1=@(x)(1-16*x/L).^(-0.25).*(1-(1-c1*exp(-c2*x/(2*h))))./x;f2=@(x)(1+5*x/L).*(1-(1-c1*exp(-c2*x/(2*h))))./x;% Numerically integrate the function from z to infinityif(L<0)psi_hat_m=integral(f1,z,inf);elsepsi_hat_m=integral(f2,z,inf);end