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

Explain function Max_Rootdepth #176

Merged
merged 4 commits into from
Jun 17, 2024
Merged
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
23 changes: 10 additions & 13 deletions src/Max_Rootdepth.m
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Subfunction - Root - Depth %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% REFERENCES
function [bbx] = Max_Rootdepth(bbx)

%{
Yunfei-Wang1993 marked this conversation as resolved.
Show resolved Hide resolved
The function identify if there is root in certain layer, bbx=0 indicates no
roots while bbx=1 indicates roots existing
%}

% get model settings
ModelSettings = io.getModelSettings();

% BR = 10:1:650; %% [gC /m^2 PFT]
% rroot = 0.5*1e-3 ; % 3.3*1e-4 ;%% [0.5-6 *10^-3] [m] root radius
%%% OUTPUTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%% Root lenth distribution %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
R_depth = ModelSettings.R_depth;

R_depth = ModelSettings.R_depth; % User-defined for different PFTs: maximum rooting depth [cm]
Tot_Depth = ModelSettings.Tot_Depth;
DeltZ = ModelSettings.DeltZ;
Elmn_Lnth = 0;
Elmn_Lnth = 0; % Rooting depth of each layer
for ML = 1:ModelSettings.NL
Elmn_Lnth = Elmn_Lnth + DeltZ(ML);
if Elmn_Lnth < Tot_Depth - R_depth
bbx(ML) = 0;
elseif Elmn_Lnth >= Tot_Depth - R_depth && Elmn_Lnth <= Tot_Depth - 5
bbx(ML) = 0; % bbx = indicate if there is root exist in this layer
elseif Elmn_Lnth >= Tot_Depth - R_depth && Elmn_Lnth <= Tot_Depth - 5 % 5 is the depths of shallow roots (user-defined)
bbx(ML) = 1;
else
bbx(ML) = 0;
Expand Down
Loading