Formatting
[foam-extend-3.2.git] / src / lagrangian / dieselSpray / spray / spray.H
blob164643a06117e4ce8d109c6399f00671acbd6f1d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::spray
27 Description
28     A spray is a cloud of parcels
30 \*---------------------------------------------------------------------------*/
32 #ifndef spray_H
33 #define spray_H
35 #include "parcel.H"
36 #include "injector.H"
37 #include "IOPtrList.H"
38 #include "interpolation.H"
39 #include "liquid.H"
40 #include "autoPtr.H"
41 #include "liquidMixture.H"
42 #include "Random.H"
43 #include "thermoPhysicsTypes.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 class atomizationModel;
51 class breakupModel;
52 class collisionModel;
53 class dispersionModel;
54 class dragModel;
55 class evaporationModel;
56 class injectorModel;
57 class heatTransferModel;
58 class wallModel;
60 class basicMultiComponentMixture;
62 /*---------------------------------------------------------------------------*\
63                         Class spray Declaration
64 \*---------------------------------------------------------------------------*/
66 class spray
68     public Cloud<parcel>
70     // Private data
72         // References to the database and meshes
74             const Time& runTime_;
75             scalar time0_;
76             const fvMesh& mesh_;
78             //- Random number generator
79             Random rndGen_;
81         //- Acceleration due to gravity
82         const vector& g_;
85         // References to the physical fields
87             const volVectorField& U_;
88             const volScalarField& rho_;
89             const volScalarField& p_;
90             const volScalarField& T_;
93         //- The spray properties
94         IOdictionary sprayProperties_;
97         //- Ambient Pressure
98         scalar ambientPressure_;
100         //- Ambient Temperature
101         scalar ambientTemperature_;
104         //- The injectors
105         IOPtrList<injector> injectors_;
108         // References to the spray sub-models
110             autoPtr<atomizationModel> atomization_;
111             autoPtr<dragModel> drag_;
112             autoPtr<evaporationModel> evaporation_;
113             autoPtr<heatTransferModel> heatTransfer_;
114             autoPtr<wallModel> wall_;
115             autoPtr<breakupModel> breakupModel_;
116             autoPtr<collisionModel> collisionModel_;
117             autoPtr<dispersionModel> dispersionModel_;
118             autoPtr<liquidMixture> fuels_;
119             autoPtr<injectorModel> injectorModel_;
122         // Iterations to avoid errors due to too small parcels
123         // causing temperature out of range
125             //- Spray iteration dictionary
126             dictionary sprayIteration_;
128             //- Number of spray iterations
129             const label sprayIterate_;
131             //- Spray relaxation factor
132             const scalar sprayRelaxFactor_;
134             //- Minimum parcel mass
135             const scalar minimumParcelMass_;
138         //- Minimum number of lagrangian subcycles
139         const label subCycles_;
142         // Composition properties
144             const PtrList<gasThermoPhysics>& gasProperties_;
145             const basicMultiComponentMixture& composition_;
147             List<label> liquidToGasIndex_;
148             List<label> gasToLiquidIndex_;
149             List<bool> isLiquidFuel_;
152         // Necessary 2D-information
154             bool twoD_;
155             vector axisOfSymmetry_;
156             vector axisOfWedge_;
157             vector axisOfWedgeNormal_;
158             scalar angleOfWedge_;
161         // Interpolation
163             dictionary interpolationSchemes_;
165             autoPtr<interpolation<vector> > UInterpolator_;
166             autoPtr<interpolation<scalar> > rhoInterpolator_;
167             autoPtr<interpolation<scalar> > pInterpolator_;
168             autoPtr<interpolation<scalar> > TInterpolator_;
171         // Spray Source Terms
173             //- Momentum
174             vectorField sms_;
176             //- Enthalpy
177             scalarField shs_;
179             //- Mass
180             PtrList<scalarField> srhos_;
182             //- The total mass of the injected liquid
183             scalar totalInjectedLiquidMass_;
185             //- The (total added) injected kinetic energy of the liquid
186             scalar injectedLiquidKE_;
189     // Private Member Functions
191         //- Disallow default bitwise copy construct
192         spray(const spray&);
194         //- Disallow default bitwise assignment
195         void operator=(const spray&);
198 public:
200     // Constructors
202         //- Construct from components
203         spray
204         (
205             const volVectorField& U,
206             const volScalarField& rho,
207             const volScalarField& p,
208             const volScalarField& T,
209             const basicMultiComponentMixture& composition,
210             const PtrList<gasThermoPhysics>& gasProperties,
211             const dictionary& thermophysicalProperties,
212             const dimensionedVector& g,
213             bool readFields = true
214         );
217     // Destructor
219         ~spray();
222     // Member Functions
224         // Spray tracking and evolution functions
226             //- Evolve the spray (move, inject and breakup)
227             void evolve();
229             //- Move the spray parcels
230             void move();
232             //- Inject more parcels
233             void inject();
235             //- Primary breakup droplets
236             void atomizationLoop();
239             //- Secondary breakup droplets
240             void breakupLoop();
243         // Access
245             inline const Time& runTime() const;
246             inline const fvMesh& mesh() const;
248             inline const volVectorField& U() const;
249             inline const volScalarField& rho() const;
250             inline const volScalarField& p() const;
251             inline const volScalarField& T() const;
253             inline PtrList<injector>& injectors();
254             inline const PtrList<injector>& injectors() const;
256             inline const atomizationModel& atomization() const;
257             inline const breakupModel& breakup() const;
258             inline const collisionModel& collisions() const;
259             inline const dispersionModel& dispersion() const;
260             inline const dragModel& drag() const;
261             inline const evaporationModel& evaporation() const;
262             inline const heatTransferModel& heatTransfer() const;
263             inline const injectorModel& injection() const;
264             inline const wallModel& wall() const;
266             inline tmp<volVectorField> momentumSource() const;
267             inline tmp<volScalarField> evaporationSource(const label i) const;
268             inline tmp<volScalarField> heatTransferSource() const;
270             inline Random& rndGen();
272             inline label sprayIterate() const;
273             inline scalar sprayRelaxFactor() const;
274             inline scalar minimumParcelMass() const;
276             inline label subCycles() const;
277             inline const vector& g() const;
279             inline const liquidMixture& fuels() const;
280             inline const PtrList<gasThermoPhysics>& gasProperties() const;
281             inline const basicMultiComponentMixture& composition() const;
283             inline const List<label>& liquidToGasIndex() const;
284             inline const List<label>& gasToLiquidIndex() const;
285             inline const List<bool>& isLiquidFuel() const;
287             inline const bool& twoD() const;
288             inline const vector& axisOfSymmetry() const;
289             inline const vector& axisOfWedge() const;
290             inline const vector& axisOfWedgeNormal() const;
291             inline const scalar& angleOfWedge() const;
293             inline const interpolation<vector>& UInterpolator() const;
294             inline const interpolation<scalar>& rhoInterpolator() const;
295             inline const interpolation<scalar>& pInterpolator() const;
296             inline const interpolation<scalar>& TInterpolator() const;
298             inline vectorField& sms();
299             inline const vectorField& sms() const;
301             inline scalarField& shs();
302             inline const scalarField& shs() const;
304             inline PtrList<scalarField>& srhos();
305             inline const PtrList<scalarField>& srhos() const;
307             inline const scalar& ambientPressure() const;
309             inline const scalar& ambientTemperature() const;
312         // Check
314             //- Returns the liquid mass that has been injected
315             scalar injectedMass(const scalar t) const;
317            //- Returns the liquid mass that will be injected by the injectors
318             scalar totalMassToInject() const;
320             //- Returns the injected enthalpy
321             scalar injectedEnthalpy(const scalar t) const;
323             //- Returns current total liquid mass in the domain
324             scalar liquidMass() const;
326             //- Returns the enthalpy of all the liquid in the domain
327             // Hdrop = Hgas - Hlat
328             scalar liquidEnthalpy() const;
330             //- Returns the enthalpy (total) of all the liquid in the domain
331             // Hdrop = Hgas - Hlat + (P-Psat)/rhoDrop;
332             scalar liquidTotalEnthalpy() const;
334             //- Returns the kinetic energy of the liquid phase
335             scalar liquidKineticEnergy() const;
337             //- Returns the injected kinetic energy of the liquid phase
338             scalar injectedLiquidKineticEnergy() const;
340             //- Returns the droplet penetration for a fraction of the
341             //  liquid from nozzle 'nozzlei'.
342             //  Fraction is defined between 0 and 1, where 1 represents 100%
343             scalar liquidPenetration
344             (
345                 const label nozzlei,
346                 const scalar prc
347             ) const;
349             //- Returns the droplet penetration for 'prc' percent of the
350             //  liquid from nozzle 0
351             scalar liquidPenetration(const scalar prc) const;
353             //- Return Sauter Mean Diameter
354             scalar smd() const;
356             //- Return Maximum Diameter
357             scalar maxD() const;
359             //- Return Ambient Pressure
360             void calculateAmbientPressure();
362             //- Return Ambient Temperature
363             void calculateAmbientTemperature();
367 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
369 } // End namespace Foam
371 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
373 #include "sprayI.H"
375 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
377 #endif
379 // ************************************************************************* //