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  //- Maximum particle Courant number
75  // Max fraction of current cell that can be traversed in a single
76  // step
77  scalar maxCo_;
78 
79  //- Current cloud iteration
80  label iter_;
81 
82  //- Particle track time
83  scalar trackTime_;
84 
85  //- Maximum integration time step (optional)
86  scalar deltaTMax_;
87 
88 
89  // Run-time options
90 
91  //- Flag to indicate whether parcels are coupled to the carrier
92  // phase, i.e. whether or not to generate source terms for
93  // carrier phase
94  Switch coupled_;
95 
96  //- Flag to correct cell values with latest transfer information
97  // during the lagrangian timestep
98  Switch cellValueSourceCorrection_;
99 
100  //- Maximum particle track time [s]
101  scalar maxTrackTime_;
102 
103  //- Flag to indicate whether coupling source terms should be
104  // reset on start-up/first read
105  Switch resetSourcesOnStartup_;
106 
107  //- List schemes, e.g. U semiImplicit 1
109 
110 
111  // Private Member Functions
112 
113  //- No copy assignment
114  void operator=(const cloudSolution&) = delete;
115 
116 
117 public:
118 
119  // Constructors
120 
121  //- Construct null from mesh reference
122  cloudSolution(const fvMesh& mesh);
123 
124  //- Construct from mesh and dictionary
125  cloudSolution(const fvMesh& mesh, const dictionary& dict);
126 
127  //- Construct copy
128  cloudSolution(const cloudSolution& cs);
129 
130 
131  //- Destructor
132  virtual ~cloudSolution();
133 
134 
135  // Member functions
136 
137  //- Read properties from dictionary
138  void read();
139 
140 
141  // Access
142 
143  //- Return relaxation coefficient for field
144  scalar relaxCoeff(const word& fieldName) const;
145 
146  //- Return semi-implicit flag coefficient for field
147  bool semiImplicit(const word& fieldName) const;
148 
149  //- Return reference to the mesh
150  inline const fvMesh& mesh() const;
151 
152  //- Return const access to the dictionary
153  inline const dictionary& dict() const;
154 
155  //- Return the active flag
156  inline const Switch active() const;
157 
158  //- Return const access to the transient flag
159  inline const Switch transient() const;
160 
161  //- Return const access to the steady flag
162  inline const Switch steadyState() const;
163 
164  //- Return const access to the calculation frequency
165  inline label calcFrequency() const;
166 
167  //- Return const access to the max particle Courant number
168  inline scalar maxCo() const;
169 
170  //- Return const access to the current cloud iteration
171  inline label iter() const;
172 
173  //- Increment and return iter counter
174  inline label nextIter();
175 
176  //- Return the particle track time
177  inline scalar trackTime() const;
178 
179  //- Return the maximum integration time step
180  inline scalar deltaTMax() const;
181 
182  //- Return const access to the coupled flag
183  inline const Switch coupled() const;
184 
185  //- Return non-const access to the coupled flag
186  inline Switch& coupled();
187 
188  //- Return const access to the cell value correction flag
189  inline const Switch cellValueSourceCorrection() const;
190 
191  //- Return const access to the particle track time
192  inline scalar maxTrackTime() const;
193 
194  //- Return const access to the reset sources flag
195  inline const Switch resetSourcesOnStartup() const;
196 
197  //- Source terms dictionary
198  inline const dictionary& sourceTermDict() const;
199 
200  //- Interpolation schemes dictionary
201  inline const dictionary& interpolationSchemes() const;
202 
203  //- Integration schemes dictionary
204  inline const dictionary& integrationSchemes() const;
205 
206 
207  // Helper functions
208 
209  //- Returns true if performing a cloud iteration this calc step
210  bool solveThisStep() const;
211 
212  //- Returns true if possible to evolve the cloud and sets timestep
213  // parameters
214  bool canEvolve();
215 
216  //- Returns true if writing this step
217  bool output() const;
218 
219  //- Return the maximum integration time
220  scalar deltaTMax(const scalar trackTime) const;
221 
222  //- Return the maximum integration length
223  scalar deltaLMax(const scalar lRef) const;
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #include "cloudSolutionI.H"
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
Foam::cloudSolution::maxTrackTime
scalar maxTrackTime() const
Return const access to the particle track time.
Definition: cloudSolutionI.H:130
Foam::cloudSolution::active
const Switch active() const
Return the active flag.
Definition: cloudSolutionI.H:40
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Tuple2.H
Foam::cloudSolution::deltaTMax
scalar deltaTMax() const
Return the maximum integration time step.
Definition: cloudSolutionI.H:106
Foam::cloudSolution::nextIter
label nextIter()
Increment and return iter counter.
Definition: cloudSolutionI.H:94
cloudSolutionI.H
Foam::cloudSolution::resetSourcesOnStartup
const Switch resetSourcesOnStartup() const
Return const access to the reset sources flag.
Definition: cloudSolutionI.H:136
Foam::cloudSolution::canEvolve
bool canEvolve()
Returns true if possible to evolve the cloud and sets timestep.
Definition: cloudSolution.C:252
Foam::cloudSolution::deltaLMax
scalar deltaLMax(const scalar lRef) const
Return the maximum integration length.
Definition: cloudSolution.C:286
Foam::cloudSolution::trackTime
scalar trackTime() const
Return the particle track time.
Definition: cloudSolutionI.H:100
Foam::cloudSolution::coupled
const Switch coupled() const
Return const access to the coupled flag.
Definition: cloudSolutionI.H:118
Foam::cloudSolution::sourceTermDict
const dictionary & sourceTermDict() const
Source terms dictionary.
Definition: cloudSolutionI.H:46
Foam::cloudSolution::integrationSchemes
const dictionary & integrationSchemes() const
Integration schemes dictionary.
Definition: cloudSolutionI.H:58
Foam::cloudSolution::maxCo
scalar maxCo() const
Return const access to the max particle Courant number.
Definition: cloudSolutionI.H:82
Foam::cloudSolution::output
bool output() const
Returns true if writing this step.
Definition: cloudSolution.C:267
Foam::cloudSolution::cellValueSourceCorrection
const Switch cellValueSourceCorrection() const
Return const access to the cell value correction flag.
Definition: cloudSolutionI.H:124
Foam::cloudSolution::solveThisStep
bool solveThisStep() const
Returns true if performing a cloud iteration this calc step.
Definition: cloudSolution.C:241
Foam::cloudSolution
Stores all relevant solution info for cloud.
Definition: cloudSolution.H:53
Switch.H
Foam::cloudSolution::dict
const dictionary & dict() const
Return const access to the dictionary.
Definition: cloudSolutionI.H:34
Foam::cloudSolution::semiImplicit
bool semiImplicit(const word &fieldName) const
Return semi-implicit flag coefficient for field.
Definition: cloudSolution.C:223
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cloudSolution::mesh
const fvMesh & mesh() const
Return reference to the mesh.
Definition: cloudSolutionI.H:28
Foam::cloudSolution::calcFrequency
label calcFrequency() const
Return const access to the calculation frequency.
Definition: cloudSolutionI.H:76
Foam::cloudSolution::iter
label iter() const
Return const access to the current cloud iteration.
Definition: cloudSolutionI.H:88
Foam::cloudSolution::relaxCoeff
scalar relaxCoeff(const word &fieldName) const
Return relaxation coefficient for field.
Definition: cloudSolution.C:205
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::cloudSolution::read
void read()
Read properties from dictionary.
Definition: cloudSolution.C:124
Foam::cloudSolution::cloudSolution
cloudSolution(const fvMesh &mesh)
Construct null from mesh reference.
Definition: cloudSolution.C:97
Foam::cloudSolution::~cloudSolution
virtual ~cloudSolution()
Destructor.
Definition: cloudSolution.C:118
Foam::cloudSolution::interpolationSchemes
const dictionary & interpolationSchemes() const
Interpolation schemes dictionary.
Definition: cloudSolutionI.H:52
Foam::cloudSolution::steadyState
const Switch steadyState() const
Return const access to the steady flag.
Definition: cloudSolutionI.H:70