All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pimpleMultiRegionControl.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::pimpleMultiRegionControl
26 
27 Description
28  Pimple multi-region control class. As Foam::pimpleControl, but for a multi-
29  region simulation comprising pimple and solid regions. More region types
30  could be added.
31 
32 SourceFiles
33  pimpleMultiRegionControlI.H
34  pimpleMultiRegionControl.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef pimpleMultiRegionControl_H
39 #define pimpleMultiRegionControl_H
40 
41 #include "solver.H"
43 #include "pimpleLoop.H"
44 #include "convergenceControl.H"
46 #include "pimpleNoLoopControl.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class pimpleMultiRegionControl Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
60  public pimpleLoop,
61  public convergenceControl,
63 {
64  // Private data
65 
66  //- The per-region pimple controls
67  UPtrList<pimpleNoLoopControl> pimpleControls_;
68 
69  //- Maximum number of energy correctors
70  label nEcorr_;
71 
72  //- Current energy corrector
73  label Ecorr_;
74 
75 
76 protected:
77 
78  // Protected Member Functions
79 
80  //- Read controls
81  virtual bool read();
82 
83 
84 public:
85 
86  // Static Data Members
87 
88  //- Run-time type information
89  TypeName("pimpleMultiRegionControl");
90 
91 
92  // Constructors
93 
94  //- Construct from time and the list of solvers
96  (
97  const Time& runTime,
98  PtrList<solver>& solvers,
99  const word& algorithmName = "PIMPLE"
100  );
101 
102 
103  //- Destructor
104  virtual ~pimpleMultiRegionControl();
105 
106 
107  // Member Functions
108 
109  // Access
110 
111  //- Access the i-th pimple control
112  inline pimpleNoLoopControl& pimple(const label i);
113 
114  // Evolution
115 
116  //- Return true if residual controls are present
117  virtual bool hasResidualControls() const;
118 
119  //- Return true if corrector residual controls are present
120  virtual bool hasCorrResidualControls() const;
121 
122  //- Return true if all convergence checks are satisfied
123  virtual convergenceData criteriaSatisfied() const;
124 
125  //- Return true if all correction convergence checks are satisfied
126  virtual bool corrCriteriaSatisfied() const;
127 
128  //- Reset the solve index in the correction residual control data
129  virtual void resetCorrSolveIndex();
130 
131  //- Update the solve index in the correction residual control data
132  virtual void updateCorrSolveIndex();
133 
134  //- Pimple loop
135  bool loop();
136 
137  //- Energy corrector loop
138  bool correctEnergy();
139 
140  //- Time run loop
141  bool run(Time& time);
142 
143  //- Time loop loop
144  bool loop(Time& time);
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
const Time & time() const
Return time.
Definition: IOobject.C:318
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:66
Convergence control class. Provides methods to check the convergence of the time loop against an abso...
Corrector convergence control class. Provides methods to check the convergence of an inner iteration ...
Multi-region-specific derivation of the solution control class.
Pimple loop class. Implements the logic which controls the pimple loop generically for a given correc...
Definition: pimpleLoop.H:52
Pimple multi-region control class. As Foam::pimpleControl, but for a multi- region simulation compris...
virtual ~pimpleMultiRegionControl()
Destructor.
bool correctEnergy()
Energy corrector loop.
virtual convergenceData criteriaSatisfied() const
Return true if all convergence checks are satisfied.
pimpleMultiRegionControl(const Time &runTime, PtrList< solver > &solvers, const word &algorithmName="PIMPLE")
Construct from time and the list of solvers.
virtual bool hasResidualControls() const
Return true if residual controls are present.
virtual bool hasCorrResidualControls() const
Return true if corrector residual controls are present.
bool run(Time &time)
Time run loop.
TypeName("pimpleMultiRegionControl")
Run-time type information.
virtual void resetCorrSolveIndex()
Reset the solve index in the correction residual control data.
virtual void updateCorrSolveIndex()
Update the solve index in the correction residual control data.
pimpleNoLoopControl & pimple(const label i)
Access the i-th pimple control.
virtual bool corrCriteriaSatisfied() const
Return true if all correction convergence checks are satisfied.
virtual bool read()
Read controls.
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
const word & algorithmName() const
Return the name of the algorithm.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59