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-2023 PCOpt/NTUA
9  Copyright (C) 2013-2023 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
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 Class
29  Foam::incompressiblePrimalSolver
30 
31 Description
32  Base class for primal incompressible solvers
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef incompressiblePrimalSolver_H
37 #define incompressiblePrimalSolver_H
38 
39 #include "primalSolver.H"
40 #include "incompressibleVars.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class objective;
48 
49 /*---------------------------------------------------------------------------*\
50  Class incompressiblePrimalSolver Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public primalSolver
56 {
57 private:
58 
59  // Privare Member Functions
60 
61  //- No copy construct
63 
64  //- No copy assignment
65  void operator=(const incompressiblePrimalSolver&) = delete;
66 
67 
68 protected:
69 
70  // Protected data
71 
72  //- Convergence criterion for reconstructing phi from U and p
73  scalar phiReconstructionTol_;
74 
75  //- Max iterations for reconstructing phi from U and p
77 
78 
79 public:
80 
81 
82  // Static Data Members
83 
84  //- Run-time type information
85  TypeName("incompressible");
86 
87 
88  // Declare run-time constructor selection table
89 
91  (
92  autoPtr,
94  dictionary,
95  (
96  fvMesh& mesh,
97  const word& managerType,
98  const dictionary& dict,
99  const word& solverName
100  ),
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  const word& solverName
114  );
115 
116 
117  // Selectors
118 
119  //- Return a reference to the selected incompressible primal solver
121  (
122  fvMesh& mesh,
123  const word& managerType,
124  const dictionary& dict,
125  const word& solverName
126  );
127 
128 
129  //- Destructor
130  virtual ~incompressiblePrimalSolver() = default;
131 
132 
133  // Member Functions
134 
135  //- Read dict if updated
136  virtual bool readDict(const dictionary& dict);
137 
138 
139  // Access
140 
141  //- Return the list of objectives assodicated with this solver
143 
144  //- Access to the incompressible variables set
145  const incompressibleVars& getIncoVars() const;
146 
147  //- Access to the incompressible variables set
149 
150 
151  // Evolution
152 
153  //- Update boundary conditions
154  virtual void correctBoundaryConditions();
155 
156 
157  // IO
158 
159  //- In case of multi-point runs with turbulent flows,
160  //- output dummy turbulence fields with the base names, to allow
161  //- continuation
162  virtual bool write(const bool valid = true) const
163  {
164  if (mesh_.time().writeTime())
165  {
166  return getIncoVars().write();
167  }
168 
169  return false;
170  }
171 
172  //- In case of multi-point runs with turbulent flows,
173  //- output dummy turbulence fields with the base names, to allow
174  //- continuation
175  virtual bool writeNow() const
176  {
177  return getIncoVars().write();
178  }
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
virtual bool writeNow() const
In case of multi-point runs with turbulent flows, output dummy turbulence fields with the base names...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
scalar phiReconstructionTol_
Convergence criterion for reconstructing phi from U and p.
static autoPtr< incompressiblePrimalSolver > New(fvMesh &mesh, const word &managerType, const dictionary &dict, const word &solverName)
Return a reference to the selected incompressible primal solver.
Base class for primal solvers.
Definition: primalSolver.H:46
const fvMesh & mesh() const
Return the solver mesh.
Definition: solverI.H:24
bool writeTime() const noexcept
True if this is a write interval.
Definition: TimeStateI.H:73
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
Base class for solution control classes.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void correctBoundaryConditions()
Update boundary conditions.
const word & managerType() const
Return the manager type.
Definition: solverI.H:72
const dictionary & dict() const
Return the solver dictionary.
Definition: solverI.H:54
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
Abstract base class for objective functions. No point in making this runTime selectable since its chi...
Definition: objective.H:55
UPtrList< objective > getObjectiveFunctions() const
Return the list of objectives assodicated with this solver.
virtual bool readDict(const dictionary &dict)
Read dict if updated.
TypeName("incompressible")
Run-time type information.
const word & solverName() const
Return the solver name.
Definition: solverI.H:30
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual bool write(const bool valid=true) const
In case of multi-point runs with turbulent flows, output dummy turbulence fields with the base names...
const incompressibleVars & getIncoVars() const
Access to the incompressible variables set.
fvMesh & mesh_
Reference to the mesh database.
Definition: solver.H:56
label phiReconstructionIters_
Max iterations for reconstructing phi from U and p.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Base class for primal incompressible solvers.
bool write() const
Write dummy turbulent fields to allow for continuation in multi-point, turbulent runs.
declareRunTimeSelectionTable(autoPtr, incompressiblePrimalSolver, dictionary,(fvMesh &mesh, const word &managerType, const dictionary &dict, const word &solverName),(mesh, managerType, dict, solverName))
Namespace for OpenFOAM.
virtual ~incompressiblePrimalSolver()=default
Destructor.