Loading...
Searching...
No Matches
stepUpdate.C
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-2021 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\*---------------------------------------------------------------------------*/
30#include "stepUpdate.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
36 defineTypeNameAndDebug(stepUpdate, 0);
38}
39
40
41// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
42
45 return dict_.optionalSubDict(type() + "Coeffs");
46}
47
48
49// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50
51Foam::stepUpdate::stepUpdate(const dictionary& dict)
53 dict_(dict)
54{}
55
56
57// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * //
58
60{
61 const word type =
62 dict.getOrDefault<word>("stepUpdateType", "bisection");
63
64 Info<< "stepUpdate type : " << type << endl;
65
66 auto* ctorPtr = dictionaryConstructorTable(type);
67
68 if (!ctorPtr)
69 {
71 (
72 dict,
73 "stepUpdate",
74 type,
75 *dictionaryConstructorTablePtr_
76 ) << exit(FatalIOError);
77 }
79 return autoPtr<stepUpdate>(ctorPtr(dict));
80}
81
82
83// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * //
85void Foam::stepUpdate::setDeriv(const scalar deriv)
86{
87 // Does nothing in base
88}
89
91void Foam::stepUpdate::setNewMeritValue(const scalar value)
92{
93 // Does nothing in base
94}
95
96
97void Foam::stepUpdate::setOldMeritValue(const scalar value)
98{
99 // Does nothing in base
100}
101
102
103// ************************************************************************* //
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
Abstract base class for step update methods used in line search.
Definition stepUpdate.H:51
const dictionary & coeffsDict()
Optional coeffs dict.
Definition stepUpdate.C:36
virtual void setDeriv(const scalar deriv)
Set objective derivative.
Definition stepUpdate.C:78
virtual void setOldMeritValue(const scalar value)
Set old merit value.
Definition stepUpdate.C:90
virtual void setNewMeritValue(const scalar value)
Set new merit value.
Definition stepUpdate.C:84
const dictionary dict_
Definition stepUpdate.H:56
static autoPtr< stepUpdate > New(const dictionary &dict)
Return a reference to the selected turbulence model.
Definition stepUpdate.C:52
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict