1 /*---------------------------------------------------------------------------*\
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 -------------------------------------------------------------------------------
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 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
28 #include "mathematicalConstants.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(ChomiakInjector, 0);
39 addToRunTimeSelectionTable
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 // Construct from components
50 ChomiakInjector::ChomiakInjector
52 const dictionary& dict,
56 injectorModel(dict, sm),
57 ChomiakDict_(dict.subDict(typeName + "Coeffs")),
62 ChomiakDict_.subDict("dropletPDF"),
66 maxSprayAngle_(ChomiakDict_.lookup("maxSprayConeAngle"))
69 if (sm.injectors().size() != maxSprayAngle_.size())
71 FatalError << "ChomiakInjector::ChomiakInjector"
72 << "(const dictionary& dict, spray& sm)\n"
73 << "Wrong number of entries in maxSprayAngle"
77 scalar referencePressure = sm.p().average().value();
79 // correct velocityProfile
80 forAll(sm.injectors(), i)
82 sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90 ChomiakInjector::~ChomiakInjector()
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 scalar ChomiakInjector::d0
102 return dropletPDF_->sample();
106 vector ChomiakInjector::direction
114 scalar dMin = dropletPDF_->minValue();
115 scalar dMax = dropletPDF_->maxValue();
117 scalar angle = (d-dMax)*maxSprayAngle_[n]/(dMin-dMax)*mathematicalConstant::pi/360.0;
118 scalar alpha = sin(angle);
119 scalar dcorr = cos(angle);
121 scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
123 // randomly distributed vector normal to the injection vector
124 vector normal = vector::zero;
128 scalar reduce = 0.01;
129 // correct beta if this is a 2D run
130 // map it onto the 'angleOfWedge'
131 beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/mathematicalConstant::pi;
132 beta += reduce*sm_.angleOfWedge();
136 sm_.axisOfWedge()*cos(beta) +
137 sm_.axisOfWedgeNormal()*sin(beta)
145 injectors_[n].properties()->tan1(hole)*cos(beta) +
146 injectors_[n].properties()->tan2(hole)*sin(beta)
150 // set the direction of injection by adding the normal vector
151 vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
158 scalar ChomiakInjector::velocity
164 const injectorType& it = sm_.injectors()[i].properties();
165 if (it.pressureIndependentVelocity())
167 return it.getTableValue(it.velocityProfile(), time);
171 scalar Pref = sm_.ambientPressure();
172 scalar Pinj = it.getTableValue(it.injectionPressureProfile(), time);
173 scalar rho = sm_.fuels().rho(Pinj, it.T(time), it.X());
174 scalar dp = max(0.0, Pinj - Pref);
175 return sqrt(2.0*dp/rho);
179 scalar ChomiakInjector::averageVelocity
184 const injectorType& it = sm_.injectors()[i].properties();
185 scalar dt = it.teoi() - it.tsoi();
186 return it.integrateTable(it.velocityProfile())/dt;
189 } // End namespace Foam
191 // ************************************************************************* //