From 3edd576b152ec5df907597fb1a24d3e570d31f72 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 22 Mar 2019 22:25:48 +0100 Subject: Slightly shift cylinder relative to finest grid This removes the "Bogus distance" warnings that are otherwise generated by `addZeroVelocityBoundary`. --- apps/adrian/cylinder2d/common/model.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'apps/adrian/cylinder2d/common') diff --git a/apps/adrian/cylinder2d/common/model.h b/apps/adrian/cylinder2d/common/model.h index 124a1df..02e15e8 100644 --- a/apps/adrian/cylinder2d/common/model.h +++ b/apps/adrian/cylinder2d/common/model.h @@ -30,7 +30,7 @@ const T deltaR = cylinderD / N; // coarse lattice spacing const Vector modelOrigin {0.0, 0.0}; const Vector modelExtend {22*cylinderD + deltaR, 4.1*cylinderD + deltaR}; -const Vector cylinderCenter {2*cylinderD, 2*cylinderD + deltaR/2}; +const Vector cylinderCenter {2*cylinderD, 2*cylinderD}; void prepareGeometry(Grid2D& grid, Vector origin, Vector extend) { @@ -78,7 +78,7 @@ void prepareGeometry(Grid2D& grid, Vector origin, Vector // Set material number for vertically centered cylinder { - const Vector cylinderOrigin = origin + Vector {cylinderCenter[0], cylinderCenter[1]}; + const Vector cylinderOrigin = origin + Vector {cylinderCenter[0], cylinderCenter[1]+physSpacing/2}; IndicatorCircle2D obstacle(cylinderOrigin, cylinderD/2); sGeometry.rename(1,5,obstacle); } @@ -99,6 +99,8 @@ void prepareLattice(Grid2D& grid) auto& sGeometry = grid.getSuperGeometry(); auto& sLattice = grid.getSuperLattice(); + const T physSpacing = converter.getPhysDeltaX(); + Dynamics& bulkDynamics = grid.addDynamics( std::unique_ptr>( new BGKdynamics( @@ -108,31 +110,26 @@ void prepareLattice(Grid2D& grid) sOnLatticeBoundaryCondition2D& sBoundaryCondition = grid.getOnLatticeBoundaryCondition(); createLocalBoundaryCondition2D(sBoundaryCondition); - const T omega = converter.getLatticeRelaxationFrequency(); + sOffLatticeBoundaryCondition2D& sOffBoundaryCondition = grid.getOffLatticeBoundaryCondition(); + createBouzidiBoundaryCondition2D(sOffBoundaryCondition); sLattice.defineDynamics(sGeometry, 0, &instances::getNoDynamics()); sLattice.defineDynamics(sGeometry, 1, &bulkDynamics); // bulk sLattice.defineDynamics(sGeometry, 2, &bulkDynamics); // walls sLattice.defineDynamics(sGeometry, 3, &bulkDynamics); // inflow sLattice.defineDynamics(sGeometry, 4, &bulkDynamics); // outflow + sLattice.defineDynamics(sGeometry, 5, &instances::getNoDynamics()); - // only set zero velocity boundary if cylinder covered by the grid - if (sGeometry.getStatistics().getNvoxel(5) > 0) { - sLattice.defineDynamics(sGeometry, 5, &instances::getNoDynamics()); - - sOffLatticeBoundaryCondition2D sOffBoundaryCondition = grid.getOffLatticeBoundaryCondition(); - createBouzidiBoundaryCondition2D(sOffBoundaryCondition); - - const Vector cylinderOrigin {cylinderCenter[0], cylinderCenter[1]}; - IndicatorCircle2D obstacle(cylinderOrigin, cylinderD/2); - - sOffBoundaryCondition.addZeroVelocityBoundary(sGeometry, 5, obstacle); - } + const T omega = converter.getLatticeRelaxationFrequency(); sBoundaryCondition.addVelocityBoundary(sGeometry, 2, omega); sBoundaryCondition.addVelocityBoundary(sGeometry, 3, omega); sBoundaryCondition.addPressureBoundary(sGeometry, 4, omega); + const Vector cylinderOrigin {cylinderCenter[0], cylinderCenter[1]+physSpacing/2}; + IndicatorCircle2D obstacle(cylinderOrigin, cylinderD/2); + sOffBoundaryCondition.addZeroVelocityBoundary(sGeometry, 5, obstacle); + AnalyticalConst2D rho0(1.0); AnalyticalConst2D u0(0.0, 0.0); @@ -143,6 +140,7 @@ void prepareLattice(Grid2D& grid) sLattice.initialize(); clout << "Prepare lattice ... OK" << std::endl; + sGeometry.print(); } void setBoundaryValues(Grid2D& grid, int iT) @@ -201,14 +199,16 @@ void takeMeasurements(Grid2D& grid, int iT, bool print=true) auto& sGeometry = grid.getSuperGeometry(); auto& converter = grid.getConverter(); + const T physSpacing = converter.getPhysDeltaX(); + SuperLatticePhysPressure2D pressure(sLattice, converter); AnalyticalFfromSuperF2D intpolatePressure(pressure, true); SuperLatticePhysDrag2D dragF(sLattice, sGeometry, 5, converter); const T radiusCylinder = cylinderD/2; - const T point1[2] { cylinderCenter[0] - radiusCylinder, cylinderCenter[1] }; - const T point2[2] { cylinderCenter[0] + radiusCylinder, cylinderCenter[1] }; + const T point1[2] { cylinderCenter[0] - radiusCylinder, cylinderCenter[1]+physSpacing/2 }; + const T point2[2] { cylinderCenter[0] + radiusCylinder, cylinderCenter[1]+physSpacing/2 }; T pressureInFrontOfCylinder, pressureBehindCylinder; intpolatePressure(&pressureInFrontOfCylinder, point1); -- cgit v1.2.3