From 16be62fddb56828c7ec7235cfce6993000bfb357 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 8 Jan 2019 18:53:10 +0100 Subject: Unify lattice preparation for both grids --- apps/adrian/poiseuille2d/poiseuille2d.cpp | 64 +++++++------------------------ 1 file changed, 13 insertions(+), 51 deletions(-) (limited to 'apps/adrian') diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp index c8a4659..f4ebffa 100644 --- a/apps/adrian/poiseuille2d/poiseuille2d.cpp +++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp @@ -95,14 +95,14 @@ void prepareGeometry(UnitConverter const& converter, clout << "Prepare Geometry ... OK" << std::endl; } -void prepareCoarseLattice(UnitConverter const& converter, - SuperLattice2D& sLattice, - Dynamics& bulkDynamics, - sOnLatticeBoundaryCondition2D& sBoundaryCondition, - SuperGeometry2D& superGeometry) +void prepareLattice(UnitConverter const& converter, + SuperLattice2D& sLattice, + Dynamics& bulkDynamics, + sOnLatticeBoundaryCondition2D& sBoundaryCondition, + SuperGeometry2D& superGeometry) { OstreamManager clout(std::cout,"prepareLattice"); - clout << "Prepare coarse lattice ..." << std::endl; + clout << "Prepare lattice ..." << std::endl; const T omega = converter.getLatticeRelaxationFrequency(); @@ -138,43 +138,7 @@ void prepareCoarseLattice(UnitConverter const& converter, sLattice.initialize(); - clout << "Prepare coarse lattice ... OK" << std::endl; -} - -void prepareFineLattice(UnitConverter const& converter, - SuperLattice2D& sLattice, - Dynamics& bulkDynamics, - sOnLatticeBoundaryCondition2D& sBoundaryCondition, - SuperGeometry2D& superGeometry) -{ - OstreamManager clout(std::cout,"prepareLattice"); - clout << "Prepare fine lattice ..." << std::endl; - - const T omega = converter.getLatticeRelaxationFrequency(); - - sLattice.defineDynamics(superGeometry, 0, &instances::getNoDynamics()); - sLattice.defineDynamics(superGeometry, 1, &bulkDynamics); // bulk - sLattice.defineDynamics(superGeometry, 2, &instances::getBounceBack()); - - const T Lx = converter.getLatticeLength(lx); - const T Ly = converter.getLatticeLength(ly); - const T p0 = 8.*converter.getLatticeViscosity()*converter.getCharLatticeVelocity()*Lx/(Ly*Ly); - AnalyticalLinear2D rho(-p0/lx*DESCRIPTOR::invCs2, 0, p0*DESCRIPTOR::invCs2+1); - - const T maxVelocity = converter.getCharLatticeVelocity(); - const T radius = ly/2; - std::vector axisPoint{0, ly/2}; - std::vector axisDirection{1, 0}; - Poiseuille2D u(axisPoint, axisDirection, maxVelocity, radius); - - sLattice.defineRhoU(superGeometry, 1, rho, u); - sLattice.iniEquilibrium(superGeometry, 1, rho, u); - sLattice.defineRhoU(superGeometry, 2, rho, u); - sLattice.iniEquilibrium(superGeometry, 2, rho, u); - - sLattice.initialize(); - - clout << "Prepare fine lattice ... OK" << std::endl; + clout << "Prepare lattice ... OK" << std::endl; } void getResults(const std::string& prefix, @@ -236,33 +200,31 @@ int main(int argc, char* argv[]) coarseGrid->getSuperGeometry().rename(1,0,refinedOverlap); coarseGrid->getSuperGeometry().rename(2,0,refinedOverlap); - Dynamics* coarseBulkDynamics; - coarseBulkDynamics = new BGKdynamics( + BGKdynamics coarseBulkDynamics( coarseGrid->getConverter().getLatticeRelaxationFrequency(), instances::getBulkMomenta()); sOnLatticeBoundaryCondition2D coarseSBoundaryCondition(coarseGrid->getSuperLattice()); createLocalBoundaryCondition2D(coarseSBoundaryCondition); - prepareCoarseLattice( + prepareLattice( coarseGrid->getConverter(), coarseGrid->getSuperLattice(), - *coarseBulkDynamics, + coarseBulkDynamics, coarseSBoundaryCondition, coarseGrid->getSuperGeometry()); - Dynamics* fineBulkDynamics; - fineBulkDynamics = new BGKdynamics( + BGKdynamics fineBulkDynamics( fineGrid->getConverter().getLatticeRelaxationFrequency(), instances::getBulkMomenta()); sOnLatticeBoundaryCondition2D fineSBoundaryCondition(fineGrid->getSuperLattice()); createLocalBoundaryCondition2D(fineSBoundaryCondition); - prepareFineLattice( + prepareLattice( fineGrid->getConverter(), fineGrid->getSuperLattice(), - *fineBulkDynamics, + fineBulkDynamics, fineSBoundaryCondition, fineGrid->getSuperGeometry()); -- cgit v1.2.3