aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-10-17 20:33:40 +0200
committerAdrian Kummerlaender2018-10-17 20:33:40 +0200
commitf72650254067bfee063c184dedcce41fdfa32931 (patch)
treee9419bb6bf6a7e8bd42a11555b987643ea862f98
parent78dc06b62b7f2a88d45789769610e76c0ff8c652 (diff)
downloadboltzbub-f72650254067bfee063c184dedcce41fdfa32931.tar
boltzbub-f72650254067bfee063c184dedcce41fdfa32931.tar.gz
boltzbub-f72650254067bfee063c184dedcce41fdfa32931.tar.bz2
boltzbub-f72650254067bfee063c184dedcce41fdfa32931.tar.lz
boltzbub-f72650254067bfee063c184dedcce41fdfa32931.tar.xz
boltzbub-f72650254067bfee063c184dedcce41fdfa32931.tar.zst
boltzbub-f72650254067bfee063c184dedcce41fdfa32931.zip
Print avg. error of Poiseuille outflow velocity
-rw-r--r--poiseuille.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/poiseuille.cc b/poiseuille.cc
index e0ee4cf..b6c9616 100644
--- a/poiseuille.cc
+++ b/poiseuille.cc
@@ -9,7 +9,7 @@ constexpr std::size_t dimY = 20;
constexpr std::size_t dimX = 5*dimY;
constexpr double uInflow = 0.02;
-constexpr double reynolds = 10;
+constexpr double reynolds = 100;
constexpr double tau = 3. * uInflow * (dimX-1) / reynolds + 0.5;
constexpr double omega = 1. / tau;
@@ -72,23 +72,33 @@ void computeLbmStep() {
}
}
+double error(std::size_t x) {
+ double acc = 0.0;
+
+ for ( std::size_t y = 1; y < dimY-1; ++y ) {
+ acc += std::abs(poiseuille(y) - fluid.velocity(x,y)[0]);
+ }
+
+ return acc / (dimY-2);
+}
+
int main() {
init();
+ std::cout << "dim: " << dimX << "x" << dimY << std::endl;
std::cout << "Re: " << reynolds << std::endl;
std::cout << "uInflow: " << uInflow << std::endl;
std::cout << "tau: " << tau << std::endl;
std::cout << "omega: " << omega << std::endl;
+ std::cout << std::endl;
+
for ( std::size_t t = 0; t <= 10000; ++t ) {
computeLbmStep();
- if ( t % 100 == 0 ) {
- std::cout << ".";
- std::cout.flush();
+ if ( t % 1000 == 0 ) {
+ std::cout << error(dimX-1) << std::endl;
fluid.writeAsVTK("result/data_t" + std::to_string(t) + ".vtk");
}
}
-
- std::cout << std::endl;
}