explicitPorositySource.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-2018 OpenFOAM Foundation
9  Copyright (C) 2020 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::fv::explicitPorositySource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Applies an explicit porosity source to
35  the momentum equation within a specified region.
36 
37  Sources applied to:
38  \verbatim
39  U | Velocity [m/s]
40  \endverbatim
41 
42  Required fields:
43  \verbatim
44  U | Velocity [m/s]
45  \endverbatim
46 
47 Usage
48  Minimal example by using \c constant/fvOptions:
49  \verbatim
50  explicitPorositySource1
51  {
52  // Mandatory entries (unmodifiable)
53  type <porosityModelName>;
54 
55  <porosityModelName>Coeffs
56  {
57  // Optional entries (runtime modifiable)
58  UNames (<Uname1> <Uname2> ... <UnameN>);
59 
60  // Conditional optional entries (runtime modifiable)
61 
62  // when the entry "UNames" is not present
63  U U;
64 
65  // Mandatory/Optional (inherited) entries
66  ...
67  }
68 
69  // Mandatory/Optional (inherited) entries
70  ...
71  }
72  \endverbatim
73 
74  where the entries mean:
75  \table
76  Property | Description | Type | Reqd | Dflt
77  type | Type name: <porosityModelName> | word | yes | -
78  UNames | Names of operand velocity fields | wordList | no | -
79  U | Name of operand velocity field | word | no | U
80  \endtable
81 
82  The inherited entries are elaborated in:
83  - \link fvOption.H \endlink
84  - \link cellSetOption.H \endlink
85 
86  Example usage, here employing the Darcy-Forchheimer model:
87  \verbatim
88  explicitPorositySourceCoeffs
89  {
90  type DarcyForchheimer;
91 
92  DarcyForchheimerCoeffs
93  {
94  d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
95  f f [0 -1 0 0 0 0 0] (0 0 0);
96 
97  coordinateSystem
98  {
99  origin (0 0 0);
100  e1 (0.70710678 0.70710678 0);
101  e2 (0 0 1);
102  }
103  }
104  }
105  \endverbatim
106 
107 Note
108  - The porous region must be selected as a \c cellZone.
109 
110 See also
111  - Foam::porosityModel
112 
113 SourceFiles
114  explicitPorositySource.C
115 
116 \*---------------------------------------------------------------------------*/
117 
118 #ifndef explicitPorositySource_H
119 #define explicitPorositySource_H
120 
121 #include "cellSetOption.H"
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 namespace Foam
126 {
127 
128 class porosityModel;
129 
130 namespace fv
131 {
132 
133 /*---------------------------------------------------------------------------*\
134  Class explicitPorositySource Declaration
135 \*---------------------------------------------------------------------------*/
136 
137 class explicitPorositySource
138 :
139  public fv::cellSetOption
140 {
141 protected:
142 
143  // Protected Data
144 
145  //- Run-time selectable porosity model
146  autoPtr<porosityModel> porosityPtr_;
147 
148 
149 public:
150 
151  //- Runtime type information
152  TypeName("explicitPorositySource");
153 
154 
155  // Constructors
156 
157  //- Construct from components
159  (
160  const word& name,
161  const word& modelType,
162  const dictionary& dict,
163  const fvMesh& mesh
164  );
165 
166  //- No copy construct
168 
169  //- No copy assignment
170  void operator=(const explicitPorositySource&) = delete;
171 
172 
173  //- Destructor
174  virtual ~explicitPorositySource() = default;
175 
176 
177  // Member Functions
178 
179  //- Access to the porosityModel
180  const porosityModel& model() const
181  {
182  return *porosityPtr_;
183  }
184 
185 
186  //- Add implicit contribution to momentum equation
187  virtual void addSup
188  (
189  fvMatrix<vector>& eqn,
190  const label fieldi
191  );
192 
193  //- Add implicit contribution to compressible momentum equation
194  virtual void addSup
195  (
196  const volScalarField& rho,
197  fvMatrix<vector>& eqn,
198  const label fieldi
199  );
200 
201  //- Add implicit contribution to phase momentum equation
202  virtual void addSup
203  (
204  const volScalarField& alpha,
205  const volScalarField& rho,
206  fvMatrix<vector>& eqn,
207  const label fieldi
208  );
209 
210 
211  //- Read dictionary
212  virtual bool read(const dictionary& dict);
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace fv
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::fv::explicitPorositySource::operator=
void operator=(const explicitPorositySource &)=delete
No copy assignment.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::fv::explicitPorositySource::TypeName
TypeName("explicitPorositySource")
Runtime type information.
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::fv::explicitPorositySource::~explicitPorositySource
virtual ~explicitPorositySource()=default
Destructor.
Foam::fv::explicitPorositySource
Applies an explicit porosity source to the momentum equation within a specified region.
Definition: explicitPorositySource.H:160
Foam::fv::explicitPorositySource::addSup
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add implicit contribution to momentum equation.
Definition: explicitPorositySource.C:78
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::fv::explicitPorositySource::model
const porosityModel & model() const
Access to the porosityModel.
Definition: explicitPorositySource.H:203
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::porosityModel
Top level model for porosity models.
Definition: porosityModel.H:57
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fv::explicitPorositySource::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: explicitPorositySource.C:116
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::explicitPorositySource::explicitPorositySource
explicitPorositySource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: explicitPorositySource.C:50
Foam::fv::explicitPorositySource::porosityPtr_
autoPtr< porosityModel > porosityPtr_
Run-time selectable porosity model.
Definition: explicitPorositySource.H:169