FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

sameCell.H

Go to the documentation of this file.
00001 vector v1 = p1().U();
00002 vector v2 = p2().U();
00003 
00004 vector vRel = v1 - v2;
00005 scalar magVRel = mag(vRel);
00006 
00007 scalar sumD = p1().d() + p2().d();
00008 scalar pc = spray_.p()[p1().cell()];
00009 
00010 spray::iterator pMin = p1;
00011 spray::iterator pMax = p2;
00012 
00013 scalar dMin = pMin().d();
00014 scalar dMax = pMax().d();
00015 
00016 if (dMin > dMax) {
00017     dMin = pMax().d();
00018     dMax = pMin().d();
00019     pMin = p2;
00020     pMax = p1;
00021 }
00022 
00023 scalar rhoMax = spray_.fuels().rho(pc, pMax().T(), pMax().X());
00024 scalar rhoMin = spray_.fuels().rho(pc, pMin().T(), pMin().X());
00025 scalar mMax = pMax().m();
00026 scalar mMin = pMin().m();
00027 scalar mTot = mMax + mMin;
00028 
00029 scalar nMax = pMax().N(rhoMax);
00030 scalar nMin = pMin().N(rhoMin);
00031 
00032 scalar mdMin = mMin/nMin;
00033 
00034 scalar nu0 = 0.25*mathematicalConstant::pi*sumD*sumD*magVRel*dt/vols_[cell1];
00035 scalar nu = nMin*nu0;
00036 scalar collProb = exp(-nu);
00037 scalar xx = rndGen_.scalar01();
00038 
00039 // collision occur
00040 if (( xx > collProb) && (mMin > VSMALL) && (mMax > VSMALL)) {
00041 
00042     scalar gamma = dMax/max(dMin, 1.0e-12);
00043     scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma;
00044 
00045     vector momMax = mMax*pMax().U();
00046     vector momMin = mMin*pMin().U();
00047 
00048     // use mass-averaged temperature to calculate We number
00049     scalar averageTemp = (pMax().T()*mMax + pMin().T()*mMin)/mTot;
00050     // and mass averaged mole fractions ...
00051     scalarField Xav((pMax().m()*pMax().X()+pMin().m()*pMin().X())/(pMax().m() + pMin().m()));
00052     scalar sigma = spray_.fuels().sigma(pc, averageTemp, Xav);
00053     sigma = max(1.0e-6, sigma);
00054     scalar rho = spray_.fuels().rho(pc, averageTemp, Xav);
00055 
00056     scalar WeColl = max(1.0e-12, 0.5*rho*magVRel*magVRel*dMin/sigma);
00057 
00058     scalar coalesceProb = min(1.0, 2.4*f/WeColl);
00059     scalar prob = rndGen_.scalar01();
00060 
00061     // Coalescence
00062     if ( prob < coalesceProb && coalescence_) {
00063 
00064         // How 'many' of the droplets coalesce
00065         // NN. This is the kiva way ... which actually works best
00066 
00067         scalar zz = collProb;
00068         scalar vnu = nu*collProb;
00069         label n=2;
00070 
00071         // xx > collProb=zz
00072         while ((zz < xx) && (n<1000)) {
00073             zz += vnu;
00074             vnu *= nu/n;
00075         }
00076         //Info<< "vnu = " << vnu << ", n = " << n << endl;
00077         scalar nProb = n - 1;
00078         // All droplets coalesce
00079         if (nProb*nMax > nMin) {
00080             nProb = nMin/nMax;
00081         }
00082 
00083         // Conservation of mass, momentum and energy
00084         pMin().m() -= nProb*nMax*mdMin;
00085 
00086         scalar newMinMass = pMin().m();
00087         scalar newMaxMass = mMax + (mMin - newMinMass);
00088         pMax().m() = newMaxMass;
00089 
00090         pMax().T() = (averageTemp*mTot - newMinMass*pMin().T())/newMaxMass;
00091         rhoMax = spray_.fuels().rho(pc, pMax().T(), pMax().X());
00092         scalar d3 = pow(dMax, 3) + nProb*pow(dMin,3);
00093         pMax().d() = cbrt(d3);
00094         pMax().U() = (momMax + (1.0-newMinMass/mMin)*momMin)/newMaxMass;
00095         
00096         // update the liquid molar fractions
00097         scalarField Ymin = spray_.fuels().Y(pMin().X());
00098         scalarField Ymax = spray_.fuels().Y(pMax().X());
00099         scalarField Ynew = mMax*Ymax + (mMin - newMinMass)*Ymin;
00100         scalar Wlinv = 0.0;
00101         forAll(Ynew, i)
00102         {
00103             Wlinv += Ynew[i]/spray_.fuels().properties()[i].W();
00104         }
00105         forAll(Ynew, i)
00106         {
00107             pMax().X()[i] = Ynew[i]/(spray_.fuels().properties()[i].W()*Wlinv);
00108         }
00109 
00110     }
00111     // Grazing collision (no coalescence)
00112     else {
00113 
00114         scalar gf = sqrt(prob) - sqrt(coalesceProb);
00115         scalar denom = 1.0 - sqrt(coalesceProb);
00116         if (denom < 1.0e-5) {
00117             denom = 1.0;
00118         }
00119         gf /= denom;
00120 
00121         // if gf negative, this means that coalescence is turned off
00122         // and these parcels should have coalesced
00123         gf = max(0.0, gf);
00124 
00125         scalar rho1 = spray_.fuels().rho(pc, p1().T(), p1().X());
00126         scalar rho2 = spray_.fuels().rho(pc, p2().T(), p2().X());
00127         scalar m1 = p1().m();
00128         scalar m2 = p2().m();
00129         scalar n1 = p1().N(rho1);
00130         scalar n2 = p2().N(rho2);
00131 
00132         // gf -> 1 => v1p -> p1().U() ...
00133         // gf -> 0 => v1p -> momentum/(m1+m2)
00134         vector mr = m1*v1 + m2*v2;
00135         vector v1p = (mr + m2*gf*vRel)/(m1+m2);
00136         vector v2p = (mr - m1*gf*vRel)/(m1+m2);
00137 
00138         if (n1 < n2) {
00139             p1().U() = v1p;
00140             p2().U() = (n1*v2p + (n2-n1)*v2)/n2;
00141         }
00142         else {
00143             p1().U() = (n2*v1p + (n1-n2)*v1)/n1;
00144             p2().U() = v2p;
00145         }
00146 
00147     } // if - coalescence or not
00148 
00149 } // if - collision
00150 
00151 
00152 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines