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(fvMatrix<Type>& eqn, const word& fieldName) const;
83 
84  //- Add a source term to a scalar equation
85  void addSupType(fvMatrix<scalar>& eqn, const word& fieldName) const;
86 
87  //- Add a source term to a compressible equation
88  template<class Type>
89  void addSupType
90  (
91  const volScalarField& rho,
92  fvMatrix<Type>& eqn,
93  const word& fieldName
94  ) const;
95 
96  //- Add a source term to a scalar compressible equation
97  void addSupType
98  (
99  const volScalarField& rho,
100  fvMatrix<scalar>& eqn,
101  const word& fieldName
102  ) const;
103 
104  //- Add a source term to a phase equation
105  template<class Type>
106  void addSupType
107  (
108  const volScalarField& alpha,
109  const volScalarField& rho,
110  fvMatrix<Type>& eqn,
111  const word& fieldName
112  ) const;
113 
114  //- Add a source term to a scalar phase equation
115  void addSupType
116  (
117  const volScalarField& alpha,
118  const volScalarField& rho,
119  fvMatrix<scalar>& eqn,
120  const word& fieldName
121  ) const;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("zeroDimensionalFixedPressure");
128 
129 
130  // Constructors
131 
132  //- Construct from dictionary
134  (
135  const word& name,
136  const word& modelType,
137  const fvMesh& mesh,
138  const dictionary& dict
139  );
140 
141 
142  //- Destructor
144 
145 
146  // Member Functions
147 
148  // Checks
149 
150  //- Return true if the fvModel adds a source term to the given
151  // field's transport equation
152  virtual bool addsSupToField(const word& fieldName) const;
153 
154 
155  // Sources
156 
157  //- Add a source term to an equation
159 
160  //- Add a source term to a compressible equation
162 
163  //- Add a source term to a phase equation
165 
166 
167  // Mesh changes
168 
169  //- Update for mesh motion
170  virtual bool movePoints();
171 
172  //- Update topology using the given map
173  virtual void topoChange(const polyTopoChangeMap&);
174 
175  //- Update from another mesh using the given map
176  virtual void mapMesh(const polyMeshMap&);
177 
178  //- Redistribute or update using the given distribution map
179  virtual void distribute(const polyDistributionMap&);
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace fv
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
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
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 void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_SUP)
Add a source term to an equation.
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_SUP(Type, nullArg)
Definition: fvModelM.H:26
#define DEFINE_FV_MODEL_ADD_RHO_SUP(Type, nullArg)
Definition: fvModelM.H:43
#define DEFINE_FV_MODEL_ADD_ALPHA_RHO_SUP(Type, nullArg)
Definition: fvModelM.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