Skip to content

Commit

Permalink
fix soilFraction
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Dec 19, 2024
1 parent 5d2e0e1 commit cb08f53
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion criteria1DWidget/tabWaterContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void TabWaterContent::computeWaterContent(Crit1DCase &myCase, int firstYear, int
{
if (isVolumetricWaterContent)
{
waterContent = myCase.soilLayers[i].getVolumetricWaterContent() * myCase.soilLayers[i].soilFraction;
waterContent = myCase.soilLayers[i].getVolumetricWaterContent();
maxWaterContent = MAXVALUE(waterContent, maxWaterContent);
}
else
Expand Down
2 changes: 1 addition & 1 deletion criteriaModel/water1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ double getReadilyAvailableWater(const Crit3DCrop &myCrop, const std::vector<soil
{
double thetaWP = soil::thetaFromSignPsi(-soil::cmTokPa(myCrop.psiLeaf), *(soilLayers[i].horizonPtr));
// [mm]
double cropWP = thetaWP * soilLayers[i].thickness * soilLayers[i].soilFraction * 1000.0;
double cropWP = thetaWP * soilLayers[i].thickness * soilLayers[i].soilFraction * 1000.;
// [mm]
double threshold = soilLayers[i].FC - myCrop.fRAW * (soilLayers[i].FC - cropWP);

Expand Down
4 changes: 2 additions & 2 deletions crop/crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ double Crit3DCrop::computeTranspiration(double maxTranspiration, const std::vect

double thetaWP; // [m3 m-3] volumetric water content at Wilting Point
double cropWP; // [mm] wilting point specific for crop
double waterSurplusThreshold; // [mm] water surplus stress threshold
double waterSurplusThreshold; // [mm] water surplus stress threshold
double waterScarcityThreshold; // [mm] water scarcity stress threshold
double WSS; // [] water surplus stress

Expand Down Expand Up @@ -763,7 +763,7 @@ double Crit3DCrop::computeTranspiration(double maxTranspiration, const std::vect

thetaWP = soil::thetaFromSignPsi(-soil::cmTokPa(psiLeaf), *(soilLayers[i].horizonPtr));
// [mm]
cropWP = thetaWP * soilLayers[i].thickness * soilLayers[i].soilFraction * 1000.0;
cropWP = thetaWP * soilLayers[i].thickness * soilLayers[i].soilFraction * 1000.;

// [mm]
waterScarcityThreshold = soilLayers[i].FC - fRAW * (soilLayers[i].FC - cropWP);
Expand Down
9 changes: 6 additions & 3 deletions soil/soil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,19 @@ namespace soil

horizonPtr = horizonPointer;

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

// [mm]
SAT = horizonPtr->waterContentSAT * thickness * 1000.;
FC = horizonPtr->waterContentFC * thickness * 1000.;
WP = horizonPtr->waterContentWP * thickness * 1000.;
critical = FC;

// hygroscopic humidity
double hygroscopicHumidity = -2000; // [kPa]
double hygroscopicHumidity = -2000; // [kPa]
double volWaterContentHH = soil::thetaFromSignPsi(hygroscopicHumidity, *horizonPtr); // [m3 m-3]
HH = volWaterContentHH * horizonPtr->getSoilFraction() * thickness * 1000.; // [mm]
HH = volWaterContentHH * soilFraction * thickness * 1000.; // [mm]

return true;
}
Expand Down Expand Up @@ -688,7 +691,7 @@ namespace soil
double getWaterContentFromPsi(double psi, const Crit1DLayer &layer)
{
double theta = soil::thetaFromSignPsi(-psi, *(layer.horizonPtr));
return theta * layer.thickness * layer.soilFraction * 1000;
return theta * layer.thickness * layer.soilFraction * 1000.;
}


Expand Down

0 comments on commit cb08f53

Please sign in to comment.