1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
28 #include "breakupModel.H"
29 #include "collisionModel.H"
30 #include "dispersionModel.H"
31 #include "injectorModel.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 scalar time = runTime_.value();
43 scalar time0 = time0_;
45 // Inject the parcels for each injector sequentially
48 autoPtr<injectorType>& it = injectors()[i].properties();
49 if (!it->pressureIndependentVelocity())
51 scalar referencePressure = p().average().value();
52 it->correctProfiles(fuels(), referencePressure);
55 const label nHoles = it->nHoles();
57 // parcels have the same mass during a timestep
58 scalar mass = it->mass(time0, time, twoD_, angleOfWedge_);
60 label Np = it->nParcelsToInject(time0, time);
65 scalar mp = mass/Np/nHoles;
67 // constT is only larger than zero for the first
68 // part of the injection
69 scalar constT = max(0.0, it->tsoi() - time0);
71 // deltaT is the duration of injection during this timestep
74 runTime_.deltaT().value(),
82 for(label j=0; j<Np; j++)
84 // calculate the time of injection for parcel 'j'
85 scalar toi = time0 + constT + deltaT*j/scalar(Np);
87 for(label n=0; n<nHoles; n++)
90 // calculate the velocity of the injected parcel
91 vector injectionPosition = it->position
103 scalar diameter = injection().d0(i, toi);
104 vector direction = injection().direction(i, n, toi, diameter);
105 vector U = injection().velocity(i, toi)*direction;
107 scalar symComponent = direction & axisOfSymmetry_;
108 vector normal = direction - symComponent*axisOfSymmetry_;
109 normal /= mag(normal);
111 // should be set from dict or model
112 scalar deviation = breakup().y0();
113 scalar ddev = breakup().yDot0();
115 label injectorCell = mesh_.findCell(injectionPosition);
117 # include "findInjectorCell.H"
119 if (injectorCell >= 0)
121 scalar liquidCore = 1.0;
123 // construct the parcel that is to be injected
125 parcel* pPtr = new parcel
147 injectedLiquidKE_ += 0.5*pPtr->m()*magSqr(U);
149 scalar dt = time - toi;
151 pPtr->stepFraction() =
152 (runTime_.deltaT().value() - dt)
153 /runTime_.deltaT().value();
155 bool keepParcel = pPtr->move(*this);
165 } // if (injectorCell....
166 } // for(label n=0...
167 } // for(label j=0....
169 } // forAll(injectors)...
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 } // End namespace Foam
179 // ************************************************************************* //