diff options
Manage dynamics, boundary condition memory in Grid2D
Mainly to further declutter simulation and refinement setup
Diffstat (limited to 'apps/adrian/poiseuille2d')
-rw-r--r-- | apps/adrian/poiseuille2d/poiseuille2d.cpp | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp index 034fb08..4091905 100644 --- a/apps/adrian/poiseuille2d/poiseuille2d.cpp +++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp @@ -90,9 +90,7 @@ void prepareGeometry(Grid2D<T,DESCRIPTOR>& grid) clout << "Prepare Geometry ... OK" << std::endl; } -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; @@ -101,6 +99,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(); + createInterpBoundaryCondition2D<T,DESCRIPTOR>(sBoundaryCondition); + const T omega = converter.getLatticeRelaxationFrequency(); sLattice.defineDynamics(sGeometry, 0, &instances::getNoDynamics<T,DESCRIPTOR>()); @@ -237,23 +244,9 @@ int main(int argc, char* argv[]) prepareGeometry(fineGrid); - BGKdynamics<T,DESCRIPTOR> coarseBulkDynamics( - coarseGrid.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta<T,DESCRIPTOR>()); - - sOnLatticeBoundaryCondition2D<T,DESCRIPTOR> coarseSBoundaryCondition(coarseGrid.getSuperLattice()); - createInterpBoundaryCondition2D<T,DESCRIPTOR>(coarseSBoundaryCondition); - - prepareLattice(coarseGrid, coarseBulkDynamics, coarseSBoundaryCondition); - - BGKdynamics<T,DESCRIPTOR> fineBulkDynamics( - fineGrid.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta<T,DESCRIPTOR>()); - - sOnLatticeBoundaryCondition2D<T,DESCRIPTOR> fineSBoundaryCondition(fineGrid.getSuperLattice()); - createInterpBoundaryCondition2D<T,DESCRIPTOR>(fineSBoundaryCondition); + prepareLattice(coarseGrid); - prepareLattice(fineGrid, fineBulkDynamics, fineSBoundaryCondition); + prepareLattice(fineGrid); clout << "starting simulation..." << endl; Timer<T> timer( |