summaryrefslogtreecommitdiff
path: root/apps/adrian
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-01-11 11:20:10 +0100
committerAdrian Kummerlaender2019-06-24 15:17:09 +0200
commitdd658eec1f3d716fa18ceb990b924b38721ecdeb (patch)
treea83da0265def901cde41e6651fa650fbe53c0fcc /apps/adrian
parent5a6c48a6d8ac139dbed3088e0e397cbb42a1f480 (diff)
downloadgrid_refinement_openlb-dd658eec1f3d716fa18ceb990b924b38721ecdeb.tar
grid_refinement_openlb-dd658eec1f3d716fa18ceb990b924b38721ecdeb.tar.gz
grid_refinement_openlb-dd658eec1f3d716fa18ceb990b924b38721ecdeb.tar.bz2
grid_refinement_openlb-dd658eec1f3d716fa18ceb990b924b38721ecdeb.tar.lz
grid_refinement_openlb-dd658eec1f3d716fa18ceb990b924b38721ecdeb.tar.xz
grid_refinement_openlb-dd658eec1f3d716fa18ceb990b924b38721ecdeb.tar.zst
grid_refinement_openlb-dd658eec1f3d716fa18ceb990b924b38721ecdeb.zip
Improve grid refinement interface
By deriving RefiningGrid2D from Grid2D to provide methods specific to refining subgrids.
Diffstat (limited to 'apps/adrian')
-rw-r--r--apps/adrian/poiseuille2d/poiseuille2d.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp
index e71e51e..3d263fa 100644
--- a/apps/adrian/poiseuille2d/poiseuille2d.cpp
+++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp
@@ -24,7 +24,9 @@
*/
#include "olb2D.h"
+#ifndef OLB_PRECOMPILED
#include "olb2D.hh"
+#endif
#include <vector>
@@ -187,18 +189,15 @@ int main(int argc, char* argv[])
auto coarseGrid = Grid2D<T,DESCRIPTOR>::make(coarseCuboid, N, baseTau, Re);
prepareGeometry(coarseGrid->getConverter(), coarseGrid->getSuperGeometry());
- const Vector<T,2> wantedFineExtend {3.0, 1.5};
- const Vector<T,2> fineOrigin = coarseGrid->alignOriginToGrid({0.8, (ly-wantedFineExtend[1])/2});
- const Vector<T,2> fineExtend = coarseGrid->alignExtendToGrid(wantedFineExtend);
+ const Vector<T,2> fineExtend {3.0, 1.5};
+ const Vector<T,2> fineOrigin {0.8, (ly-fineExtend[1])/2};
auto fineGrid = &coarseGrid->refine(fineOrigin, fineExtend);
prepareGeometry(fineGrid->getConverter(), fineGrid->getSuperGeometry());
- const T coarseDeltaX = coarseGrid->getConverter().getPhysDeltaX();
-
- IndicatorCuboid2D<T> refinedOverlap(fineExtend - 4*coarseDeltaX, fineOrigin + 2*coarseDeltaX);
- coarseGrid->getSuperGeometry().rename(1,0,refinedOverlap);
- coarseGrid->getSuperGeometry().rename(2,0,refinedOverlap);
+ auto refinedOverlap = fineGrid->getRefinedOverlap();
+ coarseGrid->getSuperGeometry().rename(1,0,*refinedOverlap);
+ coarseGrid->getSuperGeometry().rename(2,0,*refinedOverlap);
BGKdynamics<T, DESCRIPTOR> coarseBulkDynamics(
coarseGrid->getConverter().getLatticeRelaxationFrequency(),
@@ -221,18 +220,15 @@ int main(int argc, char* argv[])
sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition(fineGrid->getSuperLattice());
createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineSBoundaryCondition);
- const Vector<T,2> wantedFineExtend2 {0.6, 0.4};
- const Vector<T,2> fineOrigin2 = fineGrid->alignOriginToGrid({1.05, (ly-wantedFineExtend2[1])/2});
- const Vector<T,2> fineExtend2 = fineGrid->alignExtendToGrid(wantedFineExtend2);
+ const Vector<T,2> fineExtend2 {0.6, 0.4};
+ const Vector<T,2> fineOrigin2 {1.05, (ly-fineExtend2[1])/2};
auto fineGrid2 = &fineGrid->refine(fineOrigin2, fineExtend2);
prepareGeometry(fineGrid2->getConverter(), fineGrid2->getSuperGeometry());
- const T fine2DeltaX = fineGrid->getConverter().getPhysDeltaX();
-
- IndicatorCuboid2D<T> refinedOverlap2(fineExtend2 - 4*fine2DeltaX, fineOrigin2 + 2*fine2DeltaX);
- fineGrid->getSuperGeometry().rename(1,0,refinedOverlap2);
- fineGrid->getSuperGeometry().rename(2,0,refinedOverlap2);
+ auto refinedOverlap2 = fineGrid2->getRefinedOverlap();
+ fineGrid->getSuperGeometry().rename(1,0,*refinedOverlap2);
+ fineGrid->getSuperGeometry().rename(2,0,*refinedOverlap2);
prepareLattice(
fineGrid->getConverter(),