From 5e888fc13f38c94777963d72fc9e391cd4fa477a Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 30 Jan 2019 20:12:31 +0100 Subject: Manage dynamics, boundary condition memory in Grid2D Mainly to further declutter simulation and refinement setup --- apps/adrian/poiseuille2d/poiseuille2d.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'apps/adrian/poiseuille2d') 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& grid) clout << "Prepare Geometry ... OK" << std::endl; } -void prepareLattice(Grid2D& grid, - Dynamics& bulkDynamics, - sOnLatticeBoundaryCondition2D& sBoundaryCondition) +void prepareLattice(Grid2D& grid) { OstreamManager clout(std::cout,"prepareLattice"); clout << "Prepare lattice ..." << std::endl; @@ -101,6 +99,15 @@ void prepareLattice(Grid2D& grid, auto& sGeometry = grid.getSuperGeometry(); auto& sLattice = grid.getSuperLattice(); + Dynamics& bulkDynamics = grid.addDynamics( + std::unique_ptr>( + new BGKdynamics( + grid.getConverter().getLatticeRelaxationFrequency(), + instances::getBulkMomenta()))); + + sOnLatticeBoundaryCondition2D& sBoundaryCondition = grid.getOnLatticeBoundaryCondition(); + createInterpBoundaryCondition2D(sBoundaryCondition); + const T omega = converter.getLatticeRelaxationFrequency(); sLattice.defineDynamics(sGeometry, 0, &instances::getNoDynamics()); @@ -237,23 +244,9 @@ int main(int argc, char* argv[]) prepareGeometry(fineGrid); - BGKdynamics coarseBulkDynamics( - coarseGrid.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta()); - - sOnLatticeBoundaryCondition2D coarseSBoundaryCondition(coarseGrid.getSuperLattice()); - createInterpBoundaryCondition2D(coarseSBoundaryCondition); - - prepareLattice(coarseGrid, coarseBulkDynamics, coarseSBoundaryCondition); - - BGKdynamics fineBulkDynamics( - fineGrid.getConverter().getLatticeRelaxationFrequency(), - instances::getBulkMomenta()); - - sOnLatticeBoundaryCondition2D fineSBoundaryCondition(fineGrid.getSuperLattice()); - createInterpBoundaryCondition2D(fineSBoundaryCondition); + prepareLattice(coarseGrid); - prepareLattice(fineGrid, fineBulkDynamics, fineSBoundaryCondition); + prepareLattice(fineGrid); clout << "starting simulation..." << endl; Timer timer( -- cgit v1.2.3