Skip to content

Commit

Permalink
set gsMethod and phsOption via input_data.xlsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal-szj committed Oct 4, 2024
1 parent d69c75a commit c477a40
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
26 changes: 16 additions & 10 deletions src/STEMMUS_SCOPE.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
% Read the configPath file. Due to using MATLAB compiler, we cannot use run(CFG)
disp (['Reading config from ', CFG]);
[InputPath, OutputPath, InitialConditionPath] = io.read_config(CFG);
gsOption = 'Medlyn'; % 1 for BallBerry's method; 2 for Medlyn's method
phsOption = 2; % 1 for CLM5, 2 for ED2, 3 for PHS


% Prepare forcing and soil data
[SiteProperties, SoilProperties, TimeProperties] = io.prepareInputData(InputPath);
Expand Down Expand Up @@ -88,12 +85,11 @@
RWUs = [];
RWUg = [];

%% Set senarios
[gsMethod, phwsfMethod] = setScenario(gsOption, phsOption);


%% 1. define Constants
Constants = io.define_constants();
ParaPlant = io.define_plant_constants(SiteProperties, phwsfMethod);


RTB = 1000; % initial root total biomass (g m-2)
if strcmp(SiteProperties.sitename, 'CH-HTC')
Expand All @@ -103,10 +99,6 @@
% [Rl, Ztot] = Initial_root_biomass(RTB, ModelSettings.DeltZ_R, ModelSettings.rroot, ModelSettings.ML, SiteProperties.landcoverClass(1));
numSoilLayer = ModelSettings.ML;
soilThickness = ModelSettings.DeltZ_R';
[RootProperties,soilDepth] = calRootProperties(SiteProperties, ParaPlant, numSoilLayer, soilThickness, RTB);
Rl = RootProperties.lengthDensity;
Ztot = soilDepth;
soilDepthB2T = flipud(soilDepth);


%% 2. simulation options
Expand All @@ -116,6 +108,20 @@
parameter_file = {'input_data.xlsx'};
options = io.readStructFromExcel([path_input char(parameter_file)], 'options', 2, 1);

% Set senarios
gsOption = options.gsOption;
phsOption = options.plantHydraulics;
[gsMethod, phwsfMethod] = setScenario(gsOption, phsOption);

% define parameters for plant hydraulics module
ParaPlant = io.define_plant_constants(SiteProperties, phwsfMethod);

% calculate root parameters
[RootProperties,soilDepth] = calRootProperties(SiteProperties, ParaPlant, numSoilLayer, soilThickness, RTB);
Rl = RootProperties.lengthDensity;
Ztot = soilDepth;
soilDepthB2T = flipud(soilDepth);

if options.simulation > 2 || options.simulation < 0
fprintf('\n simulation option should be between 0 and 2 \r');
return
Expand Down
25 changes: 18 additions & 7 deletions src/setScenario.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
hydraulic pathway option.
input:
gsOption: a string indicate which stomatal conductance will be used
gsOption: a number indicate the stomatal conductance approach:
1 for BallBerry, ref[1]
2 for Medlyn, ref[2]
phsOption: a number indicate whether use plant hydraulic pathway
output:
biochemical: a string, indicate which function will be used
gsMethod: a number indicate the stomatal conductance scheme:
1 for BallBerry
2 for Medlyn
Expand All @@ -17,15 +18,25 @@
2 for ED2,
3 for PHS
references:
[1] Ball, J. T., et al. (1987). A Model Predicting Stomatal Conductance
and its Contribution to the Control of Photosynthesis under
Different Environmental Conditions, Springer, Dordrecht.
[2] Medlyn, B. E., et al. (2011). "Reconciling the optimal and empirical
approaches to modelling stomatal conductance."
Global Change Biology 17(6): 2134-2144.
%}

%% Set scenario
%biochemical = @biochemical;
if strcmp(gsOption, 'BallBerry')
gsMethod = 1;
elseif strcmp(gsOption, 'Medlyn')
gsMethod = 2;
switch gsOption
case 1
gsMethod = 1; % BallBerry stomatal conductance
case 2
gsMethod = 2; % Medlyn stomatal conductance
end

%% PHS setting
if phsOption % if phsOption is true, PHS open. Set plant water stress method.
switch phsOption
Expand Down

0 comments on commit c477a40

Please sign in to comment.