Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
12License
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
28Class
29 Foam::adjointMeshMovementSolver
30
31Description
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
47SourceFiles
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
61namespace Foam
62{
63
64// Forward declarations
67/*---------------------------------------------------------------------------*\
68 Class adjointMeshMovementSolver Decleration
69\*---------------------------------------------------------------------------*/
70
71class adjointMeshMovementSolver
72{
73protected:
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
87 // Underlaying adjoint sensitivities
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_;
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
110private:
111
112 // Private Member Functions
113
114 //- No copy construct
115 adjointMeshMovementSolver(const adjointMeshMovementSolver&) = delete;
116
117 //- No copy assignment
118 void operator=( const adjointMeshMovementSolver) = delete;
119
120
121public:
122
123 //- Runtime type information
124 TypeName("adjointMeshMovementSolver");
125
126
127 // Constructors
128
129 //- Construct from components
130 adjointMeshMovementSolver
131 (
132 const fvMesh& mesh,
133 const dictionary& dict,
135 );
136
137
138 // Destructor
139 virtual ~adjointMeshMovementSolver() = default;
140
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
159 return ma_;
160 }
161};
162
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166} // End namespace Foam
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170#endif
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174// ************************************************************************* //
Useful typenames for fields defined only at the boundaries.
Base class supporting Shape sensitivity derivatives.
volVectorField source_
Source term of the adjoint grid displacement PDEs.
autoPtr< boundaryVectorField > meshMovementSensPtr_
Part of sensitivity derivatives coming from the adjoint grid displacement PDE.
const fvMesh & mesh_
Reference to mesh.
const volVectorField & ma() const
Return the adjoint distance field.
ShapeSensitivitiesBase & adjointSensitivity_
dictionary dict_
Dictionary containing solution controls.
virtual bool readDict(const dictionary &dict)
Read dict if changed.
TypeName("adjointMeshMovementSolver")
Runtime type information.
virtual ~adjointMeshMovementSolver()=default
boundaryVectorField & meshMovementSensitivities()
Return the sensitivity term depending on ma.
void read()
Read options each time a new solution is found.
volVectorField ma_
Adjoint grid displacement field.
void setSource()
Set the source term of the PDE.
virtual void solve()
Calculate the adjoint distance field.
Abstract base class for adjoint-based sensitivities.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
dynamicFvMesh & mesh
Namespace for OpenFOAM.
GeometricField< vector, fvPatchField, volMesh > volVectorField
volVectorField::Boundary boundaryVectorField
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68