Skip to content

Commit

Permalink
update water fluxes parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Aug 21, 2024
1 parent a82079f commit fef5ada
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 31 deletions.
13 changes: 13 additions & 0 deletions DATA/SETTINGS/parameters.ini
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,16 @@ snowWaterHoldingCapacity=0.05
snowSkinThickness=0.02
snowVegetationHeight=1
soilAlbedo=0.2

[soilFluxes]
isInitialWaterPotential=true
initialWaterPotential=-2
initialDegreeOfSaturation=0.8
computeOnlySurface=false
computeAllSoilDepth=true
imposedComputationDepth=1
conductivityHorizVertRatio=4
freeCatchmentRunoff=true
freeBottomDrainage=true
freeLateralDrainage=true
modelAccuracy=3
14 changes: 14 additions & 0 deletions bin/CRITERIA3D/criteria3DProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,21 @@ bool Crit3DProject::writeCriteria3DParameters(bool isSnow, bool isWater, bool is

if (isWater)
{
parametersSettings->setValue("soilFluxes/isInitialWaterPotential", waterFluxesParameters.isInitialWaterPotential);
parametersSettings->setValue("soilFluxes/initialWaterPotential", waterFluxesParameters.initialWaterPotential);
parametersSettings->setValue("soilFluxes/initialDegreeOfSaturation", waterFluxesParameters.initialDegreeOfSaturation);

parametersSettings->setValue("soilFluxes/computeOnlySurface", waterFluxesParameters.computeOnlySurface);
parametersSettings->setValue("soilFluxes/computeAllSoilDepth", waterFluxesParameters.computeAllSoilDepth);
parametersSettings->setValue("soilFluxes/imposedComputationDepth", waterFluxesParameters.imposedComputationDepth);

parametersSettings->setValue("soilFluxes/conductivityHorizVertRatio", waterFluxesParameters.conductivityHorizVertRatio);

parametersSettings->setValue("soilFluxes/freeCatchmentRunoff", waterFluxesParameters.freeCatchmentRunoff);
parametersSettings->setValue("soilFluxes/freeBottomDrainage", waterFluxesParameters.freeBottomDrainage);
parametersSettings->setValue("soilFluxes/freeLateralDrainage", waterFluxesParameters.freeLateralDrainage);

parametersSettings->setValue("soilFluxes/modelAccuracy", waterFluxesParameters.modelAccuracy);
}

if (isSoilCrack)
Expand Down
43 changes: 22 additions & 21 deletions bin/CRITERIA3D/shared/project3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ void WaterFluxesParameters::initialize()
conductivityHorizVertRatio = 10.0; // [-] default: ten times

modelAccuracy = 3; // [-] default: error on the third digit

minSoilLayerThickness = 0.02; // [m] default: 2 cm
maxSoilLayerThickness = 0.10; // [m] default: 10 cm
maxSoilLayerThicknessDepth = 0.40; // [m] default: 40 cm
}


Expand Down Expand Up @@ -152,11 +156,8 @@ void Project3D::initializeProject3D()
soilMapFileName = "";
landUseMapFileName = "";

computationSoilDepth = 0.0; // [m]
minThickness = 0.02; // [m] default: 2 cm
maxThickness = 0.10; // [m] default: 10 cm
maxThicknessDepth = 0.40; // [m] default: 40 cm
thicknessGrowthFactor = 1.2; // [-]
computationSoilDepth = 0.0; // [m]
soilLayerThicknessGrowthFactor = 1.2; // [-]

nrSoils = 0;
nrLayers = 0;
Expand Down Expand Up @@ -1255,9 +1256,9 @@ void Project3D::setSoilLayers()
return;

