fixedCoeff.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::porosityModels::fixedCoeff
29 
30 Description
31  Fixed coefficient form of porosity model
32 
33  \f[
34  S = - \rho_ref (\alpha + \beta |U|) U
35  \f]
36 
37  In the case of compressible flow, a value for the reference density is
38  required
39 
40 SourceFiles
41  fixedCoeff.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef Foam_porosityModels_fixedCoeff_H
46 #define Foam_porosityModels_fixedCoeff_H
47 
48 #include "porosityModel.H"
49 #include "dimensionedTensor.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 namespace porosityModels
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class fixedCoeff Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class fixedCoeff
63 :
64  public porosityModel
65 {
66  // Private Data
67 
68  //- Alpha coefficient XYZ components (user-supplied) [1/s]
69  dimensionedVector alphaXYZ_;
70 
71  //- Beta coefficient XYZ components (user-supplied) [1/m]
72  dimensionedVector betaXYZ_;
73 
74  //- Model alpha coefficient - converted from alphaXYZ [1/s]
75  List<tensorField> alpha_;
76 
77  //- Model beta coefficient - converted from betaXYZ [1/m]
78  List<tensorField> beta_;
79 
80 
81  // Private Member Functions
82 
83  //- Apply
84  void apply
85  (
86  scalarField& Udiag,
87  vectorField& Usource,
88  const scalarField& V,
89  const vectorField& U,
90  const scalar rho
91  ) const;
92 
93  //- Apply
94  void apply
95  (
96  tensorField& AU,
97  const vectorField& U,
98  const scalar rho
99  ) const;
100 
101  //- No copy construct
102  fixedCoeff(const fixedCoeff&) = delete;
103 
104  //- No copy assignment
105  void operator=(const fixedCoeff&) = delete;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("fixedCoeff");
112 
113  //- Constructor
114  fixedCoeff
115  (
116  const word& name,
117  const word& modelType,
118  const fvMesh& mesh,
119  const dictionary& dict,
120  const wordRe& cellZoneName
121  );
122 
123  //- Destructor
124  virtual ~fixedCoeff() = default;
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  (
148  const volScalarField& rho,
149  const volScalarField& mu
150  ) const;
151 
152  //- Add resistance
153  virtual void correct
154  (
155  const fvVectorMatrix& UEqn,
156  volTensorField& AU
157  ) const;
158 
159 
160  // I-O
161 
162  //- Write
163  bool writeData(Ostream& os) const;
164 };
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace porosityModels
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
const dictionary & dict() const
Return dictionary used for model construction.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu)
Return the force over the cell zone(s)
virtual ~fixedCoeff()=default
Destructor.
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
Definition: fixedCoeff.C:124
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:64
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
Definition: wordRe.H:78
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
Fixed coefficient form of porosity model.
Definition: fixedCoeff.H:57
TypeName("fixedCoeff")
Runtime type information.
const dimensionedScalar mu
Atomic mass unit.
U
Definition: pEqn.H:72
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: fixedCoeff.C:186
const word & name() const
Return const access to the porosity model name.
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
bool writeData(Ostream &os) const
Write.
Definition: fixedCoeff.C:245
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
Definition: fixedCoeff.C:167
Top level model for porosity models.
Definition: porosityModel.H:53
Namespace for OpenFOAM.