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 -------------------------------------------------------------------------------
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 
30 #include "stepUpdate.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
38 }
39 
40 
41 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
42 
44 {
45  return dict_.optionalSubDict(type() + "Coeffs");
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
51 Foam::stepUpdate::stepUpdate(const dictionary& dict)
52 :
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  }
78 
79  return autoPtr<stepUpdate>(ctorPtr(dict));
80 }
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * //
84 
85 void Foam::stepUpdate::setDeriv(const scalar deriv)
86 {
87  // Does nothing in base
88 }
89 
90 
91 void Foam::stepUpdate::setNewMeritValue(const scalar value)
92 {
93  // Does nothing in base
94 }
95 
96 
97 void Foam::stepUpdate::setOldMeritValue(const scalar value)
98 {
99  // Does nothing in base
100 }
101 
102 
103 // ************************************************************************* //
dictionary dict
virtual void setOldMeritValue(const scalar value)
Set old merit value.
Definition: stepUpdate.C:90
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
Definition: dictionary.C:560
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
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:63
const dictionary & coeffsDict()
Optional coeffs dict.
Definition: stepUpdate.C:36
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
virtual void setDeriv(const scalar deriv)
Set objective derivative.
Definition: stepUpdate.C:78
Abstract base class for step update methods used in line search.
Definition: stepUpdate.H:50
const dictionary dict_
Definition: stepUpdate.H:56
messageStream Info
Information stream (stdout output on master, null elsewhere)
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
virtual void setNewMeritValue(const scalar value)
Set new merit value.
Definition: stepUpdate.C:84
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:635
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...