BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / lagrangian / dieselSpray / spraySubModels / breakupModel / ETAB / ETAB.C
blobeecccabf0dfeb8c915338434f0bccf95c9c3713f
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 "ETAB.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "mathematicalConstants.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 namespace Foam
35     defineTypeNameAndDebug(ETAB, 0);
37     addToRunTimeSelectionTable
38     (
39         breakupModel,
40         ETAB,
41         dictionary
42     );
46 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
48 Foam::ETAB::ETAB
50     const dictionary& dict,
51     spray& sm
54     breakupModel(dict, sm),
55     coeffsDict_(dict.subDict(typeName + "Coeffs")),
56     Cmu_(readScalar(coeffsDict_.lookup("Cmu"))),
57     Comega_(readScalar(coeffsDict_.lookup("Comega"))),
58     k1_(readScalar(coeffsDict_.lookup("k1"))),
59     k2_(readScalar(coeffsDict_.lookup("k2"))),
60     WeCrit_(readScalar(coeffsDict_.lookup("WeCrit"))),
61     WeTransition_(readScalar(coeffsDict_.lookup("WeTransition"))),
62     AWe_(0.0)
64     scalar k21 = k2_/k1_;
65     AWe_ = (k21*sqrt(WeTransition_) - 1.0)/pow4(WeTransition_);
69 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
71 Foam::ETAB::~ETAB()
75 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
77 void Foam::ETAB::breakupParcel
79     parcel& p,
80     const scalar deltaT,
81     const vector& Ug,
82     const liquidMixtureProperties& fuels
83 ) const
85     scalar T = p.T();
86     scalar pc = spray_.p()[p.cell()];
87     scalar r = 0.5*p.d();
88     scalar r2 = r*r;
89     scalar r3 = r*r2;
91     scalar rho = fuels.rho(pc, T, p.X());
92     scalar sigma = fuels.sigma(pc, T, p.X());
93     scalar mu = fuels.mu(pc, T, p.X());
95     // inverse of characteristic viscous damping time
96     scalar rtd = 0.5*Cmu_*mu/(rho*r2);
98     // oscillation frequency (squared)
99     scalar omega2 = Comega_*sigma/(rho*r3) - rtd*rtd;
101     if (omega2 > 0)
102     {
103         scalar omega = sqrt(omega2);
104         scalar romega = 1.0/omega;
106         scalar rhog = spray_.rho()[p.cell()];
107         scalar We = p.We(Ug, rhog, sigma);
108         scalar Wetmp = We/WeCrit_;
110         scalar y1 = p.dev() - Wetmp;
111         scalar y2 = p.ddev()*romega;
113         scalar a = sqrt(y1*y1 + y2*y2);
115         // scotty we may have break-up
116         if (a + Wetmp > 1.0)
117         {
118             scalar phic = y1/a;
120             // constrain phic within -1 to 1
121             phic = max(min(phic, 1), -1);
123             scalar phit = acos(phic);
124             scalar phi = phit;
125             scalar quad = -y2/a;
126             if (quad < 0)
127             {
128                 phi = constant::mathematical::twoPi - phit;
129             }
131             scalar tb = 0;
133             if (mag(p.dev()) < 1.0)
134             {
135                 scalar theta = acos((1.0 - Wetmp)/a);
137                 if (theta < phi)
138                 {
139                     if (constant::mathematical::twoPi - theta >= phi)
140                     {
141                         theta = -theta;
142                     }
143                     theta += constant::mathematical::twoPi;
144                 }
145                 tb = (theta-phi)*romega;
147                 // breakup occurs
148                 if (deltaT > tb)
149                 {
150                     p.dev() = 1.0;
151                     p.ddev() = -a*omega*sin(omega*tb + phi);
152                 }
153             }
155             // update droplet size
156             if (deltaT > tb)
157             {
158                 scalar sqrtWe = AWe_*pow4(We) + 1.0;
159                 scalar Kbr = k1_*omega*sqrtWe;
161                 if (We > WeTransition_)
162                 {
163                     sqrtWe = sqrt(We);
164                     Kbr = k2_*omega*sqrtWe;
165                 }
167                 scalar rWetmp = 1.0/Wetmp;
168                 scalar cosdtbu = max(-1.0, min(1.0, 1.0 - rWetmp));
169                 scalar dtbu = romega*acos(cosdtbu);
170                 scalar decay = exp(-Kbr*dtbu);
172                 scalar rNew = decay*r;
173                 if (rNew < r)
174                 {
175                     p.d() = 2*rNew;
176                     p.dev() = 0;
177                     p.ddev() = 0;
178                 }
179             }
180         }
181     }
182     else
183     {
184         // reset droplet distortion parameters
185         p.dev() = 0;
186         p.ddev() = 0;
187     }
191 // ************************************************************************* //