initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / dieselSpray / spraySubModels / breakupModel / breakupModel / breakupModel.C
blobcf992103ebf29946a1702a8fd1e2a6a3af3ba4ce
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 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
19     for more details.
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 "error.H"
28 #include "breakupModel.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(breakupModel, 0);
39 defineRunTimeSelectionTable(breakupModel, dictionary);
41 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
43 // Construct from components
44 breakupModel::breakupModel
46     const dictionary& dict,
47     spray& sm
50     dict_(dict),
51     spray_(sm),
52     rndGen_(sm.rndGen()),
53     includeOscillation_(dict_.lookup("includeOscillation")),
54     TABcoeffsDict_(dict.subDict("TABCoeffs")),
55     y0_(0.0),
56     yDot0_(0.0),
57     TABComega_(0.0),
58     TABCmu_(0.0),
59     TABWeCrit_(0.0)
61     if (includeOscillation_)
62     {
63         y0_ = readScalar(TABcoeffsDict_.lookup("y0"));
64         yDot0_ = readScalar(TABcoeffsDict_.lookup("yDot0"));
65         TABComega_ = readScalar(TABcoeffsDict_.lookup("Comega"));
66         TABCmu_ = readScalar(TABcoeffsDict_.lookup("Cmu"));
67         TABWeCrit_ = readScalar(TABcoeffsDict_.lookup("WeCrit"));
68     }
72 // * * * * * * * * * * * * * * * * Destructor    * * * * * * * * * * * * * * //
74 breakupModel::~breakupModel()
77 // * * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * //
79 void breakupModel::updateParcelProperties
81     parcel& p,
82     const scalar deltaT,
83     const vector& Ug,
84     const liquidMixture& fuels
85 ) const
88     if(includeOscillation_)
89     {
90     
91         scalar T = p.T();
92         scalar pc = spray_.p()[p.cell()];
93         scalar r = 0.5 * p.d();
94         scalar r2 = r*r;
95         scalar r3 = r*r2;
96     
97         scalar rho = fuels.rho(pc, T, p.X());
98         scalar sigma = fuels.sigma(pc, T, p.X());
99         scalar mu = fuels.mu(pc, T, p.X());
100     
101         // inverse of characteristic viscous damping time    
102         scalar rtd = 0.5*TABCmu_*mu/(rho*r2);
103         
104         // oscillation frequency (squared)
105         scalar omega2 = TABComega_ * sigma /(rho*r3) - rtd*rtd;
106         
107         if(omega2 > 0)
108         {
110             scalar omega = sqrt(omega2);
111             scalar rhog = spray_.rho()[p.cell()];
112             scalar We = p.We(Ug, rhog, sigma);
113             scalar Wetmp = We/TABWeCrit_;
115             scalar y1 = p.dev() - Wetmp;
116             scalar y2 = p.ddev()/omega;
117                        
118             // update distortion parameters
119             scalar c = cos(omega*deltaT);
120             scalar s = sin(omega*deltaT);
121             scalar e = exp(-rtd*deltaT);
122             y2 = (p.ddev() + y1*rtd)/omega;
123             
124             p.dev() = Wetmp + e*(y1*c + y2*s);
125             if (p.dev() < 0)
126             {
127                 p.dev() = 0.0;
128                 p.ddev() = 0.0;
129             }
130             else 
131             {
132                 p.ddev() = (Wetmp-p.dev())*rtd + e*omega*(y2*c - y1*s);
133             }
134         }
135         else
136         {
137             // reset droplet distortion parameters
138             p.dev() = 0;
139             p.ddev() = 0;
140         }
142     }
143     
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 } // End namespace Foam
151 // ************************************************************************* //