-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from EcoExtreML/rm_unused_vars
Rm unused variables and equations
- Loading branch information
Showing
21 changed files
with
199 additions
and
212 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function groundWaterDepth = calculateGroundWaterDepth(topLevel, headBotmLayer, Tot_Depth) | ||
% water table depth: depth from top soil layer to groundwater level | ||
groundWaterDepth = topLevel - headBotmLayer; % depth from top layer to groundwater level | ||
|
||
% Check that the position of the water table is within the soil column | ||
if groundWaterDepth <= 0 | ||
warning('The soil is fully saturated up to the land surface level!'); | ||
groundWaterDepth = 1.0; % to avoid model crashing, assign minimum groundWaterDepth value of 1 cm | ||
elseif groundWaterDepth > Tot_Depth | ||
warning('Groundwater table is below the end of the soil column!'); | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
function indxAqLay = calculateIndexAquifer(aqlevels, numAqL, soilThick) | ||
%{ | ||
Assign the index of the MODFLOW aquifer that corresponds to each STEMMUS soil layer. | ||
aqlevels elevation of top surface level and all bottom levels of aquifer layers | ||
numAqL number of MODFLOW aquifer layers, received from MODFLOW through BMI | ||
%} | ||
|
||
% Load model settings | ||
ModelSettings = io.getModelSettings(); | ||
|
||
numAqN = numAqL + 1; % number of MODFLOW aquifer nodes | ||
indxAqLay = zeros(ModelSettings.NN, 1); | ||
indxAqLay(1) = 1; | ||
for i = 2:ModelSettings.NN | ||
for K = 2:numAqN | ||
Z1 = aqlevels(K - 1); | ||
Z0 = aqlevels(K); | ||
ZZ = aqlevels(1) - soilThick(i); | ||
if ZZ <= Z1 && ZZ > Z0 | ||
indxAqLay(i) = K - 1; | ||
break | ||
elseif ZZ == Z0 && K == numAqN | ||
indxAqLay(i) = K - 1; | ||
break | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function [indxBotmLayer, indxBotmLayer_R] = calculateIndexBottomLayer(soilThick, gw_Dep) | ||
%{ | ||
Calculate the index of the bottom layer level using MODFLOW data | ||
indxBotmLayer_R index of the bottom layer that contains the current headBotmLayer (top to bottom) | ||
indxBotmLayer index of the bottom layer that contains the current headBotmLayer (bottom to top) | ||
%} | ||
|
||
indxBotmLayer_R = []; | ||
|
||
% Load model settings | ||
ModelSettings = io.getModelSettings(); | ||
|
||
for i = 1:ModelSettings.NL | ||
midThick = (soilThick(i) + soilThick(i + 1)) / 2; | ||
if gw_Dep >= soilThick(i) && gw_Dep < soilThick(i + 1) | ||
if gw_Dep < midThick | ||
indxBotmLayer_R = i; | ||
elseif gw_Dep >= midThick | ||
indxBotmLayer_R = i + 1; | ||
end | ||
break | ||
elseif gw_Dep >= soilThick(i + 1) | ||
continue | ||
end | ||
end | ||
|
||
% Note: indxBotmLayer_R starts from top to bottom, opposite of STEMMUS (bottom to top) | ||
indxBotmLayer = ModelSettings.NN - indxBotmLayer_R + 1; % index of bottom layer (from bottom to top) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function soilThick = calculateSoilLayerThickness() | ||
%{ | ||
Calculate soil layers thickness (cumulative layers thickness; e.g. 1, 2, | ||
3, 5, 10, ......., 480, total soil depth) | ||
soilThick cumulative soil layers thickness (from top to bottom) | ||
%} | ||
|
||
% Load model settings | ||
ModelSettings = io.getModelSettings(); | ||
|
||
soilThick = zeros(ModelSettings.NN, 1); % cumulative soil layers thickness | ||
soilThick(1) = 0; | ||
|
||
for i = 2:ModelSettings.NL | ||
soilThick(i) = soilThick(i - 1) + ModelSettings.DeltZ_R(i - 1); | ||
end | ||
soilThick(ModelSettings.NN) = ModelSettings.Tot_Depth; % total soil depth | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
function GroundwaterSettings = initializeGroundwaterSettings() | ||
%{ | ||
added by Mostafa, | ||
The concept followed to couple STEMMUS to MODFLOW can be found at https://doi.org/10.5194/hess-23-637-2019 | ||
and also in (preprint) https://doi.org/10.5194/gmd-2022-221 | ||
%%%%%%%%%% Important note %%%%%%%%%% | ||
The index order for the soil layers in STEMMUS is from bottom to top (NN:1), where NN is the number of STEMMUS soil layers, | ||
which is the opposite of MODFLOW (top to bottom). So, when converting information between STEMMUS and MODFLOW, indices need to be flipped | ||
%%%%%%%%%% Variables definitions %%%%%%%%%% | ||
headBotmLayer groundwater head (cm) at the bottom layer, received from MODFLOW through BMI | ||
tempBotm groundwater temperature (C) at the bottom layer, received from MODFLOW through BMI | ||
topLevel elevation of the top surface aquifer layer, received from MODFLOW through BMI | ||
% numAqL number of MODFLOW aquifer layers, received from MODFLOW through BMI | ||
% aqBotmlevels elevation of all bottom levels of aquifer layers, received from MODFLOW through BMI | ||
% aqlevels elevation of top surface level and all bottom levels of aquifer layers | ||
% SS specific storage of MODFLOW aquifers, default value = 0.05 (unitless) | ||
% SY specific yield of MODFLOW aquifers, default value = 1e-5 (1/m) | ||
%} | ||
|
||
% Activate/deactivate Groundwater coupling | ||
GroundwaterSettings.GroundwaterCoupling = 0; % (value = 0 -> deactivate coupling, or = 1 -> activate coupling); default = 0, update value to = 1 -> through BMI | ||
|
||
% Initialize the variables (head, temperature) at the bottom boundary (start of saturated zone) | ||
GroundwaterSettings.headBotmLayer = 1950.0; % groundwater head (cm) at bottom layer | ||
GroundwaterSettings.tempBotm = NaN; % groundwater temperature at bottom layer (C) | ||
|
||
% Call MODFLOW layers information (number of aquifer layers and their elevations, etc) | ||
% elevation of the top surface aquifer layer | ||
GroundwaterSettings.topLevel = 2000.0; | ||
|
||
% GroundwaterSettings.numAqL = 5; % number of MODFLOW aquifer layers | ||
% GroundwaterSettings.aqBotmlevels = [1900.0 1800.0 1700.0 1600.0 1500.0]; % elevation of all bottom levels of aquifer layers | ||
% GroundwaterSettings.aqlevels = [GroundwaterSettings.topLevel, GroundwaterSettings.aqBotmlevels]; % elevation of top surface level and all bottom levels of aquifer layers | ||
|
||
% Define Specific yield (SY) and Specific storage (SS) with default values (otherwise received from MODFLOW through BMI) | ||
% GroundwaterSettings.SY = [0.05 0.05 0.05 0.05 0.05]; % default SY = 0.05 (unitless) | ||
% GroundwaterSettings.SS = [1e-7 1e-7 1e-7 1e-7 1e-7]; % default SS = 1e-5 1/m = 1e-7 1/cm | ||
end |
Oops, something went wrong.