From c9d387e208089b431b1177d1e3f5ba829fcd947c Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 3 Feb 2019 22:42:26 +0100 Subject: Replicate SchaeferTurek 2D-2 setup in refined cylinder2d Weirdly it seems easier to get reasonably close values for the unsteady flow. Results for the steady flow seem to get worse when increasing grid resolution even in uniform grids. --- apps/adrian/cylinder2d/cylinder2d.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'apps/adrian/cylinder2d') diff --git a/apps/adrian/cylinder2d/cylinder2d.cpp b/apps/adrian/cylinder2d/cylinder2d.cpp index 066bb6f..5b67408 100644 --- a/apps/adrian/cylinder2d/cylinder2d.cpp +++ b/apps/adrian/cylinder2d/cylinder2d.cpp @@ -38,21 +38,21 @@ typedef double T; /// Setup geometry relative to cylinder diameter as defined by [SchaeferTurek96] const T cylinderD = 0.1; -const int N = 5; // resolution of the cylinder +const int N = 10; // resolution of the cylinder const T deltaR = cylinderD / N; // coarse lattice spacing const T lx = 22*cylinderD + deltaR; // length of the channel const T ly = 4.1*cylinderD + deltaR; // height of the channel const T cylinderX = 2*cylinderD; const T cylinderY = 2*cylinderD + deltaR/2; -const T Re = 20.; // Reynolds number +const T Re = 100.; // Reynolds number const T tau = 0.51; // relaxation time const T maxPhysT = 16.; // max. simulation time in s, SI unit const Characteristics PhysCharacteristics( 0.1, // char. phys. length - 0.2, // char. phys. velocity - 0.1*0.2/Re, // phsy. kinematic viscosity + 1.0, // char. phys. velocity + 0.1/Re, // phsy. kinematic viscosity 1.0); // char. phys. density void prepareGeometry(Grid2D& grid, Vector origin, Vector extend) @@ -143,19 +143,19 @@ void prepareLattice(Grid2D& grid) sLattice.defineDynamics(sGeometry, 0, &instances::getNoDynamics()); sLattice.defineDynamics(sGeometry, 1, &bulkDynamics); // bulk - sLattice.defineDynamics(sGeometry, 2, &instances::getBounceBack()); // walls + sLattice.defineDynamics(sGeometry, 2, &bulkDynamics); // walls sLattice.defineDynamics(sGeometry, 3, &bulkDynamics); // inflow sLattice.defineDynamics(sGeometry, 4, &bulkDynamics); // outflow - sLattice.defineDynamics(sGeometry, 5, &bulkDynamics); // cylinder + sLattice.defineDynamics(sGeometry, 5, &instances::getBounceBack()); // cylinder + sBoundaryCondition.addVelocityBoundary(sGeometry, 2, omega); sBoundaryCondition.addVelocityBoundary(sGeometry, 3, omega); sBoundaryCondition.addPressureBoundary(sGeometry, 4, omega); - sBoundaryCondition.addVelocityBoundary(sGeometry, 5, omega); AnalyticalConst2D rho0(1.0); AnalyticalConst2D u0(0.0, 0.0); - auto materials = sGeometry.getMaterialIndicator({1, 3, 4, 5}); + auto materials = sGeometry.getMaterialIndicator({1, 2, 3, 4}); sLattice.defineRhoU(materials, rho0, u0); sLattice.iniEquilibrium(materials, rho0, u0); @@ -238,11 +238,8 @@ void takeMeasurements(Grid2D& grid) intpolatePressure(&pressureInFrontOfCylinder, point1); intpolatePressure(&pressureBehindCylinder, point2); - clout << "pressure1=" << pressureInFrontOfCylinder; - clout << "; pressure2=" << pressureBehindCylinder; - T pressureDrop = pressureInFrontOfCylinder - pressureBehindCylinder; - clout << "; pressureDrop=" << pressureDrop; + clout << "pressureDrop=" << pressureDrop; const int input[3] {}; T drag[dragF.getTargetDim()] {}; @@ -275,22 +272,22 @@ int main(int argc, char* argv[]) const auto coarseDeltaX = coarseGrid.getConverter().getPhysDeltaX(); - const Vector fineExtend {10*cylinderD, ly-2*coarseDeltaX}; - const Vector fineOrigin {1*coarseDeltaX, coarseDeltaX}; + const Vector fineExtend {10*cylinderD, domainExtend[1]-4*coarseDeltaX}; + const Vector fineOrigin {0.5*cylinderD, (domainExtend[1]-fineExtend[1])/2}; auto& fineGrid = coarseGrid.refine(fineOrigin, fineExtend); prepareGeometry(fineGrid, domainOrigin, domainExtend); disableRefinedArea(coarseGrid, fineGrid); - const Vector fineExtend2 {6*cylinderD, fineGrid.getExtend()[1]-2*coarseDeltaX}; - const Vector fineOrigin2 {2*coarseDeltaX, (ly-fineExtend2[1])/2}; + const Vector fineExtend2 {6*cylinderD, fineGrid.getExtend()[1]-4*coarseDeltaX}; + const Vector fineOrigin2 {0.75*cylinderD, (domainExtend[1]-fineExtend2[1])/2}; auto& fineGrid2 = fineGrid.refine(fineOrigin2, fineExtend2); prepareGeometry(fineGrid2, domainOrigin, domainExtend); disableRefinedArea(fineGrid, fineGrid2); const Vector fineExtend3 {4*cylinderD, 2*cylinderD}; - const Vector fineOrigin3 {1.2*cylinderD, (ly-fineExtend3[1])/2}; + const Vector fineOrigin3 {1*cylinderD, (domainExtend[1]-fineExtend3[1])/2}; auto& fineGrid3 = fineGrid2.refine(fineOrigin3, fineExtend3); prepareGeometry(fineGrid3, domainOrigin, domainExtend); @@ -312,7 +309,7 @@ int main(int argc, char* argv[]) clout << "Total number of active cells: " << coarseGrid.getActiveVoxelN() << endl; clout << "Starting simulation..." << endl; - const int statIter = coarseGrid.getConverter().getLatticeTime(0.1); + const int statIter = coarseGrid.getConverter().getLatticeTime(0.05); Timer timer( coarseGrid.getConverter().getLatticeTime(maxPhysT), coarseGrid.getSuperGeometry().getStatistics().getNvoxel()); -- cgit v1.2.3