BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / lagrangian / spray / submodels / AtomizationModel / LISAAtomization / LISAAtomization.C
blob75fcb6a88c8ee2e0590fd406f8c44af16601ec8d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 \*---------------------------------------------------------------------------*/
26 #include "LISAAtomization.H"
28 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
30 template <class CloudType>
31 Foam::LISAAtomization<CloudType>::LISAAtomization
33     const dictionary& dict,
34     CloudType& owner
37     AtomizationModel<CloudType>(dict, owner, typeName),
38     Cl_(readScalar(this->coeffDict().lookup("Cl"))),
39     cTau_(readScalar(this->coeffDict().lookup("cTau"))),
40     Q_(readScalar(this->coeffDict().lookup("Q"))),
41     lisaExp_(readScalar(this->coeffDict().lookup("lisaExp"))),
42     injectorDirection_(this->coeffDict().lookup("injectorDirection")),
43     SMDCalcMethod_(this->coeffDict().lookup("SMDCalculationMethod"))
45     // Note: Would be good if this could be picked up from the injector
46     injectorDirection_ /= mag(injectorDirection_);
48     if (SMDCalcMethod_ == "method1")
49     {
50         SMDMethod_ = method1;
51     }
52     else if (SMDCalcMethod_ == "method2")
53     {
54         SMDMethod_ = method2;
55     }
56     else
57     {
58         SMDMethod_ = method2;
59         Info<< "Warning: SMDCalculationMethod " << SMDCalcMethod_
60             << " unknown. Options are (method1 | method2). Using method2"
61             << endl;
62     }
65 template <class CloudType>
66 Foam::LISAAtomization<CloudType>::LISAAtomization
68     const LISAAtomization<CloudType>& am
71     AtomizationModel<CloudType>(am),
72     Cl_(am.Cl_),
73     cTau_(am.cTau_),
74     Q_(am.Q_),
75     lisaExp_(am.lisaExp_),
76     injectorDirection_(am.injectorDirection_),
77     SMDCalcMethod_(am.SMDCalcMethod_)
81 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
83 template <class CloudType>
84 Foam::LISAAtomization<CloudType>::~LISAAtomization()
88 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
90 template<class CloudType>
91 Foam::scalar Foam::LISAAtomization<CloudType>::initLiquidCore() const
93     return 1.0;
97 template<class CloudType>
98 bool Foam::LISAAtomization<CloudType>::calcChi() const
100     return true;
104 template<class CloudType>
105 void Foam::LISAAtomization<CloudType>::update
107     const scalar dt,
108     scalar& d,
109     scalar& liquidCore,
110     scalar& tc,
111     const scalar rho,
112     const scalar mu,
113     const scalar sigma,
114     const scalar volFlowRate,
115     const scalar rhoAv,
116     const scalar Urel,
117     const vector& pos,
118     const vector& injectionPos,
119     const scalar pAmbient,
120     const scalar chi,
121     cachedRandom& rndGen
122 ) const
124     if (volFlowRate < SMALL)
125     {
126         return;
127     }
129     scalar tau = 0.0;
130     scalar dL = 0.0;
131     scalar k = 0.0;
133     // update atomization characteristic time
134     tc += dt;
136     scalar We = 0.5*rhoAv*sqr(Urel)*d/sigma;
137     scalar nu = mu/rho;
139     scalar Q = rhoAv/rho;
141     vector diff = pos - injectionPos;
142     scalar pWalk = mag(diff);
143     scalar traveledTime = pWalk/Urel;
145     scalar h = diff & injectorDirection_;
146     scalar delta = sqrt(sqr(pWalk) - sqr(h));
148     scalar hSheet = volFlowRate/(constant::mathematical::pi*delta*Urel);
150     // update drop diameter
151     d = min(d, hSheet);
153     if (We > 27.0/16.0)
154     {
155         scalar kPos = 0.0;
156         scalar kNeg = Q*sqr(Urel)*rho/sigma;
158         scalar derivPos = sqrt(Q*sqr(Urel));
160         scalar derivNeg =
161             (
162                 8.0*sqr(nu)*pow3(kNeg)
163               + Q*sqr(Urel)*kNeg
164               - 3.0*sigma/2.0/rho*sqr(kNeg)
165             )
166           / sqrt
167             (
168                 4.0*sqr(nu)*pow4(kNeg)
169               + Q*sqr(Urel)*sqr(kNeg)
170               - sigma*pow3(kNeg)/rho
171             )
172           - 4.0*nu*kNeg;
174         scalar kOld = 0.0;
176         for (label i=0; i<40; i++)
177         {
178             k = kPos - (derivPos/((derivNeg - derivPos)/(kNeg - kPos)));
180             scalar derivk =
181                 (
182                     8.0*sqr(nu)*pow3(k)
183                   + Q*sqr(Urel)*k
184                   - 3.0*sigma/2.0/rho*sqr(k)
185                 )
186               / sqrt
187                 (
188                     4.0*sqr(nu)*pow4(k)
189                   + Q*sqr(Urel)*sqr(k)
190                   - sigma*pow3(k)/rho
191                 )
192               - 4.0*nu*k;
194             if (derivk > 0)
195             {
196                 derivPos = derivk;
197                 kPos = k;
198             }
199             else
200             {
201                 derivNeg = derivk;
202                 kNeg = k;
203             }
205             if (mag(k - kOld)/k < 1e-4)
206             {
207                 break;
208             }
210             kOld = k;
211         }
213         scalar omegaS =
214           - 2.0*nu*sqr(k)
215           + sqrt
216             (
217                 4.0*sqr(nu)*pow4(k)
218               + Q*sqr(Urel)*sqr(k)
219               - sigma*pow3(k)/rho
220             );
222         tau = cTau_/omegaS;
224         dL = sqrt(8.0*d/k);
225     }
226     else
227     {
228         k = rhoAv*sqr(Urel)/2.0*sigma;
230         scalar J = 0.5*traveledTime*hSheet;
232         tau = pow(3.0*cTau_, 2.0/3.0)*cbrt(J*sigma/(sqr(Q)*pow4(Urel)*rho));
234         dL = sqrt(4.0*d/k);
235     }
237     scalar kL = 1.0/(dL*sqrt(0.5 + 1.5 * mu/sqrt(rho*sigma*dL)));
239     scalar dD = cbrt(3.0*constant::mathematical::pi*sqr(dL)/kL);
241     scalar atmPressure = 1.0e+5;
243     scalar pRatio = pAmbient/atmPressure;
245     dD = dD*pow(pRatio, lisaExp_);
247     scalar pExp = 0.135;
249     //  modifing dD to take account of flash boiling
250     dD = dD*(1.0 - chi*pow(pRatio, -pExp));
251     scalar lBU = Cl_ * mag(Urel)*tau;
253     if (pWalk > lBU)
254     {
255         scalar x = 0;
257         switch (SMDMethod_)
258         {
259             case method1:
260             {
261                 #include "LISASMDCalcMethod1.H"
262                 break;
263             }
264             case method2:
265             {
266                 #include "LISASMDCalcMethod2.H"
267                 break;
268             }
269         }
271         //  New droplet properties
272         liquidCore = 0.0;
273         d = x;
274         tc = 0.0;
275     }
279 // ************************************************************************* //