cloudSolution.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) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::cloudSolution
28 
29 Description
30  Stores all relevant solution info for cloud
31 
32 SourceFiles
33  cloudSolutionI.H
34  cloudSolution.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cloudSolution_H
39 #define cloudSolution_H
40 
41 #include "fvMesh.H"
42 #include "Switch.H"
43 #include "Tuple2.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class cloudSolution Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class cloudSolution
55 {
56  // Private Data
57 
58  //- Reference to the mesh
59  const fvMesh& mesh_;
60 
61  //- Dictionary used during construction
62  dictionary dict_;
63 
64  //- Cloud active flag
65  const Switch active_;
66 
67  //- Transient flag
68  Switch transient_;
69 
70  //- Calculation frequency - carrier steps per cloud step
71  // NOTE: Steady operation only
72  label calcFrequency_;
73 
74  //- Output log frequency - carrier steps per cloud step
75  // Default = 1
76  label logFrequency_;
77 
78  //- Maximum particle Courant number
79  // Max fraction of current cell that can be traversed in a single
80  // step
81  scalar maxCo_;
82 
83  //- Current cloud iteration
84  label iter_;
85 
86  //- Particle track time
87  scalar trackTime_;
88 
89  //- Maximum integration time step (optional)
90  scalar deltaTMax_;
91 
92 
93  // Run-time options
94 
95  //- Flag to indicate whether parcels are coupled to the carrier
96  // phase, i.e. whether or not to generate source terms for
97  // carrier phase
98  Switch coupled_;
99 
100  //- Flag to correct cell values with latest transfer information
101  // during the lagrangian timestep
102  Switch cellValueSourceCorrection_;
103 
104  //- Maximum particle track time [s]
105  scalar maxTrackTime_;
106 
107  //- Flag to indicate whether coupling source terms should be
108  // reset on start-up/first read
109  Switch resetSourcesOnStartup_;
110 
111  //- List schemes, e.g. U semiImplicit 1
113 
114 
115  // Private Member Functions
116 
117  //- No copy assignment
118  void operator=(const cloudSolution&) = delete;
119 
120 
121 public:
122 
123  //- Debug switch
124  static int debug;
125 
126  // Constructors
127 
128  //- Construct null from mesh reference
129  cloudSolution(const fvMesh& mesh);
130 
131  //- Construct from mesh and dictionary
132  cloudSolution(const fvMesh& mesh, const dictionary& dict);
133 
134  //- Construct copy
135  cloudSolution(const cloudSolution& cs);
136 
137 
138  //- Destructor
139  ~cloudSolution() = default;
140 
141 
142  // Member functions
143 
144  //- Read properties from dictionary
145  void read();
146 
147 
148  // Access
149 
150  //- Return relaxation coefficient for field
151  scalar relaxCoeff(const word& fieldName) const;
152 
153  //- Return semi-implicit flag coefficient for field
154  bool semiImplicit(const word& fieldName) const;
155 
156  //- Return reference to the mesh
157  inline const fvMesh& mesh() const;
158 
159  //- Return const access to the dictionary
160  inline const dictionary& dict() const;
161 
162  //- Return the active flag
163  inline const Switch active() const;
164 
165  //- Return const access to the transient flag
166  inline const Switch transient() const;
167 
168  //- Return const access to the steady flag
169  inline const Switch steadyState() const;
170 
171  //- Return const access to the calculation frequency
172  inline label calcFrequency() const;
173 
174  //- Return const access to the max particle Courant number
175  inline scalar maxCo() const;
176 
177  //- Return const access to the current cloud iteration
178  inline label iter() const;
179 
180  //- Increment and return iter counter
181  inline label nextIter();
182 
183  //- Return the particle track time
184  inline scalar trackTime() const;
185 
186  //- Return the maximum integration time step
187  inline scalar deltaTMax() const;
188 
189  //- Return const access to the coupled flag
190  inline const Switch coupled() const;
191 
192  //- Return non-const access to the coupled flag
193  inline Switch& coupled();
194 
195  //- Return const access to the cell value correction flag
196  inline const Switch cellValueSourceCorrection() const;
197 
198  //- Return const access to the particle track time
199  inline scalar maxTrackTime() const;
200 
201  //- Return const access to the reset sources flag
202  inline const Switch resetSourcesOnStartup() const;
203 
204  //- Source terms dictionary
205  inline const dictionary& sourceTermDict() const;
206 
207  //- Interpolation schemes dictionary
208  inline const dictionary& interpolationSchemes() const;
209 
210  //- Integration schemes dictionary
211  inline const dictionary& integrationSchemes() const;
212 
213 
214  // Helper functions
215 
216  //- Returns true if performing a cloud iteration this calc step
217  bool solveThisStep() const;
218 
219  //- Returns true if possible to evolve the cloud and sets timestep
220  //- parameters
221  bool canEvolve();
222 
223  //- Returns true if possible to log this step
224  bool log() const;
225 
226  //- Returns true if writing this step
227  bool output() const;
228 
229  //- Return the maximum integration time
230  scalar deltaTMax(const scalar trackTime) const;
231 
232  //- Return the maximum integration length
233  scalar deltaLMax(const scalar lRef) const;
234 };
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #include "cloudSolutionI.H"
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
label iter() const
Return const access to the current cloud iteration.
cloudSolution(const fvMesh &mesh)
Construct null from mesh reference.
Definition: cloudSolution.C:99
const Switch cellValueSourceCorrection() const
Return const access to the cell value correction flag.
label calcFrequency() const
Return const access to the calculation frequency.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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: BitOps.H:56
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, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Definition: Switch.H:77
scalar maxCo() const
Return const access to the max particle Courant number.
scalar deltaLMax(const scalar lRef) const
Return the maximum integration length.
bool log() const
Returns true if possible to log this step.
static int debug
Debug switch.
bool semiImplicit(const word &fieldName) const
Return semi-implicit flag coefficient for field.
~cloudSolution()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:63
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.
scalar deltaTMax() const
Return the maximum integration time step.
const Switch active() const
Return the active flag.
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:49
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 parameters.