OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

porousZone.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2007 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     porousZone
00027 
00028 Description
00029     porous zone definition based on cell zones and parameters obtained
00030     from a control dictionary constructed from the given stream.
00031     The orientation of the porous region is defined either by the local
00032     e1/e2 vectors, or by axis (e3) and direction (e1) as per coordinateSystems.
00033     Implemented porosity models:
00034 
00035         powerLaw (C0/C1 parameters)
00036             S = - rho * C0 * |U|^((C1 - 1) / 2) * U
00037 
00038         Darcy-Forchheimer (d/f parameters)
00039             S = - (mu * U * d + rho/2 * |U| * f) * U
00040 
00041     The model does not include correction of the temporal terms.
00042 
00043 SourceFiles
00044     porousZone.C
00045 
00046 \*---------------------------------------------------------------------------*/
00047 
00048 #ifndef porousZone_H
00049 #define porousZone_H
00050 
00051 #include "dictionary.H"
00052 #include "wordList.H"
00053 #include "labelList.H"
00054 #include "dimensionedScalar.H"
00055 #include "dimensionedTensor.H"
00056 #include "primitiveFieldsFwd.H"
00057 #include "volFieldsFwd.H"
00058 #include "fvMatricesFwd.H"
00059 
00060 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00061 
00062 namespace Foam
00063 {
00064 
00065 class fvMesh;
00066 
00067 /*---------------------------------------------------------------------------*\
00068                            Class porousZone Declaration
00069 \*---------------------------------------------------------------------------*/
00070 
00071 class porousZone
00072 {
00073     // Private data
00074 
00075         //- Reference to the finite volume mesh this zone is part of
00076         const fvMesh& mesh_;
00077 
00078         //- Name of this zone
00079         word name_;
00080 
00081         //- Dictionary containing the parameters
00082         dictionary dict_;
00083 
00084         //- Cell zone ID
00085         label cellZoneID_;
00086 
00087         //- powerLaw coefficient C0
00088         dimensionedScalar C0_;
00089 
00090         //- powerLaw coefficient C1
00091         dimensionedScalar C1_;
00092 
00093         //- Darcy coefficient 
00094         dimensionedTensor D_;
00095 
00096         //- Forchheimer coefficient
00097         dimensionedTensor F_;
00098 
00099 
00100     // Private Member Functions
00101 
00102         //- Power-law resistance
00103         template<class RhoFieldType>
00104         void addPowerLawResistance
00105         (
00106             scalarField& Udiag,
00107             const labelList& cells,
00108             const scalarField& V,
00109             const RhoFieldType& rho,
00110             const vectorField& U
00111         ) const;
00112 
00113         //- Viscous and inertial resistance
00114         template<class RhoFieldType>
00115         void addViscousInertialResistance
00116         (
00117             scalarField& Udiag,
00118             vectorField& Usource,
00119             const labelList& cells,
00120             const scalarField& V,
00121             const RhoFieldType& rho,
00122             const scalarField& mu,
00123             const vectorField& U
00124         ) const;
00125 
00126 
00127         //- Power-law resistance
00128         template<class RhoFieldType>
00129         void addPowerLawResistance
00130         (
00131             tensorField& AU,
00132             const labelList& cells,
00133             const RhoFieldType& rho,
00134             const vectorField& U
00135         ) const;
00136 
00137         //- Viscous and inertial resistance
00138         template<class RhoFieldType>
00139         void addViscousInertialResistance
00140         (
00141             tensorField& AU,
00142             const labelList& cells,
00143             const RhoFieldType& rho,
00144             const scalarField& mu,
00145             const vectorField& U
00146         ) const;
00147 
00148 
00149         //- Disallow default bitwise copy construct
00150         porousZone(const porousZone&);
00151 
00152         //- Disallow default bitwise assignment
00153         void operator=(const porousZone&);
00154 
00155 
00156 public:
00157 
00158     // Constructors
00159 
00160         //- Construct from fvMesh and Istream
00161         porousZone(const fvMesh& mesh, Istream& is);
00162 
00163         //- Return clone
00164         autoPtr<porousZone> clone() const
00165         {
00166             notImplemented("autoPtr<porousZone> clone() const");
00167             return autoPtr<porousZone>(NULL);
00168         }
00169 
00170         //- Return a pointer to a new porousZone created on freestore
00171         //  from Istream
00172         class iNew
00173         {
00174             const fvMesh& mesh_;
00175 
00176         public:
00177 
00178             iNew(const fvMesh& mesh)
00179             :
00180                 mesh_(mesh)
00181             {}
00182 
00183             autoPtr<porousZone> operator()(Istream& is) const
00184             {
00185                 return autoPtr<porousZone>(new porousZone(mesh_, is));
00186             }
00187         };
00188 
00189 
00190     // Member Functions
00191 
00192         // Access
00193 
00194             const word& zoneName() const
00195             {
00196                 return name_;
00197             }
00198 
00199             label zoneId() const
00200             {
00201                 return cellZoneID_;
00202             }
00203 
00204             const dictionary& dict() const
00205             {
00206                 return dict_;
00207             }
00208 
00209 
00210         //- Add the viscous and inertial resistance force contribution
00211         //  to the momentum equation
00212         void addResistance(fvVectorMatrix& UEqn) const;
00213 
00214         //- Add the viscous and inertial resistance force contribution
00215         //  to the tensorial diagonal.
00216         //  Optionally correct the processor BCs of AU.
00217         void addResistance
00218         (
00219             const fvVectorMatrix& UEqn,
00220             volTensorField& AU,
00221             bool correctAUpBC = true
00222         ) const;
00223 
00224         //- Write the porousZone dictionary
00225         void writeDict(Ostream&, bool subDict = true) const;
00226 
00227 
00228     // Ostream Operator
00229 
00230         friend Ostream& operator<<(Ostream&, const porousZone&);
00231 };
00232 
00233 
00234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00235 
00236 } // End namespace Foam
00237 
00238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00239 
00240 #ifdef NoRepository
00241 #   include "porousZoneTemplates.C"
00242 #endif
00243 
00244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00245 
00246 #endif
00247 
00248 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd