adjointMeshMovementSolverIncompressible.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::incompressible::adjointMeshMovementSolver
31 
32 Description
33  Solver of the adjoint to the Laplace grid displacement equation
34 
35  Reference:
36  \verbatim
37  Kavvadias, I., Papoutsis-Kiachagias, E., & Giannakoglou, K. (2015).
38  On the proper treatment of grid sensitivities in continuous adjoint
39  methods for shape optimization.
40  Journal of Computational Physics, 301, 1–18.
41  http://doi.org/10.1016/j.jcp.2015.08.012
42  \endverbatim
43 
44 SourceFiles
45  adjointMeshMovementSolver.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef adjointMeshMovementSolverIncompressible_H
50 #define adjointMeshMovementSolverIncompressible_H
51 
54 #include "createZeroField.H"
55 #include "boundaryFieldsFwd.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 namespace incompressible
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class adjointMeshMovementSolver Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 {
71 protected:
72 
73  // Protected data
74 
75  const fvMesh& mesh_;
79  label nLaplaceIters_;
80  scalar tolerance_;
83 
84  //- Wall face sens w.r.t.(x, y.z) //wall face sens w.r.t. (x,y.z)
87 
88  //- Read options each time a new solution is found
89  void read();
90 
91 
92 private:
93 
94  // Private Member Functions
95 
96  //- No copy construct
98 
99  //- No copy assignment
100  void operator=(const adjointMeshMovementSolver&) = delete;
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("adjointMeshMovementSolver");
107 
108 
109  // Constructors
110 
111  //- Construct from components
113  (
114  const fvMesh& mesh,
115  const dictionary& dict,
117  const labelHashSet& sensitivityPatchIDs,
118  const autoPtr<adjointEikonalSolver>& adjointEikonalSolverPtr
119  );
120 
121  //- Destructor
122  virtual ~adjointMeshMovementSolver() = default;
123 
124 
125  // Member Functions
126 
127  //- Read dict if changed
128  virtual bool readDict(const dictionary& dict);
129 
130  //- Accumulate source term
131  void accumulateIntegrand(const scalar dt);
132 
133  //- Calculate the adjoint distance field
134  void solve();
135 
136  //- Reset source term
137  void reset();
138 
139  //- Return the sensitivity term depending on da
141 
142  //- Return the adjoint distance field
143  const volVectorField& ma();
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace incompressible
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
Solver of the adjoint to the Laplace grid displacement equation.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
void accumulateIntegrand(const scalar dt)
Accumulate source term.
autoPtr< boundaryVectorField > meshMovementSensPtr_
Wall face sens w.r.t.(x, y.z) //wall face sens w.r.t. (x,y.z)
void read()
Read options each time a new solution is found.
virtual ~adjointMeshMovementSolver()=default
Destructor.
dynamicFvMesh & mesh
Abstract base class for adjoint-based sensitivities in incompressible flows.
virtual bool readDict(const dictionary &dict)
Read dict if changed.
TypeName("adjointMeshMovementSolver")
Runtime type information.
Useful typenames for fields defined only at the boundaries.
boundaryVectorField & meshMovementSensitivities()
Return the sensitivity term depending on da.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:79
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Namespace for OpenFOAM.
const volVectorField & ma()
Return the adjoint distance field.