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-2023 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 fvMesh& mesh,
122  const dictionary& dict
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 changes
180 
181  //- Update for mesh motion
182  virtual bool movePoints();
183 
184  //- Update topology using the given map
185  virtual void topoChange(const polyTopoChangeMap&);
186 
187  //- Update from another mesh using the given map
188  virtual void mapMesh(const polyMeshMap&);
189 
190  //- Redistribute or update using the given distribution map
191  virtual void distribute(const polyDistributionMap&);
192 
193 
194  // IO
195 
196  //- Read dictionary
197  virtual bool read(const dictionary& dict);
198 
199 
200  // Member Operators
201 
202  //- Disallow default bitwise assignment
203  void operator=(const explicitPorositySource&) = delete;
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace fv
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
General run-time selected cell set selection class for fvMesh.
Definition: fvCellSet.H:88
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
explicitPorositySource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
const porosityModel & model() const
Return the porosity model.
virtual bool read(const dictionary &dict)
Read dictionary.
void operator=(const explicitPorositySource &)=delete
Disallow default bitwise assignment.
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Add implicit contribution to momentum equation.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
TypeName("explicitPorositySource")
Runtime type information.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Top level model for porosity models.
Definition: porosityModel.H:57
A class for handling words, derived from string.
Definition: word.H:62
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict