diff options
Diffstat (limited to 'apps/adrian/cylinder2d')
-rw-r--r-- | apps/adrian/cylinder2d/cylinder2d.cpp | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/apps/adrian/cylinder2d/cylinder2d.cpp b/apps/adrian/cylinder2d/cylinder2d.cpp index bf25417..0893928 100644 --- a/apps/adrian/cylinder2d/cylinder2d.cpp +++ b/apps/adrian/cylinder2d/cylinder2d.cpp @@ -108,9 +108,7 @@ void disableRefinedArea(Grid2D<T,DESCRIPTOR>& coarseGrid, sGeometry.rename(5,0,*refinedOverlap); } -void prepareLattice(Grid2D<T,DESCRIPTOR>& grid, - Dynamics<T, DESCRIPTOR>& bulkDynamics, - sOnLatticeBoundaryCondition2D<T,DESCRIPTOR>& sBoundaryCondition) +void prepareLattice(Grid2D<T,DESCRIPTOR>& grid) { OstreamManager clout(std::cout,"prepareLattice"); clout << "Prepare lattice ..." << std::endl; @@ -119,6 +117,15 @@ void prepareLattice(Grid2D<T,DESCRIPTOR>& grid, auto& sGeometry = grid.getSuperGeometry(); auto& sLattice = grid.getSuperLattice(); + Dynamics<T,DESCRIPTOR>& bulkDynamics = grid.addDynamics( + std::unique_ptr<Dynamics<T,DESCRIPTOR>>( + new BGKdynamics<T,DESCRIPTOR>( + grid.getConverter().getLatticeRelaxationFrequency(), + instances::getBulkMomenta<T,DESCRIPTOR>()))); + + sOnLatticeBoundaryCondition2D<T,DESCRIPTOR>& sBoundaryCondition = grid.getOnLatticeBoundaryCondition(); + createLocalBoundaryCondition2D<T,DESCRIPTOR>(sBoundaryCondition); + const T omega = converter.getLatticeRelaxationFrequency(); sLattice.defineDynamics(sGeometry, 0, &instances::getNoDynamics<T,DESCRIPTOR>()); @@ -212,13 +219,6 @@ int main(int argc, char* argv[]) Grid2D<T,DESCRIPTOR> coarseGrid(coarseCuboid, N, LatticeVelocity<T>(uLat), Re); prepareGeometry(coarseGrid); - BGKdynamics<T, DESCRIPTOR> coarseBulkDynamics( - coarseGrid.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta<T, DESCRIPTOR>()); - - sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> coarseBoundaryCondition(coarseGrid.getSuperLattice()); - createLocalBoundaryCondition2D<T, DESCRIPTOR>(coarseBoundaryCondition); - const auto coarseDeltaX = coarseGrid.getConverter().getPhysDeltaX(); const Vector<T,2> fineExtend {8*cylinderD, ly-2*coarseDeltaX}; @@ -251,22 +251,6 @@ int main(int argc, char* argv[]) disableRefinedArea(coarseGrid, fineGrid); - BGKdynamics<T, DESCRIPTOR> fineBulkDynamics( - fineGrid.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta<T, DESCRIPTOR>()); - - sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineBoundaryCondition(fineGrid.getSuperLattice()); - createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineBoundaryCondition); - - BGKdynamics<T, DESCRIPTOR> fineOutflowBulkDynamics( - fineOutflowGrid.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta<T, DESCRIPTOR>()); - - sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineOutflowBoundaryCondition(fineOutflowGrid.getSuperLattice()); - createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineOutflowBoundaryCondition); - - prepareLattice(coarseGrid, coarseBulkDynamics, coarseBoundaryCondition); - const Vector<T,2> fineExtend2 {4*cylinderD, 2*cylinderD}; const Vector<T,2> fineOrigin2 {1*cylinderD, 2*cylinderD-fineExtend2[1]/2}; @@ -275,17 +259,10 @@ int main(int argc, char* argv[]) disableRefinedArea(fineGrid, fineGrid2); - BGKdynamics<T, DESCRIPTOR> fineBulkDynamics2( - fineGrid2.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta<T, DESCRIPTOR>()); - - sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineBoundaryCondition2(fineGrid2.getSuperLattice()); - createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineBoundaryCondition2); - - prepareLattice(fineGrid, fineBulkDynamics, fineBoundaryCondition); - prepareLattice(fineOutflowGrid, fineOutflowBulkDynamics, fineOutflowBoundaryCondition); - - prepareLattice(fineGrid2, fineBulkDynamics2, fineBoundaryCondition2); + prepareLattice(coarseGrid); + prepareLattice(fineGrid); + prepareLattice(fineOutflowGrid); + prepareLattice(fineGrid2); clout << "Starting simulation..." << endl; Timer<T> timer( |