diff options
Diffstat (limited to 'src/refinement/coupler2D.hh')
-rw-r--r-- | src/refinement/coupler2D.hh | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/refinement/coupler2D.hh b/src/refinement/coupler2D.hh index c2b27db..800986d 100644 --- a/src/refinement/coupler2D.hh +++ b/src/refinement/coupler2D.hh @@ -30,32 +30,32 @@ namespace olb { -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> T Coupler2D<T,DESCRIPTOR>::getScalingFactor() const { const T coarseTau = _coarse.getConverter().getLatticeRelaxationTime(); return (coarseTau - 0.25) / coarseTau; } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> T Coupler2D<T,DESCRIPTOR>::getInvScalingFactor() const { return 1./getScalingFactor(); } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> const Vector<int,3>& Coupler2D<T,DESCRIPTOR>::getFineLatticeR(int y) const { return _fineLatticeR[y]; } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> const Vector<int,3>& Coupler2D<T,DESCRIPTOR>::getCoarseLatticeR(int y) const { return _coarseLatticeR[y]; } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> Coupler2D<T,DESCRIPTOR>::Coupler2D(Grid2D<T,DESCRIPTOR>& coarse, Grid2D<T,DESCRIPTOR>& fine, Vector<T,2> origin, Vector<T,2> extend): _coarse(coarse), @@ -86,13 +86,13 @@ Coupler2D<T,DESCRIPTOR>::Coupler2D(Grid2D<T,DESCRIPTOR>& coarse, Grid2D<T,DESCRI } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> FineCoupler2D<T,DESCRIPTOR>::FineCoupler2D(Grid2D<T,DESCRIPTOR>& coarse, Grid2D<T,DESCRIPTOR>& fine, Vector<T,2> origin, Vector<T,2> extend): Coupler2D<T,DESCRIPTOR>(coarse, fine, origin, extend), _c2f_rho(this->_coarseSize), _c2f_u(this->_coarseSize, Vector<T,2>(T{})), - _c2f_fneq(this->_coarseSize, Vector<T,DESCRIPTOR<T>::q>(T{})) + _c2f_fneq(this->_coarseSize, Vector<T,DESCRIPTOR::q>(T{})) { OstreamManager clout(std::cout,"C2F"); @@ -104,7 +104,7 @@ FineCoupler2D<T,DESCRIPTOR>::FineCoupler2D(Grid2D<T,DESCRIPTOR>& coarse, Grid2D< clout << "fine size: " << this->_fineSize << std::endl; } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> void FineCoupler2D<T,DESCRIPTOR>::store() { auto& coarseLattice = this->_coarse.getSuperLattice(); @@ -114,7 +114,7 @@ void FineCoupler2D<T,DESCRIPTOR>::store() const auto pos = this->getCoarseLatticeR(y); T rho{}; T u[2] {}; - T fNeq[DESCRIPTOR<T>::q] {}; + T fNeq[DESCRIPTOR::q] {}; Cell<T,DESCRIPTOR> coarseCell; coarseLattice.get(pos, coarseCell); lbHelpers<T,DESCRIPTOR>::computeRhoU(coarseCell, rho, u); @@ -122,7 +122,7 @@ void FineCoupler2D<T,DESCRIPTOR>::store() _c2f_rho[y] = Vector<T,1>(rho); _c2f_u[y] = Vector<T,2>(u); - _c2f_fneq[y] = Vector<T,DESCRIPTOR<T>::q>(fNeq); + _c2f_fneq[y] = Vector<T,DESCRIPTOR::q>(fNeq); } } @@ -156,7 +156,7 @@ Vector<T,N> order4interpolation(const std::vector<Vector<T,N>>& data, int y) } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> void FineCoupler2D<T,DESCRIPTOR>::interpolate() { auto& coarseLattice = this->_coarse.getSuperLattice(); @@ -173,14 +173,14 @@ void FineCoupler2D<T,DESCRIPTOR>::interpolate() _c2f_rho[y] = order2interpolation(Vector<T,1>(rho), _c2f_rho[y]); _c2f_u[y] = order2interpolation(Vector<T,2>(u), _c2f_u[y]); - T fNeq[DESCRIPTOR<T>::q] {}; + T fNeq[DESCRIPTOR::q] {}; lbHelpers<T,DESCRIPTOR>::computeFneq(coarseCell, fNeq, rho, u); - _c2f_fneq[y] = order2interpolation(Vector<T,DESCRIPTOR<T>::q>(fNeq), _c2f_fneq[y]); + _c2f_fneq[y] = order2interpolation(Vector<T,DESCRIPTOR::q>(fNeq), _c2f_fneq[y]); } } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> void FineCoupler2D<T,DESCRIPTOR>::couple() { const auto& coarseLattice = this->_coarse.getSuperLattice(); @@ -191,14 +191,14 @@ void FineCoupler2D<T,DESCRIPTOR>::couple() const auto& coarsePos = this->getCoarseLatticeR(y); const auto& finePos = this->getFineLatticeR(2*y); - T fEq[DESCRIPTOR<T>::q] {}; + T fEq[DESCRIPTOR::q] {}; Cell<T,DESCRIPTOR> coarseCell; coarseLattice.get(coarsePos, coarseCell); lbHelpers<T,DESCRIPTOR>::computeFeq(coarseCell, fEq); Cell<T,DESCRIPTOR> cell; fineLattice.get(finePos, cell); - for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { cell[iPop] = fEq[iPop] + this->getScalingFactor() * _c2f_fneq[y][iPop]; } fineLattice.set(finePos, cell); @@ -216,7 +216,7 @@ void FineCoupler2D<T,DESCRIPTOR>::couple() Cell<T,DESCRIPTOR> fineCell; fineLattice.get(finePos, fineCell); - for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop]; } @@ -235,7 +235,7 @@ void FineCoupler2D<T,DESCRIPTOR>::couple() Cell<T,DESCRIPTOR> fineCell; fineLattice.get(finePos, fineCell); - for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop]; } @@ -254,7 +254,7 @@ void FineCoupler2D<T,DESCRIPTOR>::couple() Cell<T,DESCRIPTOR> fineCell; fineLattice.get(finePos, fineCell); - for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop]; } @@ -264,30 +264,30 @@ void FineCoupler2D<T,DESCRIPTOR>::couple() } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> void computeRestrictedFneq(const SuperLattice2D<T,DESCRIPTOR>& lattice, Vector<int,3> latticeR, - T restrictedFneq[DESCRIPTOR<T>::q]) + T restrictedFneq[DESCRIPTOR::q]) { - for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) { - const auto neighbor = latticeR + Vector<int,3> {0, DESCRIPTOR<T>::c[iPop][0], DESCRIPTOR<T>::c[iPop][1]}; + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + const auto neighbor = latticeR + Vector<int,3> {0, descriptors::c<DESCRIPTOR>(iPop,0), descriptors::c<DESCRIPTOR>(iPop,1)}; Cell<T,DESCRIPTOR> cell; lattice.get(neighbor, cell); - T fNeq[DESCRIPTOR<T>::q] {}; + T fNeq[DESCRIPTOR::q] {}; lbHelpers<T,DESCRIPTOR>::computeFneq(cell, fNeq); - for (int jPop=0; jPop < DESCRIPTOR<T>::q; ++jPop) { + for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) { restrictedFneq[jPop] += fNeq[jPop]; } } - for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) { - restrictedFneq[iPop] /= DESCRIPTOR<T>::q; + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + restrictedFneq[iPop] /= DESCRIPTOR::q; } } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> CoarseCoupler2D<T,DESCRIPTOR>::CoarseCoupler2D( Grid2D<T,DESCRIPTOR>& coarse, Grid2D<T,DESCRIPTOR>& fine, Vector<T,2> origin, Vector<T,2> extend): @@ -303,7 +303,7 @@ CoarseCoupler2D<T,DESCRIPTOR>::CoarseCoupler2D( clout << "coarse size: " << this->_coarseSize << std::endl; } -template <typename T, template<typename> class DESCRIPTOR> +template <typename T, typename DESCRIPTOR> void CoarseCoupler2D<T,DESCRIPTOR>::couple() { const auto& fineLattice = this->_fine.getSuperLattice(); @@ -314,18 +314,18 @@ void CoarseCoupler2D<T,DESCRIPTOR>::couple() const auto& finePos = this->getFineLatticeR(2*y); const auto& coarsePos = this->getCoarseLatticeR(y); - T fEq[DESCRIPTOR<T>::q] {}; + T fEq[DESCRIPTOR::q] {}; Cell<T,DESCRIPTOR> fineCell; fineLattice.get(finePos, fineCell); lbHelpers<T,DESCRIPTOR>::computeFeq(fineCell, fEq); - T fNeq[DESCRIPTOR<T>::q] {}; + T fNeq[DESCRIPTOR::q] {}; computeRestrictedFneq(fineLattice, finePos, fNeq); Cell<T,DESCRIPTOR> coarseCell; coarseLattice.get(coarsePos, coarseCell); - for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { coarseCell[iPop] = fEq[iPop] + this->getInvScalingFactor() * fNeq[iPop]; } |