summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-02-06 14:18:14 +0100
committerAdrian Kummerlaender2019-06-24 15:17:42 +0200
commitf4069563f596b35d90a6a3b941011ebd7cf191b9 (patch)
treebf58802df1457a1aeb0acde9b94e91aeffa9654f
parent9d547d2dc7d2e96c16ee5cbf9ebf2f73a7a5233e (diff)
downloadgrid_refinement_openlb-f4069563f596b35d90a6a3b941011ebd7cf191b9.tar
grid_refinement_openlb-f4069563f596b35d90a6a3b941011ebd7cf191b9.tar.gz
grid_refinement_openlb-f4069563f596b35d90a6a3b941011ebd7cf191b9.tar.bz2
grid_refinement_openlb-f4069563f596b35d90a6a3b941011ebd7cf191b9.tar.lz
grid_refinement_openlb-f4069563f596b35d90a6a3b941011ebd7cf191b9.tar.xz
grid_refinement_openlb-f4069563f596b35d90a6a3b941011ebd7cf191b9.tar.zst
grid_refinement_openlb-f4069563f596b35d90a6a3b941011ebd7cf191b9.zip
Export and plot cylinder2d measurements
-rw-r--r--apps/adrian/cylinder2d/optimized_grid/cylinder2d.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/apps/adrian/cylinder2d/optimized_grid/cylinder2d.cpp b/apps/adrian/cylinder2d/optimized_grid/cylinder2d.cpp
index 34294ee..e5a934c 100644
--- a/apps/adrian/cylinder2d/optimized_grid/cylinder2d.cpp
+++ b/apps/adrian/cylinder2d/optimized_grid/cylinder2d.cpp
@@ -214,12 +214,8 @@ void getResults(Grid2D<T,DESCRIPTOR>& grid,
vtmWriter.write(iT);
}
-void takeMeasurements(Grid2D<T,DESCRIPTOR>& grid)
+void takeMeasurements(Grid2D<T,DESCRIPTOR>& grid, int iT, bool print=true)
{
- static T maxDrag = 0.0;
-
- OstreamManager clout(std::cout,"measurement");
-
auto& sLattice = grid.getSuperLattice();
auto& sGeometry = grid.getSuperGeometry();
auto& converter = grid.getConverter();
@@ -236,17 +232,23 @@ void takeMeasurements(Grid2D<T,DESCRIPTOR>& grid)
T pressureInFrontOfCylinder, pressureBehindCylinder;
intpolatePressure(&pressureInFrontOfCylinder, point1);
intpolatePressure(&pressureBehindCylinder, point2);
-
- T pressureDrop = pressureInFrontOfCylinder - pressureBehindCylinder;
- clout << "pressureDrop=" << pressureDrop;
+ const T pressureDrop = pressureInFrontOfCylinder - pressureBehindCylinder;
const int input[3] {};
T drag[dragF.getTargetDim()] {};
dragF(drag, input);
- if (drag[0] > maxDrag) {
- maxDrag = drag[0];
- };
- clout << "; drag=" << drag[0] << "; maxDrag: " << maxDrag << "; lift=" << drag[1] << endl;
+
+ static Gnuplot<T> gplot("results");
+ gplot.setData(converter.getPhysTime(iT), {drag[0], drag[1], pressureDrop}, {"drag", "lift", "deltaP"}, "bottom right", {'l','l'});
+ gplot.writePNG();
+
+ if (print) {
+ OstreamManager clout(std::cout, "measurement");
+ clout << "pressureDrop=" << pressureDrop
+ << "; drag=" << drag[0]
+ << "; lift=" << drag[1]
+ << endl;
+ }
}
int main(int argc, char* argv[])
@@ -354,7 +356,7 @@ int main(int argc, char* argv[])
getResults(grid, id, iT);
});
- takeMeasurements(fineGrid3);
+ takeMeasurements(fineGrid3, iT);
}
}