Loading...
Searching...
No Matches
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-2021 PCOpt/NTUA
9 Copyright (C) 2013-2021 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{
54/*---------------------------------------------------------------------------*\
55 Class conjugateGradient Declaration
56\*---------------------------------------------------------------------------*/
57
58class conjugateGradient
59:
60 public updateMethod
62protected:
64 // Protected data
65
69
70
71private:
72
73 // Private Member Functions
74
75 //- No copy construct
76 conjugateGradient(const conjugateGradient&) = delete;
77
78 //- No copy assignment
79 void operator=(const conjugateGradient&) = delete;
80
81
82public:
83
84 //- Runtime type information
85 TypeName("conjugateGradient");
87
88 // Constructors
89
90 //- Construct from components
91 conjugateGradient
92 (
93 const fvMesh& mesh,
94 const dictionary& dict,
95 autoPtr<designVariables>& designVars,
96 const label nConstraints,
97 const word& type
98 );
99
100
101 //- Destructor
102 virtual ~conjugateGradient() = default;
103
104
105 // Member Functions
106
107 //- Compute design variables correction
108 void computeCorrection();
109
110 //- Update old correction. For use when eta has been changed externally
111 virtual void updateOldCorrection(const scalarField& oldCorrection);
112
113 //- Write useful quantities to files
114 virtual bool writeData(Ostream& os) const;
115};
116
117
118// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119
120} // End namespace Foam
121
122// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123
124#endif
125
126// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
virtual ~conjugateGradient()=default
Destructor.
void computeCorrection()
Compute design variables correction.
TypeName("conjugateGradient")
Runtime type information.
virtual bool writeData(Ostream &os) const
Write useful quantities to files.
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:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
label nConstraints() const
Get the number of constraints.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68