Skip to content

Commit

Permalink
added drainage in plots
Browse files Browse the repository at this point in the history
  • Loading branch information
gantolini committed Nov 8, 2023
1 parent de3a667 commit ce55403
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 7 deletions.
8 changes: 7 additions & 1 deletion bin/HEAT1D/graphFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ outputType getOutputType(outputGroup myOut)

return outputType::profile;
else if (myOut == energyBalance ||
myOut == errorBalance)
myOut == errorBalance ||
myOut == bottom)
return outputType::single;
else
return outputType::single;
Expand Down Expand Up @@ -50,6 +51,8 @@ void setColorScale(Crit3DColorScale* myColorScale, outputGroup outGroup, Crit3DO
myColorScale->setMaximum(3);
else if (outGroup == outputGroup::surfaceResistances)
myColorScale->setMaximum(2);
else if (outGroup == outputGroup::bottom)
myColorScale->setMaximum(1);

*graphLinear = true;
}
Expand Down Expand Up @@ -100,6 +103,9 @@ QVector<QPointF> getSingleSeries(Crit3DOut* myOut, outputVar myVar, float* MINVA
case outputVar::MBR_water :
myVal = myOut->errorOutput[i].waterMBR.y();
break;

case outputVar::bottomDrainage :
myVal = myOut->bottomFluxes[i].drainage.y();
}

myPoint.setY(myVal);
Expand Down
11 changes: 9 additions & 2 deletions bin/HEAT1D/graphFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum outputGroup
energyBalance = 10,
surfaceResistances = 11,
soilHeatConductivity = 12,
errorBalance = 13
bottom = 13,
errorBalance = 14
};

enum outputVar
Expand All @@ -34,7 +35,8 @@ enum outputVar
aerodynamicResistence = 3,
soilSurfaceResistence = 4,
MBR_heat = 5,
MBR_water = 6
MBR_water = 6,
bottomDrainage = 7
};

static const char * outputVarString[] =
Expand Down Expand Up @@ -84,6 +86,10 @@ struct heatErrors{
QPointF waterMBR;
};

struct bottomFlux{
QPointF drainage;
};

class Crit3DOut
{
public:
Expand All @@ -100,6 +106,7 @@ class Crit3DOut
QVector<landSurfaceStatus> landSurfaceOutput;
QVector<profileStatus> profileOutput;
QVector<heatErrors> errorOutput;
QVector<bottomFlux> bottomFluxes;

QString getTextOutput(outputGroup myOutGroup);
};
Expand Down
11 changes: 8 additions & 3 deletions bin/HEAT1D/heat1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

#include "heat1D.h"
#include "soilFluxes3D.h"
#include "types.h"
#include "boundary.h"
#include "soilPhysics.h"
#include "commonConstants.h"

Crit3DOut output;
Expand Down Expand Up @@ -261,6 +258,7 @@ bool initializeHeat1D(bool useInputSoils)

result = soilFluxes3D::setWaterContent(indexNode, ((indexNode-1)*(myHeat1D.initialSaturationBottom - myHeat1D.initialSaturationTop)
/ (myHeat1D.NodesNumber-2)+myHeat1D.initialSaturationTop) * (myThetaS - myThetaR) + myThetaR);

if (result != CRIT3D_OK) printf("\n error in SetWaterContent!");

if (myHeat1D.computeHeat)
Expand Down Expand Up @@ -336,11 +334,13 @@ void getOutputAllPeriod(long firstIndex, long lastIndex, Crit3DOut *output)
profileStatus myProfile;
landSurfaceStatus mySurfaceOutput;
heatErrors myErrors;
bottomFlux myBottomFluxes;

output->nrValues++;
output->profileOutput.push_back(myProfile);
output->landSurfaceOutput.push_back(mySurfaceOutput);
output->errorOutput.push_back(myErrors);
output->bottomFluxes.push_back(myBottomFluxes);

for (myIndex = firstIndex ; myIndex <= lastIndex ; myIndex++ )
{
Expand Down Expand Up @@ -460,6 +460,11 @@ void getOutputAllPeriod(long firstIndex, long lastIndex, Crit3DOut *output)
myValue = soilFluxes3D::getWaterMBR();
if (isValid(myValue)) myPoint.setY(myValue);
output->errorOutput[output->nrValues-1].waterMBR = myPoint;

//bottom fluxes
myValue = soilFluxes3D::getBoundaryWaterFlow(lastIndex);
if (isValid(myValue)) myPoint.setY(myValue);
output->bottomFluxes[output->nrValues-1].drainage = myPoint;
}

QString Crit3DOut::getTextOutput(outputGroup outGroup)
Expand Down
8 changes: 8 additions & 0 deletions bin/HEAT1D/linearGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ void LinearGraph::setProperties(outputGroup graphType)
startIndex = 5;

}
else if (graphType == outputGroup::bottom)
{
axisY->setTitleText(QString("water flow [%1]").arg(QString("m3")));

myCurveNames.append("water flow");
startIndex = 7;

}
}

void LinearGraph::tooltipLineSeries(QPointF point, bool state)
Expand Down
1 change: 1 addition & 0 deletions bin/HEAT1D/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->listWidget->addItem("surface energy balance (W m-2)");
ui->listWidget->addItem("surface resistances (s m-1)");
ui->listWidget->addItem("heat conductivity (W m-1 K-1)");
ui->listWidget->addItem("bottom fluxes (m3)");
ui->listWidget->addItem("error balance ()");
}

Expand Down
2 changes: 1 addition & 1 deletion bin/HEAT1D/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</rect>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
Expand Down

0 comments on commit ce55403

Please sign in to comment.