summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-01-16 15:40:01 +0100
committerAdrian Kummerlaender2019-06-24 15:17:09 +0200
commit69f40a510a39ba561d290ad07ccbd3f0c3786a7c (patch)
tree8533ef55b461076e6f303491da9197cc6b55ea8d /apps
parent3d447eb5e493c112682e69e5fcd5c91807fcc7fc (diff)
downloadgrid_refinement_openlb-69f40a510a39ba561d290ad07ccbd3f0c3786a7c.tar
grid_refinement_openlb-69f40a510a39ba561d290ad07ccbd3f0c3786a7c.tar.gz
grid_refinement_openlb-69f40a510a39ba561d290ad07ccbd3f0c3786a7c.tar.bz2
grid_refinement_openlb-69f40a510a39ba561d290ad07ccbd3f0c3786a7c.tar.lz
grid_refinement_openlb-69f40a510a39ba561d290ad07ccbd3f0c3786a7c.tar.xz
grid_refinement_openlb-69f40a510a39ba561d290ad07ccbd3f0c3786a7c.tar.zst
grid_refinement_openlb-69f40a510a39ba561d290ad07ccbd3f0c3786a7c.zip
Restore original bisected poiseuille flow refinement test case
Diffstat (limited to 'apps')
-rw-r--r--apps/adrian/poiseuille2d/poiseuille2d.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp
index b6c2f52..d92934b 100644
--- a/apps/adrian/poiseuille2d/poiseuille2d.cpp
+++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp
@@ -1,8 +1,8 @@
-/* Lattice Boltzmann sample, written in C++, using the OpenLB
- * library
+/*
+ * Lattice Boltzmann grid refinement sample, written in C++,
+ * using the OpenLB library
*
- * Copyright (C) 2007, 2012 Jonas Latt, Mathias J. Krause
- * Vojtech Cvrcek, Peter Weisbrod
+ * Copyright (C) 2019 Adrian Kummerländer
* E-mail contact: info@openlb.net
* The most recent release of OpenLB can be downloaded at
* <http://www.openlb.net/>
@@ -31,15 +31,14 @@
#include <vector>
using namespace olb;
-using namespace olb::descriptors;
typedef double T;
-#define DESCRIPTOR D2Q9Descriptor
+#define DESCRIPTOR descriptors::D2Q9Descriptor
const T lx = 4.0; // length of the channel
const T ly = 1.0; // height of the channel
-const int N = 50; // resolution of the model
+const int N = 30; // resolution of the model
const T Re = 100.; // Reynolds number
const T baseTau = 0.8; // Relaxation time of coarsest grid
const T maxPhysT = 60.; // max. simulation time in s, SI unit
@@ -182,16 +181,29 @@ int main(int argc, char* argv[])
OstreamManager clout(std::cout,"main");
const Vector<T,2> coarseOrigin {0.0, 0.0};
- const Vector<T,2> coarseExtend {lx, ly};
+ const Vector<T,2> coarseExtend {lx/2, ly};
IndicatorCuboid2D<T> coarseCuboid(coarseExtend, coarseOrigin);
Grid2D<T,DESCRIPTOR> coarseGrid(coarseCuboid, N, baseTau, Re);
prepareGeometry(coarseGrid);
- const Vector<T,2> fineExtend {2.0, 0.5};
- const Vector<T,2> fineOrigin {1.0, (ly-fineExtend[1])/2};
+ const T coarseDeltaX = coarseGrid.getConverter().getPhysDeltaX();
+
+ const Vector<T,2> fineExtend {lx/2+coarseDeltaX, ly};
+ const Vector<T,2> fineOrigin {lx/2-coarseDeltaX, 0.0};
+
+ auto& fineGrid = coarseGrid.refine(fineOrigin, fineExtend, false);
+
+ {
+ const Vector<T,2> origin = fineGrid.getOrigin();
+ const Vector<T,2> extend = fineGrid.getExtend();
+
+ const Vector<T,2> extendY = {0,extend[1]};
+
+ coarseGrid.addFineCoupling(fineGrid, origin, extendY);
+ coarseGrid.addCoarseCoupling(fineGrid, origin + Vector<T,2>{coarseDeltaX,0}, extendY);
+ }
- auto& fineGrid = coarseGrid.refine(fineOrigin, fineExtend);
prepareGeometry(fineGrid);
auto refinedOverlap = fineGrid.getRefinedOverlap();