adjointMeshMovementSolver.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 Class
29  Foam::adjointMeshMovementSolver
30 
31 Description
32  Class solving the adjoint grid dispalcement PDEs.
33  Assumes the primal grid displacement PDE is a Laplace one with uniform
34  diffusivity.
35 
36  Reference:
37  \verbatim
38  For the derivation of the adjoint grid displacement PDEs, see
39  Kavvadias, I., Papoutsis-Kiachagias, E., & Giannakoglou, K. (2015).
40  On the proper treatment of grid sensitivities in continuous adjoint
41  methods for shape optimization.
42  Journal of Computational Physics, 301, 1–18.
43  http://doi.org/10.1016/j.jcp.2015.08.012
44 
45  \endverbatim
46 
47 SourceFiles
48  adjointMeshMovementSolver.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef adjointMeshMovementSolver_H
53 #define adjointMeshMovementSolver_H
54 
55 #include "boundaryFieldsFwd.H"
56 #include "createZeroField.H"
57 #include "variablesSet.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 // Forward declarations
65 class ShapeSensitivitiesBase;
66 
67 /*---------------------------------------------------------------------------*\
68  Class adjointMeshMovementSolver Decleration
69 \*---------------------------------------------------------------------------*/
70 
72 {
73 protected:
74 
75  // Protected Data Members
76 
77  //- Reference to mesh
78  const fvMesh& mesh_;
79 
80  //- Dictionary containing solution controls
82 
83  //- Part of sensitivity derivatives coming from the adjoint grid
84  //- displacement PDE
86 
87  // Underlaying adjoint sensitivities
89 
90  //- Adjoint grid displacement field
92 
93  //- Source term of the adjoint grid displacement PDEs
95 
96  //- Solution controls
97  label iters_;
98  scalar tolerance_;
99 
100 
101  // Protected Member Functions
102 
103  //- Read options each time a new solution is found
104  void read();
106  //- Set the source term of the PDE
107  void setSource();
108 
109 
110 private:
111 
112  // Private Member Functions
113 
114  //- No copy construct
116 
117  //- No copy assignment
118  void operator=( const adjointMeshMovementSolver) = delete;
119 
120 
121 public:
122 
123  //- Runtime type information
124  TypeName("adjointMeshMovementSolver");
125 
126 
127  // Constructors
128 
129  //- Construct from components
131  (
132  const fvMesh& mesh,
133  const dictionary& dict,
135  );
136 
137 
138  // Destructor
139  virtual ~adjointMeshMovementSolver() = default;
140 
141 
142  // Member Functions
143 
144  //- Read dict if changed
145  virtual bool readDict(const dictionary& dict);
146 
147  //- Calculate the adjoint distance field
148  virtual void solve();
149 
150  //- Reset the source term
151  void reset();
152 
153  //- Return the sensitivity term depending on ma
155 
156  //- Return the adjoint distance field
157  inline const volVectorField& ma() const
158  {
159  return ma_;
160  }
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 // ************************************************************************* //
dictionary dict
void reset()
Reset the source term.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Abstract base class for adjoint-based sensitivities.
TypeName("adjointMeshMovementSolver")
Runtime type information.
virtual void solve()
Calculate the adjoint distance field.
volVectorField ma_
Adjoint grid displacement field.
void read()
Read options each time a new solution is found.
Class solving the adjoint grid dispalcement PDEs. Assumes the primal grid displacement PDE is a Lapla...
boundaryVectorField & meshMovementSensitivities()
Return the sensitivity term depending on ma.
dynamicFvMesh & mesh
volVectorField source_
Source term of the adjoint grid displacement PDEs.
const volVectorField & ma() const
Return the adjoint distance field.
virtual bool readDict(const dictionary &dict)
Read dict if changed.
Base class supporting Shape sensitivity derivatives.
ShapeSensitivitiesBase & adjointSensitivity_
Useful typenames for fields defined only at the boundaries.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
autoPtr< boundaryVectorField > meshMovementSensPtr_
Part of sensitivity derivatives coming from the adjoint grid displacement PDE.
virtual ~adjointMeshMovementSolver()=default
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
dictionary dict_
Dictionary containing solution controls.
void setSource()
Set the source term of the PDE.
const fvMesh & mesh_
Reference to mesh.
Namespace for OpenFOAM.