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_;
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 // ************************************************************************* //
Foam::incompressible::adjointMeshMovementSolver::ma_
volVectorField ma_
Definition: adjointMeshMovementSolverIncompressible.H:80
Foam::incompressible::adjointMeshMovementSolver::adjointEikonalSolverPtr_
const autoPtr< adjointEikonalSolver > & adjointEikonalSolverPtr_
Definition: adjointMeshMovementSolverIncompressible.H:85
Foam::incompressible::adjointMeshMovementSolver::reset
void reset()
Reset source term.
Definition: adjointMeshMovementSolverIncompressible.C:163
Foam::incompressible::adjointMeshMovementSolver::TypeName
TypeName("adjointMeshMovementSolver")
Runtime type information.
Foam::incompressible::adjointMeshMovementSolver::accumulateIntegrand
void accumulateIntegrand(const scalar dt)
Accumulate source term.
Definition: adjointMeshMovementSolverIncompressible.C:110
Foam::incompressible::adjointMeshMovementSolver::read
void read()
Read options each time a new solution is found.
Definition: adjointMeshMovementSolverIncompressible.C:47
Foam::HashSet< label, Hash< label > >
Foam::incompressible::adjointMeshMovementSolver::solve
void solve()
Calculate the adjoint distance field.
Definition: adjointMeshMovementSolverIncompressible.C:120
Foam::incompressible::adjointMeshMovementSolver::source_
volVectorField source_
Definition: adjointMeshMovementSolverIncompressible.H:81
Foam::incompressible::adjointMeshMovementSolver::mesh_
const fvMesh & mesh_
Definition: adjointMeshMovementSolverIncompressible.H:74
Foam::incompressible::adjointMeshMovementSolver::meshMovementSensitivities
boundaryVectorField & meshMovementSensitivities()
Return the sensitivity term depending on da.
Definition: adjointMeshMovementSolverIncompressible.C:170
Foam::incompressible::adjointSensitivity
Abstract base class for adjoint-based sensitivities in incompressible flows.
Definition: adjointSensitivityIncompressible.H:75
Foam::incompressible::adjointMeshMovementSolver::~adjointMeshMovementSolver
virtual ~adjointMeshMovementSolver()=default
Destructor.
createZeroField.H
Foam::incompressible::adjointMeshMovementSolver::adjointSensitivity_
Foam::incompressible::adjointSensitivity & adjointSensitivity_
Definition: adjointMeshMovementSolverIncompressible.H:76
Foam::incompressible::adjointMeshMovementSolver::tolerance_
scalar tolerance_
Definition: adjointMeshMovementSolverIncompressible.H:79
Foam::incompressible::adjointMeshMovementSolver::nLaplaceIters_
label nLaplaceIters_
Definition: adjointMeshMovementSolverIncompressible.H:78
Foam::incompressible::adjointMeshMovementSolver::readDict
virtual bool readDict(const dictionary &dict)
Read dict if changed.
Definition: adjointMeshMovementSolverIncompressible.C:102
Foam::incompressible::adjointMeshMovementSolver::ma
const volVectorField & ma()
Return the adjoint distance field.
Definition: adjointMeshMovementSolverIncompressible.C:186
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressible::adjointMeshMovementSolver::meshMovementSensPtr_
autoPtr< boundaryVectorField > meshMovementSensPtr_
Wall face sens w.r.t.(x, y.z) //wall face sens w.r.t. (x,y.z)
Definition: adjointMeshMovementSolverIncompressible.H:84
Foam::incompressible::adjointMeshMovementSolver::sensitivityPatchIDs_
const labelHashSet & sensitivityPatchIDs_
Definition: adjointMeshMovementSolverIncompressible.H:77
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::incompressible::adjointMeshMovementSolver::dict_
dictionary dict_
Definition: adjointMeshMovementSolverIncompressible.H:75
Foam::GeometricField::Boundary
The boundary fields.
Definition: GeometricField.H:115
boundaryFieldsFwd.H
Useful typenames for fields defined only at the boundaries.
adjointSensitivityIncompressible.H
adjointEikonalSolverIncompressible.H
Foam::incompressible::adjointMeshMovementSolver
Solver of the adjoint to the Laplace grid displacement equation.
Definition: adjointMeshMovementSolverIncompressible.H:68
Foam::GeometricField< vector, fvPatchField, volMesh >