zeroDimensionalFixedPressureModel.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) 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::zeroDimensionalFixedPressureModel
26 
27 Description
28  Zero-dimensional fixed pressure source. Should be used in conjunction
29  with the zeroDimensionalFixedPressureConstraint.
30 
31  This constraint and model facilitates specification of a constant or
32  time-varying pressure. It adds mass source terms proportional to the error
33  that remains when the pressure equation is evaluated at the desired
34  pressure. Iteration may be necessary to converge the constraint in the case
35  of non-linear equations of state.
36 
37  Properties are added or removed with their current value. The model
38  therefore represents a uniform expansion or contraction in infinite space.
39 
40 Usage
41  Example usage:
42  \verbatim
43  {
44  type zeroDimensionalFixedPressure;
45  }
46  \endverbatim
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef zeroDimensionalFixedPressureModel_H
51 #define zeroDimensionalFixedPressureModel_H
52 
53 #include "fvModel.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 namespace fv
60 {
61 
62 class zeroDimensionalFixedPressureConstraint;
63 
64 /*---------------------------------------------------------------------------*\
65  Class zeroDimensionalFixedPressureModel Declaration
66 \*---------------------------------------------------------------------------*/
67 
69 :
70  public fvModel
71 {
72  // Private member functions
73 
74  //- Access the corresponding constraint
75  const zeroDimensionalFixedPressureConstraint& constraint() const;
76 
77 
78  // Sources
79 
80  //- Add a source term to an equation
81  template<class Type>
82  void addSupType
83  (
84  const VolField<Type>& field,
85  fvMatrix<Type>& eqn
86  ) const;
87 
88  //- Add a source term to a compressible continuity equation
89  void addSupType
90  (
91  const volScalarField& rho,
92  fvMatrix<scalar>& eqn
93  ) const;
94 
95  //- Add a source term to a compressible equation
96  template<class Type>
97  void addSupType
98  (
99  const volScalarField& rho,
100  const VolField<Type>& field,
101  fvMatrix<Type>& eqn
102  ) const;
103 
104  //- Add a source term to a phase continuity equation
105  void addSupType
106  (
107  const volScalarField& alpha,
108  const volScalarField& rho,
109  fvMatrix<scalar>& eqn
110  ) const;
111 
112  //- Add a source term to a phase equation
113  template<class Type>
114  void addSupType
115  (
116  const volScalarField& alpha,
117  const volScalarField& rho,
118  const VolField<Type>& field,
119  fvMatrix<Type>& eqn
120  ) const;
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("zeroDimensionalFixedPressure");
127 
128 
129  // Constructors
130 
131  //- Construct from dictionary
133  (
134  const word& name,
135  const word& modelType,
136  const fvMesh& mesh,
137  const dictionary& dict
138  );
139 
140 
141  //- Destructor
143 
144 
145  // Member Functions
146 
147  // Checks
148 
149  //- Return true if the fvModel adds a source term to the given
150  // field's transport equation
151  virtual bool addsSupToField(const word& fieldName) const;
152 
153 
154  // Sources
155 
156  //- Add a source term to an equation
158 
159  //- Add a source term to a compressible equation
161 
162  //- Add a source term to a phase equation
164 
165 
166  // Mesh changes
167 
168  //- Update for mesh motion
169  virtual bool movePoints();
170 
171  //- Update topology using the given map
172  virtual void topoChange(const polyTopoChangeMap&);
173 
174  //- Update from another mesh using the given map
175  virtual void mapMesh(const polyMeshMap&);
176 
177  //- Redistribute or update using the given distribution map
178  virtual void distribute(const polyDistributionMap&);
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace fv
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
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:99
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
static const word & fieldName()
Return the name of the field associated with a source term. Special.
Definition: fvModelI.H:39
Zero-dimensional fixed pressure constraint. Should be used in conjunction with the zeroDimensionalFix...
Zero-dimensional fixed pressure source. Should be used in conjunction with the zeroDimensionalFixedPr...
zeroDimensionalFixedPressureModel(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from dictionary.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool movePoints()
Add a source term to an equation.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
TypeName("zeroDimensionalFixedPressure")
Runtime type information.
virtual bool addsSupToField(const word &fieldName) const
Return true if the fvModel adds a source term to the given.
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.
A class for handling words, derived from string.
Definition: word.H:62
#define DEFINE_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:62
#define DEFINE_FV_MODEL_ADD_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:43
#define DEFINE_FV_MODEL_ADD_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:26
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
labelList fv(nPoints)
dictionary dict