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

Add a new csv to import soil layers settings #243

Merged
merged 40 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d57490b
add a new csv to import soil layer settings
MostafaGomaa93 Jul 25, 2024
352a219
Update STEMMUS_SCOPE.m
MostafaGomaa93 Jul 25, 2024
db55a86
Update initializeGroundwaterSettings.m
MostafaGomaa93 Jul 25, 2024
edcac61
Remove the number from function input
MostafaGomaa93 Jul 25, 2024
f118ceb
Remove one white line
MostafaGomaa93 Jul 25, 2024
a56e462
Correct file name (replace calcuulateDTheta_LLh.m with calculateDThet…
MostafaGomaa93 Jul 25, 2024
f2b2c91
add a new csv to import soil layer settings
MostafaGomaa93 Jul 26, 2024
8ee4c13
remove findPhreaticSurface function
MostafaGomaa93 Jul 26, 2024
b1069d9
switch off coupling
MostafaGomaa93 Jul 26, 2024
18c39d3
Merge branch 'main' into add_csv_for_soil_layers_settings
SarahAlidoost Aug 14, 2024
b0e625b
Update src/+conductivity/+hydraulicConductivity/calculateDTheta_LLh.m
MostafaGomaa93 Aug 15, 2024
f4a277f
Update src/+io/readSoilLayerSettings.m
MostafaGomaa93 Aug 15, 2024
e919914
Update src/+io/readSoilLayerSettings.m
MostafaGomaa93 Aug 15, 2024
b563ad6
Update src/+io/readSoilLayerSettings.m
MostafaGomaa93 Aug 15, 2024
6cf1f50
Update src/STEMMUS_SCOPE.m
MostafaGomaa93 Aug 15, 2024
77218e8
Update src/STEMMUS_SCOPE.m
MostafaGomaa93 Aug 15, 2024
fbb938b
Update readSoilLayerSettings.m
MostafaGomaa93 Aug 15, 2024
46913d8
Update STEMMUS_SCOPE.m
MostafaGomaa93 Aug 15, 2024
c795088
move calculateSoilLayerThickness from +groundwater to +io
MostafaGomaa93 Aug 15, 2024
ee43233
Add files via upload
MostafaGomaa93 Aug 15, 2024
506a1f1
Delete src/+groundwater/calculateSoilLayerThickness.m
MostafaGomaa93 Aug 15, 2024
fa3946f
Create new folder for example data
MostafaGomaa93 Aug 16, 2024
b37b5de
Add files via upload
MostafaGomaa93 Aug 16, 2024
ca89f90
Delete example_data/t.txt
MostafaGomaa93 Aug 16, 2024
d174de7
Add explanation of the new csv file
MostafaGomaa93 Aug 16, 2024
5b8ffb8
Add explanation of the new csv file
MostafaGomaa93 Aug 16, 2024
6bbabc4
Update STEMMUS_SCOPE_on_CRIB.md
MostafaGomaa93 Aug 16, 2024
9c15b8b
Update src/STEMMUS_SCOPE_exe.m
MostafaGomaa93 Aug 19, 2024
50ab639
Update src/STEMMUS_SCOPE.m
MostafaGomaa93 Aug 19, 2024
8977335
Delete src/+io/checkModelRun.m
MostafaGomaa93 Aug 19, 2024
f484cdd
Update docs/STEMMUS_SCOPE_on_CRIB.md
MostafaGomaa93 Aug 19, 2024
dd6946d
Update CHANGELOG.md
MostafaGomaa93 Aug 19, 2024
3148e18
Update CHANGELOG.md
MostafaGomaa93 Aug 19, 2024
5221869
Update CHANGELOG.md
MostafaGomaa93 Aug 19, 2024
bf77ad5
Update STEMMUS_SCOPE.m
MostafaGomaa93 Aug 19, 2024
b427187
Update getModelSettings.m
MostafaGomaa93 Aug 19, 2024
8588671
Update readSoilLayerSettings.m
MostafaGomaa93 Aug 19, 2024
2796fd5
new exe file
Aug 19, 2024
c86ce7a
fix some leftover ModelSettings
SarahAlidoost Aug 20, 2024
f3d02e0
regenerate exe file
SarahAlidoost Aug 20, 2024
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
SarahAlidoost marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function dtheta_llh = calcuulateDTheta_LLh(dtheta_uuh, theta_m, theta_uu, theta_ll, gamma_hh, SoilVariables, VanGenuchten)
function dtheta_llh = calcuulateDTheta_LLh(dtheta_uuh, theta_m, theta_uu, theta_ll, gamma_hh, SoilVariables, VanGenuchten, ModelSettings)
theta_s = VanGenuchten.Theta_s;
MostafaGomaa93 marked this conversation as resolved.
Show resolved Hide resolved
theta_r = VanGenuchten.Theta_r;
alpha = VanGenuchten.Alpha;
Expand All @@ -14,8 +14,6 @@
theta_l = SoilVariables.Theta_L;
h_frez = SoilVariables.h_frez;

% get model settings
ModelSettings = io.getModelSettings();
heatTerm = hh + hh_frez;
if ModelSettings.SWCC == 1
if ModelSettings.SFCC == 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function dtheta_uuh = calculateDTheta_UUh(theta_uu, theta_m, theta_ll, gamma_hh, SoilVariables, VanGenuchten)
function dtheta_uuh = calculateDTheta_UUh(theta_uu, theta_m, theta_ll, gamma_hh, SoilVariables, VanGenuchten, ModelSettings)
theta_s = VanGenuchten.Theta_s;
theta_r = VanGenuchten.Theta_r;
alpha = VanGenuchten.Alpha;
Expand All @@ -14,9 +14,6 @@
phi_s = SoilVariables.Phi_s;
lamda = SoilVariables.Lamda;

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

heatTerm = hh + hh_frez;
if ModelSettings.SWCC == 1
if ModelSettings.SFCC == 1
Expand Down
4 changes: 1 addition & 3 deletions src/+conductivity/+hydraulicConductivity/calculateSe.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
function se = calculateSe(theta_ll, gamma_hh, SoilVariables)
% get model settings
ModelSettings = io.getModelSettings();
function se = calculateSe(theta_ll, gamma_hh, SoilVariables, ModelSettings)

% get soil constants
SoilConstants = io.getSoilConstants();
Expand Down
5 changes: 1 addition & 4 deletions src/+conductivity/+hydraulicConductivity/calculateTheta_II.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
function theta_ii = calculateTheta_II(tt, xcap, hh, Theta_II)

% get model settings
ModelSettings = io.getModelSettings();
function theta_ii = calculateTheta_II(tt, xcap, hh, Theta_II, ModelSettings)

Tf1 = 273.15 + 1;
Tf2 = 273.15 - 3;
Expand Down
4 changes: 1 addition & 3 deletions src/+conductivity/+hydraulicConductivity/calculateTheta_LL.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
function theta_ll = calculateTheta_LL(theta_uu, theta_ii, theta_m, gamma_hh, SoilVariables, VanGenuchten)
% get model settings
ModelSettings = io.getModelSettings();
function theta_ll = calculateTheta_LL(theta_uu, theta_ii, theta_m, gamma_hh, SoilVariables, VanGenuchten, ModelSettings)

% load Constants
Constants = io.define_constants();
Expand Down
5 changes: 1 addition & 4 deletions src/+conductivity/+hydraulicConductivity/calculateTheta_UU.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function theta_uu = calculateTheta_UU(theta_m, gamma_hh, SoilVariables, VanGenuchten)
function theta_uu = calculateTheta_UU(theta_m, gamma_hh, SoilVariables, VanGenuchten, ModelSettings)

hh = SoilVariables.hh;
phi_s = SoilVariables.Phi_s;
Expand All @@ -10,9 +10,6 @@
n = VanGenuchten.n;
m = VanGenuchten.m;

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

% calculate theta_uu
if ModelSettings.SWCC == 1
if ModelSettings.SFCC == 1
Expand Down
5 changes: 1 addition & 4 deletions src/+conductivity/+hydraulicConductivity/fixHeat.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
function [hh, hh_frez] = fixHeat(hh, hh_frez, Phi_s)

% get model settings
ModelSettings = io.getModelSettings();
function [hh, hh_frez] = fixHeat(hh, hh_frez, Phi_s, ModelSettings)

if ModelSettings.SWCC == 1
if ModelSettings.SFCC ~= 1
Expand Down
5 changes: 1 addition & 4 deletions src/+conductivity/calculateGasConductivity.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function k_g = calculateGasConductivity(InitialValues, TransportCoefficient, VanGenuchten, SoilVariables)
function k_g = calculateGasConductivity(InitialValues, TransportCoefficient, VanGenuchten, SoilVariables, ModelSettings)
%{
This is to calculate the intrinsic permeability of soil for gas flow.
Scanlon, B. R. (2000), Soil gas movement in unsaturated systems, in
Expand All @@ -10,9 +10,6 @@
20107, doi:10.1029/2011JD015835, 2011.
%}

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

% load Constants
Constants = io.define_constants();

Expand Down
19 changes: 8 additions & 11 deletions src/+conductivity/calculateHydraulicConductivity.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function SoilVariables = calculateHydraulicConductivity(SoilVariables, VanGenuchten, KIT, L_f)
function SoilVariables = calculateHydraulicConductivity(SoilVariables, VanGenuchten, KIT, L_f, ModelSettings)
%{
This is to calculate the hydraulic conductivity of soil, based on
hydraulic conductivity models (like VG and others).
Expand All @@ -11,9 +11,6 @@ hydraulic conductivity models (like VG and others).
20107, doi:10.1029/2011JD015835, 2011.
%}

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

% load Constants
Constants = io.define_constants();

Expand Down Expand Up @@ -73,26 +70,26 @@ hydraulic conductivity models (like VG and others).
SV = sliceVector(SV, lengthX, MN);
SV = sliceMatrix(SV, lengthX, ModelSettings.nD, MN, j);

[hh, hh_frez] = conductivity.hydraulicConductivity.fixHeat(SV.hh, SV.hh_frez, SV.Phi_s);
[hh, hh_frez] = conductivity.hydraulicConductivity.fixHeat(SV.hh, SV.hh_frez, SV.Phi_s, ModelSettings);
SV.hh = hh;
SV.hh_frez = hh_frez;

Gamma_hh = conductivity.hydraulicConductivity.calculateGamma_hh(SV.hh);
Theta_m = conductivity.hydraulicConductivity.calculateTheta_m(Gamma_hh, VG, SV.POR);
Theta_UU = conductivity.hydraulicConductivity.calculateTheta_UU(Theta_m, Gamma_hh, SV, VG);
Theta_UU = conductivity.hydraulicConductivity.calculateTheta_UU(Theta_m, Gamma_hh, SV, VG, ModelSettings);

% circular calculation of Theta_II! See issue 181, item 3
% Theta_II is soil ice content,
% Theta_LL is liquid water content,
% Theta_UU is the total water content before soil freezing. The
% 'Theta_UU' is set as saturation.
Theta_II = conductivity.hydraulicConductivity.calculateTheta_II(SV.TT, SV.XCAP, SV.hh, SV.Theta_II);
Theta_LL = conductivity.hydraulicConductivity.calculateTheta_LL(Theta_UU, Theta_II, Theta_m, Gamma_hh, SV, VG);
Theta_II = conductivity.hydraulicConductivity.calculateTheta_II(SV.TT, SV.XCAP, SV.hh, SV.Theta_II, ModelSettings);
Theta_LL = conductivity.hydraulicConductivity.calculateTheta_LL(Theta_UU, Theta_II, Theta_m, Gamma_hh, SV, VG, ModelSettings);
Theta_II = (Theta_UU - Theta_LL) * Constants.RHOL / Constants.RHOI; % ice water contentTheta_II

DTheta_UUh = conductivity.hydraulicConductivity.calculateDTheta_UUh(Theta_UU, Theta_m, Theta_LL, Gamma_hh, SV, VG);
DTheta_LLh = conductivity.hydraulicConductivity.calcuulateDTheta_LLh(DTheta_UUh, Theta_m, Theta_UU, Theta_LL, Gamma_hh, SV, VG);
Se = conductivity.hydraulicConductivity.calculateSe(Theta_LL, Gamma_hh, SV);
DTheta_UUh = conductivity.hydraulicConductivity.calculateDTheta_UUh(Theta_UU, Theta_m, Theta_LL, Gamma_hh, SV, VG, ModelSettings);
DTheta_LLh = conductivity.hydraulicConductivity.calculateDTheta_LLh(DTheta_UUh, Theta_m, Theta_UU, Theta_LL, Gamma_hh, SV, VG, ModelSettings);
Se = conductivity.hydraulicConductivity.calculateSe(Theta_LL, Gamma_hh, SV, ModelSettings);

% Ratio_ice used in Condg_k_g.m
if Theta_UU ~= 0
Expand Down
5 changes: 1 addition & 4 deletions src/+conductivity/calculateSoilThermalProperites.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [ETCON, EHCAP, TETCON, EfTCON, ZETA] = calculateSoilThermalProperites(InitialValues, ThermalConductivity, SoilVariables, VanGenuchten, DRHOVT, L, RHOV)
function [ETCON, EHCAP, TETCON, EfTCON, ZETA] = calculateSoilThermalProperites(InitialValues, ThermalConductivity, SoilVariables, VanGenuchten, ModelSettings, DRHOVT, L, RHOV)
%{
This is used to calculate Heat Capacity and Thermal Conductivity.
%}
Expand Down Expand Up @@ -38,9 +38,6 @@
% load Constants
Constants = io.define_constants();

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

MN = 0;
TCON(1) = 1.37e-3 * 4.182;
for i = 1:ModelSettings.NL
Expand Down
7 changes: 2 additions & 5 deletions src/+conductivity/calculateThermalConductivityCapacity.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function ThermalConductivityCapacity = calculateThermalConductivityCapacity(InitialValues, ThermalConductivity, SoilVariables, VanGenuchten, DRHOVT, L, RHOV)
function ThermalConductivityCapacity = calculateThermalConductivityCapacity(InitialValues, ThermalConductivity, SoilVariables, VanGenuchten, ModelSettings, DRHOVT, L, RHOV)
%{
This is to calculate thermal conductivity and thermal capacity.
Chung, S. O., and R. Horton (1987), Soil heat and water flow with a
Expand All @@ -9,9 +9,6 @@
20107, doi:10.1029/2011JD015835, 2011.
%}

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

% load Constants
Constants = io.define_constants();

Expand All @@ -21,7 +18,7 @@
RHO_bulk = ThermalConductivity.RHO_bulk;

if ModelSettings.ThmrlCondCap == 1
[ETCON, EHCAP, TETCON, EfTCON, ZETA] = conductivity.calculateSoilThermalProperites(InitialValues, ThermalConductivity, SoilVariables, VanGenuchten, DRHOVT, L, RHOV);
[ETCON, EHCAP, TETCON, EfTCON, ZETA] = conductivity.calculateSoilThermalProperites(InitialValues, ThermalConductivity, SoilVariables, VanGenuchten, ModelSettings, DRHOVT, L, RHOV);
end

for i = 1:ModelSettings.NL
Expand Down
5 changes: 1 addition & 4 deletions src/+conductivity/calculateTransportCoefficient.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function TransportCoefficient = calculateTransportCoefficient(InitialValues, SoilVariables, VanGenuchten, Delt_t)
function TransportCoefficient = calculateTransportCoefficient(InitialValues, SoilVariables, VanGenuchten, Delt_t, ModelSettings)
%{
This is to calculate the transport coefficient for absorbed liquid flow
due to temperature gradient.
Expand All @@ -20,9 +20,6 @@
TransportCoefficient.MU_W = InitialValues.MU_W;
TransportCoefficient.D_Ta = InitialValues.D_Ta;

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

% load Constants
Constants = io.define_constants();

Expand Down
5 changes: 1 addition & 4 deletions src/+conductivity/calculateVaporVariables.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function VaporVariables = calculateVaporVariables(InitialValues, SoilVariables, VanGenuchten, ThermalConductivityCapacity, TT)
function VaporVariables = calculateVaporVariables(InitialValues, SoilVariables, VanGenuchten, ModelSettings, ThermalConductivityCapacity, TT)
%{
This is to calculate vapor diffusivity, vapor dispersivity, and vapor
enhancement factor.
Expand All @@ -23,9 +23,6 @@
Eta = InitialValues.Eta;
D_A = InitialValues.D_A;

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

for i = 1:ModelSettings.NL
for j = 1:ModelSettings.nD
MN = i + j - 1;
Expand Down
3 changes: 1 addition & 2 deletions src/+dryair/assembleCoefficientMatrices.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [RHS, AirMatrices, SAVE] = assembleCoefficientMatrices(AirMatrices, SoilVariables, Delt_t, P_g, GroundwaterSettings)
function [RHS, AirMatrices, SAVE] = assembleCoefficientMatrices(AirMatrices, SoilVariables, Delt_t, P_g, ModelSettings, GroundwaterSettings)
%{
Assemble the coefficient matrices of Equation 4.32 STEMMUS Technical
Notes, page 44, for dry air equation.
Expand All @@ -14,7 +14,6 @@
C6 = AirMatrices.C6;
C7 = AirMatrices.C7;

ModelSettings = io.getModelSettings();
n = ModelSettings.NN;

% Alias of SoilVariables
Expand Down
3 changes: 1 addition & 2 deletions src/+dryair/calculateBoundaryConditions.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
function [RHS, AirMatrices] = calculateBoundaryConditions(BoundaryCondition, AirMatrices, ForcingData, RHS, KT, P_gg, GroundwaterSettings)
function [RHS, AirMatrices] = calculateBoundaryConditions(BoundaryCondition, AirMatrices, ForcingData, RHS, KT, P_gg, ModelSettings, GroundwaterSettings)
%{
Determine the boundary condition for solving the dry air equation.
%}

TopPg = 100 .* (ForcingData.Pg_msr);
ModelSettings = io.getModelSettings();
n = ModelSettings.NN;

if ~GroundwaterSettings.GroundwaterCoupling % no Groundwater coupling, added by Mostafa
Expand Down
3 changes: 1 addition & 2 deletions src/+dryair/calculateDryAirParameters.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
function AirVariabes = calculateDryAirParameters(SoilVariables, GasDispersivity, TransportCoefficient, InitialValues, VaporVariables, ...
P_gg, Xah, XaT, Xaa, RHODA, GroundwaterSettings)
P_gg, Xah, XaT, Xaa, RHODA, ModelSettings, GroundwaterSettings)
%{
Calculate all the parameters related to dry air equation e.g., Equation
3.59-3.64, STEMMUS Technical Notes, page 27-28.
%}
ModelSettings = io.getModelSettings();
Constants = io.define_constants();

AirVariabes.Cah = InitialValues.Cah;
Expand Down
4 changes: 1 addition & 3 deletions src/+dryair/calculateMatricCoefficients.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
function AirMatrices = calculateMatricCoefficients(AirVariabes, InitialValues, GroundwaterSettings)
function AirMatrices = calculateMatricCoefficients(AirVariabes, InitialValues, ModelSettings, GroundwaterSettings)
%{
Calculate all the parameters related to matric coefficients e.g.,
c1-c7 as in Equation 4.32 STEMMUS Technical Notes, page 44, which is
an example for soil moisture equation, but for dry air equation.
%}

ModelSettings = io.getModelSettings();

AirMatrices.C1 = InitialValues.C1;
AirMatrices.C2 = InitialValues.C2;
AirMatrices.C3 = InitialValues.C3;
Expand Down
12 changes: 6 additions & 6 deletions src/+dryair/solveDryAirEquations.m
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
function [AirVariabes, RHS, SAVE, P_gg] = solveDryAirEquations(SoilVariables, GasDispersivity, TransportCoefficient, InitialValues, VaporVariables, ...
BoundaryCondition, ForcingData, P_gg, P_g, Xah, XaT, Xaa, RHODA, KT, Delt_t, GroundwaterSettings)
BoundaryCondition, ForcingData, P_gg, P_g, Xah, XaT, Xaa, RHODA, KT, Delt_t, ModelSettings, GroundwaterSettings)
%{
Solve the dry air equation with the Thomas algorithm to update the soil
air pressure 'P_gg', the finite difference time-stepping scheme is
exampled as for the soil moisture equation, which derived in 'STEMMUS
Technical Notes' section 4, Equation 4.32.
%}
AirVariabes = dryair.calculateDryAirParameters(SoilVariables, GasDispersivity, TransportCoefficient, InitialValues, VaporVariables, ...
P_gg, Xah, XaT, Xaa, RHODA, GroundwaterSettings);
P_gg, Xah, XaT, Xaa, RHODA, ModelSettings, GroundwaterSettings);

AirMatrices = dryair.calculateMatricCoefficients(AirVariabes, InitialValues, GroundwaterSettings);
AirMatrices = dryair.calculateMatricCoefficients(AirVariabes, InitialValues, ModelSettings, GroundwaterSettings);

[RHS, AirMatrices, SAVE] = dryair.assembleCoefficientMatrices(AirMatrices, SoilVariables, Delt_t, P_g, GroundwaterSettings);
[RHS, AirMatrices, SAVE] = dryair.assembleCoefficientMatrices(AirMatrices, SoilVariables, Delt_t, P_g, ModelSettings, GroundwaterSettings);

[RHS, AirMatrices] = dryair.calculateBoundaryConditions(BoundaryCondition, AirMatrices, ForcingData, RHS, KT, P_gg, GroundwaterSettings);
[RHS, AirMatrices] = dryair.calculateBoundaryConditions(BoundaryCondition, AirMatrices, ForcingData, RHS, KT, P_gg, ModelSettings, GroundwaterSettings);

[AirMatrices, P_gg, RHS] = dryair.solveTridiagonalMatrixEquations(RHS, AirMatrices, GroundwaterSettings);
[AirMatrices, P_gg, RHS] = dryair.solveTridiagonalMatrixEquations(RHS, AirMatrices, ModelSettings, GroundwaterSettings);

end
4 changes: 1 addition & 3 deletions src/+dryair/solveTridiagonalMatrixEquations.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
function [AirMatrices, P_gg, RHS] = solveTridiagonalMatrixEquations(RHS, AirMatrices, GroundwaterSettings)
function [AirMatrices, P_gg, RHS] = solveTridiagonalMatrixEquations(RHS, AirMatrices, ModelSettings, GroundwaterSettings)
%{
Use Thomas algorithm to solve the tridiagonal matrix equations, which is
in the form of Equation 4.25 STEMMUS Technical Notes, page 41.
%}

ModelSettings = io.getModelSettings();

if ~GroundwaterSettings.GroundwaterCoupling % no Groundwater coupling, added by Mostafa
indxBotm = 1; % index of bottom layer is 1, STEMMUS calculates from bottom to top
else % Groundwater Coupling is activated
Expand Down
3 changes: 1 addition & 2 deletions src/+energy/assembleCoefficientMatrices.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [RHS, EnergyMatrices, SAVE] = assembleCoefficientMatrices(InitialValues, EnergyMatrices, SoilVariables, Delt_t, P_g, P_gg, GroundwaterSettings)
function [RHS, EnergyMatrices, SAVE] = assembleCoefficientMatrices(InitialValues, EnergyMatrices, SoilVariables, Delt_t, P_g, P_gg, ModelSettings, GroundwaterSettings)
%{
assembles the coefficient matrices of Equation 4.32, STEMMUS Technical
Notes, page 44, the example was only shown for the soil moisture
Expand All @@ -14,7 +14,6 @@
C6 = EnergyMatrices.C6;
C7 = EnergyMatrices.C7;

ModelSettings = io.getModelSettings();
n = ModelSettings.NN;

if ModelSettings.Soilairefc == 1 % see https://github.com/EcoExtreML/STEMMUS_SCOPE/issues/227
Expand Down
6 changes: 2 additions & 4 deletions src/+energy/calculateBoundaryConditions.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
function [RHS, EnergyMatrices] = calculateBoundaryConditions(BoundaryCondition, EnergyMatrices, HBoundaryFlux, ForcingData, ...
SoilVariables, Precip, EVAP, Delt_t, r_a_SOIL, Rn_SOIL, RHS, L, KT, GroundwaterSettings)
function [RHS, EnergyMatrices] = calculateBoundaryConditions(BoundaryCondition, EnergyMatrices, HBoundaryFlux, ForcingData, SoilVariables, ...
Precip, EVAP, Delt_t, r_a_SOIL, Rn_SOIL, RHS, L, KT, ModelSettings, GroundwaterSettings)
%{
Determine the boundary condition for solving the energy equation, see
STEMMUS Technical Notes.
%}

ModelSettings = io.getModelSettings();
n = ModelSettings.NN;

Constants = io.define_constants();

if ~GroundwaterSettings.GroundwaterCoupling % no Groundwater coupling, added by Mostafa
Expand Down
7 changes: 2 additions & 5 deletions src/+energy/calculateEnergyFluxes.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
function [QET, QEB] = calculateEnergyFluxes(SAVE, TT)
function [QET, QEB] = calculateEnergyFluxes(SAVE, TT, ModelSettings)
%{
Calculate the energy fluxes on the boundary nodes, see STEMMUS Technical
Notes.
%}

ModelSettings = io.getModelSettings();
n = ModelSettings.NN;

if ~GroundwaterSettings.GroundwaterCoupling % no Groundwater coupling, added by Mostafa
indxBotm = 1; % index of bottom layer is 1, STEMMUS calculates from bottom to top
else % Groundwater Coupling is activated
Expand All @@ -15,6 +12,6 @@
end

% So far these are unused vars
QET = SAVE(2, 1, 2) - SAVE(2, 2, 2) * TT(n - 1) - SAVE(2, 3, 2) * TT(n);
QET = SAVE(2, 1, 2) - SAVE(2, 2, 2) * TT(ModelSettings.NN - 1) - SAVE(2, 3, 2) * TT(ModelSettings.NN);
QEB = -SAVE(1, 1, 2) + SAVE(1, 2, 2) * TT(indxBotm) + SAVE(1, 3, 2) * TT(indxBotm + 1);
end
5 changes: 2 additions & 3 deletions src/+energy/calculateEnergyParameters.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
function EnergyVariables = calculateEnergyParameters(InitialValues, SoilVariables, HeatVariables, TransportCoefficient, AirVariabes, ...
VaporVariables, GasDispersivity, ThermalConductivityCapacity, ...
DRHOVh, DRHOVT, KL_T, Xah, XaT, Xaa, Srt, L_f, RHOV, RHODA, DRHODAz, L, GroundwaterSettings)
VaporVariables, GasDispersivity, ThermalConductivityCapacity, DRHOVh, DRHOVT, ...
KL_T, Xah, XaT, Xaa, Srt, L_f, RHOV, RHODA, DRHODAz, L, ModelSettings, GroundwaterSettings)
%{
Calculate all the parameters related to energy balance equation e.Constants.g.,
Equation 3.65-3.73, STEMMUS Technical Notes, page 29-32.
%}

ModelSettings = io.getModelSettings();
Constants = io.define_constants();

if ~GroundwaterSettings.GroundwaterCoupling % no Groundwater coupling, added by Mostafa
Expand Down
3 changes: 1 addition & 2 deletions src/+energy/calculateMatricCoefficients.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
function EnergyMatrices = calculateMatricCoefficients(EnergyVariables, InitialValues, GroundwaterSettings)
function EnergyMatrices = calculateMatricCoefficients(EnergyVariables, InitialValues, ModelSettings, GroundwaterSettings)
%{
Calculate all the parameters related to matric coefficients e.g., c1-c7
as in Equation 4.32 STEMMUS Technical Notes, page 44, which is an
example for soil moisture equation, but here it is for energy equation.
%}
ModelSettings = io.getModelSettings();

EnergyMatrices.C1 = InitialValues.C1;
EnergyMatrices.C2 = InitialValues.C2;
Expand Down
Loading
Loading