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