conjugateGradient.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
28
29Class
30 Foam::conjugateGradient
31
32Description
33 The Conjugate Gradient formula.
34
35 Beta computed from Fletcher-Reeves or Polak-Ribiere approaches.
36 Polak-Ribiere seems to misbehave.
37 Not tested with line search.
38
39SourceFiles
40 conjugateGradient.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef conjugateGradient_H
45#define conjugateGradient_H
46
47#include "updateMethod.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54/*---------------------------------------------------------------------------*\
55 Class conjugateGradient Declaration
56\*---------------------------------------------------------------------------*/
59:
60 public updateMethod
61{
62protected:
63
64 // Protected data
69 label counter_;
71
72
73 // Protected Member Functions
74
75 //- Allocate matrices in the first optimisation cycle
76 void allocateFields();
77
78 //- Read old info from dict
79 void readFromDict();
80
81
82private:
83
84 // Private Member Functions
85
86 //- No copy construct
87 conjugateGradient(const conjugateGradient&) = delete;
88
89 //- No copy assignment
90 void operator=(const conjugateGradient&) = delete;
91
92
93public:
94
95 //- Runtime type information
96 TypeName("conjugateGradient");
97
98
99 // Constructors
100
101 //- Construct from components
103
104
105 //- Destructor
106 virtual ~conjugateGradient() = default;
107
108
109 // Member Functions
110
111 //- Compute design variables correction
112 void computeCorrection();
113
114 //- Update old correction. For use when eta has been changed externally
115 virtual void updateOldCorrection(const scalarField& oldCorrection);
116
117 //- Write old info to dict
118 virtual void write();
119};
120
121
122// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123
124} // End namespace Foam
125
126// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127
128#endif
129
130// ************************************************************************* //
The Conjugate Gradient formula.
virtual ~conjugateGradient()=default
Destructor.
void computeCorrection()
Compute design variables correction.
void readFromDict()
Read old info from dict.
TypeName("conjugateGradient")
Runtime type information.
void allocateFields()
Allocate matrices in the first optimisation cycle.
virtual void write()
Write old info to dict.
virtual void updateOldCorrection(const scalarField &oldCorrection)
Update old correction. For use when eta has been changed externally.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Abstract base class for optimisation methods.
Definition: updateMethod.H:55
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73