explicitPorositySource.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-2021 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::fv::explicitPorositySource
26 
27 Description
28  Explicit porosity source
29 
30 Usage
31  Example usage, here employing the Darcy-Forchheimer model:
32  \verbatim
33  explicitPorositySourceCoeffs
34  {
35  type DarcyForchheimer;
36 
37  DarcyForchheimerCoeffs
38  {
39  d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
40  f f [0 -1 0 0 0 0 0] (0 0 0);
41 
42  coordinateSystem
43  {
44  type cartesian;
45  origin (0 0 0);
46  coordinateRotation
47  {
48  type axesRotation;
49  e1 (0.70710678 0.70710678 0);
50  e2 (0 0 1);
51  }
52  }
53  }
54  }
55  \endverbatim
56 
57 Note
58  The porous region must be selected as a cellZone.
59 
60 SourceFiles
61  explicitPorositySource.C
62 
63 \*---------------------------------------------------------------------------*/
64 
65 #ifndef explicitPorositySource_H
66 #define explicitPorositySource_H
67 
68 #include "fvModel.H"
69 #include "fvCellSet.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 class porosityModel;
77 
78 namespace fv
79 {
80 
81 
82 /*---------------------------------------------------------------------------*\
83  Class explicitPorositySource Declaration
84 \*---------------------------------------------------------------------------*/
85 
87 :
88  public fvModel
89 {
90  // Private data
91 
92  //- The set of cells the fvConstraint applies to
93  fvCellSet set_;
94 
95  //- Names of the velocity fields
96  wordList UNames_;
97 
98  //- Run-time selectable porosity model
99  mutable autoPtr<porosityModel> porosityPtr_;
100 
101 
102  // Private Member Functions
103 
104  //- Non-virtual read
105  void readCoeffs();
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("explicitPorositySource");
112 
113 
114  // Constructors
115 
116  //- Construct from components
118  (
119  const word& name,
120  const word& modelType,
121  const dictionary& dict,
122  const fvMesh& mesh
123  );
124 
125  //- Disallow default bitwise copy construction
127 
128 
129  //- Destructor
130  virtual ~explicitPorositySource()
131  {}
132 
133 
134  // Member Functions
135 
136  // Access
137 
138  //- Return the porosity model
139  const porosityModel& model() const
140  {
141  return porosityPtr_();
142  }
143 
144 
145  // Checks
146 
147  //- Return the list of fields for which the fvModel adds source term
148  // to the transport equation
149  virtual wordList addSupFields() const;
150 
151 
152  // Add explicit and implicit contributions
153 
154  //- Add implicit contribution to momentum equation
155  virtual void addSup
156  (
157  fvMatrix<vector>& eqn,
158  const word& fieldName
159  ) const;
160 
161  //- Add implicit contribution to compressible momentum equation
162  virtual void addSup
163  (
164  const volScalarField& rho,
165  fvMatrix<vector>& eqn,
166  const word& fieldName
167  ) const;
168 
169  //- Add implicit contribution to phase momentum equation
170  virtual void addSup
171  (
172  const volScalarField& alpha,
173  const volScalarField& rho,
174  fvMatrix<vector>& eqn,
175  const word& fieldName
176  ) const;
177 
178 
179  // Mesh motion
180 
181  //- Update for mesh changes
182  virtual void updateMesh(const mapPolyMesh&);
183 
184 
185  // IO
186 
187  //- Read dictionary
188  virtual bool read(const dictionary& dict);
189 
190 
191  // Member Operators
192 
193  //- Disallow default bitwise assignment
194  void operator=(const explicitPorositySource&) = delete;
195 };
196 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 } // End namespace fv
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
dictionary dict
virtual ~explicitPorositySource()
Destructor.
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Cell-set fvConstraint abstract base class. Provides a base set of controls regarding the location whe...
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
void operator=(const explicitPorositySource &)=delete
Disallow default bitwise assignment.
Finite volume model abstract base class.
Definition: fvModel.H:55
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Add implicit contribution to momentum equation.
const porosityModel & model() const
Return the porosity model.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
virtual bool read(const dictionary &dict)
Read dictionary.
explicitPorositySource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
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:72
virtual void updateMesh(const mapPolyMesh &)
Update for mesh changes.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Top level model for porosity models.
Definition: porosityModel.H:54
Namespace for OpenFOAM.
TypeName("explicitPorositySource")
Runtime type information.