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 "addToRunTimeSelectionTable.H"
29 #include "mathematicalConstants.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(ChomiakInjector, 0);
40 addToRunTimeSelectionTable
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 // Construct from components
51 ChomiakInjector::ChomiakInjector
53 const dictionary& dict,
57 injectorModel(dict, sm),
58 ChomiakDict_(dict.subDict(typeName + "Coeffs")),
63 ChomiakDict_.subDict("dropletPDF"),
67 maxSprayAngle_(ChomiakDict_.lookup("maxSprayConeAngle"))
70 if (sm.injectors().size() != maxSprayAngle_.size())
72 FatalError << "ChomiakInjector::ChomiakInjector"
73 << "(const dictionary& dict, spray& sm)\n"
74 << "Wrong number of entries in maxSprayAngle"
78 scalar referencePressure = sm.p().average().value();
80 // correct velocityProfile
81 forAll(sm.injectors(), i)
83 sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
89 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 ChomiakInjector::~ChomiakInjector()
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 scalar ChomiakInjector::d0
103 return dropletPDF_->sample();
107 vector ChomiakInjector::direction
115 scalar dMin = dropletPDF_->minValue();
116 scalar dMax = dropletPDF_->maxValue();
118 scalar angle = (d-dMax)*maxSprayAngle_[n]/(dMin-dMax)*mathematicalConstant::pi/360.0;
119 scalar alpha = sin(angle);
120 scalar dcorr = cos(angle);
122 scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
124 // randomly distributed vector normal to the injection vector
125 vector normal = vector::zero;
129 scalar reduce = 0.01;
130 // correct beta if this is a 2D run
131 // map it onto the 'angleOfWedge'
132 beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/mathematicalConstant::pi;
133 beta += reduce*sm_.angleOfWedge();
137 sm_.axisOfWedge()*cos(beta) +
138 sm_.axisOfWedgeNormal()*sin(beta)
146 injectors_[n].properties()->tan1(hole)*cos(beta) +
147 injectors_[n].properties()->tan2(hole)*sin(beta)
151 // set the direction of injection by adding the normal vector
152 vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
159 scalar ChomiakInjector::velocity
165 const injectorType& it = sm_.injectors()[i].properties();
166 if (it.pressureIndependentVelocity())
168 return it.getTableValue(it.velocityProfile(), time);
172 scalar Pref = sm_.ambientPressure();
173 scalar Pinj = it.getTableValue(it.injectionPressureProfile(), time);
174 scalar rho = sm_.fuels().rho(Pinj, it.T(time), it.X());
175 scalar dp = max(0.0, Pinj - Pref);
176 return sqrt(2.0*dp/rho);
180 scalar ChomiakInjector::averageVelocity
185 const injectorType& it = sm_.injectors()[i].properties();
186 scalar dt = it.teoi() - it.tsoi();
187 return it.integrateTable(it.velocityProfile())/dt;
190 } // End namespace Foam
192 // ************************************************************************* //