Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor_global_as_function_inputs #175

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/+equations/calc_rssrbs.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
function [rss, rbs] = calc_rssrbs(SMC, LAI, rbs)
global SaturatedMC ResidualMC fieldMC
function [rss, rbs] = calc_rssrbs(SMC, LAI, rbs, ResidualMC, fieldMC)
%{
This function is to calculate surface resistance, following C. van der Tol
et al. 2014 (BG). The emperical parameters "aa, 4.1, and 4.3" are
user-defined. And these parameters can be calibrated during winter season
when LAI is low.
%}
aa = 3.8;
rss = exp((aa + 4.1) - aa * (SMC - ResidualMC(1)) / (fieldMC(1) - ResidualMC(1)));
yijianzeng marked this conversation as resolved.
Show resolved Hide resolved
rbs = rbs * LAI / 4.3;
bb = 4.1;
cc = 4.3;

rss = exp((aa + bb) - aa * (SMC - ResidualMC(1)) / (fieldMC(1) - ResidualMC(1)));
rbs = rbs * LAI / cc;
4 changes: 2 additions & 2 deletions src/+io/select_input.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [SoilProperties, leafbio, canopy, meteo, angles, SpaceTimeInfo] = select_input(ScopeParameters, digitsVector, canopy, options, SpaceTimeInfo, SoilProperties)
function [SoilProperties, leafbio, canopy, meteo, angles, SpaceTimeInfo] = select_input(ScopeParameters, digitsVector, canopy, options, SoilProperties, SpaceTimeInfo)
global Theta_LL theta_s0
SoilProperties.spectrum = ScopeParameters.spectrum(digitsVector(16));
SoilProperties.rss = ScopeParameters.rss(digitsVector(17));
Expand Down Expand Up @@ -82,7 +82,7 @@
SoilProperties.GAM = equations.Soil_Inertia0(SoilProperties.cs, SoilProperties.rhos, SoilProperties.lambdas);
end
if options.calc_rss_rbs
[SoilProperties.rss, SoilProperties.rbs] = equations.calc_rssrbs(SoilProperties.SMC, canopy.LAI, SoilProperties.rbs);
[SoilProperties.rss, SoilProperties.rbs] = equations.calc_rssrbs(SoilProperties.SMC, canopy.LAI, SoilProperties.rbs, SoilProperties.ResidualMC, SoilProperties.fieldMC);
end

if leafbio.Type
Expand Down
4 changes: 2 additions & 2 deletions src/STEMMUS_SCOPE.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
ScopeParametersNames = fieldnames(ScopeParameters);
if options.simulation == 1
vi = ones(length(ScopeParametersNames), 1);
[soil, leafbio, canopy, meteo, angles, xyt] = io.select_input(ScopeParameters, vi, canopy, options);
[soil, leafbio, canopy, meteo, angles, xyt] = io.select_input(ScopeParameters, vi, canopy, options, SoilProperties);
[ScopeParameters, xyt, canopy] = io.loadTimeSeries(ScopeParameters, leafbio, soil, canopy, meteo, constants, F, xyt, path_input, options);
else
soil = struct;
Expand Down Expand Up @@ -512,7 +512,7 @@
if options.simulation == 0
vi(vmax == telmax) = k;
end
[soil, leafbio, canopy, meteo, angles, xyt] = io.select_input(ScopeParameters, vi, canopy, options, xyt, soil);
[soil, leafbio, canopy, meteo, angles, xyt] = io.select_input(ScopeParameters, vi, canopy, options, soil, xyt);
if options.simulation ~= 1
fprintf('simulation %i ', k);
fprintf('of %i \n', telmax);
Expand Down