Skip to content

Commit

Permalink
fix output time step
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Nov 15, 2023
1 parent d5f930a commit f639e0b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions bin/HEAT1D/heat1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ bool initializeHeat1D(bool useInputSoils)
}


void setSinkSources(double myHourlyPrec, int timeStepSeconds)
void setSinkSources(double myHourlyPrec)
{
for (long i=0; i < myHeat1D.NodesNumber; i++)
{
Expand All @@ -293,7 +293,7 @@ void setSinkSources(double myHourlyPrec, int timeStepSeconds)
if (myHeat1D.computeWater)
{
if (i == 0)
soilFluxes3D::setWaterSinkSource(i, (double)myHourlyPrec * myHeat1D.surfaceArea / timeStepSeconds / 1000);
soilFluxes3D::setWaterSinkSource(i, myHourlyPrec * myHeat1D.surfaceArea / (3600. * 1000.));
else
soilFluxes3D::setWaterSinkSource(i, 0);
}
Expand Down Expand Up @@ -713,13 +713,13 @@ QString Crit3DOut::getTextOutput(outputGroup outGroup)

bool runHeat1D(double myHourlyTemperature, double myHourlyRelativeHumidity,
double myHourlyWindSpeed, double myHourlyNetIrradiance,
double myHourlyPrec, int timeStepSeconds)
double myHourlyPrec, int maxTimeStepSeconds)
{
//double currentRoughness;
//double surfaceWaterHeight;
//double roughnessWater = 0.005;

setSinkSources(myHourlyPrec, timeStepSeconds);
setSinkSources(myHourlyPrec);

if (myHeat1D.computeHeat)
{
Expand All @@ -743,9 +743,9 @@ bool runHeat1D(double myHourlyTemperature, double myHourlyRelativeHumidity,
soilFluxes3D::setHeatBoundaryRoughness(1, myHeat1D.RoughnessHeat);
}

soilFluxes3D::computePeriod(timeStepSeconds);
soilFluxes3D::computePeriod(maxTimeStepSeconds);

return (true);
return true;
}


3 changes: 2 additions & 1 deletion bin/HEAT1D/heat1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ void setProcessesHeat(bool computeLatent_, bool computeAdvection_);
void getOutputAllPeriod(long firstIndex, long lastIndex, Crit3DOut *output, double timeH);
long getNodesNumber();
void setSoilHorizonNumber(int myHorizonNumber);
void setSinkSources(double myHourlyPrec);

bool initializeHeat1D(bool useInputSoils);
bool runHeat1D(double myHourlyTemperature, double myHourlyRelativeHumidity,
double myHourlyWindSpeed, double myHourlyNetIrradiance,
double myHourlyPrec, int timeStepSeconds);
double myHourlyPrec, int maxTimeStepSeconds);


8 changes: 4 additions & 4 deletions bin/HEAT1D/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void MainWindow::on_pushRunAllPeriod_clicked()
myPIniHour = ui->lineEditPrecStart->text().toInt();
myPHours = ui->lineEditPrecHours->text().toInt();

double outTimeStep = ui->lineEditTimeStep->text().toDouble();
double outputTimeStep = ui->lineEditTimeStep->text().toDouble();

int hourFin;
if (!useInputMeteoData)
Expand All @@ -148,7 +148,7 @@ void MainWindow::on_pushRunAllPeriod_clicked()

do
{
myTime = myTime.addSecs(outTimeStep);
myTime = myTime.addSecs(outputTimeStep);

if (myTime.secsTo(myRefHour) < 0)
{
Expand Down Expand Up @@ -177,9 +177,9 @@ void MainWindow::on_pushRunAllPeriod_clicked()
myP = 0.;
}

runHeat1D(myT, myRH, myWS, myNR, myP, outTimeStep);
runHeat1D(myT, myRH, myWS, myNR, myP, outputTimeStep);

totalHours += outTimeStep / 3600;
totalHours += outputTimeStep / 3600;
getOutputAllPeriod(0, getNodesNumber(), &myHeatOutput, totalHours);

ui->prgBar->setValue(indexHour);
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>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
Expand Down

0 comments on commit f639e0b

Please sign in to comment.