Loading...
Searching...
No Matches
solverControlI.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
29\*---------------------------------------------------------------------------*/
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34{
35 return solver_.dict();
36}
37
40{
41 return solverDict().subDict("solutionControls");
42}
43
45inline bool Foam::solverControl::printMaxMags() const
46{
47 return printMaxMags_;
48}
49
52{
53 return storeInitValues_;
54}
55
57inline Foam::label Foam::solverControl::iter() const
58{
59 return iter_;
60}
61
63inline Foam::label& Foam::solverControl::averageIter()
64{
65 return averageIter_;
66}
67
69inline Foam::label Foam::solverControl::averageIter() const
70{
71 return averageIter_;
72}
73
75inline Foam::label Foam::solverControl::averageStartIter() const
76{
77 return averageStartIter_;
78}
79
80
81inline bool Foam::solverControl::doAverageIter() const
82{
83 if (average_ && iter_ >= averageStartIter_)
84 {
85 return true;
86 }
87 else
88 {
89 return false;
90 }
91}
92
93
95{
96 if (average_ && averageIter_)
97 {
98 return true;
99 }
100 else
101 {
102 return false;
103 }
104}
105
107inline bool Foam::solverControl::average() const
108{
109 return average_;
110}
111
112
114{
115 return solver_;
116}
117
118
119// ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
bool doAverageIter() const
Whether or not to add fields of the current iteration to the average fields.
const solver & solver_
Reference to the underlaying solver.
bool storeInitValues() const
Re-initialize.
bool storeInitValues_
Whether to re-initialize the solution based on the initial time step. Makes sense only for optimisati...
label averageStartIter() const
Return iteration index.
label & averageIter()
Return average iteration index reference.
bool average_
Do averaging.
label averageStartIter_
Averaging start index.
virtual const dictionary solutionDict() const
Return the solutionControls dictionary.
bool printMaxMags() const
Print max mags of solver fields.
bool useAveragedFields() const
Use averaged fields? For solving the adjoint equations or computing sensitivities based on averaged f...
label averageIter_
Current averaging iteration index.
label iter_
Current iteration index.
virtual const dictionary solverDict() const
Read controls from optimisationDict.
bool average() const
Whether averaging is enabled or not.
label iter() const
Return iteration index.
bool printMaxMags_
Whether to print the max magnitude during each solver iteration.
const solver & getSolver() const
Return reference to the underlaying solver.
Base solver class.
Definition solver.H:48