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-2026 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  private autoPtr<printDictionary>,
61  public pimpleLoop,
62  public convergenceControl,
64 {
65  // Private data
66 
67  //- The per-region pimple controls
68  UPtrList<pimpleNoLoopControl> pimpleControls_;
69 
70  //- Maximum number of energy correctors
71  label nEcorr_;
72 
73  //- Current energy corrector
74  label Ecorr_;
75 
76 
77 protected:
78 
79  // Protected Member Functions
80 
81  //- Read controls
82  virtual bool read();
83 
84 
85 public:
86 
87  // Static Data Members
88 
89  //- Run-time type information
90  TypeName("pimpleMultiRegionControl");
91 
92 
93  // Constructors
94 
95  //- Construct from time and the list of solvers
97  (
98  const Time& runTime,
99  PtrList<solver>& solvers,
100  const word& algorithmName = "PIMPLE"
101  );
102 
103 
104  //- Destructor
105  virtual ~pimpleMultiRegionControl();
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  //- Access the i-th pimple control
113  inline pimpleNoLoopControl& pimple(const label i);
114 
115  // Evolution
116 
117  //- Return true if residual controls are present
118  virtual bool hasResidualControls() const;
119 
120  //- Return true if corrector residual controls are present
121  virtual bool hasCorrResidualControls() const;
122 
123  //- Return true if all convergence checks are satisfied
124  virtual convergenceData criteriaSatisfied() const;
125 
126  //- Return true if all correction convergence checks are satisfied
127  virtual bool corrCriteriaSatisfied() const;
128 
129  //- Reset the solve index in the correction residual control data
130  virtual void resetCorrSolveIndex();
131 
132  //- Update the solve index in the correction residual control data
133  virtual void updateCorrSolveIndex();
134 
135  //- Pimple loop
136  bool loop();
137 
138  //- Energy corrector loop
139  bool correctEnergy();
140 
141  //- Time run loop
142  bool run(Time& time);
143 
144  //- Time loop loop
145  bool loop(Time& time);
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
const Time & time() const
Return time.
Definition: IOobject.C:315
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
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
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:63
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