Skip to content

Commit

Permalink
Merge commit 'e913995b536f22bf433dbfebc3699c7173e1cf4e'
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Dec 19, 2024
2 parents 53566ed + e913995 commit 85647a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions agrolib/criteriaModel/criteria1DCase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,17 @@ bool Crit1DCase::initializeNumericalFluxes(std::string &error)
for (unsigned int horizonIndex = 0; horizonIndex < mySoil.nrHorizons; horizonIndex++)
{
soil::Crit3DHorizon horizon = mySoil.horizon[horizonIndex];
double soilFraction = (1.0 - horizon.coarseFragments);

result = soilFluxes3D::setSoilProperties(soilIndex, int(horizonIndex),
horizon.vanGenuchten.alpha * GRAVITY,
horizon.vanGenuchten.n, horizon.vanGenuchten.m,
horizon.vanGenuchten.he / GRAVITY,
horizon.vanGenuchten.thetaR * soilFraction,
horizon.vanGenuchten.thetaS * soilFraction,
horizon.vanGenuchten.thetaR * horizon.getSoilFraction(),
horizon.vanGenuchten.thetaS * horizon.getSoilFraction(),
(horizon.waterConductivity.kSat * 0.01) / DAY_SECONDS,
horizon.waterConductivity.l,
horizon.organicMatter, horizon.texture.clay * 0.01);

if (result != CRIT3D_OK)
{
error = "Error in setSoilProperties, horizon nr: " + std::to_string(horizonIndex + 1);
Expand Down
3 changes: 1 addition & 2 deletions agrolib/crop/root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,7 @@ namespace root
int horIndex = currentSoil.getHorizonIndex(layerDepth[l]);
if (horIndex != int(NODATA))
{
double soilFraction = (1 - currentSoil.horizon[horIndex].coarseFragments);
myCrop.roots.rootDensity[l] *= soilFraction;
myCrop.roots.rootDensity[l] *= currentSoil.horizon[horIndex].getSoilFraction();
rootDensitySumSubset += myCrop.roots.rootDensity[l];
}
}
Expand Down
4 changes: 3 additions & 1 deletion agrolib/crop/root.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@

namespace root
{
rootDistributionType getRootDistributionType(int rootShape);
int getRootDistributionNumber(rootDistributionType rootShape);

rootDistributionType getRootDistributionType(int rootShape);
rootDistributionType getRootDistributionTypeFromString(const std::string &rootShape);
std::string getRootDistributionTypeString(rootDistributionType rootType);

double getRootLengthDD(const Crit3DRoot &myRoot, double currentDD, double emergenceDD);

bool computeRootDensity(Crit3DCrop* myCrop, const std::vector<soil::Crit1DLayer> &soilLayers);

bool computeRootDensity3D(Crit3DCrop &myCrop, const soil::Crit3DSoil &currentSoil, unsigned int nrLayers,
Expand Down
2 changes: 1 addition & 1 deletion agrolib/soil/soil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ namespace soil
double waterContentHH = soil::thetaFromSignPsi(hygroscopicHumidity, *horizonPtr);

// [-]
soilFraction = (1.0 - horizonPtr->coarseFragments);
soilFraction = horizonPtr->getSoilFraction();

// [mm]
SAT = horizonPtr->vanGenuchten.thetaS * soilFraction * thickness * 1000;
Expand Down
3 changes: 1 addition & 2 deletions agrolib/soil/soil.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@

Crit3DHorizon();

double getSoilFraction()
{ return (1.0 - coarseFragments); }
double getSoilFraction() const { return (1.0 - coarseFragments); }
};


Expand Down

0 comments on commit 85647a8

Please sign in to comment.