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 \*---------------------------------------------------------------------------*/
27 #include "hollowCone.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "mathematicalConstants.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(hollowConeInjector, 0);
40 addToRunTimeSelectionTable
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 // Construct from components
51 hollowConeInjector::hollowConeInjector
53 const dictionary& dict,
57 injectorModel(dict, sm),
58 hollowConeDict_(dict.subDict(typeName + "Coeffs")),
63 hollowConeDict_.subDict("dropletPDF"),
67 innerAngle_(hollowConeDict_.lookup("innerConeAngle")),
68 outerAngle_(hollowConeDict_.lookup("outerConeAngle"))
71 if (sm.injectors().size() != innerAngle_.size())
73 FatalError << "hollowConeInjector::hollowConeInjector"
74 << "(const dictionary& dict, spray& sm)\n"
75 << "Wrong number of entries in innerAngle"
79 if (sm.injectors().size() != outerAngle_.size())
81 FatalError << "hollowConeInjector::hollowConeInjector"
82 << "(const dictionary& dict, spray& sm)\n"
83 << "Wrong number of entries in outerAngle"
87 scalar referencePressure = sm.ambientPressure();
89 // correct velocityProfile
90 forAll(sm.injectors(), i)
92 sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
98 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
100 hollowConeInjector::~hollowConeInjector()
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 scalar hollowConeInjector::d0
112 return dropletPDF_->sample();
116 vector hollowConeInjector::direction
124 scalar angle = innerAngle_[n] + rndGen_.scalar01()*(outerAngle_[n]-innerAngle_[n]);
125 scalar alpha = sin(angle*mathematicalConstant::pi/360.0);
126 scalar dcorr = cos(angle*mathematicalConstant::pi/360.0);
127 scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
129 // randomly distributed vector normal to the injection vector
130 vector normal = vector::zero;
134 scalar reduce = 0.01;
135 // correct beta if this is a 2D run
136 // map it onto the 'angleOfWedge'
138 beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi);
139 beta += reduce*sm_.angleOfWedge();
142 sm_.axisOfWedge()*cos(beta) +
143 sm_.axisOfWedgeNormal()*sin(beta)
150 injectors_[n].properties()->tan1(hole)*cos(beta) +
151 injectors_[n].properties()->tan2(hole)*sin(beta)
155 // set the direction of injection by adding the normal vector
156 vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
163 scalar hollowConeInjector::velocity
169 const injectorType& it = sm_.injectors()[i].properties();
170 if (it.pressureIndependentVelocity())
172 return it.getTableValue(it.velocityProfile(), time);
176 scalar Pref = sm_.ambientPressure();
177 scalar Pinj = it.getTableValue(it.injectionPressureProfile(), time);
178 scalar rho = sm_.fuels().rho(Pinj, it.T(time), it.X());
179 scalar dp = max(0.0, Pinj - Pref);
180 return sqrt(2.0*dp/rho);
185 scalar hollowConeInjector::averageVelocity
190 const injectorType& it = sm_.injectors()[i].properties();
191 scalar dt = it.teoi() - it.tsoi();
192 return it.integrateTable(it.velocityProfile())/dt;
195 } // End namespace Foam
197 // ************************************************************************* //