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-2022 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 public:
77 
78  // Static Data Members
79 
80  //- Run-time type information
81  TypeName("pimpleMultiRegionControl");
82 
83 
84  // Constructors
85 
86  //- Construct from time and the list of solvers
88  (
89  const Time& runTime,
90  PtrList<solver>& solvers,
91  const word& algorithmName = "PIMPLE"
92  );
93 
94 
95  //- Destructor
96  virtual ~pimpleMultiRegionControl();
97 
98 
99  // Member Functions
100 
101  // IO
102 
103  //- Read controls
104  virtual bool read();
105 
106  // Access
107 
108  //- Access the i-th pimple control
109  inline pimpleNoLoopControl& pimple(const label i);
110 
111  // Evolution
112 
113  //- Return true if residual controls are present
114  virtual bool hasResidualControls() const;
115 
116  //- Return true if corrector residual controls are present
117  virtual bool hasCorrResidualControls() const;
118 
119  //- Return true if all convergence checks are satisfied
120  virtual bool criteriaSatisfied() const;
121 
122  //- Return true if all correction convergence checks are satisfied
123  virtual bool corrCriteriaSatisfied() const;
124 
125  //- Reset the solve index in the correction residual control data
126  virtual void resetCorrSolveIndex();
127 
128  //- Update the solve index in the correction residual control data
129  virtual void updateCorrSolveIndex();
130 
131  //- Pimple loop
132  bool loop();
133 
134  //- Energy corrector loop
135  bool correctEnergy();
136 
137  //- Time run loop
138  bool run(Time& time);
139 
140  //- Time loop loop
141  bool loop(Time& time);
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
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 bool criteriaSatisfied() const
Return true if all convergence checks are satisfied.
virtual ~pimpleMultiRegionControl()
Destructor.
bool correctEnergy()
Energy corrector loop.
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 Time & time() const
Return the time.
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