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-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 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 #include "fvOptionList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class objective;
50 
51 /*---------------------------------------------------------------------------*\
52  Class incompressiblePrimalSolver Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public primalSolver
58 {
59 private:
60 
61  // Privare Member Functions
62 
63  //- No copy construct
65 
66  //- No copy assignment
67  void operator=(const incompressiblePrimalSolver&) = delete;
68 
69 
70 protected:
71 
72  // Protected data
73 
74  //- Convergence criterion for reconstructing phi from U and p
75  scalar phiReconstructionTol_;
76 
77  //- Max iterations for reconstructing phi from U and p
79 
80  //- optionList for source terms addition
82 
83 
84 public:
85 
86 
87  // Static Data Members
88 
89  //- Run-time type information
90  TypeName("incompressible");
91 
92 
93  // Declare run-time constructor selection table
94 
96  (
97  autoPtr,
99  dictionary,
100  (
101  fvMesh& mesh,
102  const word& managerType,
103  const dictionary& dict
104  ),
105  (mesh, managerType, dict)
106  );
107 
108 
109  // Constructors
110 
111  //- Construct from mesh and dictionary
113  (
114  fvMesh& mesh,
115  const word& managerType,
116  const dictionary& dict
117  );
118 
119 
120  // Selectors
121 
122  //- Return a reference to the selected incompressible primal solver
124  (
125  fvMesh& mesh,
126  const word& managerType,
127  const dictionary& dict
128  );
129 
130 
131  //- Destructor
132  virtual ~incompressiblePrimalSolver() = default;
133 
134 
135  // Member Functions
136 
137  //- Read dict if updated
138  virtual bool readDict(const dictionary& dict);
139 
140  //- Should solver name be appended to fields
141  bool useSolverNameForFields() const;
142 
143 
144  // Access
145 
146  //- Return the list of objectives assodicated with this solver
148 
149  //- Access to the incompressible variables set
150  const incompressibleVars& getIncoVars() const;
151 
152  //- Access to the incompressible variables set
154 
155 
156  // Evolution
157 
158  //- Update boundary conditions
159  virtual void correctBoundaryConditions();
160 
161 
162  // IO
163 
164  //- In case of multi-point runs with turbulent flows,
165  //- output dummy turbulence fields with the base names, to allow
166  //- continuation
167  virtual bool write(const bool valid = true) const
168  {
169  if (mesh_.time().writeTime())
170  {
171  return getIncoVars().write();
172  }
173 
174  return false;
175  }
176 
177  //- In case of multi-point runs with turbulent flows,
178  //- output dummy turbulence fields with the base names, to allow
179  //- continuation
180  virtual bool writeNow() const
181  {
182  return getIncoVars().write();
183  }
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
Foam::incompressiblePrimalSolver::getObjectiveFunctions
List< objective * > getObjectiveFunctions() const
Return the list of objectives assodicated with this solver.
Definition: incompressiblePrimalSolver.C:123
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::incompressiblePrimalSolver::writeNow
virtual bool writeNow() const
Definition: incompressiblePrimalSolver.H:179
Foam::TimeState::writeTime
bool writeTime() const
Return true if this is a write time.
Definition: TimeStateI.H:66
Foam::incompressiblePrimalSolver::fvOptions_
autoPtr< fv::optionList > fvOptions_
optionList for source terms addition
Definition: incompressiblePrimalSolver.H:80
incompressibleVars.H
Foam::solver::mesh_
fvMesh & mesh_
Reference to the mesh database.
Definition: solver.H:71
primalSolver.H
Foam::incompressiblePrimalSolver::phiReconstructionTol_
scalar phiReconstructionTol_
Convergence criterion for reconstructing phi from U and p.
Definition: incompressiblePrimalSolver.H:74
fvOptionList.H
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:54
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::incompressiblePrimalSolver::useSolverNameForFields
bool useSolverNameForFields() const
Should solver name be appended to fields.
Definition: incompressiblePrimalSolver.C:149
Foam::incompressiblePrimalSolver::correctBoundaryConditions
virtual void correctBoundaryConditions()
Update boundary conditions.
Definition: incompressiblePrimalSolver.C:173
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
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: HashTable.H:102
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:166
Foam::incompressiblePrimalSolver::~incompressiblePrimalSolver
virtual ~incompressiblePrimalSolver()=default
Destructor.
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:248
Foam::incompressiblePrimalSolver::getIncoVars
const incompressibleVars & getIncoVars() const
Access to the incompressible variables set.
Definition: incompressiblePrimalSolver.C:156
Foam::incompressiblePrimalSolver::phiReconstructionIters_
label phiReconstructionIters_
Max iterations for reconstructing phi from U and p.
Definition: incompressiblePrimalSolver.H:77
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