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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fv::explicitPorositySource
29
30Group
31 grpFvOptionsSources
32
33Description
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
47Usage
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
107Note
108 - The porous region must be selected as a \c cellZone.
109
110See also
111 - Foam::porosityModel
112
113SourceFiles
114 explicitPorositySource.C
115
116\*---------------------------------------------------------------------------*/
117
118#ifndef Foam_explicitPorositySource_H
119#define Foam_explicitPorositySource_H
120
121#include "cellSetOption.H"
122
123// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124
125namespace Foam
126{
127
128class porosityModel;
129
130namespace fv
131{
132
133/*---------------------------------------------------------------------------*\
134 Class explicitPorositySource Declaration
135\*---------------------------------------------------------------------------*/
136
137class explicitPorositySource
138:
139 public fv::cellSetOption
140{
141protected:
142
143 // Protected Data
144
145 //- Run-time selectable porosity model
146 autoPtr<porosityModel> porosityPtr_;
147
148
149public:
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;
176
177 // Member Functions
178
179 //- Access to the porosityModel
180 const porosityModel& model() const noexcept
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,
198 const label fieldi
199 );
200
201 //- Add implicit contribution to phase momentum equation
202 virtual void addSup
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// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Applies an explicit porosity source to the momentum equation within a specified region.
explicitPorositySource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual bool read(const dictionary &dict)
Read dictionary.
void operator=(const explicitPorositySource &)=delete
No copy assignment.
autoPtr< porosityModel > porosityPtr_
Run-time selectable porosity model.
explicitPorositySource(const explicitPorositySource &)=delete
No copy construct.
virtual ~explicitPorositySource()=default
Destructor.
TypeName("explicitPorositySource")
Runtime type information.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add implicit contribution to momentum equation.
const porosityModel & model() const noexcept
Access to the porosityModel.
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Top level model for porosity models.
Definition: porosityModel.H:60
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
labelList fv(nPoints)
volScalarField & alpha
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73