From 7c697923d5538b966e8ba8fa55335115044da46a Mon Sep 17 00:00:00 2001 From: ftomei Date: Fri, 2 Feb 2024 16:17:36 +0100 Subject: [PATCH] update Vine3D --- bin/VINE3D/atmosphere.cpp | 2 +- bin/VINE3D/mainWindow.cpp | 6 +++--- bin/VINE3D/vine3DProject.cpp | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/bin/VINE3D/atmosphere.cpp b/bin/VINE3D/atmosphere.cpp index bbfc87df5..fa04775ef 100644 --- a/bin/VINE3D/atmosphere.cpp +++ b/bin/VINE3D/atmosphere.cpp @@ -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"; diff --git a/bin/VINE3D/mainWindow.cpp b/bin/VINE3D/mainWindow.cpp index eec6b0935..78d92545d 100644 --- a/bin/VINE3D/mainWindow.cpp +++ b/bin/VINE3D/mainWindow.cpp @@ -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); @@ -652,7 +652,6 @@ void MainWindow::on_actionShow_boundary_triggered() } - void MainWindow::on_actionVine3D_InitializeWaterBalance_triggered() { if (! myProject.setVine3DSoilIndexMap()) return; @@ -660,10 +659,11 @@ void MainWindow::on_actionVine3D_InitializeWaterBalance_triggered() 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); diff --git a/bin/VINE3D/vine3DProject.cpp b/bin/VINE3D/vine3DProject.cpp index b376dd475..6253191ee 100644 --- a/bin/VINE3D/vine3DProject.cpp +++ b/bin/VINE3D/vine3DProject.cpp @@ -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)) @@ -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."); @@ -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; } }