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 {
36  defineTypeNameAndDebug(stepUpdate, 0);
37  defineRunTimeSelectionTable(stepUpdate, dictionary);
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 // ************************************************************************* //
Foam::stepUpdate::setDeriv
virtual void setDeriv(const scalar deriv)
Set objective derivative.
Definition: stepUpdate.C:85
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::stepUpdate::New
static autoPtr< stepUpdate > New(const dictionary &dict)
Return a reference to the selected turbulence model.
Definition: stepUpdate.C:59
Foam::stepUpdate::coeffsDict
const dictionary & coeffsDict()
Optional coeffs dict.
Definition: stepUpdate.C:43
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::stepUpdate::setNewMeritValue
virtual void setNewMeritValue(const scalar value)
Set new merit value.
Definition: stepUpdate.C:91
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
stepUpdate.H
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
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::stepUpdate::setOldMeritValue
virtual void setOldMeritValue(const scalar value)
Set old merit value.
Definition: stepUpdate.C:97
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::autoPtr< Foam::stepUpdate >
Foam::stepUpdate::dict_
const dictionary dict_
Definition: stepUpdate.H:60
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::dictionary::optionalSubDict
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:577
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:148
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)