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 -------------------------------------------------------------------------------
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 
29 Class
30  Foam::incompressiblePrimalSolver
31 
32 Description
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 
45 namespace Foam
46 {
47 
48 class objective;
49 
50 /*---------------------------------------------------------------------------*\
51  Class incompressiblePrimalSolver Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public primalSolver
57 {
58 private:
59 
60  // Privare Member Functions
61 
62  //- No copy construct
64 
65  //- No copy assignment
66  void operator=(const incompressiblePrimalSolver&) = delete;
67 
68 
69 protected:
70 
71  // Protected data
72 
73  //- Convergence criterion for reconstructing phi from U and p
74  scalar phiReconstructionTol_;
75 
76  //- Max iterations for reconstructing phi from U and p
78 
79 
80 public:
81 
82 
83  // Static Data Members
84 
85  //- Run-time type information
86  TypeName("incompressible");
87 
88 
89  // Declare run-time constructor selection table
90 
92  (
93  autoPtr,
95  dictionary,
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 // ************************************************************************* //
Foam::incompressiblePrimalSolver::getObjectiveFunctions
List< objective * > getObjectiveFunctions() const
Return the list of objectives assodicated with this solver.
Definition: incompressiblePrimalSolver.C:121
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::incompressiblePrimalSolver::writeNow
virtual bool writeNow() const
Definition: incompressiblePrimalSolver.H:175
incompressibleVars.H
Foam::solver::mesh_
fvMesh & mesh_
Reference to the mesh database.
Definition: solver.H:60
primalSolver.H
Foam::incompressiblePrimalSolver::phiReconstructionTol_
scalar phiReconstructionTol_
Convergence criterion for reconstructing phi from U and p.
Definition: incompressiblePrimalSolver.H:73
Foam::TimeState::writeTime
bool writeTime() const noexcept
True if this is a write time.
Definition: TimeStateI.H:67
Foam::incompressiblePrimalSolver::readDict
virtual bool readDict(const dictionary &dict)
Read dict if updated.
Definition: incompressiblePrimalSolver.C:109
Foam::incompressibleVars::write
bool write() const
Definition: incompressibleVars.C:539
Foam::incompressiblePrimalSolver::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, incompressiblePrimalSolver, dictionary,(fvMesh &mesh, const word &managerType, const dictionary &dict),(mesh, managerType, dict))
Foam::incompressiblePrimalSolver
Base class for primal incompressible solvers.
Definition: incompressiblePrimalSolver.H:53
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::incompressiblePrimalSolver::useSolverNameForFields
bool useSolverNameForFields() const
Should solver name be appended to fields.
Definition: incompressiblePrimalSolver.C:147
Foam::incompressiblePrimalSolver::correctBoundaryConditions
virtual void correctBoundaryConditions()
Update boundary conditions.
Definition: incompressiblePrimalSolver.C:171
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::solver::mesh
const fvMesh & mesh() const
Return the solver mesh.
Definition: solver.C:96
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::primalSolver
Base class for primal solvers.
Definition: primalSolver.H:52
Foam::incompressiblePrimalSolver::TypeName
TypeName("incompressible")
Run-time type information.
Foam::incompressiblePrimalSolver::write
virtual bool write(const bool valid=true) const
Definition: incompressiblePrimalSolver.H:162
Foam::incompressiblePrimalSolver::~incompressiblePrimalSolver
virtual ~incompressiblePrimalSolver()=default
Destructor.
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:280
Foam::incompressiblePrimalSolver::getIncoVars
const incompressibleVars & getIncoVars() const
Access to the incompressible variables set.
Definition: incompressiblePrimalSolver.C:154
Foam::incompressiblePrimalSolver::phiReconstructionIters_
label phiReconstructionIters_
Max iterations for reconstructing phi from U and p.
Definition: incompressiblePrimalSolver.H:76
Foam::solver::dict
virtual const dictionary & dict() const
Return the solver dictionary.
Definition: solver.C:113
Foam::incompressibleVars
Base class for solution control classes.
Definition: incompressibleVars.H:54
Foam::incompressiblePrimalSolver::New
static autoPtr< incompressiblePrimalSolver > New(fvMesh &mesh, const word &managerType, const dictionary &dict)
Return a reference to the selected incompressible primal solver.
Definition: incompressiblePrimalSolver.C:79