aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-10-17 19:37:06 +0200
committerAdrian Kummerlaender2018-10-17 19:37:06 +0200
commit78dc06b62b7f2a88d45789769610e76c0ff8c652 (patch)
treea2dacc90bea404224196c80a0b4bd7a3589d9040
parentc690d6c6b06102527eaca890ad7661fd1dab5605 (diff)
downloadboltzbub-78dc06b62b7f2a88d45789769610e76c0ff8c652.tar
boltzbub-78dc06b62b7f2a88d45789769610e76c0ff8c652.tar.gz
boltzbub-78dc06b62b7f2a88d45789769610e76c0ff8c652.tar.bz2
boltzbub-78dc06b62b7f2a88d45789769610e76c0ff8c652.tar.lz
boltzbub-78dc06b62b7f2a88d45789769610e76c0ff8c652.tar.xz
boltzbub-78dc06b62b7f2a88d45789769610e76c0ff8c652.tar.zst
boltzbub-78dc06b62b7f2a88d45789769610e76c0ff8c652.zip
Extract analytical solution of Poiseuille flow velocity
-rw-r--r--poiseuille.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/poiseuille.cc b/poiseuille.cc
index 7afb1ae..e0ee4cf 100644
--- a/poiseuille.cc
+++ b/poiseuille.cc
@@ -5,7 +5,7 @@
#include "lbm.h"
#include "boundary_conditions.h"
-constexpr std::size_t dimY = 40;
+constexpr std::size_t dimY = 20;
constexpr std::size_t dimX = 5*dimY;
constexpr double uInflow = 0.02;
@@ -17,11 +17,15 @@ constexpr double omega = 1. / tau;
DataCellBuffer pop(dimX, dimY);
FluidBuffer fluid(dimX, dimY);
+double poiseuille(std::size_t y) {
+ return -4. * uInflow / (dimY*dimY) * (y+0.5) * (y+0.5 - dimY);
+}
+
void init() {
for ( std::size_t x = 0; x < dimX; ++x ) {
for ( std::size_t y = 0; y < dimY; ++y ) {
fluid.density(x,y) = 1.0;
- fluid.velocity(x,y) = { 0.0, 0.0 };
+ fluid.velocity(x,y) = {0.0, 0.0};
static_cast<Cell&>(pop.curr(x,y)).equilibrize(
fluid.density(x,y), fluid.velocity(x,y));
@@ -46,8 +50,7 @@ void computeLbmStep() {
}
for ( std::size_t y = 1; y < dimY-1; ++y ) {
- const double localU = -4. * uInflow / (dimY*dimY) * y * (double(y)-dimY);
- computeMovingWallCell(pop, {0,y}, {1,0}, {localU,0});
+ computeMovingWallCell(pop, {0,y}, {1,0}, {poiseuille(y), 0});
}
for ( std::size_t x = 0; x < dimX; ++x ) {
@@ -80,7 +83,7 @@ int main() {
for ( std::size_t t = 0; t <= 10000; ++t ) {
computeLbmStep();
- if ( t % 1000 == 0 ) {
+ if ( t % 100 == 0 ) {
std::cout << ".";
std::cout.flush();
fluid.writeAsVTK("result/data_t" + std::to_string(t) + ".vtk");