1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Porous zone definition based on cell zones.
31 Porous zone definition based on cell zones and parameters obtained from a
32 control dictionary constructed from the given stream. The orientation of
33 the porous region is defined with the same notation as a coordinateSystem,
34 but only a Cartesian coordinate system is valid.
36 Implemented porosity models:
38 powerLaw (@e C0 and @e C1 parameters)
40 S = - \rho C_0 |U|^{(C_1 - 1)/2} U
43 Darcy-Forchheimer (@e d and @e f parameters)
45 S = - (\mu \, d + \frac{\rho |U|}{2} \, f) U
49 Since negative Darcy/Forchheimer parameters are invalid, they can be used
50 to specify a multiplier (of the max component).
52 The porousZones method porousZones::ddt() mirrors the normal fvm::ddt()
53 method, but accounts for the effective volume of the cells.
56 porousZones and coordinateSystems
62 \*---------------------------------------------------------------------------*/
67 #include "dictionary.H"
68 #include "coordinateSystem.H"
69 #include "coordinateSystems.H"
71 #include "labelList.H"
72 #include "dimensionedScalar.H"
73 #include "dimensionedTensor.H"
74 #include "primitiveFieldsFwd.H"
75 #include "volFieldsFwd.H"
76 #include "fvMatricesFwd.H"
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 /*---------------------------------------------------------------------------*\
88 Class porousZone Declaration
89 \*---------------------------------------------------------------------------*/
98 //- Reference to the finite volume mesh this zone is part of
101 //- Dictionary containing the parameters
107 //- Coordinate system used for the zone (Cartesian)
108 coordinateSystem coordSys_;
110 //- porosity of the zone (0 < porosity <= 1)
111 // Placeholder for treatment of temporal terms.
115 //- powerLaw coefficient C0
118 //- powerLaw coefficient C1
121 //- Darcy coefficient
122 dimensionedTensor D_;
124 //- Forchheimer coefficient
125 dimensionedTensor F_;
128 // Private Member Functions
130 //- adjust negative resistance values to be multiplier of max value
131 static void adjustNegativeResistance(dimensionedVector& resist);
133 //- Power-law resistance
134 template<class RhoFieldType>
135 void addPowerLawResistance
138 const labelList& cells,
139 const scalarField& V,
140 const RhoFieldType& rho,
144 //- Viscous and inertial resistance
145 template<class RhoFieldType>
146 void addViscousInertialResistance
149 vectorField& Usource,
150 const labelList& cells,
151 const scalarField& V,
152 const RhoFieldType& rho,
153 const scalarField& mu,
158 //- Power-law resistance
159 template<class RhoFieldType>
160 void addPowerLawResistance
163 const labelList& cells,
164 const RhoFieldType& rho,
168 //- Viscous and inertial resistance
169 template<class RhoFieldType>
170 void addViscousInertialResistance
173 const labelList& cells,
174 const RhoFieldType& rho,
175 const scalarField& mu,
180 //- Disallow default bitwise copy construct
181 porousZone(const porousZone&);
183 //- Disallow default bitwise assignment
184 void operator=(const porousZone&);
191 //- Construct from components
192 porousZone(const word& name, const fvMesh&, const dictionary&);
195 autoPtr<porousZone> clone() const
197 notImplemented("autoPtr<porousZone> clone() const");
198 return autoPtr<porousZone>(NULL);
201 //- Return pointer to new porousZone created on freestore from Istream
204 //- Reference to the finite volume mesh this zone is part of
209 iNew(const fvMesh& mesh)
214 autoPtr<porousZone> operator()(Istream& is) const
219 return autoPtr<porousZone>(new porousZone(name, mesh_, dict));
225 virtual ~porousZone()
234 const word& zoneName() const
240 const fvMesh& mesh() const
251 //- dictionary values used for the porousZone
252 const dictionary& dict() const
257 //- Return coordinate system
258 const coordinateSystem& coordSys() const
264 const point& origin() const
266 return coordSys_.origin();
270 const vector& axis() const
272 return coordSys_.axis();
276 scalar porosity() const
281 //- Edit access to porosity
288 //- Modify time derivative elements according to porosity
290 void modifyDdt(fvMatrix<Type>&) const;
292 //- Add the viscous and inertial resistance force contribution
293 // to the momentum equation
294 void addResistance(fvVectorMatrix& UEqn) const;
296 //- Add the viscous and inertial resistance force contribution
297 // to the tensorial diagonal.
298 // Optionally correct the processor BCs of AU.
301 const fvVectorMatrix& UEqn,
303 bool correctAUprocBC = true
306 //- Write the porousZone dictionary
307 virtual void writeDict(Ostream&, bool subDict = true) const;
312 friend Ostream& operator<<(Ostream&, const porousZone&);
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 } // End namespace Foam
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
323 # include "porousZoneTemplates.C"
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330 // ************************************************************************* //