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  // Constructors
124 
125  //- Construct null from mesh reference
126  cloudSolution(const fvMesh& mesh);
127 
128  //- Construct from mesh and dictionary
129  cloudSolution(const fvMesh& mesh, const dictionary& dict);
130 
131  //- Construct copy
132  cloudSolution(const cloudSolution& cs);
133 
134 
135  //- Destructor
136  virtual ~cloudSolution();
137 
138 
139  // Member functions
140 
141  //- Read properties from dictionary
142  void read();
143 
144 
145  // Access
146 
147  //- Return relaxation coefficient for field
148  scalar relaxCoeff(const word& fieldName) const;
149 
150  //- Return semi-implicit flag coefficient for field
151  bool semiImplicit(const word& fieldName) const;
152 
153  //- Return reference to the mesh
154  inline const fvMesh& mesh() const;
155 
156  //- Return const access to the dictionary
157  inline const dictionary& dict() const;
158 
159  //- Return the active flag
160  inline const Switch active() const;
161 
162  //- Return const access to the transient flag
163  inline const Switch transient() const;
164 
165  //- Return const access to the steady flag
166  inline const Switch steadyState() const;
167 
168  //- Return const access to the calculation frequency
169  inline label calcFrequency() const;
170 
171  //- Return const access to the max particle Courant number
172  inline scalar maxCo() const;
173 
174  //- Return const access to the current cloud iteration
175  inline label iter() const;
176 
177  //- Increment and return iter counter
178  inline label nextIter();
179 
180  //- Return the particle track time
181  inline scalar trackTime() const;
182 
183  //- Return the maximum integration time step
184  inline scalar deltaTMax() const;
185 
186  //- Return const access to the coupled flag
187  inline const Switch coupled() const;
188 
189  //- Return non-const access to the coupled flag
190  inline Switch& coupled();
191 
192  //- Return const access to the cell value correction flag
193  inline const Switch cellValueSourceCorrection() const;
194 
195  //- Return const access to the particle track time
196  inline scalar maxTrackTime() const;
197 
198  //- Return const access to the reset sources flag
199  inline const Switch resetSourcesOnStartup() const;
200 
201  //- Source terms dictionary
202  inline const dictionary& sourceTermDict() const;
203 
204  //- Interpolation schemes dictionary
205  inline const dictionary& interpolationSchemes() const;
206 
207  //- Integration schemes dictionary
208  inline const dictionary& integrationSchemes() const;
209 
210 
211  // Helper functions
212 
213  //- Returns true if performing a cloud iteration this calc step
214  bool solveThisStep() const;
215 
216  //- Returns true if possible to evolve the cloud and sets timestep
217  //- parameters
218  bool canEvolve();
219 
220  //- Returns true if possible to log this step
221  bool log() const;
222 
223  //- Returns true if writing this step
224  bool output() const;
225 
226  //- Return the maximum integration time
227  scalar deltaTMax(const scalar trackTime) const;
228 
229  //- Return the maximum integration length
230  scalar deltaLMax(const scalar lRef) const;
231 };
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace Foam
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #include "cloudSolutionI.H"
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
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:92
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:120
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.
bool semiImplicit(const word &fieldName) const
Return semi-implicit flag coefficient for field.
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:79
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.