// set thicknessGrowthFactor
if (minThickness == maxThickness)
if (waterFluxesParameters.minSoilLayerThickness == waterFluxesParameters.maxSoilLayerThickness)
{
thicknessGrowthFactor = 1.0;
soilLayerThicknessGrowthFactor = 1.0;
}
else
{
Expand All @@ -1267,16 +1268,16 @@ void Project3D::setSoilLayers()
while (factor <= 2.0)
{
double upperDepth = 0;
double currentThickness = minThickness;
double currentThickness = waterFluxesParameters.minSoilLayerThickness;
double currentDepth = upperDepth + currentThickness * 0.5;
while (currentThickness < maxThickness)
while (currentThickness < waterFluxesParameters.maxSoilLayerThickness)
{
upperDepth += currentThickness;
currentThickness = std::min(currentThickness * factor, maxThickness);
currentThickness = std::min(currentThickness * factor, waterFluxesParameters.maxSoilLayerThickness);
currentDepth = upperDepth + currentThickness * 0.5;
}

double error = fabs(currentDepth - maxThicknessDepth);
double error = fabs(currentDepth - waterFluxesParameters.maxSoilLayerThicknessDepth);
if (error < bestError)
{
bestError = error;
Expand All @@ -1285,18 +1286,18 @@ void Project3D::setSoilLayers()

factor += 0.01;
}
thicknessGrowthFactor = bestFactor;
soilLayerThicknessGrowthFactor = bestFactor;
}

nrLayers++;
double currentThickness = minThickness;
double currentDepth = minThickness;
double currentThickness = waterFluxesParameters.minSoilLayerThickness;
double currentLowerDepth = waterFluxesParameters.minSoilLayerThickness;

while ((computationSoilDepth - currentDepth) > minThickness)
while ((computationSoilDepth - currentLowerDepth) > waterFluxesParameters.minSoilLayerThickness)
{
nrLayers++;
double nextThickness = std::min(maxThickness, currentThickness * thicknessGrowthFactor);
currentDepth += nextThickness;
double nextThickness = std::min(currentThickness * soilLayerThicknessGrowthFactor, waterFluxesParameters.maxSoilLayerThickness);
currentLowerDepth += nextThickness;
currentThickness = nextThickness;
}
}
Expand All @@ -1321,9 +1322,9 @@ bool Project3D::setLayersDepth()
if (nrLayers == 1)
return true;

layerThickness[1] = minThickness;
layerDepth[1] = minThickness * 0.5;
double currentDepth = minThickness;
layerThickness[1] = waterFluxesParameters.minSoilLayerThickness;
layerDepth[1] = waterFluxesParameters.minSoilLayerThickness * 0.5;
double currentDepth = waterFluxesParameters.minSoilLayerThickness;

for (unsigned int i = 2; i <= lastLayer; i++)
{
Expand All @@ -1333,7 +1334,7 @@ bool Project3D::setLayersDepth()
}
else
{
layerThickness[i] = std::min(maxThickness, layerThickness[i-1] * thicknessGrowthFactor);
layerThickness[i] = std::min(waterFluxesParameters.maxSoilLayerThickness, layerThickness[i-1] * soilLayerThicknessGrowthFactor);
}

layerDepth[i] = currentDepth + layerThickness[i] * 0.5;
Expand Down
20 changes: 10 additions & 10 deletions bin/CRITERIA3D/shared/project3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@
bool computeAllSoilDepth;

bool isInitialWaterPotential;
double initialWaterPotential; // [m]
double initialDegreeOfSaturation; // [-]
double initialWaterPotential; // [m]
double initialDegreeOfSaturation; // [-]

double imposedComputationDepth; // [m]
double conductivityHorizVertRatio; // [-]
double imposedComputationDepth; // [m]
double conductivityHorizVertRatio; // [-]

int modelAccuracy; // [-]
int modelAccuracy; // [-]

bool freeCatchmentRunoff;
bool freeLateralDrainage;
bool freeBottomDrainage;

double minSoilLayerThickness; // [m] minimum thickness of soil layers
double maxSoilLayerThickness; // [m] maximum thickness of soil layers
double maxSoilLayerThicknessDepth; // [m] depth at which the layers must have maximum thickness

WaterFluxesParameters();

void initialize();
Expand Down Expand Up @@ -127,13 +131,9 @@
soil::Crit3DFittingOptions fittingOptions;

// layers
double minThickness; // [m] minimum thickness of soil layers
double maxThickness; // [m] maximum thickness of soil layers
double maxThicknessDepth; // [m] depth at which the layers must have maximum thickness
double thicknessGrowthFactor; // [-] progressive growth factor of layer thicknesses

std::vector <double> layerDepth; // [m]
std::vector <double> layerThickness; // [m]
double soilLayerThicknessGrowthFactor; // [-] progressive growth factor of layer thicknesses

double previousTotalWaterContent; // [m3]

Expand Down

0 comments on commit fef5ada

Please sign in to comment.