diff options
author | Adrian Kummerlaender | 2019-02-24 20:56:46 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2019-02-24 20:56:50 +0100 |
commit | 82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8 (patch) | |
tree | 077d87798cff1265f4640c64636b924700940d42 /src/main.cc | |
parent | 1f2b1cb037a202cafe25167c071a2615341dafdb (diff) | |
download | compustream-82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8.tar compustream-82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8.tar.gz compustream-82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8.tar.bz2 compustream-82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8.tar.lz compustream-82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8.tar.xz compustream-82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8.tar.zst compustream-82a37700e3ff8c1b9c43dbf00c05bd112bd58ec8.zip |
Play around with open boundaries
Diffstat (limited to 'src/main.cc')
-rw-r--r-- | src/main.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/main.cc b/src/main.cc index 99e9a73..5604f3d 100644 --- a/src/main.cc +++ b/src/main.cc @@ -25,7 +25,7 @@ #include "timer.h" constexpr GLuint nX = 256; -constexpr GLuint nY = 256; +constexpr GLuint nY = 128; constexpr int lups = 50; // max lattice updates per second @@ -53,11 +53,19 @@ int setupGeometry(int x, int y) { if ( x == 0 || y == 0 || x == nX-1 || y == nY-1 ) { return 0; // disable end of world } - if ( ((x == 1 || x == nX-2) && (y > 0 && y < nY-1)) - || ((y == 1 || y == nY-2) && (x > 0 && x < nX-1)) ) { + if ( (x == 1 || x == nX-2) && (y > 0 && y < nY-1) ) { + if ( x == 1 && y > nY/4 && y < 3*nY/4 ) { + return 5; // inflow + } + if ( x == nX-2 && y > nY/4 && y < 3*nY/4 ) { + return 6; // outflow + } + return 2; // bounce back outer walls + } + if ( (y == 1 || y == nY-2) && (x > 0 && x < nX-1) ) { return 2; // bounce back outer walls } - return 1; // everything else shall be fluid + return 1; // everything else shall be bulk fluid } int renderWindow() { @@ -68,7 +76,7 @@ int renderWindow() { return -1; } - float world_width = 1.5*nX; + float world_width = 1*nX; float world_height = getWorldHeight(window.getWidth(), window.getHeight(), world_width); glm::mat4 MVP = getMVP(world_width, world_height); |