incompressibleAdjointSolver.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::incompressibleAdjointSolver
31 
32 Description
33  Base class for incompressibleAdjoint solvers
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef incompressibleAdjointSolver_H
38 #define incompressibleAdjointSolver_H
39 
40 #include "adjointSolver.H"
41 #include "incompressibleVars.H"
43 #include "ATCModel.H"
44 #include "fvOptionAdjointList.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class incompressibleAdjointSolver Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public adjointSolver
58 {
59 private:
60 
61  // Private Member Functions
62 
63  //- No copy construct
65  (
67  ) = delete;
68 
69  //- No copy assignment
70  void operator=(const incompressibleAdjointSolver&) = delete;
71 
72 
73 protected:
74 
75  // Protected data
76 
77  //- Primal variable set
79 
80  //- Adjoint Transpose Convection options
82 
83  //- optionList for source terms addition
85 
86 
87 public:
88 
89 
90  // Static Data Members
91 
92  //- Run-time type information
93  TypeName("incompressible");
94 
95 
96  // Declare run-time constructor selection table
97 
99  (
100  autoPtr,
102  dictionary,
103  (
104  fvMesh& mesh,
105  const word& managerType,
106  const dictionary& dict,
107  const word& primalSolverName
108  ),
109  (mesh, managerType, dict, primalSolverName)
110  );
111 
112 
113  // Constructors
114 
115  //- Construct from mesh and dictionary
117  (
118  fvMesh& mesh,
119  const word& managerType,
120  const dictionary& dict,
121  const word& primalSolverName
122  );
123 
124 
125  // Selectors
126 
127  //- Return a reference to the selected incompressible adjoint solver
129  (
130  fvMesh& mesh,
131  const word& managerType,
132  const dictionary& dict,
133  const word& primalSolverName
134  );
135 
136 
137  //- Destructor
138  virtual ~incompressibleAdjointSolver() = default;
139 
140 
141  // Member Functions
142 
143  //- Read dict if updated
144  virtual bool readDict(const dictionary& dict);
145 
146  //- Should solver name be appended to fields
147  virtual bool useSolverNameForFields() const;
148 
149 
150  // Access
151 
152  //- Access to the incompressible primal variables set
153  const incompressibleVars& getPrimalVars() const;
154 
155  //- Access to the incompressible adjoint variables set
156  virtual const incompressibleAdjointVars& getAdjointVars() const;
157 
158  //- Access to the incompressible adjoint variables set
160 
161  //- Access to the ATC model
162  const autoPtr<ATCModel>& getATCModel() const;
163 
164  //- Access to the ATC model
166 
167  //- Access to fvOptionsAdjointList
169 
170 
171  // Evolution
172 
173  //- Update primal based quantities, e.g. the primal fields
174  //- in adjoint turbulence models
175  virtual void updatePrimalBasedQuantities();
176 
177 
178  // IO
179 
180  //- In case of multi-point runs with turbulent flows,
181  //- output dummy turbulence fields with the base names, to allow
182  //- continuation
183  virtual bool write(const bool valid = true) const
184  {
185  if (mesh_.time().writeTime())
186  {
187  return primalVars_.write();
188  }
189 
190  return false;
191  }
192 
193  //- In case of multi-point runs with turbulent flows,
194  //- output dummy turbulence fields with the base names, to allow
195  //- continuation
196  virtual bool writeNow() const
197  {
198  return primalVars_.write();
199  }
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
Foam::adjointSolver
Base class for adjoint solvers.
Definition: adjointSolver.H:57
Foam::incompressibleAdjointSolver::ATCModel_
autoPtr< ATCModel > ATCModel_
Adjoint Transpose Convection options.
Definition: incompressibleAdjointSolver.H:80
Foam::incompressibleAdjointSolver::New
static autoPtr< incompressibleAdjointSolver > New(fvMesh &mesh, const word &managerType, const dictionary &dict, const word &primalSolverName)
Return a reference to the selected incompressible adjoint solver.
Definition: incompressibleAdjointSolver.C:78
Foam::incompressibleAdjointSolver
Base class for incompressibleAdjoint solvers.
Definition: incompressibleAdjointSolver.H:54
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
ATCModel.H
Foam::TimeState::writeTime
bool writeTime() const
Return true if this is a write time.
Definition: TimeStateI.H:66
Foam::adjointSolver::primalSolverName
const word & primalSolverName() const
Return the primal solver name.
Definition: adjointSolver.H:152
Foam::incompressibleAdjointSolver::useSolverNameForFields
virtual bool useSolverNameForFields() const
Should solver name be appended to fields.
Definition: incompressibleAdjointSolver.C:121
incompressibleVars.H
Foam::incompressibleAdjointSolver::getAdjointVars
virtual const incompressibleAdjointVars & getAdjointVars() const
Access to the incompressible adjoint variables set.
Definition: incompressibleAdjointSolver.C:136
Foam::solver::mesh_
fvMesh & mesh_
Reference to the mesh database.
Definition: solver.H:71
Foam::incompressibleAdjointSolver::TypeName
TypeName("incompressible")
Run-time type information.
Foam::incompressibleAdjointSolver::fvOptionsAdjoint_
fv::optionAdjointList fvOptionsAdjoint_
optionList for source terms addition
Definition: incompressibleAdjointSolver.H:83
Foam::incompressibleAdjointVars
Class including all adjoint fields for incompressible flows.
Definition: incompressibleAdjointVars.H:52
Foam::fv::optionAdjointList
Definition: fvOptionAdjointList.H:59
fvOptionAdjointList.H
Foam::incompressibleAdjointSolver::write
virtual bool write(const bool valid=true) const
Definition: incompressibleAdjointSolver.H:182
adjointSolver.H
Foam::incompressibleVars::write
bool write() const
Definition: incompressibleVars.C:539
Foam::incompressibleAdjointSolver::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, incompressibleAdjointSolver, dictionary,(fvMesh &mesh, const word &managerType, const dictionary &dict, const word &primalSolverName),(mesh, managerType, dict, primalSolverName))
Foam::incompressibleAdjointSolver::writeNow
virtual bool writeNow() const
Definition: incompressibleAdjointSolver.H:195
Foam::incompressibleAdjointSolver::updatePrimalBasedQuantities
virtual void updatePrimalBasedQuantities()
Definition: incompressibleAdjointSolver.C:174
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressibleAdjointSolver::getATCModel
const autoPtr< ATCModel > & getATCModel() const
Access to the ATC model.
Definition: incompressibleAdjointSolver.C:155
incompressibleAdjointVars.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::incompressibleAdjointSolver::getFvOptionsAdjoint
fv::optionAdjointList & getFvOptionsAdjoint()
Access to fvOptionsAdjointList.
Definition: incompressibleAdjointSolver.C:168
Foam::solver::mesh
const fvMesh & mesh() const
Return the solver mesh.
Definition: solver.C:96
Foam::incompressibleAdjointSolver::primalVars_
incompressibleVars & primalVars_
Primal variable set.
Definition: incompressibleAdjointSolver.H:77
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:248
Foam::incompressibleAdjointSolver::readDict
virtual bool readDict(const dictionary &dict)
Read dict if updated.
Definition: incompressibleAdjointSolver.C:109
Foam::incompressibleAdjointSolver::getPrimalVars
const incompressibleVars & getPrimalVars() const
Access to the incompressible primal variables set.
Definition: incompressibleAdjointSolver.C:128
Foam::solver::dict
virtual const dictionary & dict() const
Return the solver dictionary.
Definition: solver.C:113
Foam::incompressibleAdjointSolver::~incompressibleAdjointSolver
virtual ~incompressibleAdjointSolver()=default
Destructor.
Foam::incompressibleVars
Base class for solution control classes.
Definition: incompressibleVars.H:54