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

trajectoryCM.H

Go to the documentation of this file.
00001 vector v1 = p1().U();
00002 vector v2 = p2().U();
00003 scalar pc = spray_.p()[p1().cell()];
00004 
00005 vector vRel = v1 - v2;
00006 scalar magVRel = mag(vRel);
00007 
00008 vector p = p2().position() - p1().position();
00009 scalar dist = mag(p);
00010 
00011 scalar vAlign = vRel & (p/(dist+SMALL));
00012 
00013 if (vAlign > 0)
00014 {
00015     scalar sumD = p1().d() + p2().d();
00016 
00017     if (vAlign*dt > dist - 0.5*sumD)
00018     {
00019         scalar v1Mag = mag(v1);
00020         scalar v2Mag = mag(v2);
00021         vector nv1 = v1/v1Mag;
00022         vector nv2 = v2/v2Mag;
00023 
00024         scalar v1v2 = nv1 & nv2;
00025         scalar v1p = nv1 & p;
00026         scalar v2p = nv2 & p;
00027 
00028         scalar det = 1.0 - v1v2*v1v2;
00029 
00030         scalar alpha = 1.0e+20;
00031         scalar beta = 1.0e+20;
00032 
00033         if (mag(det) > 1.0e-4)
00034         {
00035             beta = -(v2p - v1v2*v1p)/det;
00036             alpha = v1p + v1v2*beta;
00037         }
00038 
00039         alpha /= v1Mag*dt;
00040         beta /= v2Mag*dt;
00041 
00042         // is collision possible within this timestep
00043         if ((alpha>0) && (alpha<1.0) && (beta>0) && (beta<1.0)) 
00044         {
00045             vector p1c = p1().position() + alpha*v1*dt;
00046             vector p2c = p2().position() + beta*v2*dt;
00047 
00048             scalar closestDist = mag(p1c-p2c);
00049 
00050             scalar collProb = 
00051                 pow(0.5*sumD/max(0.5*sumD, closestDist), cSpace_)
00052                *exp(-cTime_*mag(alpha-beta));
00053 
00054             scalar xx = rndGen_.scalar01();
00055 
00056             spray::iterator pMin = p1;
00057             spray::iterator pMax = p2;
00058 
00059             scalar dMin = pMin().d();
00060             scalar dMax = pMax().d();
00061 
00062             if (dMin > dMax)
00063             {
00064                 dMin = pMax().d();
00065                 dMax = pMin().d();
00066                 pMin = p2;
00067                 pMax = p1;
00068             }
00069 
00070             scalar rhoMax = spray_.fuels().rho(pc, pMax().T(), pMax().X());
00071             scalar rhoMin = spray_.fuels().rho(pc, pMin().T(), pMin().X());
00072             scalar mMax = pMax().m();
00073             scalar mMin = pMin().m();
00074             scalar nMax = pMax().N(rhoMax);
00075             scalar nMin = pMin().N(rhoMin);
00076 
00077             scalar mdMin = mMin/nMin;
00078 
00079             // collision occur
00080             if ((xx < collProb) && (mMin > VSMALL) && (mMax > VSMALL))
00081             {
00082                 scalar mTot = mMax + mMin;
00083 
00084                 scalar gamma = dMax/max(dMin, 1.0e-12);
00085                 scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma;
00086 
00087                 vector momMax = mMax*pMax().U();
00088                 vector momMin = mMin*pMin().U();
00089 
00090                 // use mass-averaged temperature to calculate We number
00091                 scalar averageTemp = (pMax().T()*mMax + pMin().T()*mMin)/mTot;
00092                 // and mass averaged mole fractions ...
00093                 scalarField 
00094                     Xav((pMax().m()*pMax().X()+pMin().m()*pMin().X())
00095                    /(pMax().m() + pMin().m()));
00096 
00097                 scalar sigma = spray_.fuels().sigma(pc, averageTemp, Xav);
00098                 sigma = max(1.0e-6, sigma);
00099                 scalar rho = spray_.fuels().rho(pc, averageTemp, Xav);
00100 
00101                 scalar dMean = sqrt(dMin*dMax);
00102                 scalar WeColl = 
00103                     max(1.0e-12, 0.5*rho*magVRel*magVRel*dMean/sigma);
00104 
00105                 // coalescence only possible when parcels are close enoug
00106 
00107                 scalar coalesceProb = min(1.0, 2.4*f/WeColl);
00108 
00109                 scalar prob = rndGen_.scalar01();
00110 
00111                 // Coalescence
00112                 if ( prob < coalesceProb && coalescence_) 
00113                 {
00114                     // How 'many' of the droplets coalesce
00115                     scalar nProb = prob*nMin/nMax;
00116 
00117                     // Conservation of mass, momentum and energy
00118 
00119                     pMin().m() -= nMax*nProb*mdMin;
00120 
00121                     scalar newMinMass = pMin().m();
00122                     scalar newMaxMass = mMax + (mMin - newMinMass);
00123                     pMax().m() = newMaxMass;
00124 
00125                     pMax().T() = 
00126                         (averageTemp*mTot - newMinMass*pMin().T())/newMaxMass;
00127                     rhoMax = spray_.fuels().rho(pc, pMax().T(), pMax().X());
00128 
00129                     pMax().d() = 
00130                         pow
00131                         (
00132                             6.0*newMaxMass/(rhoMax*mathematicalConstant::pi*nMax),
00133                             1.0/3.0
00134                         );
00135 
00136                     pMax().U() = 
00137                         (momMax + (1.0-newMinMass/mMin)*momMin)/newMaxMass;
00138 
00139                     // update the liquid molar fractions
00140                     scalarField Ymin = spray_.fuels().Y(pMin().X());
00141                     scalarField Ymax = spray_.fuels().Y(pMax().X());
00142                     scalarField Ynew = mMax*Ymax + (mMin - newMinMass)*Ymin;
00143                     scalar Wlinv = 0.0;
00144                     forAll(Ynew, i)
00145                     {
00146                         Wlinv += Ynew[i]/spray_.fuels().properties()[i].W();
00147                     }
00148                     forAll(Ynew, i)
00149                     {
00150                         pMax().X()[i] = 
00151                             Ynew[i]/(spray_.fuels().properties()[i].W()*Wlinv);
00152                     }
00153 
00154 
00155                 }
00156                 // Grazing collision (no coalescence)
00157                 else
00158                 {
00159                     scalar gf = sqrt(prob) - sqrt(coalesceProb);
00160                     scalar denom = 1.0 - sqrt(coalesceProb);
00161                     if (denom < 1.0e-5) {
00162                         denom = 1.0;
00163                     }
00164                     gf /= denom;
00165 
00166                     // if gf negative, this means that coalescence is turned off
00167                     // and these parcels should have coalesced
00168                     gf = max(0.0, gf);
00169 
00170                     scalar rho1 = spray_.fuels().rho(pc, p1().T(), p1().X());
00171                     scalar rho2 = spray_.fuels().rho(0.0, p2().T(), p2().X());
00172                     scalar m1 = p1().m();
00173                     scalar m2 = p2().m();
00174                     scalar n1 = p1().N(rho1);
00175                     scalar n2 = p2().N(rho2);
00176 
00177                     // gf -> 1 => v1p -> p1().U() ...
00178                     // gf -> 0 => v1p -> momentum/(m1+m2)
00179 
00180                     vector mr = m1*v1 + m2*v2;
00181                     vector v1p = (mr + m2*gf*vRel)/(m1+m2);
00182                     vector v2p = (mr - m1*gf*vRel)/(m1+m2);
00183 
00184                     if (n1 < n2)
00185                     {
00186                         p1().U() = v1p;
00187                         p2().U() = (n1*v2p + (n2-n1)*v2)/n2;
00188                     }
00189                     else
00190                     {
00191                         p1().U() = (n2*v1p + (n1-n2)*v1)/n1;
00192                         p2().U() = v2p;
00193                     }
00194 
00195                 } // if - coalescence or not
00196 
00197             } // if - collision
00198 
00199         } // if - possible collision (alpha, beta) in timeinterval
00200 
00201     } // if - travelled distance is larger distance between parcels
00202 
00203 } // if - parcel travel towards eachother
00204 
00205 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines