fixedCoeff.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::porosityModels::fixedCoeff
26 
27 Description
28  Fixed coefficient form of porosity model
29 
30  \f[
31  S = - \rho_ref (\alpha + \beta |U|) U
32  \f]
33 
34  In the case of compressible flow, a value for the reference density is
35  required
36 
37 SourceFiles
38  fixedCoeff.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef fixedCoeff_H
43 #define fixedCoeff_H
44 
45 #include "porosityModel.H"
46 #include "dimensionedTensor.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 namespace porosityModels
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class fixedCoeff Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class fixedCoeff
60 :
61  public porosityModel
62 {
63  // Private Data
64 
65  //- Alpha coefficient XYZ components (user-supplied) [1/s]
66  dimensionedVector alphaXYZ_;
67 
68  //- Beta coefficient XYZ components (user-supplied) [1/m]
69  dimensionedVector betaXYZ_;
70 
71  //- Model alpha coefficient - converted from alphaXYZ [1/s]
72  tensorField alpha_;
73 
74  //- Model beta coefficient - converted from betaXYZ [1/m]
75  tensorField beta_;
76 
77  bool rhoRefFound_;
78 
79  scalar rhoRef_;
80 
81 
82  // Private Member Functions
83 
84  //- Apply
85  void apply
86  (
87  scalarField& Udiag,
88  vectorField& Usource,
89  const scalarField& V,
90  const vectorField& U,
91  const scalar rho
92  ) const;
93 
94  //- Apply
95  void apply
96  (
97  tensorField& AU,
98  const vectorField& U,
99  const scalar rho
100  ) const;
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("fixedCoeff");
107 
108  // Constructors
109 
110  fixedCoeff
111  (
112  const word& name,
113  const fvMesh& mesh,
114  const dictionary& dict,
115  const dictionary& coeffDict,
116  const word& cellZoneName
117  );
118 
119  //- Disallow default bitwise copy construction
120  fixedCoeff(const fixedCoeff&) = delete;
121 
122 
123  //- Destructor
124  virtual ~fixedCoeff();
125 
126 
127  // Member Functions
128 
129  //- Transform the model data wrt mesh changes
130  virtual void calcTransformModelData();
131 
132  //- Calculate the porosity force
133  virtual void calcForce
134  (
135  const volVectorField& U,
136  const volScalarField& rho,
137  const volScalarField& mu,
139  ) const;
140 
141  //- Add resistance
142  virtual void correct(fvVectorMatrix& UEqn) const;
143 
144  //- Add resistance
145  virtual void correct
146  (
147  const fvVectorMatrix& UEqn,
148  volTensorField& AU
149  ) const;
150 
151 
152  // Member Operators
153 
154  //- Disallow default bitwise assignment
155  void operator=(const fixedCoeff&) = delete;
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace porosityModels
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Generic GeometricField class.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Top level model for porosity models.
Definition: porosityModel.H:57
const word & name() const
Return const access to the porosity model name.
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu) const
Return the force over the cell zone(s)
Fixed coefficient form of porosity model.
Definition: fixedCoeff.H:61
void operator=(const fixedCoeff &)=delete
Disallow default bitwise assignment.
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
Definition: fixedCoeff.C:172
fixedCoeff(const word &name, const fvMesh &mesh, const dictionary &dict, const dictionary &coeffDict, const word &cellZoneName)
Definition: fixedCoeff.C:92
virtual ~fixedCoeff()
Destructor.
Definition: fixedCoeff.C:115
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: fixedCoeff.C:196
TypeName("fixedCoeff")
Runtime type information.
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
Definition: fixedCoeff.C:121
A class for handling words, derived from string.
Definition: word.H:62
fvVectorMatrix & UEqn
Definition: UEqn.H:11
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
U
Definition: pEqn.H:72
const dimensionedScalar mu
Atomic mass unit.
Namespace for OpenFOAM.
dictionary dict