Skip to content

Commit

Permalink
update Vine3D
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Feb 2, 2024
1 parent a4ffa13 commit 7c69792
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/VINE3D/atmosphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ bool vine3DInterpolationDemRadiation(Vine3DProject* myProject, const Crit3DTime&
return false;
}

if (radiation::computeRadiationGrid(&(myProject->radSettings), myProject->DEM, myProject->radiationMaps, myCrit3DTime))
if (radiation::computeRadiationDEM(&(myProject->radSettings), myProject->DEM, myProject->radiationMaps, myCrit3DTime))
myResult = setRadiationScale(myProject->radiationMaps->globalRadiationMap->colorScale);
else
myProject->errorString = "Function vine3DInterpolationDemRadiation: error computing irradiance";
Expand Down
6 changes: 3 additions & 3 deletions bin/VINE3D/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ MainWindow::MainWindow(QWidget *parent) :
showPointsGroup->setEnabled(false);

// Set tiles source
this->setMapSource(WebTileSource::OPEN_STREET_MAP);
this->setMapSource(WebTileSource::GOOGLE_Terrain);

// Set start size and position
this->startCenter = new Position (myProject.gisSettings.startLocation.longitude, myProject.gisSettings.startLocation.latitude, 0.0);
Expand Down Expand Up @@ -652,18 +652,18 @@ void MainWindow::on_actionShow_boundary_triggered()
}



void MainWindow::on_actionVine3D_InitializeWaterBalance_triggered()
{
if (! myProject.setVine3DSoilIndexMap()) return;

if (myProject.initializeWaterBalance3D())
{
myProject.outputWaterBalanceMaps = new Crit3DWaterBalanceMaps(myProject.DEM);
QMessageBox::information(nullptr, "", "Criteria3D initialized.");
QMessageBox::information(nullptr, "", "3D water fluxes initialized.");
}
}


void MainWindow::on_actionShowPointsHide_triggered()
{
redrawMeteoPoints(showNone, true);
Expand Down
18 changes: 12 additions & 6 deletions bin/VINE3D/vine3DProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,15 @@ bool Vine3DProject::loadVine3DProject(QString myFileName)
return false;
soilMap.isLoaded = true;

processes.computeEvaporation = true;
processes.computeCrop = true;

if (! initializeWaterBalance3D())
{
logError();
return false;
}

outputWaterBalanceMaps = new Crit3DWaterBalanceMaps(DEM);

if (! initializeGrapevine(this))
Expand Down Expand Up @@ -1471,11 +1475,11 @@ int Vine3DProject::getVine3DSoilIndex(long row, long col)
bool Vine3DProject::setVine3DSoilIndexMap()
{
// check
if (!DEM.isLoaded || !modelCaseIndexMap.isLoaded || nrSoils == 0)
if (! DEM.isLoaded || ! modelCaseIndexMap.isLoaded || nrSoils == 0)
{
if (!DEM.isLoaded)
if (! DEM.isLoaded)
logError("setVine3DSoilIndexMap: missing Digital Elevation Model.");
else if (!modelCaseIndexMap.isLoaded)
else if (! modelCaseIndexMap.isLoaded)
logError("setVine3DSoilIndexMap: missing field map.");
else if (nrSoils == 0)
logError("setVine3DSoilIndexMap: missing soil properties.");
Expand Down Expand Up @@ -1592,10 +1596,12 @@ bool Vine3DProject::computeVine3DWaterSinkSource()
int idField = getModelCaseIndex(row, col);
float laiGrass = modelCases[idField].maxLAIGrass;
float laiVine = statePlantMaps->leafAreaIndexMap->value[row][col];
float laiTot = laiVine + laiGrass;
double laiTot = double(laiVine + laiGrass);

int soilIndex = getSoilIndex(row, col);

double realEvap = computeEvaporation(row, col, double(laiTot)); // [mm]
flow = area * (realEvap / 1000.0); // [m3/h]
double realEvap = assignEvaporation(row, col, laiTot, soilIndex); // [mm]
flow = area * (realEvap / 1000.0); // [m3/h]
totalEvaporation += flow;
}
}
Expand Down

0 comments on commit 7c69792

Please sign in to comment.