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