⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 momentaonboundaries.h

📁 open lattice boltzmann project www.openlb.org
💻 H
字号:
/*  This file is part of the OpenLB library * *  Copyright (C) 2006, 2007 Jonas Latt *  Address: Rue General Dufour 24,  1211 Geneva 4, Switzerland  *  E-mail: jonas.latt@gmail.com * *  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 * Implementation of boundary cell dynamics -- header file. */#ifndef MOMENTA_ON_BOUNDARIES_H#define MOMENTA_ON_BOUNDARIES_H#include "dynamics.h"#include "util.h"#include "cell.h"namespace olb {template<typename T, template<typename U> class Lattice> class Cell;/// Dirichlet condition on velocity and/or pressuretemplate<typename T, template<typename U> class Lattice>class DirichletBoundaryMomenta : public Momenta<T,Lattice> {};template<typename T, template<typename U> class Lattice>class EquilibriumBM : public DirichletBoundaryMomenta<T,Lattice> {public:    EquilibriumBM();    EquilibriumBM(T rho_, const T u_[Lattice<T>::d]);    virtual T computeRho(Cell<T,Lattice> const& cell) const;    virtual void computeU (        Cell<T,Lattice> const& cell,        T u[Lattice<T>::d] ) const;    virtual void computeJ (        Cell<T,Lattice> const& cell,        T j[Lattice<T>::d] ) const;    virtual void computeStress (        Cell<T,Lattice> const& cell,         T rho, const T u[Lattice<T>::d],        T pi[util::TensorVal<Lattice<T> >::n] ) const;    virtual void defineRho(Cell<T,Lattice>& cell, T rho) ;    virtual void defineU(Cell<T,Lattice>& cell,                         const T u[Lattice<T>::d]) ;    virtual void defineAllMomenta (        Cell<T,Lattice>& cell,        T rho, const T u[Lattice<T>::d],        const T pi[util::TensorVal<Lattice<T> >::n] ); private:    T rho, u[Lattice<T>::d];};/// Computation of velocity momenta on a velocity boundarytemplate<typename T, template<typename U> class Lattice,         int direction, int orientation>class VelocityBM : virtual public DirichletBoundaryMomenta<T,Lattice> {public:    /// Default Constructor: initialization to zero    VelocityBM();    /// Constructor with boundary initialization    VelocityBM(const T u_[Lattice<T>::d]);    virtual T computeRho(Cell<T,Lattice> const& cell) const;    virtual void computeU (        Cell<T,Lattice> const& cell,        T u[Lattice<T>::d] ) const;    virtual void computeJ (        Cell<T,Lattice> const& cell,        T j[Lattice<T>::d] ) const;    void computeU(T u[Lattice<T>::d]) const;    virtual void defineRho(Cell<T,Lattice>& cell, T rho) ;    virtual void defineU(Cell<T,Lattice>& cell,                         const T u[Lattice<T>::d]) ;    void defineU(const T u[Lattice<T>::d]);    virtual void defineAllMomenta (        Cell<T,Lattice>& cell,        T rho, const T u[Lattice<T>::d],        const T pi[util::TensorVal<Lattice<T> >::n] );private:    T u[Lattice<T>::d];   ///< value of the velocity on the boundary};/// Computation of velocity momenta on a velocity boundarytemplate<typename T, template<typename U> class Lattice,         int direction, int orientation>class PressureBM : virtual public DirichletBoundaryMomenta<T,Lattice> {public:    /// Default Constructor: initialization to u=0, rho=1    PressureBM();    /// Constructor with boundary initialization    PressureBM(const T values_[Lattice<T>::d]);    virtual T computeRho(Cell<T,Lattice> const& cell) const;    T computeRho() const;    virtual void computeU (        Cell<T,Lattice> const& cell,        T u[Lattice<T>::d] ) const;    virtual void computeJ (        Cell<T,Lattice> const& cell,        T j[Lattice<T>::d] ) const;    virtual void defineRho(Cell<T,Lattice>& cell, T rho);    void defineRho(T rho);    virtual void defineU(Cell<T,Lattice>& cell,                         const T u[Lattice<T>::d]);    virtual void defineAllMomenta (        Cell<T,Lattice>& cell,        T rho, const T u[Lattice<T>::d],        const T pi[util::TensorVal<Lattice<T> >::n] );private:    /// Velocity/Density on boundary.    /** Contains velocity on the boundary, except for values[direction] that     * contains a prescription for the density.     */    T values[Lattice<T>::d];};/// Here, the stress is computed from the particle distribution functionstemplate<typename T, template<typename U> class Lattice>class FreeStressBM : virtual public DirichletBoundaryMomenta<T,Lattice>{public:    virtual void computeStress (            Cell<T,Lattice> const& cell,            T rho, const T u[Lattice<T>::d],            T pi[util::TensorVal<Lattice<T> >::n] ) const;};/// Use special trick to compute u resp. rho, but compute pi from part. distr. functionstemplate<typename T, template<typename U> class Lattice,         template <             typename T_, template<typename U_> class Lattice_,             int direction_, int orientation_ >         class HydroBM,         int direction, int orientation>class BasicDirichletBM    : public FreeStressBM<T, Lattice>,      public HydroBM<T,Lattice,direction,orientation>{ };/// Computation of the stress tensor for regularized boundarytemplate<typename T, template<typename U> class Lattice,         int direction, int orientation>class RegularizedBM : virtual public DirichletBoundaryMomenta<T,Lattice> {public:    /// Stress tensor    virtual void computeStress (            Cell<T,Lattice> const& cell,            T rho, const T u[Lattice<T>::d],            T pi[util::TensorVal<Lattice<T> >::n] ) const;};/// Regularized velocity boundary nodetemplate<typename T, template<typename U> class Lattice,         int direction, int orientation>class RegularizedVelocityBM    : public RegularizedBM<T,Lattice,direction,orientation>,      public VelocityBM<T,Lattice,direction,orientation>{public:    RegularizedVelocityBM() { }    RegularizedVelocityBM(const T u_[Lattice<T>::d])        : VelocityBM<T,Lattice,direction,orientation>(u_)    { }};/// Regularized pressure boundary nodetemplate<typename T, template<typename U> class Lattice,         int direction, int orientation>class RegularizedPressureBM    : public RegularizedBM<T,Lattice,direction,orientation>,      public PressureBM<T,Lattice,direction,orientation>{public:    RegularizedPressureBM() { }    RegularizedPressureBM(const T values_[Lattice<T>::d])        : PressureBM<T,Lattice,direction,orientation>(values_)    { }};/// In this class, the velocity is fixed/** * As opposed to VelocityBM, the pressure is however not * computed from a special trick on the boundary, but the * same way it would be in the bulk. */template<typename T, template<typename U> class Lattice>class FixedVelocityBM : public Momenta<T,Lattice> {public:    virtual T computeRho(Cell<T,Lattice> const& cell) const;    virtual void computeU (        Cell<T,Lattice> const& cell,        T u[Lattice<T>::d] ) const;    virtual void computeJ (        Cell<T,Lattice> const& cell,        T j[Lattice<T>::d] ) const;    virtual void computeStress (        Cell<T,Lattice> const& cell,         T rho, const T u[Lattice<T>::d],        T pi[util::TensorVal<Lattice<T> >::n] ) const;    virtual void computeRhoU (        Cell<T,Lattice> const& cell,        T& rho, T u[Lattice<T>::d]) const;    virtual void computeAllMomenta (        Cell<T,Lattice> const& cell,        T& rho, T u[Lattice<T>::d],        T pi[util::TensorVal<Lattice<T> >::n] ) const;    virtual void defineRho(Cell<T,Lattice>& cell, T rho);    virtual void defineU(Cell<T,Lattice>& cell,                         const T u[Lattice<T>::d]);    virtual void defineRhoU (        Cell<T,Lattice>& cell,        T rho, const T u[Lattice<T>::d]);    virtual void defineAllMomenta (        Cell<T,Lattice>& cell,        T rho, const T u[Lattice<T>::d],        const T pi[util::TensorVal<Lattice<T> >::n] );private:    BulkMomenta<T,Lattice> basicMomenta;    T fixU[Lattice<T>::d];};}  // namespace olb#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -