equationInitialResidualCondition.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) 2015 OpenFOAM Foundation
9  Copyright (C) 2016-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::functionObjects::runTimeControls::equationInitialResidualCondition
29 
30 Description
31  Minimum or maximum initial residual run time condition
32 
33 SourceFiles
34  equationInitialResidualCondition.H
35  equationInitialResidualCondition.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef functionObjects_runTimeControls_equationInitialResidualCondition_H
40 #define functionObjects_runTimeControls_equationInitialResidualCondition_H
41 
42 #include "runTimeCondition.H"
43 #include "solverFieldSelection.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class fvMesh;
51 
52 namespace functionObjects
53 {
54 namespace runTimeControls
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class equationInitialResidualCondition Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
63  public runTimeCondition
64 {
65 public:
66 
67  enum operatingMode
68  {
69  omMin,
70  omMax
71  };
72 
74 
75 
76 protected:
77 
78  // Protected data
79 
80  //- Field names
82 
83  //- Value to compare
84  const scalar value_;
85 
86  //- Start checking from time - always skips first iteration
87  scalar timeStart_;
88 
89  //- Operating mode
91 
92 
93  // Protected Member Functions
94 
95  //- Set the residual (scalar) value
96  template<class Type>
97  void setResidual
98  (
99  const fvMesh& mesh,
100  const dictionary& dict,
101  const word& fieldName,
102  const label componenti,
103  bool& canSet,
104  scalar& residual
105  ) const;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("equationInitialResidual");
112 
113  //- Constructor
115  (
116  const word& name,
117  const objectRegistry& obr,
118  const dictionary& dict,
119  stateFunctionObject& state
120  );
121 
122  //- Destructor
123  virtual ~equationInitialResidualCondition() = default;
124 
125 
126  // Public Member Functions
127 
128  //- Apply the condition
129  virtual bool apply();
130 
131  //- Write
132  virtual void write();
133 
134  //- Reset
135  virtual void reset();
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace runTimeControls
142 } // End namespace functionObjects
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #ifdef NoRepository
149 #endif
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
void setResidual(const fvMesh &mesh, const dictionary &dict, const word &fieldName, const label componenti, bool &canSet, scalar &residual) const
Set the residual (scalar) value.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
equationInitialResidualCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("equationInitialResidual")
Runtime type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Base class for function objects, adding functionality to read/write state information (data required ...
Registry of regIOobjects.
scalar timeStart_
Start checking from time - always skips first iteration.
Namespace for OpenFOAM.
virtual const word & name() const
Return the condition name.