diff options
Unify lattice preparation for both grids
Diffstat (limited to 'apps')
-rw-r--r-- | apps/adrian/poiseuille2d/poiseuille2d.cpp | 64 |
1 files changed, 13 insertions, 51 deletions
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<T,DESCRIPTOR> const& converter, clout << "Prepare Geometry ... OK" << std::endl; } -void prepareCoarseLattice(UnitConverter<T,DESCRIPTOR> const& converter, - SuperLattice2D<T, DESCRIPTOR>& sLattice, - Dynamics<T, DESCRIPTOR>& bulkDynamics, - sOnLatticeBoundaryCondition2D<T,DESCRIPTOR>& sBoundaryCondition, - SuperGeometry2D<T>& superGeometry) +void prepareLattice(UnitConverter<T,DESCRIPTOR> const& converter, + SuperLattice2D<T, DESCRIPTOR>& sLattice, + Dynamics<T, DESCRIPTOR>& bulkDynamics, + sOnLatticeBoundaryCondition2D<T,DESCRIPTOR>& sBoundaryCondition, + SuperGeometry2D<T>& 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<T,DESCRIPTOR> const& converter, sLattice.initialize(); - clout << "Prepare coarse lattice ... OK" << std::endl; -} - -void prepareFineLattice(UnitConverter<T,DESCRIPTOR> const& converter, - SuperLattice2D<T, DESCRIPTOR>& sLattice, - Dynamics<T, DESCRIPTOR>& bulkDynamics, - sOnLatticeBoundaryCondition2D<T,DESCRIPTOR>& sBoundaryCondition, - SuperGeometry2D<T>& superGeometry) -{ - OstreamManager clout(std::cout,"prepareLattice"); - clout << "Prepare fine lattice ..." << std::endl; - - const T omega = converter.getLatticeRelaxationFrequency(); - - sLattice.defineDynamics(superGeometry, 0, &instances::getNoDynamics<T, DESCRIPTOR>()); - sLattice.defineDynamics(superGeometry, 1, &bulkDynamics); // bulk - sLattice.defineDynamics(superGeometry, 2, &instances::getBounceBack<T, DESCRIPTOR>()); - - const T Lx = converter.getLatticeLength(lx); - const T Ly = converter.getLatticeLength(ly); - const T p0 = 8.*converter.getLatticeViscosity()*converter.getCharLatticeVelocity()*Lx/(Ly*Ly); - AnalyticalLinear2D<T,T> rho(-p0/lx*DESCRIPTOR<T>::invCs2, 0, p0*DESCRIPTOR<T>::invCs2+1); - - const T maxVelocity = converter.getCharLatticeVelocity(); - const T radius = ly/2; - std::vector<T> axisPoint{0, ly/2}; - std::vector<T> axisDirection{1, 0}; - Poiseuille2D<T> 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<T, DESCRIPTOR>* coarseBulkDynamics; - coarseBulkDynamics = new BGKdynamics<T, DESCRIPTOR>( + BGKdynamics<T, DESCRIPTOR> coarseBulkDynamics( coarseGrid->getConverter().getLatticeRelaxationFrequency(), instances::getBulkMomenta<T, DESCRIPTOR>()); sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> coarseSBoundaryCondition(coarseGrid->getSuperLattice()); createLocalBoundaryCondition2D<T, DESCRIPTOR>(coarseSBoundaryCondition); - prepareCoarseLattice( + prepareLattice( coarseGrid->getConverter(), coarseGrid->getSuperLattice(), - *coarseBulkDynamics, + coarseBulkDynamics, coarseSBoundaryCondition, coarseGrid->getSuperGeometry()); - Dynamics<T, DESCRIPTOR>* fineBulkDynamics; - fineBulkDynamics = new BGKdynamics<T, DESCRIPTOR>( + BGKdynamics<T, DESCRIPTOR> fineBulkDynamics( fineGrid->getConverter().getLatticeRelaxationFrequency(), instances::getBulkMomenta<T, DESCRIPTOR>()); sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition(fineGrid->getSuperLattice()); createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineSBoundaryCondition); - prepareFineLattice( + prepareLattice( fineGrid->getConverter(), fineGrid->getSuperLattice(), - *fineBulkDynamics, + fineBulkDynamics, fineSBoundaryCondition, fineGrid->getSuperGeometry()); |