/* This file is part of the OpenLB library * * Copyright (C) 2006, 2007 Jonas Latt * E-mail contact: info@openlb.net * The most recent release of OpenLB can be downloaded at * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ /** \file * Local boundary cell 3D dynamics -- generic implementation. */ #ifndef MOMENTA_ON_BOUNDARIES_3D_HH #define MOMENTA_ON_BOUNDARIES_3D_HH #include "momentaOnBoundaries3D.h" #include "dynamics/lbHelpers.h" #include "dynamics/firstOrderLbHelpers.h" namespace olb { ////////////////////// Class InnerEdgeVelBM3D /////////////// template InnerEdgeVelBM3D:: InnerEdgeVelBM3D() { for (int iD=0; iD InnerEdgeVelBM3D:: InnerEdgeVelBM3D(const T u_[DESCRIPTOR::d]) { for (int iD=0; iD T InnerEdgeVelBM3D::computeRho ( Cell const& cell ) const { T rho1 = velocityBMRho(cell, _u); T rho2 = velocityBMRho(cell, _u); return (rho1 + rho2) / (T)2; } template void InnerEdgeVelBM3D::computeU ( Cell const& cell, T u[DESCRIPTOR::d] ) const { for (int iD=0; iD void InnerEdgeVelBM3D::computeJ ( Cell const& cell, T j[DESCRIPTOR::d] ) const { T rho = computeRho(cell); for (int iD=0; iD void InnerEdgeVelBM3D::computeU ( T u[DESCRIPTOR::d] ) const { for (int iD=0; iD void InnerEdgeVelBM3D::defineRho ( Cell& cell, T rho ) { } template void InnerEdgeVelBM3D::defineU ( Cell& cell, const T u[DESCRIPTOR::d] ) { for (int iD=0; iD void InnerEdgeVelBM3D::defineU ( const T u[DESCRIPTOR::d] ) { for (int iD=0; iD void InnerEdgeVelBM3D:: defineAllMomenta ( Cell& cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal::n] ) { for (int iD=0; iD void InnerEdgeVelBM3D:: computeStress ( Cell const& cell, T rho, const T u[DESCRIPTOR::d], T pi[util::TensorVal::n] ) const { typedef lbHelpers lbH; T uSqr = util::normSqr(u); Cell newCell(cell); for (int iPop=0; iPop(iPop,direction1) == -normal1) && (descriptors::c(iPop,direction2) == -normal2) ) { int opp = util::opposite(iPop); newCell[iPop] = newCell[opp] - lbH::equilibrium(opp, rho, u, uSqr) + lbH::equilibrium(iPop, rho, u, uSqr); } } lbH::computeStress(newCell, rho, u, pi); } ////////////////////// Class InnerCornerVelBM3D /////////////// template InnerCornerVelBM3D::InnerCornerVelBM3D() { for (int iD=0; iD InnerCornerVelBM3D::InnerCornerVelBM3D ( const T u_[DESCRIPTOR::d]) { for (int iD=0; iD T InnerCornerVelBM3D::computeRho ( Cell const& cell ) const { T rhoX = velocityBMRho(cell, _u); T rhoY = velocityBMRho(cell, _u); T rhoZ = velocityBMRho(cell, _u); return (rhoX + rhoY + rhoZ) / (T)3; } template void InnerCornerVelBM3D::computeU ( Cell const& cell, T u[DESCRIPTOR::d] ) const { for (int iD=0; iD void InnerCornerVelBM3D::computeJ ( Cell const& cell, T j[DESCRIPTOR::d] ) const { T rho = computeRho(cell); for (int iD=0; iD void InnerCornerVelBM3D::computeU ( T u[DESCRIPTOR::d] ) const { for (int iD=0; iD void InnerCornerVelBM3D::defineRho ( Cell& cell, T rho ) { } template void InnerCornerVelBM3D::defineU ( Cell& cell, const T u[DESCRIPTOR::d] ) { for (int iD=0; iD void InnerCornerVelBM3D::defineU ( const T u[DESCRIPTOR::d] ) { for (int iD=0; iD void InnerCornerVelBM3D::defineAllMomenta ( Cell& cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal::n] ) { for (int iD=0; iD void InnerCornerVelBM3D::computeStress ( Cell const& cell, T rho, const T u[DESCRIPTOR::d], T pi[util::TensorVal::n] ) const { typedef lbHelpers lbH; Cell newCell(cell); int v[DESCRIPTOR::d] = { -normalX, -normalY, -normalZ }; int unknownF = util::findVelocity(v); if (unknownF != DESCRIPTOR::q) { int oppositeF = util::opposite(unknownF); T uSqr = util::normSqr(u); newCell[unknownF] = newCell[oppositeF] - lbH::equilibrium(oppositeF, rho, u, uSqr) + lbH::equilibrium(unknownF, rho, u, uSqr); } lbH::computeStress(newCell, rho, u, pi); } } // namespace olb #endif