1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
27 #include "breakupModel.H"
28 #include "collisionModel.H"
29 #include "dispersionModel.H"
30 #include "injectorModel.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 void Foam::spray::inject()
36 scalar time = runTime_.value();
37 scalar time0 = time0_;
39 parcel::trackingData td(*this);
41 // Inject the parcels for each injector sequentially
44 autoPtr<injectorType>& it = injectors()[i].properties();
45 if (!it->pressureIndependentVelocity())
47 scalar referencePressure = p().average().value();
48 it->correctProfiles(fuels(), referencePressure);
51 const label nHoles = it->nHoles();
53 // parcels have the same mass during a timestep
54 scalar mass = it->mass(time0, time, twoD_, angleOfWedge_);
56 label Np = it->nParcelsToInject(time0, time);
61 scalar mp = mass/Np/nHoles;
63 // constT is only larger than zero for the first
64 // part of the injection
65 scalar constT = max(0.0, it->tsoi() - time0);
67 // deltaT is the duration of injection during this timestep
70 runTime_.deltaTValue(),
78 for (label j=0; j<Np; j++)
80 // calculate the time of injection for parcel 'j'
81 scalar toi = time0 + constT + deltaT*j/scalar(Np);
83 for (label n=0; n<nHoles; n++)
86 // calculate the velocity of the injected parcel
87 vector injectionPosition = it->position
99 scalar diameter = injection().d0(i, toi);
101 injection().direction(i, n, toi, diameter);
102 vector U = injection().velocity(i, toi)*direction;
104 scalar symComponent = direction & axisOfSymmetry_;
105 vector normal = direction - symComponent*axisOfSymmetry_;
106 normal /= mag(normal);
108 // should be set from dict or model
109 scalar deviation = breakup().y0();
110 scalar ddev = breakup().yDot0();
112 label injectorCell = -1;
113 label injectorTetFaceI = -1;
114 label injectorTetPtI = -1;
124 #include "findInjectorCell.H"
126 if (injectorCell >= 0)
128 scalar liquidCore = 1.0;
130 // construct the parcel that is to be injected
132 parcel* pPtr = new parcel
156 injectedLiquidKE_ += 0.5*pPtr->m()*magSqr(U);
158 scalar dt = time - toi;
160 pPtr->stepFraction() =
161 (runTime_.deltaTValue() - dt)
162 /runTime_.deltaTValue();
165 pPtr->move(td, runTime_.deltaTValue());
175 } // if (injectorCell....
176 } // for (label n=0...
177 } // for (label j=0....
179 } // forAll(injectors)...
185 // ************************************************************************* //