incompressiblePrimalSolver.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) 2007-2020 PCOpt/NTUA
9 Copyright (C) 2013-2020 FOSS GP
10 Copyright (C) 2019 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28
29Class
30 Foam::incompressiblePrimalSolver
31
32Description
33 Base class for primal incompressible solvers
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef incompressiblePrimalSolver_H
38#define incompressiblePrimalSolver_H
39
40#include "primalSolver.H"
41#include "incompressibleVars.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48class objective;
49
50/*---------------------------------------------------------------------------*\
51 Class incompressiblePrimalSolver Declaration
52\*---------------------------------------------------------------------------*/
55:
56 public primalSolver
57{
58private:
59
60 // Privare Member Functions
61
62 //- No copy construct
64
65 //- No copy assignment
66 void operator=(const incompressiblePrimalSolver&) = delete;
67
68
69protected:
70
71 // Protected data
72
73 //- Convergence criterion for reconstructing phi from U and p
75
76 //- Max iterations for reconstructing phi from U and p
78
79
80public:
81
82
83 // Static Data Members
84
85 //- Run-time type information
86 TypeName("incompressible");
87
88
89 // Declare run-time constructor selection table
92 (
93 autoPtr,
96 (
97 fvMesh& mesh,
98 const word& managerType,
99 const dictionary& dict
100 ),
101 (mesh, managerType, dict)
102 );
103
104
105 // Constructors
106
107 //- Construct from mesh and dictionary
109 (
110 fvMesh& mesh,
111 const word& managerType,
112 const dictionary& dict
113 );
114
115
116 // Selectors
117
118 //- Return a reference to the selected incompressible primal solver
120 (
121 fvMesh& mesh,
122 const word& managerType,
123 const dictionary& dict
124 );
125
126
127 //- Destructor
128 virtual ~incompressiblePrimalSolver() = default;
129
130
131 // Member Functions
132
133 //- Read dict if updated
134 virtual bool readDict(const dictionary& dict);
135
136 //- Should solver name be appended to fields
137 bool useSolverNameForFields() const;
138
139
140 // Access
141
142 //- Return the list of objectives assodicated with this solver
144
145 //- Access to the incompressible variables set
146 const incompressibleVars& getIncoVars() const;
147
148 //- Access to the incompressible variables set
150
151
152 // Evolution
153
154 //- Update boundary conditions
155 virtual void correctBoundaryConditions();
156
157
158 // IO
159
160 //- In case of multi-point runs with turbulent flows,
161 //- output dummy turbulence fields with the base names, to allow
162 //- continuation
163 virtual bool write(const bool valid = true) const
164 {
165 if (mesh_.time().writeTime())
166 {
167 return getIncoVars().write();
168 }
169
170 return false;
171 }
172
173 //- In case of multi-point runs with turbulent flows,
174 //- output dummy turbulence fields with the base names, to allow
175 //- continuation
176 virtual bool writeNow() const
177 {
178 return getIncoVars().write();
179 }
180};
181
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185} // End namespace Foam
186
187// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188
189#endif
190
191// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
bool writeTime() const noexcept
True if this is a write time.
Definition: TimeStateI.H:67
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
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
Base class for primal incompressible solvers.
TypeName("incompressible")
Run-time type information.
List< objective * > getObjectiveFunctions() const
Return the list of objectives assodicated with this solver.
virtual ~incompressiblePrimalSolver()=default
Destructor.
const incompressibleVars & getIncoVars() const
Access to the incompressible variables set.
virtual bool write(const bool valid=true) const
virtual bool readDict(const dictionary &dict)
Read dict if updated.
label phiReconstructionIters_
Max iterations for reconstructing phi from U and p.
bool useSolverNameForFields() const
Should solver name be appended to fields.
static autoPtr< incompressiblePrimalSolver > New(fvMesh &mesh, const word &managerType, const dictionary &dict)
Return a reference to the selected incompressible primal solver.
scalar phiReconstructionTol_
Convergence criterion for reconstructing phi from U and p.
virtual void correctBoundaryConditions()
Update boundary conditions.
declareRunTimeSelectionTable(autoPtr, incompressiblePrimalSolver, dictionary,(fvMesh &mesh, const word &managerType, const dictionary &dict),(mesh, managerType, dict))
Base class for solution control classes.
Base class for primal solvers.
Definition: primalSolver.H:55
virtual const dictionary & dict() const
Return the solver dictionary.
Definition: solver.C:113
const fvMesh & mesh() const
Return the solver mesh.
Definition: solver.C:96
fvMesh & mesh_
Reference to the mesh database.
Definition: solver.H:60
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
runTime write()
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73