cloudSolution.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) 2011-2019 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::cloudSolution
26 
27 Description
28  Stores all relevant solution info for cloud
29 
30 SourceFiles
31  cloudSolutionI.H
32  cloudSolution.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef cloudSolution_H
37 #define cloudSolution_H
38 
39 #include "fvMesh.H"
40 #include "Switch.H"
41 #include "Tuple2.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class cloudSolution Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class cloudSolution
53 {
54  // Private Data
55 
56  //- Reference to the mesh
57  const fvMesh& mesh_;
58 
59  //- Dictionary used during construction
60  dictionary dict_;
61 
62  //- Cloud active flag
63  const Switch active_;
64 
65  //- Transient flag
66  Switch transient_;
67 
68  //- Calculation frequency - carrier steps per cloud step
69  // NOTE: Steady operation only
70  label calcFrequency_;
71 
72  //- Maximum particle Courant number
73  // Max fraction of current cell that can be traversed in a single
74  // step
75  scalar maxCo_;
76 
77  //- Current cloud iteration
78  label iter_;
79 
80  //- Particle track time
81  scalar trackTime_;
82 
83 
84  // Run-time options
85 
86  //- Flag to indicate whether parcels are coupled to the carrier
87  // phase, i.e. whether or not to generate source terms for
88  // carrier phase
89  Switch coupled_;
90 
91  //- Flag to correct cell values with latest transfer information
92  // during the lagrangian timestep
93  Switch cellValueSourceCorrection_;
94 
95  //- Maximum particle track time [s]
96  scalar maxTrackTime_;
97 
98  //- Flag to indicate whether coupling source terms should be
99  // reset on start-up/first read
100  Switch resetSourcesOnStartup_;
101 
102  //- List schemes, e.g. U semiImplicit 1
104 
105 
106 public:
107 
108  // Constructors
109 
110  //- Construct null from mesh reference
111  cloudSolution(const fvMesh& mesh);
112 
113  //- Construct from mesh and dictionary
114  cloudSolution(const fvMesh& mesh, const dictionary& dict);
115 
116  //- Construct copy
117  cloudSolution(const cloudSolution& cs);
118 
119 
120  //- Destructor
121  virtual ~cloudSolution();
122 
123 
124  // Member Functions
125 
126  //- Read properties from dictionary
127  void read();
128 
129 
130  // Access
131 
132  //- Return relaxation coefficient for field
133  scalar relaxCoeff(const word& fieldName) const;
134 
135  //- Return semi-implicit flag coefficient for field
136  bool semiImplicit(const word& fieldName) const;
137 
138  //- Return reference to the mesh
139  inline const fvMesh& mesh() const;
140 
141  //- Return const access to the dictionary
142  inline const dictionary& dict() const;
143 
144  //- Return the active flag
145  inline const Switch active() const;
146 
147  //- Return const access to the transient flag
148  inline const Switch transient() const;
149 
150  //- Return const access to the steady flag
151  inline const Switch steadyState() const;
152 
153  //- Return const access to the calculation frequency
154  inline label calcFrequency() const;
155 
156  //- Return const access to the max particle Courant number
157  inline scalar maxCo() const;
158 
159  //- Return const access to the current cloud iteration
160  inline label iter() const;
161 
162  //- Increment and return iter counter
163  inline label nextIter();
164 
165  //- Return the particle track time
166  inline scalar trackTime() const;
167 
168  //- Return const access to the coupled flag
169  inline const Switch coupled() const;
170 
171  //- Return non-const access to the coupled flag
172  inline Switch& coupled();
173 
174  //- Return const access to the cell value correction flag
175  inline const Switch cellValueSourceCorrection() const;
176 
177  //- Return const access to the particle track time
178  inline scalar maxTrackTime() const;
179 
180  //- Return const access to the reset sources flag
181  inline const Switch resetSourcesOnStartup() const;
182 
183  //- Source terms dictionary
184  inline const dictionary& sourceTermDict() const;
185 
186  //- Interpolation schemes dictionary
187  inline const dictionary& interpolationSchemes() const;
188 
189  //- Integration schemes dictionary
190  inline const dictionary& integrationSchemes() const;
191 
192 
193  // Helper functions
194 
195  //- Returns true if performing a cloud iteration this calc step
196  bool solveThisStep() const;
197 
198  //- Returns true if possible to evolve the cloud and sets timestep
199  // parameters
200  bool canEvolve();
201 
202  //- Returns true if writing this step
203  bool output() const;
204 
205 
206  // Member Operators
207 
208  //- Disallow default bitwise assignment
209  void operator=(const cloudSolution&) = delete;
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #include "cloudSolutionI.H"
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
virtual ~cloudSolution()
Destructor.
label iter() const
Return const access to the current cloud iteration.
cloudSolution(const fvMesh &mesh)
Construct null from mesh reference.
Definition: cloudSolution.C:81
const Switch cellValueSourceCorrection() const
Return const access to the cell value correction flag.
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
label calcFrequency() const
Return const access to the calculation frequency.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
scalar relaxCoeff(const word &fieldName) const
Return relaxation coefficient for field.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
const fvMesh & mesh() const
Return reference to the mesh.
const dictionary & interpolationSchemes() const
Interpolation schemes dictionary.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
scalar maxCo() const
Return const access to the max particle Courant number.
bool semiImplicit(const word &fieldName) const
Return semi-implicit flag coefficient for field.
A class for handling words, derived from string.
Definition: word.H:59
scalar trackTime() const
Return the particle track time.
bool solveThisStep() const
Returns true if performing a cloud iteration this calc step.
scalar maxTrackTime() const
Return const access to the particle track time.
const Switch active() const
Return the active flag.
void operator=(const cloudSolution &)=delete
Disallow default bitwise assignment.
const Switch coupled() const
Return const access to the coupled flag.
const dictionary & dict() const
Return const access to the dictionary.
Stores all relevant solution info for cloud.
Definition: cloudSolution.H:51
const Switch steadyState() const
Return const access to the steady flag.
label nextIter()
Increment and return iter counter.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const dictionary & integrationSchemes() const
Integration schemes dictionary.
const dictionary & sourceTermDict() const
Source terms dictionary.
void read()
Read properties from dictionary.
bool output() const
Returns true if writing this step.
const Switch resetSourcesOnStartup() const
Return const access to the reset sources flag.
Namespace for OpenFOAM.
bool canEvolve()
Returns true if possible to evolve the cloud and sets timestep.