diff --git a/applications/solvers/lagrangian/sprayFoam/Make/files b/applications/solvers/lagrangian/sprayFoam/Make/files new file mode 100644 index 0000000000..893038ce0a --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/Make/files @@ -0,0 +1,3 @@ +sprayFoam.C + +EXE = $(FOAM_APPBIN)/sprayFoam diff --git a/applications/solvers/lagrangian/sprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/Make/options new file mode 100644 index 0000000000..ff504df32f --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/Make/options @@ -0,0 +1,50 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I${LIB_SRC}/meshTools/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/lagrangian/spray/lnInclude \ + -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam + + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lcompressibleTurbulenceModel \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -llagrangian \ + -llagrangianIntermediate \ + -llagrangianSpray \ + -lspecie \ + -lbasicThermophysicalModels \ + -lliquidProperties \ + -lliquidMixtureProperties \ + -lsolidProperties \ + -lsolidMixtureProperties \ + -lthermophysicalFunctions \ + -lreactionThermophysicalModels \ + -lSLGThermo \ + -lchemistryModel \ + -lradiationModels \ + -lODE \ + -lregionModels \ + -lsurfaceFilmModels \ + -lsampling diff --git a/applications/solvers/lagrangian/sprayFoam/chemistry.H b/applications/solvers/lagrangian/sprayFoam/chemistry.H new file mode 100644 index 0000000000..99f418af6f --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/chemistry.H @@ -0,0 +1,44 @@ +if (chemistry.chemistry()) +{ + Info<< "Solving chemistry" << endl; + + chemistry.solve + ( + runTime.value() - runTime.deltaTValue(), + runTime.deltaTValue() + ); + + // turbulent time scale + if (turbulentReaction) + { + tmp tepsilon(turbulence->epsilon()); + const volScalarField& epsilon = tepsilon(); + tmp tmuEff(turbulence->muEff()); + const volScalarField& muEff = tmuEff(); + tmp ttc(chemistry.tc()); + const volScalarField& tc = ttc(); + + forAll(epsilon, i) + { + if (epsilon[i] > 0) + { + // Chalmers PaSR model + scalar tk = Cmix.value()*Foam::sqrt(muEff[i]/rho[i]/epsilon[i]); + kappa[i] = + (runTime.deltaTValue() + tc[i]) + /(runTime.deltaTValue() + tc[i] + tk); + } + else + { + // Return to laminar combustion + kappa[i] = 1.0; + } + } + } + else + { + kappa = 1.0; + } + + chemistrySh = kappa*chemistry.Sh()(); +} diff --git a/applications/solvers/lagrangian/sprayFoam/createClouds.H b/applications/solvers/lagrangian/sprayFoam/createClouds.H new file mode 100644 index 0000000000..ee0985ff70 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/createClouds.H @@ -0,0 +1,9 @@ +Info<< "\nConstructing reacting cloud" << endl; +basicSprayCloud parcels +( + "sprayCloud", + rho, + U, + g, + slgThermo +); diff --git a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C new file mode 100644 index 0000000000..5252fd3cf3 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + sprayFoam + +Description + Transient PIMPLE solver for compressible, laminar or turbulent flow with + spray parcels. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "hCombustionThermo.H" +#include "turbulenceModel.H" +#include "basicSprayCloud.H" +#include "psiChemistryModel.H" +#include "chemistrySolver.H" +#include "radiationModel.H" +#include "SLGThermo.H" +#include "pimpleControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createMesh.H" + #include "readChemistryProperties.H" + #include "readGravitationalAcceleration.H" + #include "createFields.H" + #include "createClouds.H" + #include "createRadiationModel.H" + #include "initContinuityErrs.H" + #include "readTimeControls.H" + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + + pimpleControl pimple(mesh); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readTimeControls.H" + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + parcels.evolve(); + + #include "chemistry.H" + #include "rhoEqn.H" + + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) + { + #include "UEqn.H" + #include "YEqn.H" + #include "hsEqn.H" + + // --- PISO loop + for (int corr=0; corrcorrect(); + } + } + + rho = thermo.rho(); + + if (runTime.write()) + { + chemistry.dQ()().write(); + } + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return(0); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/Allwmake b/src/lagrangian/Allwmake index b8774ae594..bedfd29f6b 100755 --- a/src/lagrangian/Allwmake +++ b/src/lagrangian/Allwmake @@ -7,6 +7,7 @@ wmake $makeType distributionModels wmake $makeType basic wmake $makeType solidParticle wmake $makeType intermediate +wmake $makeType spray wmake $makeType dieselSpray wmake $makeType dsmc wmake $makeType coalCombustion diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 0ea66723b0..516c62d482 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -126,17 +126,6 @@ void Foam::KinematicCloud::solve(TrackData& td) } -template -void Foam::KinematicCloud::preEvolve() -{ - Info<< "\nSolving cloud " << this->name() << endl; - - this->dispersion().cacheFields(true); - forces_.cacheFields(true); - updateCellOccupancy(); -} - - template void Foam::KinematicCloud::buildCellOccupancy() { @@ -310,6 +299,7 @@ Foam::KinematicCloud::KinematicCloud U_(U), mu_(mu), g_(g), + pAmbient_(0.0), forces_ ( *this, @@ -403,6 +393,7 @@ Foam::KinematicCloud::KinematicCloud U_(c.U_), mu_(c.mu_), g_(c.g_), + pAmbient_(c.pAmbient_), forces_(c.forces_), functions_(c.functions_), dispersionModel_(c.dispersionModel_->clone()), @@ -478,6 +469,7 @@ Foam::KinematicCloud::KinematicCloud U_(c.U_), mu_(c.mu_), g_(c.g_), + pAmbient_(c.pAmbient_), forces_(*this, mesh), functions_(*this), dispersionModel_(NULL), @@ -507,7 +499,7 @@ bool Foam::KinematicCloud::hasWallImpactDistance() const template -void Foam::KinematicCloud::checkParcelProperties +void Foam::KinematicCloud::setParcelThermoProperties ( parcelType& parcel, const scalar lagrangianDt, @@ -518,7 +510,17 @@ void Foam::KinematicCloud::checkParcelProperties { parcel.rho() = constProps_.rho0(); } +} + +template +void Foam::KinematicCloud::checkParcelProperties +( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ const scalar carrierDt = mesh_.time().deltaTValue(); parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt; parcel.typeId() = constProps_.parcelTypeId(); @@ -600,6 +602,20 @@ void Foam::KinematicCloud::scaleSources() } +template +void Foam::KinematicCloud::preEvolve() +{ + Info<< "\nSolving cloud " << this->name() << endl; + + this->dispersion().cacheFields(true); + forces_.cacheFields(true); + updateCellOccupancy(); + + pAmbient_ = constProps_.dict().template + lookupOrDefault("pAmbient", pAmbient_); +} + + template void Foam::KinematicCloud::evolve() { diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index dcd6157226..4b034d5f08 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -176,6 +176,9 @@ protected: //- Gravity const dimensionedVector& g_; + //- Averaged ambient domain pressure + scalar pAmbient_; + //- Optional particle forces forceType forces_; @@ -230,9 +233,6 @@ protected: template void solve(TrackData& td); - //- Pre-evolve - void preEvolve(); - //- Build the cellOccupancy void buildCellOccupancy(); @@ -367,6 +367,12 @@ public: //- Gravity inline const dimensionedVector& g() const; + //- Return const-access to the ambient pressure + inline scalar pAmbient() const; + + //- Return reference to the ambient pressure + inline scalar& pAmbient(); + //- Optional particle forces // inline const typename parcelType::forceType& forces() const; @@ -456,6 +462,12 @@ public: //- Total rotational kinetic energy in the system inline scalar rotationalKineticEnergyOfSystem() const; + //- Penetration for percentage of the current total mass + inline scalar penetration(const scalar& prc) const; + + //- Mean diameter Dij + inline scalar Dij(const label i, const label j) const; + // Fields @@ -474,6 +486,14 @@ public: // Cloud evolution functions + //- Set parcel thermo properties + void setParcelThermoProperties + ( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed + ); + //- Check parcel properties void checkParcelProperties ( @@ -514,6 +534,9 @@ public: //- Apply scaling to (transient) cloud sources void scaleSources(); + //- Pre-evolve + void preEvolve(); + //- Evolve the cloud void evolve(); diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index b317fbcc73..92b9040ebd 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -109,6 +109,20 @@ inline const Foam::dimensionedVector& Foam::KinematicCloud::g() const } +template +inline Foam::scalar Foam::KinematicCloud::pAmbient() const +{ + return pAmbient_; +} + + +template +inline Foam::scalar& Foam::KinematicCloud::pAmbient() +{ + return pAmbient_; +} + + template //inline const typename CloudType::parcelType::forceType& inline const typename Foam::KinematicCloud::forceType& @@ -264,6 +278,131 @@ Foam::KinematicCloud::rotationalKineticEnergyOfSystem() const } +template +inline Foam::scalar Foam::KinematicCloud::Dij +( + const label i, + const label j +) const +{ + scalar si = 0.0; + scalar sj = 0.0; + forAllConstIter(typename KinematicCloud, *this, iter) + { + const parcelType& p = iter(); + si += p.nParticle()*pow(p.d(), i); + sj += p.nParticle()*pow(p.d(), j); + } + + reduce(si, sumOp()); + reduce(sj, sumOp()); + sj = max(sj, VSMALL); + + return si/sj; +} + + +template +inline Foam::scalar Foam::KinematicCloud::penetration +( + const scalar& prc +) const +{ + scalar distance = 0.0; + scalar mTot = 0.0; + + label np = this->size(); + + // arrays containing the parcels mass and + // distance from injector in ascending order + scalarField mass(np); + scalarField dist(np); + + if (np > 0) + { + label n = 0; + + // first arrange the parcels in ascending order + // the first parcel is closest to its injection position + // and the last one is most far away. + forAllConstIter(typename KinematicCloud, *this, iter) + { + const parcelType& p = iter(); + scalar mi = p.nParticle()*p.mass(); + scalar di = mag(p.position() - p.position0()); + mTot += mi; + + // insert at the last place + mass[n] = mi; + dist[n] = di; + + label i = 0; + bool found = false; + + // insert the parcel in the correct place + // and move the others + while ((i < n) && (!found)) + { + if (di < dist[i]) + { + found = true; + for (label j=n; j>i; j--) + { + mass[j] = mass[j-1]; + dist[j] = dist[j-1]; + } + mass[i] = mi; + dist[i] = di; + } + i++; + } + n++; + } + } + + reduce(mTot, sumOp()); + + if (np > 0) + { + scalar mLimit = prc*mTot; + scalar mOff = (1.0 - prc)*mTot; + + if (np > 1) + { + // 'prc' is large enough that the parcel most far + // away will be used, no need to loop... + if (mLimit > mTot - mass[np-1]) + { + distance = dist[np-1]; + } + else + { + scalar mOffSum = 0.0; + label i = np; + + while ((mOffSum < mOff) && (i>0)) + { + i--; + mOffSum += mass[i]; + } + distance = + dist[i+1] + + (dist[i] - dist[i+1])*(mOffSum - mOff) + /mass[i+1] ; + } + } + else + { + distance = dist[0]; + } + } + + reduce(distance, maxOp()); + + return distance; +} + + template inline Foam::cachedRandom& Foam::KinematicCloud::rndGen() { diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H index 5f0fdb1cee..7bde67fb76 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H @@ -174,6 +174,9 @@ public: //- Return const access to the coupled flag inline const Switch coupled() const; + //- Return non-const access to the coupled flag + inline Switch& coupled(); + //- Return const access to the cell value correction flag inline const Switch cellValueSourceCorrection() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H index 0fc183bf9d..1559691fe1 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H @@ -101,6 +101,12 @@ inline Foam::scalar Foam::cloudSolution::trackTime() const } +inline Foam::Switch& Foam::cloudSolution::coupled() +{ + return coupled_; +} + + inline const Foam::Switch Foam::cloudSolution::coupled() const { return coupled_; diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index c536cd84d6..b30cf74230 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -224,22 +224,18 @@ Foam::ReactingCloud::~ReactingCloud() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::ReactingCloud::checkParcelProperties +void Foam::ReactingCloud::setParcelThermoProperties ( parcelType& parcel, const scalar lagrangianDt, const bool fullyDescribed ) { - CloudType::checkParcelProperties - ( - parcel, - lagrangianDt, - fullyDescribed - ); + CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed); if (!fullyDescribed) { + parcel.pc() = this->thermo().thermo().p()[parcel.cell()]; parcel.Y() = composition().YMixture0(); } else @@ -257,6 +253,18 @@ void Foam::ReactingCloud::checkParcelProperties } +template +void Foam::ReactingCloud::checkParcelProperties +( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); +} + + template void Foam::ReactingCloud::storeState() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index 324636cca5..c8a6295a32 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -267,6 +267,14 @@ public: // Cloud evolution functions + //- Set parcel thermo properties + void setParcelThermoProperties + ( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed + ); + //- Check parcel properties void checkParcelProperties ( diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 0290eacb7c..45f94d8928 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -155,19 +155,14 @@ Foam::ReactingMultiphaseCloud::~ReactingMultiphaseCloud() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::ReactingMultiphaseCloud::checkParcelProperties +void Foam::ReactingMultiphaseCloud::setParcelThermoProperties ( parcelType& parcel, const scalar lagrangianDt, const bool fullyDescribed ) { - CloudType::checkParcelProperties - ( - parcel, - lagrangianDt, - fullyDescribed - ); + CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed); label idGas = this->composition().idGas(); label idLiquid = this->composition().idLiquid(); @@ -203,6 +198,18 @@ void Foam::ReactingMultiphaseCloud::checkParcelProperties } +template +void Foam::ReactingMultiphaseCloud::checkParcelProperties +( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); +} + + template void Foam::ReactingMultiphaseCloud::storeState() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index 1f7d3dd22e..6e9e0ee77a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -41,7 +41,6 @@ SourceFiles #ifndef ReactingMultiphaseCloud_H #define ReactingMultiphaseCloud_H -#include "ReactingCloud.H" #include "reactingMultiphaseCloud.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -241,6 +240,14 @@ public: // Cloud evolution functions + //- Set parcel thermo properties + void setParcelThermoProperties + ( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed + ); + //- Check parcel properties void checkParcelProperties ( diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 91cb53aff0..4615938187 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -233,6 +233,24 @@ Foam::ThermoCloud::~ThermoCloud() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::ThermoCloud::setParcelThermoProperties +( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed); + + if (!fullyDescribed) + { + parcel.T() = constProps_.T0(); + parcel.Cp() = constProps_.Cp0(); + } +} + + template void Foam::ThermoCloud::checkParcelProperties ( @@ -242,12 +260,6 @@ void Foam::ThermoCloud::checkParcelProperties ) { CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); - - if (!fullyDescribed) - { - parcel.T() = constProps_.T0(); - parcel.Cp() = constProps_.Cp0(); - } } @@ -304,6 +316,15 @@ void Foam::ThermoCloud::scaleSources() } +template +void Foam::ThermoCloud::preEvolve() +{ + CloudType::preEvolve(); + + this->pAmbient() = thermo_.thermo().p().average().value(); +} + + template void Foam::ThermoCloud::evolve() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index f725dca73e..f51ce04c8c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -281,6 +281,14 @@ public: // Cloud evolution functions + //- Set parcel thermo properties + void setParcelThermoProperties + ( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed + ); + //- Check parcel properties void checkParcelProperties ( @@ -304,6 +312,9 @@ public: //- Apply scaling to (transient) cloud sources void scaleSources(); + //- Pre-evolve + void preEvolve(); + //- Evolve the cloud void evolve(); diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index 19b953b7e7..7e3785ded3 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -124,6 +124,17 @@ public: const bool readFields = true ); + //- Construct from components + constantProperties + ( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio + ); + // Member functions @@ -536,6 +547,15 @@ public: const scalar muc // carrier dynamic viscosity ) const; + //- Weber number + inline scalar We + ( + const vector& U, // particle velocity + const scalar d, // particle diameter + const scalar rhoc, // carrier density + const scalar sigma // particle surface tension + ) const; + // Main calculation loop diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H index 06e2b1e462..bbe6d80d54 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H @@ -85,6 +85,26 @@ inline Foam::KinematicParcel::constantProperties::constantProperties } } +template +inline Foam::KinematicParcel::constantProperties::constantProperties +( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio +) +: + dict_(dictionary::null), + parcelTypeId_(parcelTypeId), + rhoMin_(rhoMin), + rho0_(rho0), + minParticleMass_(minParticleMass), + youngsModulus_(youngsModulus), + poissonsRatio_(poissonsRatio) +{} + template inline Foam::KinematicParcel::KinematicParcel @@ -522,4 +542,17 @@ inline Foam::scalar Foam::KinematicParcel::Re } +template +inline Foam::scalar Foam::KinematicParcel::We +( + const vector& U, + const scalar d, + const scalar rhoc, + const scalar sigma +) const +{ + return rhoc*magSqr(U - Uc_)*d/(sigma + ROOTVSMALL); +} + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 7e9e16bbc7..a0cd912d7c 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -38,8 +38,8 @@ SourceFiles #ifndef ReactingMultiphaseParcel_H #define ReactingMultiphaseParcel_H -#include "ReactingParcel.H" -#include "ReactingMultiphaseCloud.H" +#include "particle.H" +#include "SLGThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index 48ef87864e..f88dc69cf2 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H @@ -26,8 +26,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -inline -Foam::ReactingMultiphaseParcel::constantProperties:: +inline Foam::ReactingMultiphaseParcel::constantProperties:: constantProperties() : ParcelType::constantProperties(), @@ -37,8 +36,7 @@ constantProperties() template -inline -Foam::ReactingMultiphaseParcel::constantProperties:: +inline Foam::ReactingMultiphaseParcel::constantProperties:: constantProperties ( const constantProperties& cp @@ -227,4 +225,5 @@ inline bool& Foam::ReactingMultiphaseParcel::canCombust() return canCombust_; } + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 21e7768aa7..2184132c63 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -24,8 +24,9 @@ License \*---------------------------------------------------------------------------*/ #include "ReactingParcel.H" -#include "mathematicalConstants.H" #include "specie.H" +#include "CompositionModel.H" +#include "mathematicalConstants.H" using namespace Foam::constant::mathematical; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index dc0a9faa9f..61f5bc8f9a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -38,8 +38,8 @@ SourceFiles #ifndef ReactingParcel_H #define ReactingParcel_H -#include "ThermoParcel.H" -#include "ReactingCloud.H" +#include "particle.H" +#include "SLGThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -104,6 +104,27 @@ public: const bool readFields = true ); + //- Construct from components + constantProperties + ( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr, + const scalar pMin, + const Switch& constantVolume, + const scalar Tvap, + const scalar Tbp + ); + // Access @@ -136,7 +157,6 @@ public: autoPtr > pInterp_; - public: typedef typename ParcelType::template TrackingData::trackPart @@ -327,6 +347,9 @@ public: //- Return the owner cell pressure inline scalar pc() const; + //- Return reference to the owner cell pressure + inline scalar& pc(); + // Edit @@ -403,7 +426,7 @@ public: const CompositionType& compModel ); - //- Read - composition supplied + //- Write - composition supplied template static void writeFields(const CloudType& c); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H index a476985107..86b5337f1c 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H @@ -74,6 +74,49 @@ inline Foam::ReactingParcel::constantProperties::constantProperties } +template +inline Foam::ReactingParcel::constantProperties::constantProperties +( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr, + const scalar pMin, + const Switch& constantVolume, + const scalar Tvap, + const scalar Tbp +) +: + ParcelType::constantProperties + ( + parcelTypeId, + rhoMin, + rho0, + minParticleMass, + youngsModulus, + poissonsRatio, + T0, + TMin, + Cp0, + epsilon0, + f0, + Pr + ), + pMin_(pMin), + constantVolume_(constantVolume), + Tvap_(Tvap), + Tbp_(Tbp) +{} + + template inline Foam::ReactingParcel::ReactingParcel ( @@ -194,6 +237,13 @@ inline Foam::scalar Foam::ReactingParcel::pc() const } +template +inline Foam::scalar& Foam::ReactingParcel::pc() +{ + return pc_; +} + + template inline Foam::scalar& Foam::ReactingParcel::mass0() { diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index 3b494e746e..604304a72a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -39,8 +39,8 @@ SourceFiles #ifndef ThermoParcel_H #define ThermoParcel_H -#include "KinematicParcel.H" -#include "ThermoCloud.H" +#include "particle.H" +#include "SLGThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -112,6 +112,23 @@ public: const bool readFields = true ); + //- Construct from components + constantProperties + ( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr + ); + // Member functions diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H index d350390a9e..d57b05bd8f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -81,6 +81,41 @@ inline Foam::ThermoParcel::constantProperties::constantProperties } +template +inline Foam::ThermoParcel::constantProperties::constantProperties +( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr +) +: + ParcelType::constantProperties + ( + parcelTypeId, + rhoMin, + rho0, + minParticleMass, + youngsModulus, + poissonsRatio + ), + T0_(T0), + TMin_(TMin), + Cp0_(Cp0), + epsilon0_(epsilon0), + f0_(f0), + Pr_(Pr) +{} + + template inline Foam::ThermoParcel::ThermoParcel ( diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C index acda24158c..157a1ab3f7 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C @@ -45,9 +45,6 @@ License namespace Foam { - typedef basicReactingCloud::thermoCloudType thermoCloudType2; - typedef basicReactingCloud::kinematicCloudType kinematicCloudType2; - makeParcelCloudFunctionObjects(basicReactingCloud); // Kinematic sub-models diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H b/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H index 76e6c0b5d1..d1b28c39df 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H @@ -30,6 +30,7 @@ License #include "CellZoneInjection.H" #include "ConeInjection.H" +#include "ConeNozzleInjection.H" #include "FieldActivatedInjection.H" #include "InflationInjection.H" #include "KinematicLookupTableInjection.H" diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H index 6dc5f69610..f77e3824f8 100644 --- a/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H @@ -30,6 +30,7 @@ License #include "CellZoneInjection.H" #include "ConeInjection.H" +#include "ConeNozzleInjection.H" #include "FieldActivatedInjection.H" #include "ManualInjection.H" #include "NoInjection.H" diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H index 274f92e36e..b58f36322e 100644 --- a/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H @@ -30,6 +30,7 @@ License #include "CellZoneInjection.H" #include "ConeInjection.H" +#include "ConeNozzleInjection.H" #include "FieldActivatedInjection.H" #include "ManualInjection.H" #include "NoInjection.H" diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index 024f439666..1068ea0096 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C @@ -27,6 +27,7 @@ License #include "Pstream.H" #include "ListListOps.H" #include "surfaceWriter.H" +#include "globalIndex.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/NoCollision/NoCollision.H b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/NoCollision/NoCollision.H index 4cd294cf9e..97c6308d3f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/NoCollision/NoCollision.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/NoCollision/NoCollision.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,7 +87,7 @@ public: // this model this will always be 1. virtual label nSubCycles() const; - //- Flag to indicate whether model activates injection model + //- Flag to indicate whether model activates collision model virtual bool active() const; //- Indicates whether model determines wall collisions or not, diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C index 008b7a117d..7e7c83806d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C @@ -158,45 +158,6 @@ void Foam::CellZoneInjection::setPositions } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::CellZoneInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((0.0 >= time0) && (0.0 < time1)) - { - return positions_.size(); - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::CellZoneInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - // All parcels introduced at SOI - if ((0.0 >= time0) && (0.0 < time1)) - { - return this->volumeTotal_; - } - else - { - return 0.0; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -316,6 +277,43 @@ Foam::scalar Foam::CellZoneInjection::timeEnd() const } +template +Foam::label Foam::CellZoneInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((0.0 >= time0) && (0.0 < time1)) + { + return positions_.size(); + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::CellZoneInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + // All parcels introduced at SOI + if ((0.0 >= time0) && (0.0 < time1)) + { + return this->volumeTotal_; + } + else + { + return 0.0; + } +} + + template void Foam::CellZoneInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.H index 03e9079584..ebc3bf764a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.H @@ -95,25 +95,6 @@ class CellZoneInjection void setPositions(const labelList& cellZoneCells); -protected: - - // Protected member functions - - //- Number of parcels to introduce over the time step relative to SOI - label parcelsToInject - ( - const scalar time0, - const scalar time1 - ); - - //- Volume of parcels to introduce over the time step relative to SOI - scalar volumeToInject - ( - const scalar time0, - const scalar time1 - ); - - public: //- Runtime type information @@ -147,6 +128,12 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index 439989e88b..c38494a08d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -30,53 +30,6 @@ License using namespace Foam::constant::mathematical; -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::ConeInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - const scalar targetVolume = flowRateProfile_().integrate(0, time1); - - const label targetParcels = - parcelsPerInjector_*targetVolume/this->volumeTotal_; - - const label nToInject = targetParcels - nInjected_; - - nInjected_ += nToInject; - - return positionAxis_.size()*nToInject; - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::ConeInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - return flowRateProfile_().integrate(time0, time1); - } - else - { - return 0.0; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -195,6 +148,51 @@ Foam::scalar Foam::ConeInjection::timeEnd() const } +template +Foam::label Foam::ConeInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + const scalar targetVolume = flowRateProfile_().integrate(0, time1); + + const label targetParcels = + parcelsPerInjector_*targetVolume/this->volumeTotal_; + + const label nToInject = targetParcels - nInjected_; + + nInjected_ += nToInject; + + return positionAxis_.size()*nToInject; + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::ConeInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return flowRateProfile_().integrate(time0, time1); + } + else + { + return 0.0; + } +} + + template void Foam::ConeInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H index 7feabc946e..a8771e5b30 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H @@ -113,17 +113,6 @@ class ConeInjection vectorList tanVec2_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -157,6 +146,13 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C new file mode 100644 index 0000000000..1339545c23 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -0,0 +1,374 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ConeNozzleInjection.H" +#include "DataEntry.H" +#include "mathematicalConstants.H" +#include "distributionModel.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ConeNozzleInjection::ConeNozzleInjection +( + const dictionary& dict, + CloudType& owner +) +: + InjectionModel(dict, owner, typeName), + injectionMethod_(imPoint), + outerNozzleDiameter_ + ( + readScalar(this->coeffDict().lookup("outerNozzleDiameter")) + ), + innerNozzleDiameter_ + ( + readScalar(this->coeffDict().lookup("innerNozzleDiameter")) + ), + duration_(readScalar(this->coeffDict().lookup("duration"))), + position_(this->coeffDict().lookup("position")), + injectorCell_(-1), + tetFaceI_(-1), + tetPtI_(-1), + direction_(this->coeffDict().lookup("direction")), + parcelsPerSecond_ + ( + readScalar(this->coeffDict().lookup("parcelsPerSecond")) + ), + volumeFlowRate_ + ( + DataEntry::New + ( + "volumeFlowRate", + this->coeffDict() + ) + ), + Cd_ + ( + DataEntry::New + ( + "Cd", + this->coeffDict() + ) + ), + thetaInner_ + ( + DataEntry::New + ( + "thetaInner", + this->coeffDict() + ) + ), + thetaOuter_ + ( + DataEntry::New + ( + "thetaOuter", + this->coeffDict() + ) + ), + sizeDistribution_ + ( + distributionModels::distributionModel::New + ( + this->coeffDict().subDict("sizeDistribution"), + owner.rndGen() + ) + ), + tanVec1_(vector::zero), + tanVec2_(vector::zero), + normal_(vector::zero) +{ + if (innerNozzleDiameter_ >= outerNozzleDiameter_) + { + FatalErrorIn + ( + "Foam::ConeNozzleInjection::ConeNozzleInjection" + "(" + "const dictionary&, " + "CloudType&" + ")" + )<< "innerNozzleDiameter >= outerNozzleDiameter" << nl + << exit(FatalError); + } + + word injectionMethodType = this->coeffDict().lookup("injectionMethod"); + + if (injectionMethodType == "disc") + { + injectionMethod_ = imDisc; + } + else if (injectionMethodType == "point") + { + injectionMethod_ = imPoint; + + // Set/cache the injector cell + this->findCellAtPosition + ( + injectorCell_, + tetFaceI_, + tetPtI_, + position_, + false + ); + } + else + { + FatalErrorIn + ( + "Foam::InjectionModel::InjectionModel" + "(" + "const dictionary&, " + "CloudType&" + ")" + )<< "injectionMethod must be either 'point' or 'disc'" << nl + << exit(FatalError); + } + + cachedRandom& rndGen = this->owner().rndGen(); + + // Normalise direction vector + direction_ /= mag(direction_); + + // Determine direction vectors tangential to direction + vector tangent = vector::zero; + scalar magTangent = 0.0; + + while(magTangent < SMALL) + { + vector v = rndGen.sample01(); + + tangent = v - (v & direction_)*direction_; + magTangent = mag(tangent); + } + + tanVec1_ = tangent/magTangent; + tanVec2_ = direction_^tanVec1_; + + // Set total volume to inject + this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); +} + + +template +Foam::ConeNozzleInjection::ConeNozzleInjection +( + const ConeNozzleInjection& im +) +: + InjectionModel(im), + injectionMethod_(im.injectionMethod_), + outerNozzleDiameter_(im.outerNozzleDiameter_), + innerNozzleDiameter_(im.innerNozzleDiameter_), + duration_(im.duration_), + position_(im.position_), + injectorCell_(im.injectorCell_), + direction_(im.direction_), + parcelsPerSecond_(im.parcelsPerSecond_), + volumeFlowRate_(im.volumeFlowRate_().clone().ptr()), + Cd_(im.Cd_().clone().ptr()), + thetaInner_(im.thetaInner_().clone().ptr()), + thetaOuter_(im.thetaOuter_().clone().ptr()), + sizeDistribution_(im.sizeDistribution_().clone().ptr()), + tanVec1_(im.tanVec1_), + tanVec2_(im.tanVec1_), + normal_(im.normal_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ConeNozzleInjection::~ConeNozzleInjection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::ConeNozzleInjection::timeEnd() const +{ + return this->SOI_ + duration_; +} + + +template +Foam::label Foam::ConeNozzleInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return floor((time1 - time0)*parcelsPerSecond_); + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::ConeNozzleInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return volumeFlowRate_().integrate(time0, time1); + } + else + { + return 0.0; + } +} + + +template +void Foam::ConeNozzleInjection::setPositionAndCell +( + const label, + const label, + const scalar, + vector& position, + label& cellOwner, + label& tetFaceI, + label& tetPtI +) +{ + cachedRandom& rndGen = this->owner().rndGen(); + + scalar beta = mathematical::twoPi*rndGen.sample01(); + normal_ = tanVec1_*cos(beta) + tanVec2_*sin(beta); + + switch (injectionMethod_) + { + case imPoint: + { + position = position_; + cellOwner = injectorCell_; + tetFaceI = tetFaceI_; + tetPtI = tetPtI_; + + break; + } + case imDisc: + { + scalar frac = rndGen.sample01(); + scalar dr = outerNozzleDiameter_ - innerNozzleDiameter_; + scalar r = 0.5*(innerNozzleDiameter_ + frac*dr); + position = position_ + r*normal_; + + this->findCellAtPosition + ( + cellOwner, + tetFaceI, + tetPtI, + position, + false + ); + break; + } + default: + { + FatalErrorIn + ( + "void Foam::ConeNozzleInjection::setPositionAndCell" + "(" + "const label, " + "const label, " + "const scalar, " + "vector&, " + "label&" + ")" + )<< "Unknown injectionMethod type" << nl + << exit(FatalError); + } + } +} + + +template +void Foam::ConeNozzleInjection::setProperties +( + const label parcelI, + const label, + const scalar time, + typename CloudType::parcelType& parcel +) +{ + cachedRandom& rndGen = this->owner().rndGen(); + + // set particle velocity + const scalar deg2Rad = mathematical::pi/180.0; + + scalar t = time - this->SOI_; + scalar ti = thetaInner_().value(t); + scalar to = thetaOuter_().value(t); + scalar coneAngle = rndGen.sample01()*(to - ti) + ti; + + coneAngle *= deg2Rad; + scalar alpha = sin(coneAngle); + scalar dcorr = cos(coneAngle); + + vector normal = alpha*normal_; + vector dirVec = dcorr*direction_; + dirVec += normal; + dirVec /= mag(dirVec); + + scalar Ao = 0.25*mathematical::pi*outerNozzleDiameter_*outerNozzleDiameter_; + scalar Ai = 0.25*mathematical::pi*innerNozzleDiameter_*innerNozzleDiameter_; + scalar massFlowRate = + this->massTotal()*volumeFlowRate_().value(t)/this->volumeTotal(); + + scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai)); + parcel.U() = Umag*dirVec; + + // set particle diameter + parcel.d() = sizeDistribution_->sample(); +} + + +template +bool Foam::ConeNozzleInjection::fullyDescribed() const +{ + return false; +} + + +template +bool Foam::ConeNozzleInjection::validInjection(const label) +{ + return true; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H new file mode 100644 index 0000000000..d5e9a6fc7f --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H @@ -0,0 +1,235 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ConeNozzleInjection + +Description + Cone injection + + - User specifies + - time of start of injection + - injector position + - direction (along injection axis) + - parcel flow rate + - discharge coefficient, Cd + - inner and outer cone angles + + - Parcel diameters obtained by size distribution model + + - Parcel velocity is calculated as: + + U = V_dot/(A * Cd), where V_dot is the volume flow rate + + Based on the old 'unitInjection' model + +SourceFiles + ConeNozzleInjection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ConeNozzleInjection_H +#define ConeNozzleInjection_H + +#include "InjectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes + +template +class DataEntry; + +class distributionModel; + +/*---------------------------------------------------------------------------*\ + Class ConeNozzleInjection Declaration +\*---------------------------------------------------------------------------*/ + +template +class ConeNozzleInjection +: + public InjectionModel +{ +public: + + //- Injection method enumeration + enum injectionMethod + { + imPoint, + imDisc + }; + + +private: + + // Private data + + //- point/disc injection method + injectionMethod injectionMethod_; + + //- Outer nozzle diameter [m] + const scalar outerNozzleDiameter_; + + //- Inner nozzle diameter [m] + const scalar innerNozzleDiameter_; + + //- Injection duration [s] + const scalar duration_; + + //- Injector position [m] + vector position_; + + //- Cell containing injector position [] + label injectorCell_; + + //- Index of tet face for injector cell + label tetFaceI_; + + //- Index of tet point for injector cell + label tetPtI_; + + //- Injector direction [] + vector direction_; + + //- Number of parcels to introduce per second [] + const label parcelsPerSecond_; + + //- Volume flow rate of parcels to introduce relative to SOI [m^3/s] + const autoPtr > volumeFlowRate_; + + //- Discharge coefficient, relative to SOI [m/s] + const autoPtr > Cd_; + + //- Inner cone angle relative to SOI [deg] + const autoPtr > thetaInner_; + + //- Outer cone angle relative to SOI [deg] + const autoPtr > thetaOuter_; + + //- Parcel size PDF model + const autoPtr sizeDistribution_; + + + // Tangential vectors to the direction vector + + //- First tangential vector + vector tanVec1_; + + //- Second tangential vector + vector tanVec2_; + + //- injection vector orthogonal to direction + vector normal_; + + +public: + + //- Runtime type information + TypeName("coneNozzleInjection"); + + + // Constructors + + //- Construct from dictionary + ConeNozzleInjection(const dictionary& dict, CloudType& owner); + + //- Construct copy + ConeNozzleInjection(const ConeNozzleInjection& im); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ConeNozzleInjection(*this) + ); + } + + + //- Destructor + virtual ~ConeNozzleInjection(); + + + // Member Functions + + //- Return the end-of-injection time + scalar timeEnd() const; + + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + + + // Injection geometry + + //- Set the injection position and owner cell + virtual void setPositionAndCell + ( + const label parcelI, + const label nParcels, + const scalar time, + vector& position, + label& cellOwner, + label& tetFaceI, + label& tetPtI + ); + + //- Set the parcel properties + virtual void setProperties + ( + const label parcelI, + const label nParcels, + const scalar time, + typename CloudType::parcelType& parcel + ); + + //- Flag to identify whether model fully describes the parcel + virtual bool fullyDescribed() const; + + //- Return flag to identify whether or not injection of parcelI is + // permitted + virtual bool validInjection(const label parcelI); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ConeNozzleInjection.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C index 03fe941dab..abe77e41f6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C @@ -29,44 +29,6 @@ License using namespace Foam::constant::mathematical; -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::FieldActivatedInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if (sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size()) - { - return positions_.size(); - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::FieldActivatedInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - if (sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size()) - { - return this->volumeTotal_/nParcelsPerInjector_; - } - else - { - return 0; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -180,16 +142,45 @@ Foam::FieldActivatedInjection::~FieldActivatedInjection() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -bool Foam::FieldActivatedInjection::active() const +Foam::scalar Foam::FieldActivatedInjection::timeEnd() const { - return true; + return GREAT; } template -Foam::scalar Foam::FieldActivatedInjection::timeEnd() const +Foam::label Foam::FieldActivatedInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) { - return GREAT; + if (sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size()) + { + return positions_.size(); + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::FieldActivatedInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + if (sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size()) + { + return this->volumeTotal_/nParcelsPerInjector_; + } + else + { + return 0; + } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.H index d98f3f427b..d8a403e08a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.H @@ -115,17 +115,6 @@ class FieldActivatedInjection sizeDistribution_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -156,12 +145,15 @@ public: // Member Functions - //- Flag to indicate whether model activates injection model - bool active() const; - //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C index 8930fa85e8..0a7996df43 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C @@ -31,7 +31,129 @@ License using namespace Foam::constant::mathematical; -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::InflationInjection::InflationInjection +( + const dictionary& dict, + CloudType& owner +) +: + InjectionModel(dict, owner, typeName), + generationSetName_(this->coeffDict().lookup("generationCellSet")), + inflationSetName_(this->coeffDict().lookup("inflationCellSet")), + generationCells_(), + inflationCells_(), + duration_(readScalar(this->coeffDict().lookup("duration"))), + flowRateProfile_ + ( + DataEntry::New + ( + "flowRateProfile", + this->coeffDict() + ) + ), + growthRate_ + ( + DataEntry::New + ( + "growthRate", + this->coeffDict() + ) + ), + newParticles_(), + volumeAccumulator_(0.0), + fraction_(1.0), + selfSeed_(this->coeffDict().lookupOrDefault("selfSeed", false)), + dSeed_(SMALL), + sizeDistribution_ + ( + distributionModels::distributionModel::New + ( + this->coeffDict().subDict("sizeDistribution"), + owner.rndGen() + ) + ) +{ + if (selfSeed_) + { + dSeed_ = readScalar(this->coeffDict().lookup("dSeed")); + } + + cellSet generationCells(this->owner().mesh(), generationSetName_); + + generationCells_ = generationCells.toc(); + + cellSet inflationCells(this->owner().mesh(), inflationSetName_); + + // Union of cellSets + inflationCells |= generationCells; + + inflationCells_ = inflationCells.toc(); + + if (Pstream::parRun()) + { + scalar generationVolume = 0.0; + + forAll(generationCells_, gCI) + { + label cI = generationCells_[gCI]; + + generationVolume += this->owner().mesh().cellVolumes()[cI]; + } + + scalar totalGenerationVolume = generationVolume; + + reduce(totalGenerationVolume, sumOp()); + + fraction_ = generationVolume/totalGenerationVolume; + } + + // Set total volume/mass to inject + this->volumeTotal_ = fraction_*flowRateProfile_().integrate(0.0, duration_); + this->massTotal_ *= fraction_; +} + + +template +Foam::InflationInjection::InflationInjection +( + const Foam::InflationInjection& im +) +: + InjectionModel(im), + generationSetName_(im.generationSetName_), + inflationSetName_(im.inflationSetName_), + generationCells_(im.generationCells_), + inflationCells_(im.inflationCells_), + duration_(im.duration_), + flowRateProfile_(im.flowRateProfile_().clone().ptr()), + growthRate_(im.growthRate_().clone().ptr()), + newParticles_(im.newParticles_), + volumeAccumulator_(im.volumeAccumulator_), + fraction_(im.fraction_), + selfSeed_(im.selfSeed_), + dSeed_(im.dSeed_), + sizeDistribution_(im.sizeDistribution_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::InflationInjection::~InflationInjection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::InflationInjection::timeEnd() const +{ + return this->SOI_ + duration_; +} + template Foam::label Foam::InflationInjection::parcelsToInject @@ -305,130 +427,6 @@ Foam::scalar Foam::InflationInjection::volumeToInject } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::InflationInjection::InflationInjection -( - const dictionary& dict, - CloudType& owner -) -: - InjectionModel(dict, owner, typeName), - generationSetName_(this->coeffDict().lookup("generationCellSet")), - inflationSetName_(this->coeffDict().lookup("inflationCellSet")), - generationCells_(), - inflationCells_(), - duration_(readScalar(this->coeffDict().lookup("duration"))), - flowRateProfile_ - ( - DataEntry::New - ( - "flowRateProfile", - this->coeffDict() - ) - ), - growthRate_ - ( - DataEntry::New - ( - "growthRate", - this->coeffDict() - ) - ), - newParticles_(), - volumeAccumulator_(0.0), - fraction_(1.0), - selfSeed_(this->coeffDict().lookupOrDefault("selfSeed", false)), - dSeed_(SMALL), - sizeDistribution_ - ( - distributionModels::distributionModel::New - ( - this->coeffDict().subDict("sizeDistribution"), - owner.rndGen() - ) - ) -{ - if (selfSeed_) - { - dSeed_ = readScalar(this->coeffDict().lookup("dSeed")); - } - - cellSet generationCells(this->owner().mesh(), generationSetName_); - - generationCells_ = generationCells.toc(); - - cellSet inflationCells(this->owner().mesh(), inflationSetName_); - - // Union of cellSets - inflationCells |= generationCells; - - inflationCells_ = inflationCells.toc(); - - if (Pstream::parRun()) - { - scalar generationVolume = 0.0; - - forAll(generationCells_, gCI) - { - label cI = generationCells_[gCI]; - - generationVolume += this->owner().mesh().cellVolumes()[cI]; - } - - scalar totalGenerationVolume = generationVolume; - - reduce(totalGenerationVolume, sumOp()); - - fraction_ = generationVolume/totalGenerationVolume; - } - - // Set total volume/mass to inject - this->volumeTotal_ = fraction_*flowRateProfile_().integrate(0.0, duration_); - this->massTotal_ *= fraction_; -} - - -template -Foam::InflationInjection::InflationInjection -( - const Foam::InflationInjection& im -) -: - InjectionModel(im), - generationSetName_(im.generationSetName_), - inflationSetName_(im.inflationSetName_), - generationCells_(im.generationCells_), - inflationCells_(im.inflationCells_), - duration_(im.duration_), - flowRateProfile_(im.flowRateProfile_().clone().ptr()), - growthRate_(im.growthRate_().clone().ptr()), - newParticles_(im.newParticles_), - volumeAccumulator_(im.volumeAccumulator_), - fraction_(im.fraction_), - selfSeed_(im.selfSeed_), - dSeed_(im.dSeed_), - sizeDistribution_(im.sizeDistribution_().clone().ptr()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::InflationInjection::~InflationInjection() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -Foam::scalar Foam::InflationInjection::timeEnd() const -{ - return this->SOI_ + duration_; -} - - template void Foam::InflationInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H index 4913cccae4..c7fb4c39e0 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H @@ -111,17 +111,6 @@ class InflationInjection const autoPtr sizeDistribution_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -155,6 +144,12 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 9340f754e7..fadf3b26c5 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -101,46 +101,6 @@ void Foam::InjectionModel::writeProps() } -template -Foam::label Foam::InjectionModel::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - notImplemented - ( - "Foam::label Foam::InjectionModel::parcelsToInject" - "(" - "const scalar, " - "const scalar" - ") const" - ); - - return 0; -} - - -template -Foam::scalar Foam::InjectionModel::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - notImplemented - ( - "Foam::scalar Foam::InjectionModel::volumeToInject" - "(" - "const scalar, " - "const scalar" - ") const" - ); - - return 0.0; -} - - template bool Foam::InjectionModel::validInjection(const label parcelI) { @@ -510,6 +470,54 @@ Foam::scalar Foam::InjectionModel::timeEnd() const } +template +Foam::label Foam::InjectionModel::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + notImplemented + ( + "Foam::label Foam::InjectionModel::parcelsToInject" + "(" + "const scalar, " + "const scalar" + ") const" + ); + + return 0; +} + + +template +Foam::scalar Foam::InjectionModel::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + notImplemented + ( + "Foam::scalar Foam::InjectionModel::volumeToInject" + "(" + "const scalar, " + "const scalar" + ") const" + ); + + return 0.0; +} + + +template +Foam::scalar Foam::InjectionModel::averageParcelMass() +{ + label nTotal = parcelsToInject(0.0, timeEnd() - timeStart()); + return massTotal_/nTotal; +} + + template template void Foam::InjectionModel::inject(TrackData& td) @@ -522,6 +530,7 @@ void Foam::InjectionModel::inject(TrackData& td) const scalar time = this->owner().db().time().value(); const scalar trackTime = this->owner().solution().trackTime(); const polyMesh& mesh = this->owner().mesh(); + typename TrackData::cloudType& cloud = td.cloud(); // Prepare for next time step label parcelsAdded = 0; @@ -583,11 +592,14 @@ void Foam::InjectionModel::inject(TrackData& td) tetPtI ); + // Check/set new parcel thermo properties + cloud.setParcelThermoProperties(*pPtr, dt, fullyDescribed()); + // Assign new parcel properties in injection model setProperties(parcelI, newParcels, timeInj, *pPtr); - // Check new parcel properties - td.cloud().checkParcelProperties(*pPtr, dt, fullyDescribed()); + // Check/set new parcel injection properties + cloud.checkParcelProperties(*pPtr, dt, fullyDescribed()); // Apply correction to velocity for 2-D cases meshTools::constrainDirection @@ -639,6 +651,7 @@ void Foam::InjectionModel::injectSteadyState } const polyMesh& mesh = this->owner().mesh(); + typename TrackData::cloudType& cloud = td.cloud(); // Reset counters time0_ = 0.0; @@ -688,11 +701,14 @@ void Foam::InjectionModel::injectSteadyState tetPtI ); + // Check/set new parcel thermo properties + cloud.setParcelThermoProperties(*pPtr, 0.0, fullyDescribed()); + // Assign new parcel properties in injection model setProperties(parcelI, newParcels, 0.0, *pPtr); - // Check new parcel properties - td.cloud().checkParcelProperties(*pPtr, 0.0, fullyDescribed()); + // Check/set new parcel injection properties + cloud.checkParcelProperties(*pPtr, 0.0, fullyDescribed()); // Apply correction to velocity for 2-D cases meshTools::constrainDirection diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H index 827dd1347b..3ccede38f8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H @@ -143,12 +143,6 @@ protected: // Protected Member Functions - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - //- Additional flag to identify whether or not injection of parcelI is // permitted virtual bool validInjection(const label parcelI); @@ -266,6 +260,24 @@ public: //- Return the end-of-injection time virtual scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject + ( + const scalar time0, + const scalar time1 + ); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject + ( + const scalar time0, + const scalar time1 + ); + + //- Return the average parcel mass over the injection period + scalar averageParcelMass(); + + // Counters //- Return the number of injections diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C index 6326b4c2d8..ab11c043a4 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C @@ -26,46 +26,6 @@ License #include "KinematicLookupTableInjection.H" #include "scalarIOList.H" -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::KinematicLookupTableInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::KinematicLookupTableInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - scalar volume = 0.0; - if ((time0 >= 0.0) && (time0 < duration_)) - { - forAll(injectors_, i) - { - volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); - } - } - - return volume; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -156,6 +116,44 @@ Foam::scalar Foam::KinematicLookupTableInjection::timeEnd() const } +template +Foam::label Foam::KinematicLookupTableInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::KinematicLookupTableInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + scalar volume = 0.0; + if ((time0 >= 0.0) && (time0 < duration_)) + { + forAll(injectors_, i) + { + volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); + } + } + + return volume; +} + + template void Foam::KinematicLookupTableInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H index 86038d90cf..d431f348b4 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.H @@ -91,17 +91,6 @@ class KinematicLookupTableInjection labelList injectorTetPts_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -138,6 +127,12 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C index daf844e770..d9cf3476ab 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C @@ -30,45 +30,6 @@ License using namespace Foam::constant::mathematical; -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::ManualInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((0.0 >= time0) && (0.0 < time1)) - { - return positions_.size(); - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::ManualInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - // All parcels introduced at SOI - if ((0.0 >= time0) && (0.0 < time1)) - { - return this->volumeTotal_; - } - else - { - return 0.0; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -192,6 +153,43 @@ Foam::scalar Foam::ManualInjection::timeEnd() const } +template +Foam::label Foam::ManualInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((0.0 >= time0) && (0.0 < time1)) + { + return positions_.size(); + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::ManualInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + // All parcels introduced at SOI + if ((0.0 >= time0) && (0.0 < time1)) + { + return this->volumeTotal_; + } + else + { + return 0.0; + } +} + + template void Foam::ManualInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H index fbc5e13aea..4a4fe620b8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H @@ -85,17 +85,6 @@ class ManualInjection const autoPtr sizeDistribution_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -129,6 +118,12 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.C index 9bb6a21cee..7fd662296a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.C @@ -26,30 +26,6 @@ License #include "NoInjection.H" #include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::NoInjection::parcelsToInject -( - const scalar, - const scalar -) -{ - return 0; -} - - -template -Foam::scalar Foam::NoInjection::volumeToInject -( - const scalar, - const scalar -) -{ - return 0.0; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -89,6 +65,28 @@ Foam::scalar Foam::NoInjection::timeEnd() const } +template +Foam::label Foam::NoInjection::parcelsToInject +( + const scalar, + const scalar +) +{ + return 0; +} + + +template +Foam::scalar Foam::NoInjection::volumeToInject +( + const scalar, + const scalar +) +{ + return 0.0; +} + + template void Foam::NoInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.H index f736f31ad1..3b6065edc7 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.H @@ -51,16 +51,6 @@ class NoInjection : public InjectionModel { -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - public: @@ -98,6 +88,12 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C index 38517d00a7..43caac3865 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C @@ -27,64 +27,6 @@ License #include "DataEntry.H" #include "distributionModel.H" -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::PatchInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - scalar nParcels =fraction_*(time1 - time0)*parcelsPerSecond_; - - cachedRandom& rnd = this->owner().rndGen(); - - label nParcelsToInject = floor(nParcels); - - // Inject an additional parcel with a probability based on the - // remainder after the floor function - if - ( - nParcelsToInject > 0 - && ( - nParcels - scalar(nParcelsToInject) - > rnd.position(scalar(0), scalar(1)) - ) - ) - { - ++nParcelsToInject; - } - - return nParcelsToInject; - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::PatchInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - return fraction_*flowRateProfile_().integrate(time0, time1); - } - else - { - return 0.0; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -182,6 +124,62 @@ Foam::scalar Foam::PatchInjection::timeEnd() const } +template +Foam::label Foam::PatchInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + scalar nParcels =fraction_*(time1 - time0)*parcelsPerSecond_; + + cachedRandom& rnd = this->owner().rndGen(); + + label nParcelsToInject = floor(nParcels); + + // Inject an additional parcel with a probability based on the + // remainder after the floor function + if + ( + nParcelsToInject > 0 + && ( + nParcels - scalar(nParcelsToInject) + > rnd.position(scalar(0), scalar(1)) + ) + ) + { + ++nParcelsToInject; + } + + return nParcelsToInject; + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::PatchInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return fraction_*flowRateProfile_().integrate(time0, time1); + } + else + { + return 0.0; + } +} + + template void Foam::PatchInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H index e7428b3167..3aca5eb9b1 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H @@ -94,17 +94,6 @@ class PatchInjection scalar fraction_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -138,6 +127,12 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index be2e267b86..853578783d 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -38,6 +38,7 @@ SourceFiles #ifndef CompositionModel_H #define CompositionModel_H +#include "SubModelBase.H" #include "IOdictionary.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" diff --git a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.C b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.C index 39d1fe6096..23e7198dee 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.C @@ -25,46 +25,6 @@ License #include "ReactingLookupTableInjection.H" -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::ReactingLookupTableInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::ReactingLookupTableInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - scalar volume = 0.0; - if ((time0 >= 0.0) && (time0 < duration_)) - { - forAll(injectors_, i) - { - volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); - } - } - - return volume; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -155,6 +115,44 @@ Foam::scalar Foam::ReactingLookupTableInjection::timeEnd() const } +template +Foam::label Foam::ReactingLookupTableInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::ReactingLookupTableInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + scalar volume = 0.0; + if ((time0 >= 0.0) && (time0 < duration_)) + { + forAll(injectors_, i) + { + volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); + } + } + + return volume; +} + + template void Foam::ReactingLookupTableInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H index 955ab3c7d8..680e3e5061 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/ReactingLookupTableInjection.H @@ -94,17 +94,6 @@ class ReactingLookupTableInjection labelList injectorTetPts_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -145,6 +134,13 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.C index fd7839b331..90d0b21bb0 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.C @@ -25,48 +25,6 @@ License #include "ReactingMultiphaseLookupTableInjection.H" -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label -Foam::ReactingMultiphaseLookupTableInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); - } - else - { - return 0; - } -} - - -template -Foam::scalar -Foam::ReactingMultiphaseLookupTableInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - scalar volume = 0.0; - if ((time0 >= 0.0) && (time0 < duration_)) - { - forAll(injectors_, i) - { - volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); - } - } - - return volume; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -161,6 +119,46 @@ Foam::ReactingMultiphaseLookupTableInjection::timeEnd() const } +template +Foam::label +Foam::ReactingMultiphaseLookupTableInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); + } + else + { + return 0; + } +} + + +template +Foam::scalar +Foam::ReactingMultiphaseLookupTableInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + scalar volume = 0.0; + if ((time0 >= 0.0) && (time0 < duration_)) + { + forAll(injectors_, i) + { + volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); + } + } + + return volume; +} + + template void Foam::ReactingMultiphaseLookupTableInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H index 3ed279fd30..a69c2566d0 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/ReactingMultiphaseLookupTableInjection.H @@ -97,17 +97,6 @@ class ReactingMultiphaseLookupTableInjection labelList injectorTetPts_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -148,6 +137,12 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.C b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.C index 8a59b2ec0d..fa50295739 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.C @@ -26,46 +26,6 @@ License #include "ThermoLookupTableInjection.H" #include "scalarIOList.H" -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::ThermoLookupTableInjection::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); - } - else - { - return 0; - } -} - - -template -Foam::scalar Foam::ThermoLookupTableInjection::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - scalar volume = 0.0; - if ((time0 >= 0.0) && (time0 < duration_)) - { - forAll(injectors_, i) - { - volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); - } - } - - return volume; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -156,6 +116,44 @@ Foam::scalar Foam::ThermoLookupTableInjection::timeEnd() const } +template +Foam::label Foam::ThermoLookupTableInjection::parcelsToInject +( + const scalar time0, + const scalar time1 +) +{ + if ((time0 >= 0.0) && (time0 < duration_)) + { + return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_); + } + else + { + return 0; + } +} + + +template +Foam::scalar Foam::ThermoLookupTableInjection::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + scalar volume = 0.0; + if ((time0 >= 0.0) && (time0 < duration_)) + { + forAll(injectors_, i) + { + volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0); + } + } + + return volume; +} + + template void Foam::ThermoLookupTableInjection::setPositionAndCell ( diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H index f9753b2a30..a671c08e7b 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/ThermoLookupTableInjection.H @@ -93,17 +93,6 @@ class ThermoLookupTableInjection labelList injectorTetPts_; -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - public: //- Runtime type information @@ -141,6 +130,13 @@ public: //- Return the end-of-injection time scalar timeEnd() const; + //- Number of parcels to introduce relative to SOI + virtual label parcelsToInject(const scalar time0, const scalar time1); + + //- Volume of parcels to introduce relative to SOI + virtual scalar volumeToInject(const scalar time0, const scalar time1); + + // Injection geometry diff --git a/src/lagrangian/spray/Make/files b/src/lagrangian/spray/Make/files new file mode 100644 index 0000000000..f570e6d821 --- /dev/null +++ b/src/lagrangian/spray/Make/files @@ -0,0 +1,7 @@ +clouds/baseClasses/sprayCloud/sprayCloud.C + +SPRAYPARCEL=parcels/derived/basicSprayParcel +$(SPRAYPARCEL)/defineBasicSprayParcel.C +$(SPRAYPARCEL)/makeBasicSprayParcelSubmodels.C + +LIB = $(FOAM_LIBBIN)/liblagrangianSpray diff --git a/src/lagrangian/spray/Make/options b/src/lagrangian/spray/Make/options new file mode 100644 index 0000000000..0d8cf66e84 --- /dev/null +++ b/src/lagrangian/spray/Make/options @@ -0,0 +1,46 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ + -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -ldistributionModels \ + -llagrangian \ + -llagrangianIntermediate \ + -lliquidProperties \ + -lliquidMixtureProperties \ + -lsolidProperties \ + -lsolidMixtureProperties \ + -lspecie \ + -lbasicThermophysicalModels \ + -lreactionThermophysicalModels \ + -lSLGThermo \ + -lchemistryModel \ + -lradiationModels \ + -lODE \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -ldynamicFvMesh \ + -lsurfaceFilmModels diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C new file mode 100644 index 0000000000..6cb30fed26 --- /dev/null +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C @@ -0,0 +1,371 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "SprayCloud.H" +#include "AtomizationModel.H" +#include "BreakupModel.H" +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::SprayCloud::setModels() +{ + atomizationModel_.reset + ( + AtomizationModel >::New + ( + this->subModelProperties(), + *this + ).ptr() + ); + + breakupModel_.reset + ( + BreakupModel >::New + ( + this->subModelProperties(), + *this + ).ptr() + ); + + stochasticCollisionModel_.reset + ( + StochasticCollisionModel >::New + ( + this->subModelProperties(), + *this + ).ptr() + ); +} + + +template +void Foam::SprayCloud::cloudReset +( + SprayCloud& c +) +{ + CloudType::cloudReset(c); + + atomizationModel_.reset(c.atomizationModel_.ptr()); + breakupModel_.reset(c.breakupModel_.ptr()); + stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr()); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SprayCloud::SprayCloud +( + const word& cloudName, + const volScalarField& rho, + const volVectorField& U, + const dimensionedVector& g, + const SLGThermo& thermo, + bool readFields +) +: + CloudType(cloudName, rho, U, g, thermo, false), + sprayCloud(), + cloudCopyPtr_(NULL), + averageParcelMass_(0.0), + atomizationModel_(NULL), + breakupModel_(NULL), + stochasticCollisionModel_(NULL) +{ + if (this->solution().active()) + { + setModels(); + + averageParcelMass_ = this->injection().averageParcelMass(); + + if (readFields) + { + parcelType::readFields(*this, this->composition()); + } + + Info << "Average parcel mass: " << averageParcelMass_ << endl; + } +} + + +template +Foam::SprayCloud::SprayCloud +( + SprayCloud& c, + const word& name +) +: + CloudType(c, name), + sprayCloud(), + cloudCopyPtr_(NULL), + averageParcelMass_(c.averageParcelMass_), + atomizationModel_(c.atomizationModel_->clone()), + breakupModel_(c.breakupModel_->clone()), + stochasticCollisionModel_(c.stochasticCollisionModel_->clone()) +{} + + +template +Foam::SprayCloud::SprayCloud +( + const fvMesh& mesh, + const word& name, + const SprayCloud& c +) +: + CloudType(mesh, name, c), + sprayCloud(), + cloudCopyPtr_(NULL), + averageParcelMass_(0.0), + atomizationModel_(NULL), + breakupModel_(NULL), + stochasticCollisionModel_(NULL) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::SprayCloud::~SprayCloud() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::SprayCloud::setParcelThermoProperties +( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed); + + if (!fullyDescribed) + { + const liquidMixtureProperties& liqMix = this->composition().liquids(); + + const scalarField& Y(parcel.Y()); + scalarField X(liqMix.X(Y)); + + // override rho and Cp from constantProperties + parcel.Cp() = liqMix.Cp(parcel.pc(), parcel.T(), X); + parcel.rho() = liqMix.rho(parcel.pc(), parcel.T(), X); + } +} + + +template +void Foam::SprayCloud::checkParcelProperties +( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); + + // store the injection position and initial drop size + parcel.position0() = parcel.position(); + parcel.d0() = parcel.d(); + + parcel.y() = breakup().y0(); + parcel.yDot() = breakup().yDot0(); + + parcel.liquidCore() = atomization().initLiquidCore(); +} + + +template +void Foam::SprayCloud::storeState() +{ + cloudCopyPtr_.reset + ( + static_cast*> + ( + clone(this->name() + "Copy").ptr() + ) + ); +} + + +template +void Foam::SprayCloud::restoreState() +{ + cloudReset(cloudCopyPtr_()); + cloudCopyPtr_.clear(); +} + + +template +void Foam::SprayCloud::evolve() +{ + if (this->solution().canEvolve()) + { + typename parcelType::template + TrackingData > td(*this); + + this->solve(td); + } +} + + +template +template +void Foam::SprayCloud::motion(TrackData& td) +{ + const scalar dt = this->solution().trackTime(); + + td.part() = TrackData::tpLinearTrack; + CloudType::move(td, dt); + + this->updateCellOccupancy(); + + if (stochasticCollision().active()) + { + const liquidMixtureProperties& liqMix = this->composition().liquids(); + + label i = 0; + forAllIter(typename SprayCloud, *this, iter) + { + label j = 0; + forAllIter(typename SprayCloud, *this, jter) + { + if (j > i) + { + parcelType& p = iter(); + scalar Vi = this->mesh().V()[p.cell()]; + scalarField X1(liqMix.X(p.Y())); + scalar sigma1 = liqMix.sigma(p.pc(), p.T(), X1); + scalar mp = p.mass()*p.nParticle(); + + parcelType& q = jter(); + scalar Vj = this->mesh().V()[q.cell()]; + scalarField X2(liqMix.X(q.Y())); + scalar sigma2 = liqMix.sigma(q.pc(), q.T(), X2); + scalar mq = q.mass()*q.nParticle(); + + bool updateProperties = stochasticCollision().update + ( + dt, + this->rndGen(), + p.position(), + mp, + p.d(), + p.nParticle(), + p.U(), + p.rho(), + p.T(), + p.Y(), + sigma1, + p.cell(), + Vi, + q.position(), + mq, + q.d(), + q.nParticle(), + q.U(), + q.rho(), + q.T(), + q.Y(), + sigma2, + q.cell(), + Vj + ); + + // for coalescence we need to update the density and + // the diameter cause of the temp/conc/mass-change + if (updateProperties) + { + if (mp > VSMALL) + { + scalarField Xp(liqMix.X(p.Y())); + p.rho() = liqMix.rho(p.pc(), p.T(), Xp); + p.Cp() = liqMix.Cp(p.pc(), p.T(), Xp); + p.d() = + cbrt + ( + 6.0*mp + /( + p.nParticle() + *p.rho() + *constant::mathematical::pi + ) + ); + } + + if (mq > VSMALL) + { + scalarField Xq(liqMix.X(q.Y())); + q.rho() = liqMix.rho(q.pc(), q.T(), Xq); + q.Cp() = liqMix.Cp(q.pc(), q.T(), Xq); + q.d() = + cbrt + ( + 6.0*mq + /( + q.nParticle() + *q.rho() + *constant::mathematical::pi + ) + ); + } + } + } + j++; + } + i++; + } + + // remove coalesced particles (diameter set to 0) + forAllIter(typename SprayCloud, *this, iter) + { + parcelType& p = iter(); + if (p.mass() < VSMALL) + { + deleteParticle(p); + } + } + } +} + + +template +void Foam::SprayCloud::info() const +{ + CloudType::info(); + scalar d32 = 1.0e+6*this->Dij(3, 2); + scalar pen = this->penetration(0.95); + + Info << " D32 (mu) = " << d32 << endl; + Info << " Liquid penetration 95% mass (m) = " << pen << endl; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H new file mode 100644 index 0000000000..92f9210c62 --- /dev/null +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::SprayCloud + +Description + Templated base class for spray cloud + +\*---------------------------------------------------------------------------*/ + +#ifndef SprayCloud_H +#define SprayCloud_H + +#include "sprayCloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +template +class AtomizationModel; + +template +class BreakupModel; + +template +class StochasticCollisionModel; + +/*---------------------------------------------------------------------------*\ + Class SprayCloud Declaration +\*---------------------------------------------------------------------------*/ + +template +class SprayCloud +: + public CloudType, + public sprayCloud +{ +public: + + // Public typedefs + + //- Type of cloud this cloud was instantiated for + typedef CloudType cloudType; + + //- Type of parcel the cloud was instantiated for + typedef typename CloudType::particleType parcelType; + + //- Convenience typedef for this cloud type + typedef SprayCloud sprayCloudType; + + +private: + + // Private data + + //- Cloud copy pointer + autoPtr > cloudCopyPtr_; + + //- Average parcel mass + scalar averageParcelMass_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + SprayCloud(const SprayCloud&); + + //- Disallow default bitwise assignment + void operator=(const SprayCloud&); + + +protected: + + // Protected data + + // References to the cloud sub-models + + //- Atomization model + autoPtr > > + atomizationModel_; + + //- Break-up model + autoPtr > > breakupModel_; + + //- Collision model + autoPtr > > + stochasticCollisionModel_; + + + // Protected Member Functions + + // Initialisation + + //- Set cloud sub-models + void setModels(); + + + // Cloud evolution functions + + //- Reset state of cloud + void cloudReset(SprayCloud& c); + + +public: + + // Constructors + + //- Construct given carrier gas fields + SprayCloud + ( + const word& cloudName, + const volScalarField& rho, + const volVectorField& U, + const dimensionedVector& g, + const SLGThermo& thermo, + bool readFields = true + ); + + //- Copy constructor with new name + SprayCloud(SprayCloud& c, const word& name); + + //- Copy constructor with new name - creates bare cloud + SprayCloud + ( + const fvMesh& mesh, + const word& name, + const SprayCloud& c + ); + + + //- Construct and return clone based on (this) with new name + virtual autoPtr > clone(const word& name) + { + return autoPtr > + ( + new SprayCloud(*this, name) + ); + } + + //- Construct and return bare clone based on (this) with new name + virtual autoPtr > cloneBare(const word& name) const + { + return autoPtr > + ( + new SprayCloud(this->mesh(), name, *this) + ); + } + + + //- Destructor + virtual ~SprayCloud(); + + + // Member Functions + + // Access + + //- Return a reference to the cloud copy + inline const SprayCloud& cloudCopy() const; + + //- Return const-access to the average parcel mass + inline scalar averageParcelMass() const; + + + // Sub-models + + //- Return const-access to the atomization model + inline const AtomizationModel >& + atomization() const; + + //- Return const-access to the breakup model + inline const BreakupModel >& + breakup() const; + + //- Return const-access to the breakup model + inline const StochasticCollisionModel >& + stochasticCollision() const; + + + // Check + + //- Print cloud information + void info() const; + + + // Cloud evolution functions + + //- Set parcel thermo properties + void setParcelThermoProperties + ( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed + ); + + //- Check parcel properties + void checkParcelProperties + ( + parcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed + ); + + //- Store the current cloud state + void storeState(); + + //- Reset the current cloud to the previously stored state + void restoreState(); + + //- Evolve the spray (inject, move) + void evolve(); + //- Particle motion + + template + void motion(TrackData& td); +}; + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "SprayCloudI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "SprayCloud.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H new file mode 100644 index 0000000000..a5037f79fe --- /dev/null +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline const Foam::SprayCloud& +Foam::SprayCloud::cloudCopy() const +{ + return cloudCopyPtr_(); +} + + +template +inline const Foam::AtomizationModel >& +Foam::SprayCloud::atomization() const +{ + return atomizationModel_; +} + + +template +inline const Foam::BreakupModel >& +Foam::SprayCloud::breakup() const +{ + return breakupModel_; +} + + +template +inline const Foam::StochasticCollisionModel >& +Foam::SprayCloud::stochasticCollision() const +{ + return stochasticCollisionModel_; +} + + +template +inline Foam::scalar Foam::SprayCloud::averageParcelMass() const +{ + return averageParcelMass_; +} + diff --git a/src/lagrangian/spray/clouds/baseClasses/sprayCloud/sprayCloud.C b/src/lagrangian/spray/clouds/baseClasses/sprayCloud/sprayCloud.C new file mode 100644 index 0000000000..4e0f125263 --- /dev/null +++ b/src/lagrangian/spray/clouds/baseClasses/sprayCloud/sprayCloud.C @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "sprayCloud.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(sprayCloud, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::sprayCloud::sprayCloud() +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * // + +Foam::sprayCloud::~sprayCloud() +{} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/clouds/baseClasses/sprayCloud/sprayCloud.H b/src/lagrangian/spray/clouds/baseClasses/sprayCloud/sprayCloud.H new file mode 100644 index 0000000000..f4540a547f --- /dev/null +++ b/src/lagrangian/spray/clouds/baseClasses/sprayCloud/sprayCloud.H @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::sprayCloud + +Description + Virtual abstract base class for templated SprayCloud + +SourceFiles + sprayCloud.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sprayCloud_H +#define sprayCloud_H + +#include "typeInfo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class sprayCloud Declaration +\*---------------------------------------------------------------------------*/ + +class sprayCloud +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + sprayCloud(const sprayCloud&); + + //- Disallow default bitwise assignment + void operator=(const sprayCloud&); + + +public: + + //- Runtime type information + TypeName("sprayCloud"); + + // Constructors + + //- Null constructor + sprayCloud(); + + + //- Destructor + virtual ~sprayCloud(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/clouds/derived/basicSprayCloud/basicSprayCloud.H b/src/lagrangian/spray/clouds/derived/basicSprayCloud/basicSprayCloud.H new file mode 100644 index 0000000000..736ebfd88f --- /dev/null +++ b/src/lagrangian/spray/clouds/derived/basicSprayCloud/basicSprayCloud.H @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::basicSprayCloud + +Description + Cloud class to introduce reacting spray parcels + +\*---------------------------------------------------------------------------*/ + +#ifndef basicSprayCloud_H +#define basicSprayCloud_H + +#include "Cloud.H" +#include "KinematicCloud.H" +#include "ThermoCloud.H" +#include "ReactingCloud.H" +#include "SprayCloud.H" +#include "basicSprayParcel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef SprayCloud + < + ReactingCloud + < + ThermoCloud + < + KinematicCloud + < + Cloud + < + basicSprayParcel + > + > + > + > + > basicSprayCloud; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C new file mode 100644 index 0000000000..325181b3c7 --- /dev/null +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C @@ -0,0 +1,490 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "SprayParcel.H" +#include "CompositionModel.H" +#include "AtomizationModel.H" + +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + +template +template +void Foam::SprayParcel::setCellValues +( + TrackData& td, + const scalar dt, + const label cellI +) +{ + ParcelType::setCellValues(td, dt, cellI); +} + + +template +template +void Foam::SprayParcel::cellValueSourceCorrection +( + TrackData& td, + const scalar dt, + const label cellI +) +{ + ParcelType::cellValueSourceCorrection(td, dt, cellI); +} + + +template +template +void Foam::SprayParcel::calc +( + TrackData& td, + const scalar dt, + const label cellI +) +{ + bool coupled = td.cloud().solution().coupled(); + + // check if parcel belongs to liquid core + if (liquidCore() > 0.5) + { + // liquid core parcels should not interact with the gas + if (td.cloud().solution().coupled()) + { + td.cloud().solution().coupled() = false; + } + } + + // store the parcel properties + const scalarField& Y(this->Y()); + scalarField X(td.cloud().composition().liquids().X(Y)); + + scalar T0 = this->T(); + this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T0, X); + scalar rho0 = td.cloud().composition().liquids().rho(this->pc_, T0, X); + this->rho() = rho0; + + ParcelType::calc(td, dt, cellI); + + if (td.keepParticle) + { + // update Cp, diameter and density due to change in temperature + // and/or composition + scalar T1 = this->T(); + const scalarField& Y1(this->Y()); + scalarField X1(td.cloud().composition().liquids().X(Y1)); + + this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T1, X1); + + scalar rho1 = td.cloud().composition().liquids().rho(this->pc_, T1, X1); + this->rho() = rho1; + scalar d1 = this->d()*cbrt(rho0/rho1); + this->d() = d1; + + if (liquidCore() > 0.5) + { + calcAtomization(td, dt, cellI); + + // preserve the total mass/volume by increasing the number of + // particles in parcels due to breakup + scalar d2 = this->d(); + this->nParticle() *= pow3(d1/d2); + } + else + { + calcBreakup(td, dt, cellI); + } + } + + // restore coupled + td.cloud().solution().coupled() = coupled; +} + + +template +template +void Foam::SprayParcel::calcAtomization +( + TrackData& td, + const scalar dt, + const label cellI +) +{ + typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + const CompositionModel& composition = + td.cloud().composition(); + + typedef typename TrackData::cloudType::sprayCloudType sprayCloudType; + const AtomizationModel& atomization = + td.cloud().atomization(); + + + // cell state info is updated in ReactingParcel calc + const scalarField& Y(this->Y()); + scalarField X(composition.liquids().X(Y)); + + scalar rho = composition.liquids().rho(this->pc(), this->T(), X); + scalar mu = composition.liquids().mu(this->pc(), this->T(), X); + scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X); + + // Average molecular weight of carrier mix - assumes perfect gas + scalar Wc = this->rhoc_*specie::RR*this->Tc()/this->pc(); + scalar R = specie::RR/Wc; + scalar Tav = atomization.Taverage(this->T(), this->Tc()); + + // calculate average gas density based on average temperature + scalar rhoAv = this->pc()/(R*Tav); + + scalar soi = td.cloud().injection().timeStart(); + scalar currentTime = td.cloud().db().time().value(); + const vector& pos = this->position(); + const vector& injectionPos = this->position0(); + + // disregard the continous phase when calculating the relative velocity + // (in line with the deactivated coupled assumption) + scalar Urel = mag(this->U()); + + scalar t0 = max(0.0, currentTime - this->age() - soi); + scalar t1 = min(t0 + dt, td.cloud().injection().timeEnd() - soi); + // this should be the vol flow rate from when the parcel was injected + scalar volFlowRate = td.cloud().injection().volumeToInject(t0, t1)/dt; + + scalar chi = 0.0; + if (atomization.calcChi()) + { + chi = this->chi(td, X); + } + + atomization.update + ( + dt, + this->d(), + this->liquidCore(), + this->tc(), + rho, + mu, + sigma, + volFlowRate, + rhoAv, + Urel, + pos, + injectionPos, + td.cloud().pAmbient(), + chi, + td.cloud().rndGen() + ); +} + + +template +template +void Foam::SprayParcel::calcBreakup +( + TrackData& td, + const scalar dt, + const label cellI +) +{ + typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + const CompositionModel& composition = + td.cloud().composition(); + + typedef typename TrackData::cloudType cloudType; + typedef typename cloudType::parcelType parcelType; + typedef typename cloudType::forceType forceType; + + const parcelType& p = static_cast(*this); + const forceType& forces = td.cloud().forces(); + + if (td.cloud().breakup().solveOscillationEq()) + { + solveTABEq(td, dt); + } + + // cell state info is updated in ReactingParcel calc + const scalarField& Y(this->Y()); + scalarField X(composition.liquids().X(Y)); + + scalar rho = composition.liquids().rho(this->pc(), this->T(), X); + scalar mu = composition.liquids().mu(this->pc(), this->T(), X); + scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X); + + // Average molecular weight of carrier mix - assumes perfect gas + scalar Wc = this->rhoc()*specie::RR*this->Tc()/this->pc(); + scalar R = specie::RR/Wc; + scalar Tav = td.cloud().atomization().Taverage(this->T(), this->Tc()); + + // calculate average gas density based on average temperature + scalar rhoAv = this->pc()/(R*Tav); + scalar muAv = this->muc(); + vector Urel = this->U() - this->Uc(); + scalar Urmag = mag(Urel); + scalar Re = this->Re(this->U(), this->d(), rhoAv, muAv); + + const scalar mass = p.mass(); + const forceSuSp Fcp = forces.calcCoupled(p, dt, mass, Re, muAv); + const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, muAv); + scalar tMom = 1.0/(Fcp.Sp() + Fncp.Sp()); + + const vector g = td.cloud().g().value(); + + scalar massChild = 0.0; + scalar dChild = 0.0; + if + ( + td.cloud().breakup().update + ( + dt, + g, + this->d(), + this->tc(), + this->ms(), + this->nParticle(), + this->KHindex(), + this->y(), + this->yDot(), + this->d0(), + rho, + mu, + sigma, + this->U(), + rhoAv, + muAv, + Urel, + Urmag, + tMom, + td.cloud().averageParcelMass(), + dChild, + massChild, + td.cloud().rndGen() + ) + ) + { + scalar Re = rhoAv*Urmag*dChild/muAv; + this->mass0() -= massChild; + + // Add child parcel as copy of parent + SprayParcel* child = new SprayParcel(*this); + child->mass0() = massChild; + child->d() = dChild; + child->nParticle() = massChild/rho*this->volume(dChild); + + const forceSuSp Fcp = + forces.calcCoupled(*child, dt, massChild, Re, muAv); + const forceSuSp Fncp = + forces.calcNonCoupled(*child, dt, massChild, Re, muAv); + + child->liquidCore() = 0.0; + child->KHindex() = 1.0; + child->y() = td.cloud().breakup().y0(); + child->yDot() = td.cloud().breakup().yDot0(); + child->tc() = -GREAT; + child->ms() = 0.0; + child->injector() = this->injector(); + child->tMom() = 1.0/(Fcp.Sp() + Fncp.Sp()); + child->user() = 0.0; + child->setCellValues(td, dt, cellI); + + td.cloud().addParticle(child); + } +} + + +template +template +Foam::scalar Foam::SprayParcel::chi +( + TrackData& td, + const scalarField& X +) const +{ + // modifications to take account of the flash boiling on primary break-up + + static label nIter = 200; + + typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + const CompositionModel& composition = + td.cloud().composition(); + + scalar chi = 0.0; + scalar T0 = this->T(); + scalar Tc0 = this->Tc(); + scalar p0 = this->pc(); + scalar pAmb = td.cloud().pAmbient(); + + scalar pv = composition.liquids().pv(p0, T0, X); + + forAll(composition.liquids(), i) + { + if (pv >= 0.999*pAmb) + { + // liquid is boiling - calc boiling temperature + + const liquidProperties& liq = composition.liquids().properties()[i]; + scalar TBoil = T0; + + for (label k=0; k p0) + { + TBoil = TBoil - (T0 - Tc0)/nIter; + } + else + { + break; + } + } + + scalar hl = liq.hl(pAmb, TBoil); + scalar iTp = liq.h(pAmb, T0) - liq.rho(pAmb, T0); + scalar iTb = liq.h(pAmb, TBoil) - pAmb/liq.rho(pAmb, TBoil); + + chi += X[i]*(iTp - iTb)/hl; + } + } + + chi = min(1.0, max(chi, 0.0)); + + return chi; +} + + +template +template +void Foam::SprayParcel::solveTABEq +( + TrackData& td, + const scalar dt +) +{ + typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + const CompositionModel& composition = + td.cloud().composition(); + + const scalar& TABCmu = td.cloud().breakup().TABCmu(); + const scalar& TABWeCrit = td.cloud().breakup().TABWeCrit(); + const scalar& TABComega = td.cloud().breakup().TABComega(); + + scalar r = 0.5*this->d(); + scalar r2 = r*r; + scalar r3 = r*r2; + + const scalarField& Y(this->Y()); + scalarField X(composition.liquids().X(Y)); + + scalar rho = composition.liquids().rho(this->pc(), this->T(), X); + scalar mu = composition.liquids().mu(this->pc(), this->T(), X); + scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X); + + // inverse of characteristic viscous damping time + scalar rtd = 0.5*TABCmu*mu/(rho*r2); + + // oscillation frequency (squared) + scalar omega2 = TABComega*sigma/(rho*r3) - rtd*rtd; + + if(omega2 > 0) + { + scalar omega = sqrt(omega2); + scalar rhoc = this->rhoc(); + scalar Wetmp = this->We(this->U(), r, rhoc, sigma)/TABWeCrit; + + scalar y1 = this->y() - Wetmp; + scalar y2 = this->yDot()/omega; + + // update distortion parameters + scalar c = cos(omega*dt); + scalar s = sin(omega*dt); + scalar e = exp(-rtd*dt); + y2 = (this->yDot() + y1*rtd)/omega; + + this->y() = Wetmp + e*(y1*c + y2*s); + if (this->y() < 0) + { + this->y() = 0.0; + this->yDot() = 0.0; + } + else + { + this->yDot() = (Wetmp - this->y())*rtd + e*omega*(y2*c - y1*s); + } + } + else + { + // reset distortion parameters + this->y() = 0; + this->yDot() = 0; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SprayParcel::SprayParcel(const SprayParcel& p) +: + ParcelType(p), + d0_(p.d0_), + position0_(p.position0_), + liquidCore_(p.liquidCore_), + KHindex_(p.KHindex_), + y_(p.y_), + yDot_(p.yDot_), + tc_(p.tc_), + ms_(p.ms_), + injector_(p.injector_), + tMom_(p.tMom_), + user_(p.user_) +{} + + +template +Foam::SprayParcel::SprayParcel +( + const SprayParcel& p, + const polyMesh& mesh +) +: + ParcelType(p, mesh), + d0_(p.d0_), + position0_(p.position0_), + liquidCore_(p.liquidCore_), + KHindex_(p.KHindex_), + y_(p.y_), + yDot_(p.yDot_), + tc_(p.tc_), + ms_(p.ms_), + injector_(p.injector_), + tMom_(p.tMom_), + user_(p.user_) +{} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "SprayParcelIO.C" + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H new file mode 100644 index 0000000000..9dc9b94e11 --- /dev/null +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H @@ -0,0 +1,421 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::SprayParcel + +Description + Reacing spray parcel, with added functionality for atomization and breakup + +\*---------------------------------------------------------------------------*/ + +#ifndef SprayParcel_H +#define SprayParcel_H + +#include "particle.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template +class SprayParcel; + +template +Ostream& operator<< +( + Ostream&, + const SprayParcel& +); + +/*---------------------------------------------------------------------------*\ + Class SprayParcel Declaration +\*---------------------------------------------------------------------------*/ + +template +class SprayParcel +: + public ParcelType +{ + +protected: + + // Protected data + + // Spray parcel properties + + //- Initial droplet diameter + scalar d0_; + + //- Injection position + vector position0_; + + //- Part of liquid core ( >0.5=liquid, <0.5=droplet ) + scalar liquidCore_; + + //- Index for KH Breakup + scalar KHindex_; + + //- Spherical deviation + scalar y_; + + //- Rate of change of spherical deviation + scalar yDot_; + + //- Characteristic time (used in atomization and/or breakup model) + scalar tc_; + + //- Stripped parcel mass due to breakup + scalar ms_; + + //- Injected from injector (needed e.g. for calculating distance + // from injector) + scalar injector_; + + //- Momentum relaxation time (needed for calculating parcel acc.) + scalar tMom_; + + //- Passive scalar (extra variable to be defined by user) + scalar user_; + + +public: + + // Static data members + + //- String representation of properties + static string propHeader; + + //- Runtime type information + TypeName("SprayParcel"); + + + // Constructors + + //- Construct from owner, position, and cloud owner + // Other properties initialised as null + inline SprayParcel + ( + const polyMesh& mesh, + const vector& position, + const label cellI, + const label tetFaceI, + const label tetPtI + ); + + //- Construct from components + inline SprayParcel + ( + const polyMesh& mesh, + const vector& position, + const label cellI, + const label tetFaceI, + const label tetPtI, + const label typeId, + const scalar nParticle0, + const scalar d0, + const scalar dTarget0, + const vector& U0, + const vector& f0, + const vector& angularMomentum0, + const vector& torque0, + const scalarField& Y0, + const scalar liquidCore, + const scalar KHindex, + const scalar y, + const scalar yDot, + const scalar tc, + const scalar ms, + const scalar injector, + const scalar tMom, + const scalar user, + const typename ParcelType::constantProperties& constProps + ); + + //- Construct from Istream + SprayParcel + ( + const polyMesh& mesh, + Istream& is, + bool readFields = true + ); + + //- Construct as a copy + SprayParcel + ( + const SprayParcel& p, + const polyMesh& mesh + ); + + //- Construct as a copy + SprayParcel(const SprayParcel& p); + + //- Construct and return a (basic particle) clone + virtual autoPtr clone() const + { + return autoPtr(new SprayParcel(*this)); + } + + //- Construct and return a (basic particle) clone + virtual autoPtr clone(const polyMesh& mesh) const + { + return autoPtr + ( + new SprayParcel(*this, mesh) + ); + } + + //- Factory class to read-construct particles used for + // parallel transfer + class iNew + { + const polyMesh& mesh_; + + public: + + iNew(const polyMesh& mesh) + : + mesh_(mesh) + {} + + autoPtr > operator()(Istream& is) const + { + return autoPtr > + ( + new SprayParcel(mesh_, is, true) + ); + } + }; + + + // Member Functions + + // Access + + //- Return const access to initial droplet diameter + inline scalar d0() const; + + //- Return const access to initial droplet position + inline const vector& position0() const; + + //- Return const access to liquid core + inline scalar liquidCore() const; + + //- Return const access to Kelvin-Helmholtz breakup index + inline scalar KHindex() const; + + //- Return const access to spherical deviation + inline scalar y() const; + + //- Return const access to rate of change of spherical deviation + inline scalar yDot() const; + + //- Return const access to atomization characteristic time + inline scalar tc() const; + + //- Return const access to stripped parcel mass + inline scalar ms() const; + + //- Return const access to injector id + inline scalar injector() const; + + //- Return const access to momentum relaxation time + inline scalar tMom() const; + + //- Return const access to passive user scalar + inline scalar user() const; + + + // Edit + + //- Return access to initial droplet diameter + inline scalar& d0(); + + //- Return access to initial droplet position + inline vector& position0(); + + //- Return access to liquid core + inline scalar& liquidCore(); + + //- Return access to Kelvin-Helmholtz breakup index + inline scalar& KHindex(); + + //- Return access to spherical deviation + inline scalar& y(); + + //- Return access to rate of change of spherical deviation + inline scalar& yDot(); + + //- Return access to atomization characteristic time + inline scalar& tc(); + + //- Return access to stripped parcel mass + inline scalar& ms(); + + //- Return access to injector id + inline scalar& injector(); + + //- Return access to momentum relaxation time + inline scalar& tMom(); + + //- Return access to passive user scalar + inline scalar& user(); + + + // Main calculation loop + + //- Set cell values + template + void setCellValues + ( + TrackData& td, + const scalar dt, + const label cellI + ); + + //- Correct parcel properties according to atomization model + template + void calcAtomization + ( + TrackData& td, + const scalar dt, + const label cellI + ); + + //- Correct parcel properties according to breakup model + template + void calcBreakup + ( + TrackData& td, + const scalar dt, + const label cellI + ); + + //- Correct cell values using latest transfer information + template + void cellValueSourceCorrection + ( + TrackData& td, + const scalar dt, + const label cellI + ); + + //- Correct surface values due to emitted species + template + void correctSurfaceValues + ( + TrackData& td, + const label cellI, + const scalar T, + const scalarField& Cs, + scalar& rhos, + scalar& mus, + scalar& Pr, + scalar& kappa + ); + + //- Update parcel properties over the time interval + template + void calc + ( + TrackData& td, + const scalar dt, + const label cellI + ); + + //- Calculate the chi-factor for flash-boiling for the + // atomization model + template + scalar chi + ( + TrackData& td, + const scalarField& X + ) const; + + //- Solve the TAB equation + template + void solveTABEq + ( + TrackData& td, + const scalar dt + ); + + + // I-O + + //- Read + template + static void readFields + ( + CloudType& c, + const CompositionType& compModel + ); + + //- Read - no composition + template + static void readFields(CloudType& c); + + //- Write + template + static void writeFields + ( + const CloudType& c, + const CompositionType& compModel + ); + + //- Write - composition supplied + template + static void writeFields(const CloudType& c); + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const SprayParcel& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "SprayParcelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "SprayParcel.C" +#endif + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H new file mode 100644 index 0000000000..da87dc91fc --- /dev/null +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H @@ -0,0 +1,270 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::SprayParcel::SprayParcel +( + const polyMesh& mesh, + const vector& position, + const label cellI, + const label tetFaceI, + const label tetPtI +) +: + ParcelType(mesh, position, cellI, tetFaceI, tetPtI), + d0_(this->d()), + position0_(position), + liquidCore_(0.0), + KHindex_(0.0), + y_(0.0), + yDot_(0.0), + tc_(0.0), + ms_(0.0), + injector_(1.0), + tMom_(GREAT), + user_(0.0) +{} + + +template +inline Foam::SprayParcel::SprayParcel +( + const polyMesh& mesh, + const vector& position, + const label cellI, + const label tetFaceI, + const label tetPtI, + const label typeId, + const scalar nParticle0, + const scalar d0, + const scalar dTarget0, + const vector& U0, + const vector& f0, + const vector& angularMomentum0, + const vector& torque0, + const scalarField& Y0, + const scalar liquidCore, + const scalar KHindex, + const scalar y, + const scalar yDot, + const scalar tc, + const scalar ms, + const scalar injector, + const scalar tMom, + const scalar user, + const typename ParcelType::constantProperties& constProps +) +: + ParcelType + ( + mesh, + position, + cellI, + tetFaceI, + tetPtI, + typeId, + nParticle0, + d0, + dTarget0, + U0, + f0, + angularMomentum0, + torque0, + Y0, + constProps + ), + d0_(d0), + position0_(position), + liquidCore_(liquidCore), + KHindex_(KHindex), + y_(y), + yDot_(yDot), + tc_(tc), + ms_(ms), + injector_(injector), + tMom_(tMom), + user_(user) +{} + + +// * * * * * * * * * * SprayParcel Member Functions * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::SprayParcel::d0() const +{ + return d0_; +} + + +template +inline const Foam::vector& Foam::SprayParcel::position0() const +{ + return position0_; +} + + +template +inline Foam::scalar Foam::SprayParcel::liquidCore() const +{ + return liquidCore_; +} + + +template +inline Foam::scalar Foam::SprayParcel::KHindex() const +{ + return KHindex_; +} + + +template +inline Foam::scalar Foam::SprayParcel::y() const +{ + return y_; +} + + +template +inline Foam::scalar Foam::SprayParcel::yDot() const +{ + return yDot_; +} + + +template +inline Foam::scalar Foam::SprayParcel::tc() const +{ + return tc_; +} + + +template +inline Foam::scalar Foam::SprayParcel::ms() const +{ + return ms_; +} + + +template +inline Foam::scalar Foam::SprayParcel::injector() const +{ + return injector_; +} + + +template +inline Foam::scalar Foam::SprayParcel::tMom() const +{ + return tMom_; +} + + +template +inline Foam::scalar Foam::SprayParcel::user() const +{ + return user_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::d0() +{ + return d0_; +} + + +template +inline Foam::vector& Foam::SprayParcel::position0() +{ + return position0_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::liquidCore() +{ + return liquidCore_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::KHindex() +{ + return KHindex_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::y() +{ + return y_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::yDot() +{ + return yDot_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::tc() +{ + return tc_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::ms() +{ + return ms_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::injector() +{ + return injector_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::tMom() +{ + return tMom_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::user() +{ + return user_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C new file mode 100644 index 0000000000..a4c66ce964 --- /dev/null +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C @@ -0,0 +1,337 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "SprayParcel.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +Foam::string Foam::SprayParcel::propHeader = + ParcelType::propHeader + + " d0" + + " position0" + + " liquidCore" + + " KHindex" + + " y" + + " yDot" + + " tc" + + " ms" + + " injector" + + " tMom" + + " user"; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SprayParcel::SprayParcel +( + const polyMesh& mesh, + Istream& is, + bool readFields +) +: + ParcelType(mesh, is, readFields), + d0_(0.0), + position0_(vector::zero), + liquidCore_(0.0), + KHindex_(0.0), + y_(0.0), + yDot_(0.0), + tc_(0.0), + ms_(0.0), + injector_(1.0), + tMom_(GREAT), + user_(0.0) +{ + if (readFields) + { + + if (is.format() == IOstream::ASCII) + { + d0_ = readScalar(is); + is >> position0_; + liquidCore_ = readScalar(is); + KHindex_ = readScalar(is); + y_ = readScalar(is); + yDot_ = readScalar(is); + tc_ = readScalar(is); + ms_ = readScalar(is); + injector_ = readScalar(is); + tMom_ = readScalar(is); + user_ = readScalar(is); + } + else + { + is.read + ( + reinterpret_cast(&d0_), + sizeof(d0_) + + sizeof(position0_) + + sizeof(liquidCore_) + + sizeof(KHindex_) + + sizeof(y_) + + sizeof(yDot_) + + sizeof(tc_) + + sizeof(ms_) + + sizeof(injector_) + + sizeof(tMom_) + + sizeof(user_) + ); + } + } + + // Check state of Istream + is.check + ( + "SprayParcel::SprayParcel" + "(" + "const polyMesh, " + "Istream&, " + "bool" + ")" + ); +} + + +template +template +void Foam::SprayParcel::readFields(CloudType& c) +{ + if (!c.size()) + { + return; + } + + ParcelType::readFields(c); +} + + +template +template +void Foam::SprayParcel::readFields +( + CloudType& c, + const CompositionType& compModel +) +{ + if (!c.size()) + { + return; + } + + ParcelType::readFields(c, compModel); + + IOField d0(c.fieldIOobject("d0", IOobject::MUST_READ)); + c.checkFieldIOobject(c, d0); + + IOField position0 + ( + c.fieldIOobject("position0", IOobject::MUST_READ) + ); + c.checkFieldIOobject(c, position0); + + IOField liquidCore(c.fieldIOobject + ( + "liquidCore", IOobject::MUST_READ) + ); + c.checkFieldIOobject(c, liquidCore); + + IOField KHindex(c.fieldIOobject("KHindex", IOobject::MUST_READ)); + c.checkFieldIOobject(c, KHindex); + + IOField y(c.fieldIOobject("y", IOobject::MUST_READ)); + c.checkFieldIOobject(c, y); + + IOField yDot(c.fieldIOobject("yDot", IOobject::MUST_READ)); + c.checkFieldIOobject(c, yDot); + + IOField tc(c.fieldIOobject("tc", IOobject::MUST_READ)); + c.checkFieldIOobject(c, tc); + + IOField ms(c.fieldIOobject("ms", IOobject::MUST_READ)); + c.checkFieldIOobject(c, ms); + + IOField injector(c.fieldIOobject("injector", IOobject::MUST_READ)); + c.checkFieldIOobject(c, injector); + + IOField tMom(c.fieldIOobject("tMom", IOobject::MUST_READ)); + c.checkFieldIOobject(c, tMom); + + IOField user(c.fieldIOobject("user", IOobject::MUST_READ)); + c.checkFieldIOobject(c, user); + + label i = 0; + forAllIter(typename Cloud >, c, iter) + { + SprayParcel& p = iter(); + p.d0_ = d0[i]; + p.position0_ = position0[i]; + p.liquidCore_ = liquidCore[i]; + p.KHindex_ = KHindex[i]; + p.y_ = y[i]; + p.yDot_ = yDot[i]; + p.tc_ = tc[i]; + p.ms_ = ms[i]; + p.injector_ = injector[i]; + p.tMom_ = tMom[i]; + p.user_ = user[i]; + i++; + } +} + + +template +template +void Foam::SprayParcel::writeFields(const CloudType& c) +{ + ParcelType::writeFields(c); +} + + +template +template +void Foam::SprayParcel::writeFields +( + const CloudType& c, + const CompositionType& compModel +) +{ + ParcelType::writeFields(c, compModel); + + label np = c.size(); + + IOField d0(c.fieldIOobject("d0", IOobject::NO_READ), np); + IOField position0 + ( + c.fieldIOobject("position0", IOobject::NO_READ), + np + ); + IOField liquidCore + ( + c.fieldIOobject("liquidCore", IOobject::NO_READ), + np + ); + IOField KHindex(c.fieldIOobject("KHindex", IOobject::NO_READ), np); + IOField y(c.fieldIOobject("y", IOobject::NO_READ), np); + IOField yDot(c.fieldIOobject("yDot", IOobject::NO_READ), np); + IOField tc(c.fieldIOobject("tc", IOobject::NO_READ), np); + IOField ms(c.fieldIOobject("ms", IOobject::NO_READ), np); + IOField injector + ( + c.fieldIOobject("injector", IOobject::NO_READ), + np + ); + IOField tMom(c.fieldIOobject("tMom", IOobject::NO_READ), np); + IOField user(c.fieldIOobject("user", IOobject::NO_READ), np); + + label i = 0; + forAllConstIter(typename Cloud >, c, iter) + { + const SprayParcel& p = iter(); + d0[i] = p.d0_; + position0[i] = p.position0_; + liquidCore[i] = p.liquidCore_; + KHindex[i] = p.KHindex_; + y[i] = p.y_; + yDot[i] = p.yDot_; + tc[i] = p.tc_; + ms[i] = p.ms_; + injector[i] = p.injector_; + tMom[i] = p.tMom_; + user[i] = p.user_; + i++; + } + + d0.write(); + position0.write(); + liquidCore.write(); + KHindex.write(); + y.write(); + yDot.write(); + tc.write(); + ms.write(); + injector.write(); + tMom.write(); + user.write(); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const SprayParcel& p +) +{ + if (os.format() == IOstream::ASCII) + { + os << static_cast(p) + << token::SPACE << p.d0() + << token::SPACE << p.position0() + << token::SPACE << p.liquidCore() + << token::SPACE << p.KHindex() + << token::SPACE << p.y() + << token::SPACE << p.yDot() + << token::SPACE << p.tc() + << token::SPACE << p.ms() + << token::SPACE << p.injector() + << token::SPACE << p.tMom() + << token::SPACE << p.user(); + } + else + { + os << static_cast(p); + os.write + ( + reinterpret_cast(&p.d0_), + sizeof(p.d0()) + + sizeof(p.position0()) + + sizeof(p.liquidCore()) + + sizeof(p.KHindex()) + + sizeof(p.y()) + + sizeof(p.yDot()) + + sizeof(p.tc()) + + sizeof(p.ms()) + + sizeof(p.injector()) + + sizeof(p.tMom()) + + sizeof(p.user()) + ); + } + + // Check state of Ostream + os.check + ( + "Ostream& operator<<(Ostream&, const SprayParcel&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/derived/basicSprayParcel/basicSprayParcel.H b/src/lagrangian/spray/parcels/derived/basicSprayParcel/basicSprayParcel.H new file mode 100644 index 0000000000..79f3941f8c --- /dev/null +++ b/src/lagrangian/spray/parcels/derived/basicSprayParcel/basicSprayParcel.H @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::basicSprayParcel + +Description + Definition of spray parcel + +SourceFiles + basicSprayParcel.C + basicSprayParcelIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef basicSprayParcel_H +#define basicSprayParcel_H + +#include "contiguous.H" +#include "particle.H" +#include "KinematicParcel.H" +#include "ThermoParcel.H" +#include "ReactingParcel.H" +#include "SprayParcel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef SprayParcel + < + ReactingParcel + < + ThermoParcel + < + KinematicParcel + < + particle + > + > + > + > basicSprayParcel; + + template<> + inline bool contiguous() + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/derived/basicSprayParcel/defineBasicSprayParcel.C b/src/lagrangian/spray/parcels/derived/basicSprayParcel/defineBasicSprayParcel.C new file mode 100644 index 0000000000..c55d0098a1 --- /dev/null +++ b/src/lagrangian/spray/parcels/derived/basicSprayParcel/defineBasicSprayParcel.C @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "basicSprayParcel.H" +#include "Cloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameAndDebug(basicSprayParcel, 0); + defineTemplateTypeNameAndDebug(Cloud, 0); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C b/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C new file mode 100644 index 0000000000..6f242a8fe6 --- /dev/null +++ b/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "basicSprayCloud.H" + +#include "makeParcelCloudFunctionObjects.H" + +// Kinematic +#include "makeThermoParcelForces.H" // thermo variant +#include "makeParcelDispersionModels.H" +#include "makeSprayParcelInjectionModels.H" // Spray variant +#include "makeParcelPatchInteractionModels.H" + +// Thermodynamic +#include "makeParcelHeatTransferModels.H" + +// Reacting +#include "makeReactingParcelCompositionModels.H" +#include "makeReactingParcelPhaseChangeModels.H" +#include "makeReactingParcelSurfaceFilmModels.H" + +// Spray +#include "makeSprayParcelAtomizationModels.H" +#include "makeSprayParcelBreakupModels.H" +#include "makeSprayParcelCollisionModels.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeParcelCloudFunctionObjects(basicSprayCloud); + + // Kinematic sub-models + makeThermoParcelForces(basicSprayCloud); + makeParcelDispersionModels(basicSprayCloud); + makeSprayParcelInjectionModels(basicSprayCloud); + makeParcelPatchInteractionModels(basicSprayCloud); + + // Thermo sub-models + makeParcelHeatTransferModels(basicSprayCloud); + + // Reacting sub-models + makeReactingParcelCompositionModels(basicSprayCloud); + makeReactingParcelPhaseChangeModels(basicSprayCloud); + makeReactingParcelSurfaceFilmModels(basicSprayCloud); + + // Spray sub-models + makeSprayParcelAtomizationModels(basicSprayCloud); + makeSprayParcelBreakupModels(basicSprayCloud); + makeSprayParcelCollisionModels(basicSprayCloud); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/include/makeSprayParcelAtomizationModels.H b/src/lagrangian/spray/parcels/include/makeSprayParcelAtomizationModels.H new file mode 100644 index 0000000000..ee2c9e1d7e --- /dev/null +++ b/src/lagrangian/spray/parcels/include/makeSprayParcelAtomizationModels.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSprayParcelAtomizationModels_H +#define makeSprayParcelAtomizationModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NoAtomization.H" +#include "BlobsSheetAtomization.H" +#include "LISAAtomization.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSprayParcelAtomizationModels(CloudType) \ + \ + makeAtomizationModel(CloudType); \ + makeAtomizationModelType(NoAtomization, CloudType); \ + makeAtomizationModelType(BlobsSheetAtomization, CloudType); \ + makeAtomizationModelType(LISAAtomization, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/include/makeSprayParcelBreakupModels.H b/src/lagrangian/spray/parcels/include/makeSprayParcelBreakupModels.H new file mode 100644 index 0000000000..993e40d89b --- /dev/null +++ b/src/lagrangian/spray/parcels/include/makeSprayParcelBreakupModels.H @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSprayParcelBreakupModels_H +#define makeSprayParcelBreakupModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NoBreakup.H" +#include "PilchErdman.H" +#include "ReitzDiwakar.H" +#include "ReitzKHRT.H" +#include "TAB.H" +#include "ETAB.H" +#include "SHF.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSprayParcelBreakupModels(CloudType) \ + \ + makeBreakupModel(CloudType) \ + makeBreakupModelType(NoBreakup, CloudType); \ + makeBreakupModelType(PilchErdman, CloudType); \ + makeBreakupModelType(ReitzDiwakar, CloudType); \ + makeBreakupModelType(ReitzKHRT, CloudType); \ + makeBreakupModelType(TAB, CloudType); \ + makeBreakupModelType(ETAB, CloudType); \ + makeBreakupModelType(SHF, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H b/src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H new file mode 100644 index 0000000000..2d30cb72b9 --- /dev/null +++ b/src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSprayParcelCollisionModels_H +#define makeSprayParcelCollisionModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NoStochasticCollision.H" +#include "ORourkeCollision.H" +#include "TrajectoryCollision.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSprayParcelCollisionModels(CloudType) \ + \ + makeStochasticCollisionModel(CloudType); \ + makeStochasticCollisionModelType(NoStochasticCollision, CloudType); \ + makeStochasticCollisionModelType(ORourkeCollision, CloudType); \ + makeStochasticCollisionModelType(TrajectoryCollision, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/parcels/include/makeSprayParcelInjectionModels.H b/src/lagrangian/spray/parcels/include/makeSprayParcelInjectionModels.H new file mode 100644 index 0000000000..dfc11b6125 --- /dev/null +++ b/src/lagrangian/spray/parcels/include/makeSprayParcelInjectionModels.H @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSprayParcelInjectionModels_H +#define makeSprayParcelInjectionModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "CellZoneInjection.H" +#include "ConeInjection.H" +#include "ConeNozzleInjection.H" +#include "FieldActivatedInjection.H" +#include "InflationInjection.H" +#include "ManualInjection.H" +#include "NoInjection.H" +#include "PatchInjection.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSprayParcelInjectionModels(CloudType) \ + \ + makeInjectionModel(CloudType); \ + \ + makeInjectionModelType(CellZoneInjection, CloudType); \ + makeInjectionModelType(ConeInjection, CloudType); \ + makeInjectionModelType(ConeNozzleInjection, CloudType); \ + makeInjectionModelType(FieldActivatedInjection, CloudType); \ + makeInjectionModelType(InflationInjection, CloudType); \ + makeInjectionModelType(ManualInjection, CloudType); \ + makeInjectionModelType(NoInjection, CloudType); \ + makeInjectionModelType(PatchInjection, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModel.C b/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModel.C new file mode 100644 index 0000000000..9fea0cb7e7 --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModel.C @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "AtomizationModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::AtomizationModel::AtomizationModel +( + CloudType& owner +) +: + SubModelBase(owner) +{} + + +template +Foam::AtomizationModel::AtomizationModel +( + const AtomizationModel& am +) +: + SubModelBase(am) +{} + + +template +Foam::AtomizationModel::AtomizationModel +( + const dictionary& dict, + CloudType& owner, + const word& type +) +: + SubModelBase(owner, dict, type) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::AtomizationModel::~AtomizationModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::AtomizationModel::initLiquidCore() const +{ + notImplemented + ( + "Foam::scalar " + "Foam::AtomizationModel::initLiquidCore() const" + ); + + return 0.0; +} + + +template +Foam::scalar Foam::AtomizationModel::Taverage +( + const scalar& Tl, + const scalar& Tc +) const +{ + return (2.0*Tl + Tc)/3.0; +} + + +template +bool Foam::AtomizationModel::calcChi() const +{ + notImplemented("bool Foam::AtomizationModel::calcChi()"); + + return false; +} + + +template +void Foam::AtomizationModel::update +( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volFlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen +) const +{ + notImplemented + ( + "void Foam::AtomizationModel::update" + "(" + "const scalar, " + "scalar&, " + "scalar&, " + "scalar&, " + "const scalar, " + "const scalar, " + "const scalar, " + "const scalar, " + "const scalar, " + "const scalar, " + "const vector&, " + "const vector&, " + "const scalar, " + "const scalar, " + "cachedRandom&" + ") const" + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "AtomizationModelNew.C" + +// ************************************************************************* // + diff --git a/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModel.H b/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModel.H new file mode 100644 index 0000000000..b06f91f7ad --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModel.H @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::AtomizationModel + +Description + Templated atomization model class + +SourceFiles + AtomizationModel.C + AtomizationModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef AtomizationModel_H +#define AtomizationModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "SubModelBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class AtomizationModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class AtomizationModel +: + public SubModelBase +{ +public: + + //- Runtime type information + TypeName("atomizationModel"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + AtomizationModel, + dictionary, + ( + const dictionary& dict, + CloudType& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct null from owner + AtomizationModel(CloudType& owner); + + //- Construct from dictionary + AtomizationModel + ( + const dictionary& dict, + CloudType& owner, + const word& type + ); + + //- Construct copy + AtomizationModel(const AtomizationModel& am); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new AtomizationModel(*this) + ); + } + + + //- Destructor + virtual ~AtomizationModel(); + + + //- Selector + static autoPtr > New + ( + const dictionary& dict, + CloudType& owner + ); + + + // Member Functions + + //- initial value of liquidCore + virtual scalar initLiquidCore() const; + + //- Average temperature calculation + scalar Taverage(const scalar& Tliq, const scalar& Tc) const; + + //- flag to indicate if chi needs to be calculated + virtual bool calcChi() const; + + virtual void update + ( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volFlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeAtomizationModel(CloudType) \ + \ + typedef CloudType::sprayCloudType sprayCloudType; \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + AtomizationModel, \ + 0 \ + ); \ + defineTemplateRunTimeSelectionTable \ + ( \ + AtomizationModel, \ + dictionary \ + ); + + +#define makeAtomizationModelType(SS, CloudType) \ + \ + typedef CloudType::sprayCloudType sprayCloudType; \ + defineNamedTemplateTypeNameAndDebug(SS, 0); \ + \ + AtomizationModel:: \ + adddictionaryConstructorToTable > \ + add##SS##CloudType##sprayCloudType##ConstructorToTable_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "AtomizationModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModelNew.C b/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModelNew.C new file mode 100644 index 0000000000..8129643f3e --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/AtomizationModel/AtomizationModelNew.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "AtomizationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::AtomizationModel::New +( + const dictionary& dict, + CloudType& owner +) +{ + word AtomizationModelType(dict.lookup("atomizationModel")); + + Info<< "Selecting AtomizationModel " << AtomizationModelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(AtomizationModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "AtomizationModel::New" + "(" + "const dictionary&, " + "CloudType&" + ")" + ) << "Unknown AtomizationModelType type " + << AtomizationModelType + << ", constructor not in hash table" << nl << nl + << " Valid AtomizationModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); + } + + return autoPtr >(cstrIter()(dict, owner)); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.C b/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.C new file mode 100644 index 0000000000..4e2cbbb9c0 --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.C @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "BlobsSheetAtomization.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::BlobsSheetAtomization::BlobsSheetAtomization +( + const dictionary& dict, + CloudType& owner +) +: + AtomizationModel(dict, owner, typeName), + B_(readScalar(this->coeffDict().lookup("B"))), + angle_(readScalar(this->coeffDict().lookup("angle"))) +{} + + +template +Foam::BlobsSheetAtomization::BlobsSheetAtomization +( + const BlobsSheetAtomization& am +) +: + AtomizationModel(am), + B_(am.B_), + angle_(am.B_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::BlobsSheetAtomization::~BlobsSheetAtomization() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::BlobsSheetAtomization::initLiquidCore() const +{ + return 1.0; +} + + +template +bool Foam::BlobsSheetAtomization::calcChi() const +{ + return false; +} + + +template +void Foam::BlobsSheetAtomization::update +( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volFlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen +) const +{ + scalar lBU = + B_ + * sqrt + ( + rho*sigma*d*cos(angle_*constant::mathematical::pi/360.0) + / sqr(rhoAv*Urel) + ); + + scalar pWalk = mag(pos - injectionPos); + + if (pWalk > lBU) + { + liquidCore = 0.0; + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.H b/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.H new file mode 100644 index 0000000000..a4f956b175 --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.H @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::BlobsSheetAtomization + +Description + Primary Breakup Model for pressure swirl atomizers. + + Accurate description in + @verbatim + Z. Han, S. Parrish, P.V. Farrell, R.D. Reitz + "Modeling Atomization Processes Of Pressure Swirl Hollow-Cone Fuel Sprays" + Atomization and Sprays, vol. 7, pp. 663-684, 1997 + + and + + L. Allocca, G. Bella, A. De Vita, L. Di Angelo + "Experimental Validation of a GDI Spray Model" + SAE Technical Paper Series, 2002-01-1137 + @endverbatim + + +\*---------------------------------------------------------------------------*/ + +#ifndef BlobsSheetAtomization_H +#define BlobsSheetAtomization_H + +#include "AtomizationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class BlobsSheetAtomization Declaration +\*---------------------------------------------------------------------------*/ + +template +class BlobsSheetAtomization +: + public AtomizationModel +{ +private: + + scalar B_; + scalar angle_; + + +public: + + //- Runtime type information + TypeName("blobsSheetAtomization"); + + + // Constructors + + //- Construct from dictionary + BlobsSheetAtomization(const dictionary& dict, CloudType& cloud); + + //- Construct copy + BlobsSheetAtomization(const BlobsSheetAtomization& am); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new BlobsSheetAtomization(*this) + ); + } + + + //- Destructor + virtual ~BlobsSheetAtomization(); + + + // Member Functions + + //- initial value of liquidCore + virtual scalar initLiquidCore() const; + + //- flag to indicate if chi needs to be calculated + virtual bool calcChi() const; + + virtual void update + ( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volHlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "BlobsSheetAtomization.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.C b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.C new file mode 100644 index 0000000000..1cebba9748 --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.C @@ -0,0 +1,279 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "LISAAtomization.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::LISAAtomization::LISAAtomization +( + const dictionary& dict, + CloudType& owner +) +: + AtomizationModel(dict, owner, typeName), + Cl_(readScalar(this->coeffDict().lookup("Cl"))), + cTau_(readScalar(this->coeffDict().lookup("cTau"))), + Q_(readScalar(this->coeffDict().lookup("Q"))), + lisaExp_(readScalar(this->coeffDict().lookup("lisaExp"))), + injectorDirection_(this->coeffDict().lookup("injectorDirection")), + SMDCalcMethod_(this->coeffDict().lookup("SMDCalculationMethod")) +{ + // Note: Would be good if this could be picked up from the injector + injectorDirection_ /= mag(injectorDirection_); + + if (SMDCalcMethod_ == "method1") + { + SMDMethod_ = method1; + } + else if (SMDCalcMethod_ == "method2") + { + SMDMethod_ = method2; + } + else + { + SMDMethod_ = method2; + Info<< "Warning: SMDCalculationMethod " << SMDCalcMethod_ + << " unknown. Options are (method1 | method2). Using method2" + << endl; + } +} + +template +Foam::LISAAtomization::LISAAtomization +( + const LISAAtomization& am +) +: + AtomizationModel(am), + Cl_(am.Cl_), + cTau_(am.cTau_), + Q_(am.Q_), + lisaExp_(am.lisaExp_), + injectorDirection_(am.injectorDirection_), + SMDCalcMethod_(am.SMDCalcMethod_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::LISAAtomization::~LISAAtomization() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::LISAAtomization::initLiquidCore() const +{ + return 1.0; +} + + +template +bool Foam::LISAAtomization::calcChi() const +{ + return true; +} + + +template +void Foam::LISAAtomization::update +( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volFlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen +) const +{ + if (volFlowRate < SMALL) + { + return; + } + + scalar tau = 0.0; + scalar dL = 0.0; + scalar k = 0.0; + + // update atomization characteristic time + tc += dt; + + scalar We = 0.5*rhoAv*sqr(Urel)*d/sigma; + scalar nu = mu/rho; + + scalar Q = rhoAv/rho; + + vector diff = pos - injectionPos; + scalar pWalk = mag(diff); + scalar traveledTime = pWalk/Urel; + + scalar h = diff & injectorDirection_; + scalar delta = sqrt(sqr(pWalk) - sqr(h)); + + scalar hSheet = volFlowRate/(constant::mathematical::pi*delta*Urel); + + // update drop diameter + d = min(d, hSheet); + + if (We > 27.0/16.0) + { + scalar kPos = 0.0; + scalar kNeg = Q*sqr(Urel)*rho/sigma; + + scalar derivPos = sqrt(Q*sqr(Urel)); + + scalar derivNeg = + ( + 8.0*sqr(nu)*pow3(kNeg) + + Q*sqr(Urel)*kNeg + - 3.0*sigma/2.0/rho*sqr(kNeg) + ) + / sqrt + ( + 4.0*sqr(nu)*pow4(kNeg) + + Q*sqr(Urel)*sqr(kNeg) + - sigma*pow3(kNeg)/rho + ) + - 4.0*nu*kNeg; + + scalar kOld = 0.0; + + for (label i=0; i<40; i++) + { + k = kPos - (derivPos/((derivNeg - derivPos)/(kNeg - kPos))); + + scalar derivk = + ( + 8.0*sqr(nu)*pow3(k) + + Q*sqr(Urel)*k + - 3.0*sigma/2.0/rho*sqr(k) + ) + / sqrt + ( + 4.0*sqr(nu)*pow4(k) + + Q*sqr(Urel)*sqr(k) + - sigma*pow3(k)/rho + ) + - 4.0*nu*k; + + if (derivk > 0) + { + derivPos = derivk; + kPos = k; + } + else + { + derivNeg = derivk; + kNeg = k; + } + + if (mag(k - kOld)/k < 1e-4) + { + break; + } + + kOld = k; + } + + scalar omegaS = + - 2.0*nu*sqr(k) + + sqrt + ( + 4.0*sqr(nu)*pow4(k) + + Q*sqr(Urel)*sqr(k) + - sigma*pow3(k)/rho + ); + + tau = cTau_/omegaS; + + dL = sqrt(8.0*d/k); + } + else + { + k = rhoAv*sqr(Urel)/2.0*sigma; + + scalar J = 0.5*traveledTime*hSheet; + + tau = pow(3.0*cTau_, 2.0/3.0)*cbrt(J*sigma/(sqr(Q)*pow4(Urel)*rho)); + + dL = sqrt(4.0*d/k); + } + + scalar kL = 1.0/(dL*sqrt(0.5 + 1.5 * mu/sqrt(rho*sigma*dL))); + + scalar dD = cbrt(3.0*constant::mathematical::pi*sqr(dL)/kL); + + scalar atmPressure = 1.0e+5; + + scalar pRatio = pAmbient/atmPressure; + + dD = dD*pow(pRatio, lisaExp_); + + scalar pExp = 0.135; + + // modifing dD to take account of flash boiling + dD = dD*(1.0 - chi*pow(pRatio, -pExp)); + scalar lBU = Cl_ * mag(Urel)*tau; + + if (pWalk > lBU) + { + scalar x = 0; + + switch (SMDMethod_) + { + case method1: + { + #include "LISASMDCalcMethod1.H" + break; + } + case method2: + { + #include "LISASMDCalcMethod2.H" + break; + } + } + + // New droplet properties + liquidCore = 0.0; + d = x; + tc = 0.0; + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.H b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.H new file mode 100644 index 0000000000..e336ceaafd --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::LISAAtomization + +Description + Primary Breakup Model for pressure swirl atomizers. + + Accurate description in + @verbatim + P.K. Senecal, D.P. Schmidt, I. Nouar, C.J. Rutland, R.D. Reitz, M. Corradini + "Modeling high-speed viscous liquid sheet atomization" + International Journal of Multiphase Flow 25 (1999) pags. 1073-1097 + @endverbatim + + and + + @verbatim + D.P. Schmidt, I. Nouar, P.K. Senecal, C.J. Rutland, J.K. Martin, R.D. Reitz + "Pressure-Swirl Atomization in the Near Field" + SAE Techical Paper Series 1999-01-0496 + @endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef LISAAtomization_H +#define LISAAtomization_H + +#include "AtomizationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class LISAAtomization Declaration +\*---------------------------------------------------------------------------*/ + +template +class LISAAtomization +: + public AtomizationModel +{ + +public: + + //- Enumeration for SMD calculations + enum SMDMethods + { + method1, + method2 + }; + + +private: + + // Private data + + scalar Cl_; + scalar cTau_; + scalar Q_; + scalar lisaExp_; + vector injectorDirection_; + word SMDCalcMethod_; + + SMDMethods SMDMethod_; + + +public: + + //- Runtime type information + TypeName("LISA"); + + + // Constructors + + //- Construct from dictionary + LISAAtomization(const dictionary&, CloudType&); + + //- Construct copy + LISAAtomization(const LISAAtomization& am); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new LISAAtomization(*this) + ); + } + + + //- Destructor + virtual ~LISAAtomization(); + + + // Member Functions + + //- initial value of liquidCore + virtual scalar initLiquidCore() const; + + //- flag to indicate if chi needs to be calculated + virtual bool calcChi() const; + + virtual void update + ( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volFlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "LISAAtomization.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISASMDCalcMethod1.H b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISASMDCalcMethod1.H new file mode 100644 index 0000000000..a153b5a0ca --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISASMDCalcMethod1.H @@ -0,0 +1,33 @@ +{ + // calculate the new diameter with a Rosin Rammler distribution + + scalar minValue = min(d, dD/10.0); + scalar maxValue = dD; + + if(maxValue - minValue < SMALL) + { + minValue = d/10.0; + } + + scalar range = maxValue - minValue; + + scalar y = 0; + + bool success = false; + + while(!success) + { + + x = minValue + range*rndGen.sample01(); + y = rndGen.sample01(); + scalar p = 0.0; + scalar nExp = 1; + scalar xx = pow(x/dD, nExp); + + p = xx*exp(-xx); + if (y rrd; + scalar probFactorMin = exp(-pow(minValue/delta, nExp)); + scalar probFactorMax = exp(-pow(maxValue/delta, nExp)); + scalar probFactor = 1.0/(probFactorMin - probFactorMax); + + forAll(rrd, n) + { + scalar xx = minValue + range*n/500; + rrd[n] = (probFactorMin - exp(-pow(xx/delta, nExp)))*probFactor; + } + + + bool success = false; + + scalar y = rndGen.sample01(); + label k = 0; + + while(!success && (k<500)) + { + if (rrd[k] > y) + { + success = true; + } + k++; + } + + x = minValue + range*(k - 0.5)/500.0; +} diff --git a/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.C b/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.C new file mode 100644 index 0000000000..0f4f74c976 --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "NoAtomization.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::NoAtomization::NoAtomization +( + const dictionary& dict, + CloudType& owner +) +: + AtomizationModel(owner) +{} + + +template +Foam::NoAtomization::NoAtomization +( + const NoAtomization& am +) +: + AtomizationModel(am) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::NoAtomization::~NoAtomization() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::NoAtomization::active() const +{ + return false; +} + + +template +Foam::scalar Foam::NoAtomization::initLiquidCore() const +{ + return 0.0; +} + + +template +bool Foam::NoAtomization::calcChi() const +{ + return false; +} + + +template +void Foam::NoAtomization::update +( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volFlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen +) const +{} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.H b/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.H new file mode 100644 index 0000000000..37132fc05f --- /dev/null +++ b/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.H @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::NoAtomization + +Description + Dummy phase change model for 'none' + +\*---------------------------------------------------------------------------*/ + +#ifndef NoAtomization_H +#define NoAtomization_H + +#include "AtomizationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class NoAtomization Declaration +\*---------------------------------------------------------------------------*/ + +template +class NoAtomization +: + public AtomizationModel +{ +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from dictionary + NoAtomization(const dictionary& dict, CloudType& cloud); + + //- Construct copy + NoAtomization(const NoAtomization& am); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new NoAtomization(*this) + ); + } + + + //- Destructor + virtual ~NoAtomization(); + + + // Member Functions + + //- Flag to indicate whether model activates atomization model + virtual bool active() const; + + //- Initial value of liquidCore + virtual scalar initLiquidCore() const; + + //- Flag to indicate if chi needs to be calculated + virtual bool calcChi() const; + + virtual void update + ( + const scalar dt, + scalar& d, + scalar& liquidCore, + scalar& tc, + const scalar rho, + const scalar mu, + const scalar sigma, + const scalar volFlowRate, + const scalar rhoAv, + const scalar Urel, + const vector& pos, + const vector& injectionPos, + const scalar pAmbient, + const scalar chi, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "NoAtomization.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C new file mode 100644 index 0000000000..a4e2d8f37f --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::BreakupModel::BreakupModel +( + CloudType& owner +) +: + SubModelBase(owner), + solveOscillationEq_(false), + y0_(0.0), + yDot0_(0.0), + TABComega_(0.0), + TABCmu_(0.0), + TABWeCrit_(0.0) +{} + + +template +Foam::BreakupModel::BreakupModel +( + const BreakupModel& bum +) +: + SubModelBase(bum), + solveOscillationEq_(bum.solveOscillationEq_), + y0_(bum.y0_), + yDot0_(bum.yDot0_), + TABComega_(bum.TABComega_), + TABCmu_(bum.TABCmu_), + TABWeCrit_(bum.TABWeCrit_) +{} + + +template +Foam::BreakupModel::BreakupModel +( + const dictionary& dict, + CloudType& owner, + const word& type +) +: + SubModelBase(owner, dict, type), + solveOscillationEq_(this->coeffDict().lookup("solveOscillationEq")), + y0_(0.0), + yDot0_(0.0), + TABComega_(0.0), + TABCmu_(0.0), + TABWeCrit_(0.0) +{ + if (solveOscillationEq_) + { + const dictionary TABcoeffsDict(dict.subDict("TABCoeffs")); + y0_ = TABcoeffsDict.template lookupOrDefault("y0", 0.0); + yDot0_ = TABcoeffsDict.template lookupOrDefault("yDot0", 0.0); + TABComega_ = + TABcoeffsDict.template lookupOrDefault("Comega", 8.0); + TABCmu_ = TABcoeffsDict.template lookupOrDefault("Cmu", 10.0); + TABWeCrit_ = + TABcoeffsDict.template lookupOrDefault("WeCrit", 12.0); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::BreakupModel::~BreakupModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::BreakupModel::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + notImplemented + ( + "bool Foam::BreakupModel::update" + "(" + "const scalar, " + "const vector&, " + "scalar&, " + "scalar&, " + "scalar&, " + "scalar&, " + "scalar&, " + "scalar&, " + "scalar&, " + "const scalar, " + "const scalar, " + "const scalar, " + "const scalar, " + "const vector&, " + "const scalar, " + "const scalar, " + "const vector&, " + "const scalar, " + "const scalar, " + "const scalar, " + "scalar&, " + "scalar&, " + "cachedRandom&" + ") const;" + ); + + return false; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "BreakupModelNew.C" + +// ************************************************************************* // + diff --git a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H new file mode 100644 index 0000000000..9df5a2eec2 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H @@ -0,0 +1,235 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::BreakupModel + +Description + Templated break-up model class + +SourceFiles + BreakupModel.C + BreakupModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef BreakupModel_H +#define BreakupModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class BreakupModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class BreakupModel +: + public SubModelBase +{ + +protected: + + // Protected data + + Switch solveOscillationEq_; + + scalar y0_; + scalar yDot0_; + scalar TABComega_; + scalar TABCmu_; + scalar TABWeCrit_; + + +public: + + //- Runtime type information + TypeName("breakupModel"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + BreakupModel, + dictionary, + ( + const dictionary& dict, + CloudType& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct null from owner + BreakupModel(CloudType& owner); + + //- Construct from dictionary + BreakupModel + ( + const dictionary& dict, + CloudType& owner, + const word& type + ); + + //- Construct copy + BreakupModel(const BreakupModel& bum); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new BreakupModel(*this) + ); + } + + + //- Destructor + virtual ~BreakupModel(); + + + //- Selector + static autoPtr > New + ( + const dictionary& dict, + CloudType& owner + ); + + + // Access + + inline const Switch& solveOscillationEq() const + { + return solveOscillationEq_; + } + + inline const scalar& y0() const + { + return y0_; + } + + inline const scalar& yDot0() const + { + return yDot0_; + } + + inline const scalar& TABComega() const + { + return TABComega_; + } + + inline const scalar& TABCmu() const + { + return TABCmu_; + } + + inline const scalar& TABWeCrit() const + { + return TABWeCrit_; + } + + + // Member Functions + + //- Update the parcel properties and return true if a child parcel + // should be added + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeBreakupModel(CloudType) \ + \ + typedef CloudType::sprayCloudType sprayCloudType; \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + BreakupModel, \ + 0 \ + ); \ + defineTemplateRunTimeSelectionTable \ + ( \ + BreakupModel, \ + dictionary \ + ); + + +#define makeBreakupModelType(SS, CloudType) \ + \ + typedef CloudType::sprayCloudType sprayCloudType; \ + defineNamedTemplateTypeNameAndDebug(SS, 0); \ + \ + BreakupModel:: \ + adddictionaryConstructorToTable > \ + add##SS##CloudType##sprayCloudType##ConstructorToTable_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "BreakupModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModelNew.C b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModelNew.C new file mode 100644 index 0000000000..fee504d131 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModelNew.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::BreakupModel::New +( + const dictionary& dict, + CloudType& owner +) +{ + word BreakupModelType(dict.lookup("breakupModel")); + + Info<< "Selecting BreakupModel " << BreakupModelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(BreakupModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "BreakupModel::New" + "(" + "const dictionary&, " + "CloudType&" + ")" + ) << "Unknown BreakupModelType type " + << BreakupModelType + << ", constructor not in hash table" << nl << nl + << " Valid BreakupModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); + } + + return autoPtr >(cstrIter()(dict, owner)); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.C b/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.C new file mode 100644 index 0000000000..1ba28effe1 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.C @@ -0,0 +1,228 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ETAB.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ETAB::ETAB +( + const dictionary& dict, + CloudType& owner +) +: + BreakupModel(dict, owner, typeName), + Cmu_(this->coeffDict().template lookupOrDefault("Cmu", 10.0)), + Comega_(this->coeffDict().template lookupOrDefault("Comega", 8.0)), + k1_(this->coeffDict().template lookupOrDefault("k1", 0.2)), + k2_(this->coeffDict().template lookupOrDefault("k2", 0.2)), + WeCrit_ +( + this->coeffDict().template lookupOrDefault("WeCrit", 12.0) +), + WeTransition_ + ( + this->coeffDict().template lookupOrDefault + ( + "WeTransition", + 100.0 + ) + ), + AWe_(0.0) +{ + scalar k21 = k2_/k1_; + AWe_ = (k21*sqrt(WeTransition_) - 1.0)/pow4(WeTransition_); + + if (!BreakupModel::solveOscillationEq_) + { + Info<< "Warning: solveOscillationEq is set to " + << BreakupModel::solveOscillationEq_ << nl + << " Setting it to true in order for the ETAB model to work." + << endl; + BreakupModel::solveOscillationEq_ = true; + } +} + + +template +Foam::ETAB::ETAB(const ETAB& bum) +: + BreakupModel(bum), + Cmu_(bum.Cmu_), + Comega_(bum.Comega_), + k1_(bum.k1_), + k2_(bum.k2_), + WeCrit_(bum.WeCrit_), + WeTransition_(bum.WeTransition_), + AWe_(bum.AWe_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ETAB::~ETAB() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::ETAB::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + scalar r = 0.5*d; + scalar r2 = r*r; + scalar r3 = r*r2; + + scalar semiMass = nParticle*pow3(d); + + // inverse of characteristic viscous damping time + scalar rtd = 0.5*Cmu_*mu/(rho*r2); + + // oscillation frequency (squared) + scalar omega2 = Comega_*sigma/(rho*r3) - rtd*rtd; + + if (omega2 > 0) + { + scalar omega = sqrt(omega2); + scalar romega = 1.0/omega; + + scalar We = rhoc*sqr(Urmag)*r/sigma; + scalar Wetmp = We/WeCrit_; + + scalar y1 = y - Wetmp; + scalar y2 = yDot*romega; + + scalar a = sqrt(y1*y1 + y2*y2); + + // scotty we may have break-up + if (a + Wetmp > 1.0) + { + scalar phic = y1/a; + + // constrain phic within -1 to 1 + phic = max(min(phic, 1), -1); + + scalar phit = acos(phic); + scalar phi = phit; + scalar quad = -y2/a; + if (quad < 0) + { + phi = 2*constant::mathematical::pi - phit; + } + + scalar tb = 0; + + if (mag(y) < 1.0) + { + scalar theta = acos((1.0 - Wetmp)/a); + + if (theta < phi) + { + if (2*constant::mathematical::pi - theta >= phi) + { + theta = -theta; + } + theta += 2*constant::mathematical::pi; + } + tb = (theta - phi)*romega; + + // breakup occurs + if (dt > tb) + { + y = 1.0; + yDot = -a*omega*sin(omega*tb + phi); + } + } + + // update droplet size + if (dt > tb) + { + scalar sqrtWe = AWe_*pow4(We) + 1.0; + scalar Kbr = k1_*omega*sqrtWe; + + if (We > WeTransition_) + { + sqrtWe = sqrt(We); + Kbr =k2_*omega*sqrtWe; + } + + scalar rWetmp = 1.0/Wetmp; + scalar cosdtbu = max(-1.0, min(1.0, 1.0 - rWetmp)); + scalar dtbu = romega*acos(cosdtbu); + scalar decay = exp(-Kbr*dtbu); + + scalar rNew = decay*r; + if (rNew < r) + { + d = 2.0*rNew; + y = 0.0; + yDot = 0.0; + } + } + } + } + else + { + // reset droplet distortion parameters + y = 0; + yDot = 0; + } + + // update the nParticle count to conserve mass + nParticle = semiMass/pow3(d); + + // Do not add child parcel + return false; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.H b/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.H new file mode 100644 index 0000000000..f37b7da93d --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.H @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ETAB + +Description + The Enhanced TAB model. + + Described in the papers below. + @verbatim + F.X. Tanner + "Liquid Jet Atomization and Droplet Breakup Modeling of + Non-Evaporating Diesel Fuel Sprays" + SAE 970050, + SAE Transactions: Journal of Engines, Vol 106, Sec 3 pp 127-140 + + F.X. Tanner and G. Weisser + "Simulation of Liquid Jet Atomization for + Fuel Sprays by Means of Cascade Drop Breakup Model" + SAE 980808 + SAE Technical Paper Series + @endverbatim + +See Also + The TAB model + +\*---------------------------------------------------------------------------*/ + +#ifndef ETAB_H +#define ETAB_H + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class ETAB Declaration +\*---------------------------------------------------------------------------*/ + +template +class ETAB +: + public BreakupModel +{ +private: + + // Private data + + // Model constants + + // Cmu_ and Comega_ are the same as in the TAB model + scalar Cmu_; + scalar Comega_; + + scalar k1_; + scalar k2_; + scalar WeCrit_; + scalar WeTransition_; + scalar AWe_; + + +public: + + //- Runtime type information + TypeName("ETAB"); + + + // Constructors + + //- Construct from dictionary + ETAB(const dictionary&, CloudType&); + + //- Construct copy + ETAB(const ETAB& bum); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ETAB(*this) + ); + } + + + //- Destructor + virtual ~ETAB(); + + + // Member Functions + + //- update the parcel properties + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ETAB.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.C b/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.C new file mode 100644 index 0000000000..645d67f8fe --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "NoBreakup.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::NoBreakup::NoBreakup +( + const dictionary&, + CloudType& owner +) +: + BreakupModel(owner) +{} + + + +template +Foam::NoBreakup::NoBreakup(const NoBreakup& bum) +: + BreakupModel(bum) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::NoBreakup::~NoBreakup() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::NoBreakup::active() const +{ + return false; +} + + +template +bool Foam::NoBreakup::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + // Do nothing + return false; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.H b/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.H new file mode 100644 index 0000000000..178550ff18 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.H @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::NoBreakup + +Description + Dummy breakup model for 'none' + +\*---------------------------------------------------------------------------*/ + +#ifndef NoBreakup_H +#define NoBreakup_H + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class NoBreakup Declaration +\*---------------------------------------------------------------------------*/ + +template +class NoBreakup +: + public BreakupModel +{ +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from dictionary + NoBreakup(const dictionary&, CloudType&); + + //- Construct copy + NoBreakup(const NoBreakup& bum); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new NoBreakup(*this) + ); + } + + + //- Destructor + virtual ~NoBreakup(); + + + // Member Functions + + //- Flag to indicate whether model activates break-up model + virtual bool active() const; + + //- update the parcel properties + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "NoBreakup.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C new file mode 100644 index 0000000000..a3a6cdd2f9 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "PilchErdman.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::PilchErdman::PilchErdman +( + const dictionary& dict, + CloudType& owner +) +: + BreakupModel(dict, owner, typeName), + B1_(this->coeffDict().template lookupOrDefault("B1", 0.375)), + B2_(this->coeffDict().template lookupOrDefault("B2", 0.236)) +{} + + +template +Foam::PilchErdman::PilchErdman(const PilchErdman& bum) +: + BreakupModel(bum), + B1_(bum.B1_), + B2_(bum.B2_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::PilchErdman::~PilchErdman() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::PilchErdman::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + scalar semiMass = nParticle*pow3(d); + scalar We = 0.5*rhoc*sqr(Urmag)*d/sigma; + scalar Oh = mu/pow(rho*d*sigma, 0.5); + + scalar Wec = 6.0*(1.0 + 1.077*pow(Oh, 1.6)); + + if (We > Wec) + { + // We > 1335, wave crest stripping + scalar taubBar = 5.5; + + if (We > 175.0) + { + // sheet stripping + taubBar = 0.766*pow(2.0*We - 12.0, 0.25); + } + else if (We > 22.0) + { + // Bag-and-stamen breakup + taubBar = 14.1*pow(2.0*We - 12.0, -0.25); + } + else if (We > 9.0) + { + // Bag breakup + taubBar = 2.45*pow(2.0*We - 12.0, 0.25); + } + else if (We > 6.0) + { + // Vibrational breakup + taubBar = 6.0*pow(2.0*We - 12.0, -0.25); + } + + scalar rho12 = pow(rhoc/rho, 0.5); + + scalar Vd = Urmag*rho12*(B1_*taubBar * B2_*taubBar*taubBar); + scalar Vd1 = sqr(1.0 - Vd/Urmag); + Vd1 = max(Vd1, SMALL); + scalar Ds = 2.0*Wec*sigma*Vd1/(Vd1*rhoc*sqr(Urmag)); + scalar A = Urmag*rho12/d; + + scalar taub = taubBar/A; + + scalar frac = dt/taub; + + // update the droplet diameter according to the rate eq. (implicitly) + d = (d + frac*Ds)/(1.0 + frac); + + // correct the number of particles to conserve mass + nParticle = semiMass/pow3(d); + } + + return false; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.H b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.H new file mode 100644 index 0000000000..6ff144b05c --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::PilchErdman + +Description + secondary breakup model + + @verbatim + Pilch, M. and Erdman, C.A. + "Use of breakup time data and velocity history data + to predict the maximum size of stable fragments for acceleration + induced breakup of a liquid drop." + Int. J. Multiphase Flows 13 (1987), 741-757 + @endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef PilchErdman_H +#define PilchErdman_H + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class PilchErdman Declaration +\*---------------------------------------------------------------------------*/ + +template +class PilchErdman +: + public BreakupModel +{ +private: + + // Private data + + scalar B1_; + scalar B2_; + + +public: + + //- Runtime type information + TypeName("PilchErdman"); + + + // Constructors + + //- Construct from dictionary + PilchErdman(const dictionary&, CloudType&); + + //- Construct copy + PilchErdman(const PilchErdman& bum); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new PilchErdman(*this) + ); + } + + + //- Destructor + virtual ~PilchErdman(); + + + // Member Functions + + //- update the parcel properties + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "PilchErdman.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C new file mode 100644 index 0000000000..1ff7327986 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ReitzDiwakar.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ReitzDiwakar::ReitzDiwakar +( + const dictionary& dict, + CloudType& owner +) +: + BreakupModel(dict, owner, typeName), + Cbag_(this->coeffDict().template lookupOrDefault("Cbag", 6.0)), + Cb_(this->coeffDict().template lookupOrDefault("Cb", 0.785)), + Cstrip_(this->coeffDict().template lookupOrDefault("Cstrip", 0.5)), + Cs_(this->coeffDict().template lookupOrDefault("Cs", 10.0)) +{} + + +template +Foam::ReitzDiwakar::ReitzDiwakar(const ReitzDiwakar& bum) +: + BreakupModel(bum), + Cbag_(bum.Cbag_), + Cb_(bum.Cb_), + Cstrip_(bum.Cstrip_), + Cs_(bum.Cs_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ReitzDiwakar::~ReitzDiwakar() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::ReitzDiwakar::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + scalar d1 = d; + scalar nuc = muc/rhoc; + scalar We = 0.5*rhoc*sqr(Urmag)*d/sigma; + scalar Re = Urmag*d/nuc; + + scalar sqRey = sqrt(Re); + + if (We > Cbag_) + { + if (We > Cstrip_*sqRey) + { + scalar dStrip = sqr(2.0*Cstrip_*sigma)/(rhoc*pow3(Urmag)*muc); + scalar tauStrip = Cs_*d*sqrt(rho/rhoc)/Urmag; + scalar fraction = dt/tauStrip; + + // new droplet diameter, implicit calculation + d = (fraction*dStrip + d)/(1.0 + fraction); + } + else + { + scalar dBag = 2.0*Cbag_*sigma/(rhoc*sqr(Urmag)); + + scalar tauBag = Cb_*d*sqrt(rho*d/sigma); + + scalar fraction = dt/tauBag; + + // new droplet diameter, implicit calculation + d = (fraction*dBag + d)/(1.0 + fraction); + } + + // preserve the total mass/volume by updating the number of + // particles in parcels due to breakup + nParticle *= pow(d1/d, 3.0); + } + + return false; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.H b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.H new file mode 100644 index 0000000000..8d66d47208 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.H @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ReitzDiwakar + +Description + secondary breakup model + + @verbatim + Reitz, R.D. + "Modelling atomization processes in highpressure vaporizing sprays" + Atomization and Spray Technology 3 (1987), 309-337 + @endverbatim + + @verbatim + Reitz, R.D. and Diwakar, R. + "Effect of drop breakup on fuel sprays" + SAE Tech. paper series, 860469 (1986) + @endverbatim + + @verbatim + Reitz, R.D. and Diwakar, R. + "Structure of high-pressure fuel sprays" + SAE Tech. paper series, 870598 (1987) + @endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef ReitzDiwakar_H +#define ReitzDiwakar_H + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class ReitzDiwakar Declaration +\*---------------------------------------------------------------------------*/ + +template +class ReitzDiwakar +: + public BreakupModel +{ +private: + + // Private data + + scalar Cbag_; + scalar Cb_; + scalar Cstrip_; + scalar Cs_; + + +public: + + //- Runtime type information + TypeName("ReitzDiwakar"); + + + // Constructors + + //- Construct from dictionary + ReitzDiwakar(const dictionary&, CloudType&); + + //- Construct copy + ReitzDiwakar(const ReitzDiwakar& bum); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ReitzDiwakar(*this) + ); + } + + + //- Destructor + virtual ~ReitzDiwakar(); + + + // Member Functions + + //- update the parcel properties + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ReitzDiwakar.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C new file mode 100644 index 0000000000..0e8835c75c --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C @@ -0,0 +1,259 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ReitzKHRT.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ReitzKHRT::ReitzKHRT +( + const dictionary& dict, + CloudType& owner +) +: + BreakupModel(dict, owner, typeName), + b0_(this->coeffDict().template lookupOrDefault("B0", 0.61)), + b1_(this->coeffDict().template lookupOrDefault("B1", 40.0)), + cTau_(this->coeffDict().template lookupOrDefault("Ctau", 1.0)), + cRT_(this->coeffDict().template lookupOrDefault("CRT", 0.1)), + msLimit_ + ( + this->coeffDict().template lookupOrDefault + ( + "msLimit", + 0.03 + ) + ), + weberLimit_(readScalar(this->coeffDict().lookup("WeberLimit"))) +{} + + +template +Foam::ReitzKHRT::ReitzKHRT(const ReitzKHRT& bum) +: + BreakupModel(bum), + b0_(bum.b0_), + b1_(bum.b1_), + cTau_(bum.cTau_), + cRT_(bum.cRT_), + msLimit_(bum.msLimit_), + weberLimit_(bum.weberLimit_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ReitzKHRT::~ReitzKHRT() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::ReitzKHRT::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + bool addParcel = false; + + scalar r = 0.5*d; + scalar d3 = pow3(d); + scalar d03 = pow3(d0); + + scalar rhopi6 = rho*constant::mathematical::pi/6.0; + scalar mass = nParticle*d3*rhopi6; + scalar mass0 = nParticle*d03*rhopi6; + + scalar weGas = 0.5*rhoc*sqr(Urmag)*d/sigma; + scalar weLiquid = 0.5*rho*sqr(Urmag)*d/sigma; + + // Note: Reitz is using radius instead of diameter for Re-number + scalar reLiquid = rho*Urmag*r/mu; + scalar ohnesorge = sqrt(weLiquid)/(reLiquid + VSMALL); + scalar taylor = ohnesorge*sqrt(weGas); + + vector acceleration = Urel/tMom; + vector trajectory = U/mag(U); + scalar gt = (g + acceleration) & trajectory; + + // frequency of the fastest growing KH-wave + scalar omegaKH = + (0.34 + 0.38*pow(weGas, 1.5)) + /((1.0 + ohnesorge)*(1.0 + 1.4*pow(taylor, 0.6))) + *sqrt(sigma/(rho*pow3(r))); + + // corresponding KH wave-length. + scalar lambdaKH = + 9.02 + *r + *(1.0 + 0.45*sqrt(ohnesorge)) + *(1.0 + 0.4*pow(taylor, 0.7)) + /pow(1.0 + 0.865*pow(weGas, 1.67), 0.6); + + // characteristic Kelvin-Helmholtz breakup time + scalar tauKH = 3.726*b1_*r/(omegaKH*lambdaKH); + + // stable KH diameter + scalar dc = 2.0*b0_*lambdaKH; + + // the frequency of the fastest growing RT wavelength. + scalar helpVariable = mag(gt*(rho - rhoc)); + scalar omegaRT = sqrt + ( + 2.0*pow(helpVariable, 1.5) + /(3.0*sqrt(3.0*sigma)*(rhoc + rho)) + ); + + // RT wave number + scalar KRT = sqrt(helpVariable/(3.0*sigma + VSMALL)); + + // wavelength of the fastest growing RT frequency + scalar lambdaRT = 2.0*constant::mathematical::pi*cRT_/(KRT + VSMALL); + + // if lambdaRT < diameter, then RT waves are growing on the surface + // and we start to keep track of how long they have been growing + if ((tc > 0) || (lambdaRT < d) ) + { + tc += dt; + scalar multiplier = d/lambdaRT; + d = cbrt(d3/multiplier); + } + + // characteristic RT breakup time + scalar tauRT = cTau_/(omegaRT + VSMALL); + + // check if we have RT breakup + if ((tc > tauRT) && (lambdaRT < d)) + { + // the RT breakup creates diameter/lambdaRT new droplets + tc = -GREAT; + scalar nDrops = d/lambdaRT; + d = cbrt(d3/nDrops); + } + // otherwise check for KH breakup + else if (dc < d) + { + // no breakup below Weber = 12 + if (weGas > weberLimit_) + { + scalar fraction = dt/tauKH; + + // reduce the diameter according to the rate-equation + d = (fraction*dc + d)/(1.0 + fraction); + + //scalar ms0 = rho*pow3(dc)*mathematicalConstant::pi/6.0; + scalar ms0 = mass0*(1.0 - pow3(d/d0)); + ms += ms0; + + if (ms/averageParcelMass > msLimit_) + { + // Correct evaluation of the number of child droplets and the + // diameter of parcel droplets after breaukp + // Solution of cubic equation for the diameter of the parent + // drops after breakup, see Eq. 18 in + // Patterson & Reitz, SAE 980131 + bool br3 = true; + scalar ae3 = 1.0; + scalar be3 = -dc; + scalar ce3 = 0.0; + scalar de3 = d*d*(dc - d); + scalar qe3 = + pow3(be3/(3.0*ae3)) - be3*ce3/(6.0*ae3*ae3) + de3/(2.0*ae3); + scalar pe3 = (3.0*ae3*ce3 - be3*be3)/(9.0*ae3*ae3); + scalar D3 = qe3*qe3 + pe3*pe3*pe3; + + if (D3 < 0) br3 = false; + + if (br3) + { + D3 = sqrt(D3); + scalar ue3 = cbrt(-qe3 + D3); + scalar ve3 = cbrt(-qe3 - D3); + scalar dParenDrops = ue3 + ve3 - be3/3.; + scalar mc = nParticle*(pow3(d) - pow3(dParenDrops)); + scalar nChildDrops = mc/pow3(dc); + + if (nChildDrops >= nParticle) + { + addParcel = true; + d = dParenDrops; + ms = 0.0; + dChild = dc; + massChild = mc*rhopi6; + + // reduce the parent mass by reducing nParticle + mass -= massChild; + } + } + } + } + } + else if (KHindex < 0.5) + { + // Case of larger drops after breakup (Reitz, Atomization & Spray + // Technology 3 (1987) 309-337, p.322) pIndKH() should be introduced + + scalar lengthScale = + min(lambdaKH, 2.0*constant::mathematical::pi*Urmag/omegaKH); + scalar diameterLargerDrop = cbrt(1.5*d*d*lengthScale); + d = diameterLargerDrop; + ms = 0.0; + KHindex = 1.0; + } + + // correct the number of parcels in parent + scalar massDrop = pow3(d)*rhopi6; + nParticle = mass/massDrop; + + return addParcel; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.H b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.H new file mode 100644 index 0000000000..464404f573 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ReitzKHRT + +Description + secondary breakup model which uses the Kelvin-Helmholtz + instability theory to predict the 'stripped' droplets... and + the Raleigh-Taylor instability as well. + +\*---------------------------------------------------------------------------*/ + +#ifndef ReitzKHRT_H +#define ReitzKHRT_H + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class ReitzKHRT Declaration +\*---------------------------------------------------------------------------*/ + +template +class ReitzKHRT +: + public BreakupModel +{ +private: + + // Private data + + // model constants + scalar b0_; + scalar b1_; + scalar cTau_; + scalar cRT_; + scalar msLimit_; + scalar weberLimit_; + + +public: + + //- Runtime type information + TypeName("ReitzKHRT"); + + + // Constructors + + //- Construct from dictionary + ReitzKHRT(const dictionary&, CloudType&); + + //- Construct copy + ReitzKHRT(const ReitzKHRT& bum); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ReitzKHRT(*this) + ); + } + + + //- Destructor + virtual ~ReitzKHRT(); + + + // Member Functions + + //- update the parcel diameter + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ReitzKHRT.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/SHF/SHF.C b/src/lagrangian/spray/submodels/BreakupModel/SHF/SHF.C new file mode 100644 index 0000000000..73dd7cc401 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/SHF/SHF.C @@ -0,0 +1,297 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "SHF.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SHF::SHF +( + const dictionary& dict, + CloudType& owner +) +: + BreakupModel(dict, owner, typeName), + weCorrCoeff_(readScalar(this->coeffDict().lookup("weCorrCoeff"))), + weBuCrit_(readScalar(this->coeffDict().lookup("weBuCrit"))), + weBuBag_(readScalar(this->coeffDict().lookup("weBuBag"))), + weBuMM_(readScalar(this->coeffDict().lookup("weBuMM"))), + ohnCoeffCrit_(readScalar(this->coeffDict().lookup("ohnCoeffCrit"))), + ohnCoeffBag_(readScalar(this->coeffDict().lookup("ohnCoeffBag"))), + ohnCoeffMM_(readScalar(this->coeffDict().lookup("ohnCoeffMM"))), + ohnExpCrit_(readScalar(this->coeffDict().lookup("ohnExpCrit"))), + ohnExpBag_(readScalar(this->coeffDict().lookup("ohnExpBag"))), + ohnExpMM_(readScalar(this->coeffDict().lookup("ohnExpMM"))), + cInit_(readScalar(this->coeffDict().lookup("Cinit"))), + c1_(readScalar(this->coeffDict().lookup("C1"))), + c2_(readScalar(this->coeffDict().lookup("C2"))), + c3_(readScalar(this->coeffDict().lookup("C3"))), + cExp1_(readScalar(this->coeffDict().lookup("Cexp1"))), + cExp2_(readScalar(this->coeffDict().lookup("Cexp2"))), + cExp3_(readScalar(this->coeffDict().lookup("Cexp3"))), + weConst_(readScalar(this->coeffDict().lookup("Weconst"))), + weCrit1_(readScalar(this->coeffDict().lookup("Wecrit1"))), + weCrit2_(readScalar(this->coeffDict().lookup("Wecrit2"))), + coeffD_(readScalar(this->coeffDict().lookup("CoeffD"))), + onExpD_(readScalar(this->coeffDict().lookup("OnExpD"))), + weExpD_(readScalar(this->coeffDict().lookup("WeExpD"))), + mu_(readScalar(this->coeffDict().lookup("mu"))), + sigma_(readScalar(this->coeffDict().lookup("sigma"))), + d32Coeff_(readScalar(this->coeffDict().lookup("d32Coeff"))), + cDmaxBM_(readScalar(this->coeffDict().lookup("cDmaxBM"))), + cDmaxS_(readScalar(this->coeffDict().lookup("cDmaxS"))), + corePerc_(readScalar(this->coeffDict().lookup("corePerc"))) +{} + + +template +Foam::SHF::SHF(const SHF& bum) +: + BreakupModel(bum), + weCorrCoeff_(bum.weCorrCoeff_), + weBuCrit_(bum.weBuCrit_), + weBuBag_(bum.weBuBag_), + weBuMM_(bum.weBuMM_), + ohnCoeffCrit_(bum.ohnCoeffCrit_), + ohnCoeffBag_(bum.ohnCoeffBag_), + ohnCoeffMM_(bum.ohnCoeffMM_), + ohnExpCrit_(bum.ohnExpCrit_), + ohnExpBag_(bum.ohnExpBag_), + ohnExpMM_(bum.ohnExpMM_), + cInit_(bum.cInit_), + c1_(bum.c1_), + c2_(bum.c2_), + c3_(bum.c3_), + cExp1_(bum.cExp1_), + cExp2_(bum.cExp2_), + cExp3_(bum.cExp3_), + weConst_(bum.weConst_), + weCrit1_(bum.weCrit1_), + weCrit2_(bum.weCrit2_), + coeffD_(bum.coeffD_), + onExpD_(bum.onExpD_), + weExpD_(bum.weExpD_), + mu_(bum.mu_), + sigma_(bum.sigma_), + d32Coeff_(bum.d32Coeff_), + cDmaxBM_(bum.cDmaxBM_), + cDmaxS_(bum.cDmaxS_), + corePerc_(bum.corePerc_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::SHF::~SHF() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::SHF::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + bool addChild = false; + + scalar d03 = pow(d, 3); + scalar rhopi6 = rho*constant::mathematical::pi/6.0; + scalar mass0 = nParticle*rhopi6*d03; + scalar mass = mass0; + + scalar weGas = 0.5*rhoc*sqr(Urmag)*d/sigma; + scalar weLiquid = 0.5*rho*sqr(Urmag)*d/sigma; + + // correct the Reynolds number. Reitz is using radius instead of diameter + scalar reLiquid = 0.5*Urmag*d/mu; + scalar ohnesorge = sqrt(weLiquid)/(reLiquid + VSMALL); + + vector acceleration = Urel/tMom; + vector trajectory = U/mag(U); + + scalar weGasCorr = weGas/(1.0 + weCorrCoeff_*ohnesorge); + + // droplet deformation characteristic time + + scalar tChar = d/Urmag*sqrt(rho/rhoc); + + scalar tFirst = cInit_*tChar; + + scalar tSecond = 0; + scalar tCharSecond = 0; + + bool bag = false; + bool multimode = false; + bool shear = false; + bool success = false; + + + // update the droplet characteristic time + tc += dt; + + if (weGas > weConst_) + { + if(weGas < weCrit1_) + { + tCharSecond = c1_*pow((weGas - weConst_), cExp1_); + } + else if(weGas >= weCrit1_ && weGas <= weCrit2_) + { + tCharSecond = c2_*pow((weGas - weConst_), cExp2_); + } + else + { + tCharSecond = c3_*pow((weGas - weConst_), cExp3_); + } + } + + scalar weC = weBuCrit_*(1.0 + ohnCoeffCrit_*pow(ohnesorge, ohnExpCrit_)); + scalar weB = weBuBag_*(1.0 + ohnCoeffBag_*pow(ohnesorge, ohnExpBag_)); + scalar weMM = weBuMM_*(1.0 + ohnCoeffMM_*pow(ohnesorge, ohnExpMM_)); + + if (weGas > weC && weGas < weB) + { + bag = true; + } + + if (weGas >= weB && weGas <= weMM) + { + multimode = true; + } + + if (weGas > weMM) + { + shear = true; + } + + tSecond = tCharSecond*tChar; + + scalar tBreakUP = tFirst + tSecond; + if (tc > tBreakUP) + { + scalar d32 = coeffD_*d*pow(ohnesorge, onExpD_)*pow(weGasCorr, weExpD_); + + if (bag || multimode) + { + scalar d05 = d32Coeff_ * d32; + + scalar x = 0.0; + scalar yGuess = 0.0; + scalar dGuess = 0.0; + + while(!success) + { + x = cDmaxBM_*rndGen.sample01(); + dGuess = sqr(x)*d05; + yGuess = rndGen.sample01(); + + scalar p = + x + /(2.0*sqrt(2.0*constant::mathematical::pi)*sigma_) + *exp(-0.5*sqr((x - mu_)/sigma_)); + + if (yGuess < p) + { + success = true; + } + } + + d = dGuess; + tc = 0.0; + } + + if (shear) + { + scalar dC = weConst_*sigma/(rhoc*sqr(Urmag)); + scalar d32Red = 4.0*(d32*dC)/(5.0*dC - d32); + + scalar d05 = d32Coeff_ * d32Red; + + scalar x = 0.0; + scalar yGuess = 0.0; + scalar dGuess = 0.0; + + while(!success) + { + x = cDmaxS_*rndGen.sample01(); + dGuess = sqr(x)*d05; + yGuess = rndGen.sample01(); + + scalar p = + x + /(2.0*sqrt(2.0*constant::mathematical::pi)*sigma_) + *exp(-0.5*sqr((x - mu_)/sigma_)); + + if (yGuess. + +Class + Foam::SHF + +Description + Secondary Breakup Model to take account of the different breakup regimes, + bag, molutimode, shear.... + + Accurate description in + @verbatim + R. Schmehl, G. Maier, S. Witting + "CFD Analysis of Fuel Atomization, Secondary Droplet Breakup and Spray + Dispersion in the Premix Duct of a LPP Combustor". + Eight International Conference on Liquid Atomization and Spray Systems, 2000 + @endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef SHF_H +#define SHF_H + +#include "BreakupModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class SHF Declaration +\*---------------------------------------------------------------------------*/ + +template +class SHF +: + public BreakupModel +{ +private: + + // Private data + + // Model constants + + scalar weCorrCoeff_; + + scalar weBuCrit_; + scalar weBuBag_; + scalar weBuMM_; + + scalar ohnCoeffCrit_; + scalar ohnCoeffBag_; + scalar ohnCoeffMM_; + + scalar ohnExpCrit_; + scalar ohnExpBag_; + scalar ohnExpMM_; + + scalar cInit_; + + scalar c1_; + scalar c2_; + scalar c3_; + + scalar cExp1_; + scalar cExp2_; + scalar cExp3_; + + scalar weConst_; + scalar weCrit1_; + scalar weCrit2_; + + scalar coeffD_; + scalar onExpD_; + scalar weExpD_; + + scalar mu_; + scalar sigma_; + + scalar d32Coeff_; + scalar cDmaxBM_; + scalar cDmaxS_; + + scalar corePerc_; + + +public: + + //- Runtime type information + TypeName("SHF"); + + + // Constructors + + //- Construct from dictionary + SHF(const dictionary&, CloudType&); + + //- Construct copy + SHF(const SHF& bum); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new SHF(*this) + ); + } + + + //- Destructor + virtual ~SHF(); + + + // Member Functions + + //- update the parcel properties + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "SHF.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.C b/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.C new file mode 100644 index 0000000000..0153b6bc5e --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.C @@ -0,0 +1,245 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "TAB.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::TAB::TAB +( + const dictionary& dict, + CloudType& owner +) +: + BreakupModel(dict, owner, typeName), + Cmu_(BreakupModel::TABCmu_), + Comega_(BreakupModel::TABComega_), + WeCrit_(BreakupModel::TABWeCrit_), + SMDCalcMethod_(this->coeffDict().lookup("SMDCalculationMethod")) +{ + // calculate the inverse function of the Rossin-Rammler Distribution + const scalar xx0 = 12.0; + const scalar rrd100 = + 1.0/(1.0-exp(-xx0)*(1.0 + xx0 + sqr(xx0)/2.0 + pow3(xx0)/6.0)); + + forAll(rrd_, n) + { + scalar xx = 0.12*(n + 1); + rrd_[n] = + (1.0 - exp(-xx)*(1.0 + xx + sqr(xx)/2.0 + pow3(xx)/6.0))*rrd100; + } + + if (!BreakupModel::solveOscillationEq_) + { + Info<< "Warning: solveOscillationEq is set to " + << BreakupModel::solveOscillationEq_ << nl + << " Setting it to true in order for the TAB model to work." + << endl; + BreakupModel::solveOscillationEq_ = true; + } + + if (SMDCalcMethod_ == "method1") + { + SMDMethod_ = method1; + } + else if (SMDCalcMethod_ == "method2") + { + SMDMethod_ = method2; + } + else + { + SMDMethod_ = method2; + Info<< "Warning: SMDCalculationMethod unknown. Options are " + "(method1 | method2). Using method2" << endl; + } +} + + +template +Foam::TAB::TAB(const TAB& bum) +: + BreakupModel(bum), + Cmu_(bum.Cmu_), + Comega_(bum.Comega_), + WeCrit_(bum.WeCrit_), + SMDCalcMethod_(bum.SMDCalcMethod_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::TAB::~TAB() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::TAB::update +( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen +) const +{ + scalar r = 0.5*d; + scalar r2 = r*r; + scalar r3 = r*r2; + + scalar semiMass = nParticle*pow3(d); + + // inverse of characteristic viscous damping time + scalar rtd = 0.5*Cmu_*mu/(rho*r2); + + // oscillation frequency (squared) + scalar omega2 = Comega_*sigma/(rho*r3) - rtd*rtd; + + if (omega2 > 0) + { + scalar omega = sqrt(omega2); + scalar We = rhoc*sqr(Urmag)*r/sigma; + scalar Wetmp = We/WeCrit_; + + scalar y1 = y - Wetmp; + scalar y2 = yDot/omega; + + scalar a = sqrt(y1*y1 + y2*y2); + + // scotty we may have break-up + if (a+Wetmp > 1.0) + { + scalar phic = y1/a; + + // constrain phic within -1 to 1 + phic = max(min(phic, 1), -1); + + scalar phit = acos(phic); + scalar phi = phit; + scalar quad = -y2/a; + if (quad < 0) + { + phi = 2.0*constant::mathematical::pi - phit; + } + + scalar tb = 0; + + if (mag(y) < 1.0) + { + scalar coste = 1.0; + if ((Wetmp - a < -1) && (yDot < 0)) + { + coste = -1.0; + } + + scalar theta = acos((coste-Wetmp)/a); + + if (theta < phi) + { + if (2*constant::mathematical::pi-theta >= phi) + { + theta = -theta; + } + theta += 2*constant::mathematical::pi; + } + tb = (theta-phi)/omega; + + // breakup occurs + if (dt > tb) + { + y = 1.0; + yDot = -a*omega*sin(omega*tb + phi); + } + + } + + // update droplet size + if (dt > tb) + { + scalar rs = + r/(1.0 + (4.0/3.0)*sqr(y) + rho*r3/(8*sigma)*sqr(yDot)); + + label n = 0; + scalar rNew = 0.0; + switch (SMDMethod_) + { + case method1: + { + #include "TABSMDCalcMethod1.H" + break; + } + case method2: + { + #include "TABSMDCalcMethod2.H" + break; + } + } + + if (rNew < r) + { + d = 2*rNew; + y = 0; + yDot = 0; + } + } + } + } + else + { + // reset droplet distortion parameters + y = 0; + yDot = 0; + } + + // update the nParticle count to conserve mass + nParticle = semiMass/pow3(d); + + // Do not add child parcel + return false; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.H b/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.H new file mode 100644 index 0000000000..9c2664f8ce --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::TAB + +Description + The TAB Method for Numerical Calculation of Spray Droplet Breakup. + + @verbatim + O'Rourke, P.J. and Amsden, A.A., + "The TAB Method for Numerical Calculation of Spray Droplet Breakup," + 1987 SAE International Fuels and Lubricants Meeting and Exposition, + Toronto, Ontario, November 2-5, 1987, + Los Alamos National Laboratory document LA-UR-87-2105; + SAE Technical Paper Series, Paper 872089. + @endverbatim + + This implementation follows the kiva version. + +See Also + The Enhanced %TAB model - ETAB + +\*---------------------------------------------------------------------------*/ + +#ifndef TAB_H +#define TAB_H + +#include "BreakupModel.H" +#include "FixedList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class TAB Declaration +\*---------------------------------------------------------------------------*/ + +template +class TAB +: + public BreakupModel +{ +public: + + //- Enumeration for the SMD brekup calculation + enum SMDMethods + { + method1, + method2 + }; + + +private: + + // Private data + + // Inverse function approximation of the Rossin-Rammler Distribution + // used when calculating the droplet size after breakup + FixedList rrd_; + + + // Model constants + + scalar Cmu_; + scalar Comega_; + scalar WeCrit_; + word SMDCalcMethod_; + SMDMethods SMDMethod_; + + +public: + + //- Runtime type information + TypeName("TAB"); + + + // Constructors + + //- Construct from dictionary + TAB(const dictionary& dict, CloudType& owner); + + //- Construct copy + TAB(const TAB& im); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new TAB(*this) + ); + } + + + //- Destructor + virtual ~TAB(); + + + // Member Functions + + //- update the parcel diameter + virtual bool update + ( + const scalar dt, + const vector& g, + scalar& d, + scalar& tc, + scalar& ms, + scalar& nParticle, + scalar& KHindex, + scalar& y, + scalar& yDot, + const scalar d0, + const scalar rho, + const scalar mu, + const scalar sigma, + const vector& U, + const scalar rhoc, + const scalar muc, + const vector& Urel, + const scalar Urmag, + const scalar tMom, + const scalar averageParcelMass, + scalar& dChild, + scalar& massChild, + cachedRandom& rndGen + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "TAB.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/BreakupModel/TAB/TABSMDCalcMethod1.H b/src/lagrangian/spray/submodels/BreakupModel/TAB/TABSMDCalcMethod1.H new file mode 100644 index 0000000000..7c663ab391 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/TAB/TABSMDCalcMethod1.H @@ -0,0 +1,15 @@ +{ + bool found = false; + scalar random = rndGen.sample01(); + while (!found && (n<99)) + { + if (rrd_[n]>random) + { + found = true; + } + n++; + } + rNew = 0.04*n*rs; +} + + diff --git a/src/lagrangian/spray/submodels/BreakupModel/TAB/TABSMDCalcMethod2.H b/src/lagrangian/spray/submodels/BreakupModel/TAB/TABSMDCalcMethod2.H new file mode 100644 index 0000000000..5d3be05323 --- /dev/null +++ b/src/lagrangian/spray/submodels/BreakupModel/TAB/TABSMDCalcMethod2.H @@ -0,0 +1,46 @@ +{ + // Calculation of the mean radius based on SMR rs. Coefficient + // factorGamma depends on nExp. + scalar factorGamma = 1.; + scalar delta = rs/factorGamma; + + scalar minValue = min(d/2.0, 0.04*rs); + scalar maxValue = rs*4.0; + + scalar range = maxValue - minValue; + + if (maxValue - minValue < SMALL) + { + minValue = d/20.0; + maxValue = d; + } + + scalar nExp = 3.5; + FixedList rrd; + + scalar probFactorMin = exp(-pow(minValue/delta, nExp)); + scalar probFactorMax = exp(-pow(maxValue/delta, nExp)); + scalar probFactor = 1./(probFactorMin - probFactorMax); + + forAll(rrd, n) + { + scalar xx = minValue + range*n/100; + rrd[n] = (probFactorMin - exp(-pow(xx/delta, nExp)))*probFactor; + } + + label n = 0; + bool found = false; + scalar random = rndGen.sample01(); + + while (!found && (n<100)) + { + if (rrd[n] > random) + { + found = true; + } + n++; + + } + + rNew = minValue + range*(n - 0.5)/100.0; +} diff --git a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C new file mode 100644 index 0000000000..f3c2da05fd --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "NoStochasticCollision.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::NoStochasticCollision::NoStochasticCollision +( + const dictionary& dict, + CloudType& owner +) +: + StochasticCollisionModel(owner) +{} + + +template +Foam::NoStochasticCollision::NoStochasticCollision +( + const NoStochasticCollision& cm +) +: + StochasticCollisionModel(cm) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::NoStochasticCollision::~NoStochasticCollision() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::NoStochasticCollision::active() const +{ + return false; +} + + +template +bool Foam::NoStochasticCollision::update +( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj +) const +{ + return false; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H new file mode 100644 index 0000000000..866e1f6c8d --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::NoStochasticCollision + +Description + Dummy collision model for 'none' + +\*---------------------------------------------------------------------------*/ + +#ifndef NoStochasticCollision_H +#define NoStochasticCollision_H + +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class NoStochasticCollision Declaration +\*---------------------------------------------------------------------------*/ + +template +class NoStochasticCollision +: + public StochasticCollisionModel +{ +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from dictionary + NoStochasticCollision(const dictionary& dict, CloudType& owner); + + //- Construct copy + NoStochasticCollision(const NoStochasticCollision& cm); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new NoStochasticCollision(*this) + ); + } + + + //- Destructor + virtual ~NoStochasticCollision(); + + + // Member Functions + + //- Flag to indicate whether model activates collision model + virtual bool active() const; + + virtual bool update + ( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "NoStochasticCollision.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C new file mode 100644 index 0000000000..73e6baf417 --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C @@ -0,0 +1,298 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ORourkeCollision.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ORourkeCollision::ORourkeCollision +( + const dictionary& dict, + CloudType& owner +) +: + StochasticCollisionModel(dict, owner, typeName), + coalescence_(this->coeffDict().lookup("coalescence")) +{} + + +template +Foam::ORourkeCollision::ORourkeCollision +( + const ORourkeCollision& cm +) +: + StochasticCollisionModel(cm), + coalescence_(cm.coalescence_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ORourkeCollision::~ORourkeCollision() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::ORourkeCollision::update +( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U1, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj +) const +{ + // check if parcels belong to same cell + if ((celli != cellj) || (m1 < VSMALL) || (m2 < VSMALL)) + { + return false; + } + + bool coalescence = false; + + scalar magVrel = mag(U1-U2); + scalar sumD = d1 + d2; + scalar nu0 = 0.25*constant::mathematical::pi*sumD*sumD*magVrel*dt/volj; + scalar nMin = min(N1, N2); + scalar nu = nMin*nu0; + scalar collProb = exp(-nu); + scalar xx = rndGen.sample01(); + + // collision occurs + if (xx > collProb) + { + if (d1 > d2) + { + coalescence = collideSorted + ( + dt, + rndGen, + pos1, + m1, + d1, + N1, + U1, + rho1, + T1, + Y1, + sigma1, + celli, + voli, + pos2, + m2, + d2, + N2, + U2, + rho2, + T2, + Y2, + sigma2, + cellj, + volj + ); + } + else + { + coalescence = collideSorted + ( + dt, + rndGen, + pos2, + m2, + d2, + N2, + U2, + rho2, + T2, + Y2, + sigma2, + cellj, + volj, + pos1, + m1, + d1, + N1, + U1, + rho1, + T1, + Y1, + sigma1, + celli, + voli + ); + } + } + return coalescence; +} + + +template +bool Foam::ORourkeCollision::collideSorted +( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U1, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj +) const +{ + bool coalescence = false; + + vector vRel = U1 - U2; + scalar magVRel = mag(vRel); + + scalar mdMin = m2/N2; + + scalar mTot = m1 + m2; + + scalar gamma = d1/max(d2, 1.0e-12); + scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma; + + vector momMax = m1*U1; + vector momMin = m2*U2; + + // use mass-averaged temperature to calculate We number + scalar Tm = (T1*m1 + T2*m2)/mTot; + + // interpolate the averaged surface tension + scalar sigma = sigma1 + (sigma2 - sigma1)*(Tm - T1)/(T2 - T1); + + sigma = max(1.0e-6, sigma); + scalar Vtot = m1/rho1 + m2/rho2; + scalar rho = mTot/Vtot; + + scalar dMean = sqrt(d1*d2); + scalar WeColl = max(1.0e-12, 0.5*rho*magVRel*magVRel*dMean/sigma); + + scalar coalesceProb = min(1.0, 2.4*f/WeColl); + + scalar prob = rndGen.sample01(); + + // Coalescence + if (prob < coalesceProb && coalescence_) + { + coalescence = true; + // How 'many' of the droplets coalesce + scalar nProb = prob*N2/N1; + + // Conservation of mass, momentum and energy + scalar m2Org = m2; + scalar dm = N1*nProb*mdMin; + m2 -= dm; + scalar V2 = constant::mathematical::pi*pow3(d2)/6.0; + N2 = m2/(rho2*V2); + + scalar m1Org = m1; + m1 += dm; + T1 = (Tm*mTot - m2*T2)/m1; + + U1 =(momMax + (1.0 - m2/m2Org)*momMin)/m1; + + // update the liquid mass fractions + Y1 = (m1Org*Y1 + dm*Y2)/m1; + } + // Grazing collision (no coalescence) + else + { + scalar gf = sqrt(prob) - sqrt(coalesceProb); + scalar denom = 1.0 - sqrt(coalesceProb); + if (denom < 1.0e-5) + { + denom = 1.0; + } + gf /= denom; + + // if gf negative, this means that coalescence is turned off + // and these parcels should have coalesced + gf = max(0.0, gf); + + // gf -> 1 => v1p -> p1().U() ... + // gf -> 0 => v1p -> momentum/(m1+m2) + + vector mr = m1*U1 + m2*U2; + vector v1p = (mr + m2*gf*vRel)/(m1+m2); + vector v2p = (mr - m1*gf*vRel)/(m1+m2); + + if (N1 < N2) + { + U1 = v1p; + U2 = (N1*v2p + (N2-N1)*U2)/N2; + } + else + { + U1 = (N2*v1p + (N1-N2)*U1)/N1; + U2 = v2p; + } + + } + + return coalescence; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H new file mode 100644 index 0000000000..ad685e8d34 --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ORourkeCollision + +Description + Collision model by P.J. O'Rourke. + + +\*---------------------------------------------------------------------------*/ + +#ifndef ORourkeCollision_H +#define ORourkeCollision_H + +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class ORourkeCollision Declaration +\*---------------------------------------------------------------------------*/ + +template +class ORourkeCollision +: + public StochasticCollisionModel +{ +private: + + dictionary coeffsDict_; + Switch coalescence_; + +public: + + //- Runtime type information + TypeName("ORourke"); + + + // Constructors + + //- Construct from dictionary + ORourkeCollision(const dictionary& dict, CloudType& cloud); + + //- Construct copy + ORourkeCollision(const ORourkeCollision& cm); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ORourkeCollision(*this) + ); + } + + + //- Destructor + virtual ~ORourkeCollision(); + + + // Member Functions + + virtual bool update + ( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj + ) const; + + + // 1 is the larger drop and 2 is the smaller + bool collideSorted + ( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ORourkeCollision.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C b/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C new file mode 100644 index 0000000000..efc7f85750 --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::StochasticCollisionModel::StochasticCollisionModel +( + CloudType& owner +) +: + SubModelBase(owner) +{} + + +template +Foam::StochasticCollisionModel::StochasticCollisionModel +( + const StochasticCollisionModel& cm +) +: + SubModelBase(cm) +{} + + +template +Foam::StochasticCollisionModel::StochasticCollisionModel +( + const dictionary& dict, + CloudType& owner, + const word& type +) +: + SubModelBase(owner, dict, type) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::StochasticCollisionModel::~StochasticCollisionModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::StochasticCollisionModel::update +( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U1, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj +) const +{ + notImplemented + ( + "bool Foam::StochasticCollisionModel::update" + "(" + "const scalar, " + "cachedRandom&, " + "vector&, " + "scalar&, " + "scalar&, " + "scalar&, " + "vector&, " + "scalar&, " + "scalar&, " + "scalarField&, " + "const scalar, " + "const label, " + "const scalar, " + "vector&, " + "scalar&, " + "scalar&, " + "scalar&, " + "vector&, " + "scalar&, " + "scalar&, " + "scalarField&, " + "const scalar, " + "const label, " + "const scalar" + ") const" + ); + + return false; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "StochasticCollisionModelNew.C" + +// ************************************************************************* // + diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H b/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H new file mode 100644 index 0000000000..012a851424 --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H @@ -0,0 +1,189 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::StochasticCollisionModel + +Description + Templated stochastic collision model class + +SourceFiles + StochasticCollisionModel.C + StochasticCollisionModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef StochasticCollisionModel_H +#define StochasticCollisionModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "SubModelBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class StochasticCollisionModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class StochasticCollisionModel +: + public SubModelBase +{ +public: + + //- Runtime type information + TypeName("collisionModel"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + StochasticCollisionModel, + dictionary, + ( + const dictionary& dict, + CloudType& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct null from owner + StochasticCollisionModel(CloudType& owner); + + //- Construct from dictionary + StochasticCollisionModel + ( + const dictionary& dict, + CloudType& owner, + const word& type + ); + + //- Construct copy + StochasticCollisionModel(const StochasticCollisionModel& cm); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new StochasticCollisionModel(*this) + ); + } + + + //- Destructor + virtual ~StochasticCollisionModel(); + + + //- Selector + static autoPtr > New + ( + const dictionary& dict, + CloudType& owner + ); + + + // Member Functions + + virtual bool update + ( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U1, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeStochasticCollisionModel(CloudType) \ + \ + typedef CloudType::sprayCloudType sprayCloudType; \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + StochasticCollisionModel, \ + 0 \ + ); \ + defineTemplateRunTimeSelectionTable \ + ( \ + StochasticCollisionModel, \ + dictionary \ + ); + + +#define makeStochasticCollisionModelType(SS, CloudType) \ + \ + typedef CloudType::sprayCloudType sprayCloudType; \ + defineNamedTemplateTypeNameAndDebug(SS, 0); \ + \ + StochasticCollisionModel:: \ + adddictionaryConstructorToTable > \ + add##SS##CloudType##sprayCloudType##ConstructorToTable_; + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "StochasticCollisionModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C b/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C new file mode 100644 index 0000000000..e35e390143 --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::StochasticCollisionModel::New +( + const dictionary& dict, + CloudType& owner +) +{ + word modelType(dict.lookup("stochasticCollisionModel")); + + Info<< "Selecting StochasticCollisionModel " << modelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "StochasticCollisionModel::New" + "(" + "const dictionary&, " + "CloudType&" + ")" + ) << "Unknown StochasticCollisionModelType type " + << modelType << ", constructor not in hash table" << nl << nl + << " Valid StochasticCollisionModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); + } + + return autoPtr > + ( + cstrIter()(dict, owner) + ); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C new file mode 100644 index 0000000000..b0b7215017 --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C @@ -0,0 +1,343 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "TrajectoryCollision.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::TrajectoryCollision::TrajectoryCollision +( + const dictionary& dict, + CloudType& owner +) +: + StochasticCollisionModel(dict, owner, typeName), + cSpace_(readScalar(this->coeffDict().lookup("cSpace"))), + cTime_(readScalar(this->coeffDict().lookup("cTime"))), + coalescence_(this->coeffDict().lookup("coalescence")) +{} + + +template +Foam::TrajectoryCollision::TrajectoryCollision +( + const TrajectoryCollision& cm +) +: + StochasticCollisionModel(cm), + cSpace_(cm.cSpace_), + cTime_(cm.cTime_), + coalescence_(cm.coalescence_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::TrajectoryCollision::~TrajectoryCollision() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::TrajectoryCollision::update +( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U1, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj +) const +{ + bool coalescence = false; + + vector vRel = U1 - U2; + + vector p = pos2 - pos1; + scalar dist = mag(p); + + scalar vAlign = vRel & (p/(dist + SMALL)); + + if (vAlign > 0) + { + scalar sumD = d1 + d2; + + if (vAlign*dt > dist - 0.5*sumD) + { + scalar v1Mag = mag(U1); + scalar v2Mag = mag(U2); + vector nv1 = U1/v1Mag; + vector nv2 = U2/v2Mag; + + scalar v1v2 = nv1 & nv2; + scalar v1p = nv1 & p; + scalar v2p = nv2 & p; + + scalar det = 1.0 - v1v2*v1v2; + + scalar alpha = 1.0e+20; + scalar beta = 1.0e+20; + + if (mag(det) > 1.0e-4) + { + beta = -(v2p - v1v2*v1p)/det; + alpha = v1p + v1v2*beta; + } + + alpha /= v1Mag*dt; + beta /= v2Mag*dt; + + // is collision possible within this timestep + if ((alpha>0) && (alpha<1.0) && (beta>0) && (beta<1.0)) + { + vector p1c = pos1 + alpha*U1*dt; + vector p2c = pos2 + beta*U2*dt; + + scalar closestDist = mag(p1c-p2c); + + scalar collProb = + pow(0.5*sumD/max(0.5*sumD, closestDist), cSpace_) + * exp(-cTime_*mag(alpha-beta)); + + scalar xx = rndGen.sample01(); + + // collision occur + if ((xx < collProb) && (m1 > VSMALL) && (m2 > VSMALL)) + { + if (d1 > d2) + { + coalescence = collideSorted + ( + dt, + rndGen, + pos1, + m1, + d1, + N1, + U1, + rho1, + T1, + Y1, + sigma1, + celli, + voli, + pos2, + m2, + d2, + N2, + U2, + rho2, + T2, + Y2, + sigma2, + cellj, + volj + ); + } + else + { + coalescence = collideSorted + ( + dt, + rndGen, + pos2, + m2, + d2, + N2, + U2, + rho2, + T2, + Y2, + sigma2, + cellj, + volj, + pos1, + m1, + d1, + N1, + U1, + rho1, + T1, + Y1, + sigma1, + celli, + voli + ); + } + } + } + } + } + + return coalescence; +} + + +template +bool Foam::TrajectoryCollision::collideSorted +( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U1, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj +) const +{ + bool coalescence = false; + + vector vRel = U1 - U2; + + scalar mdMin = m2/N2; + + scalar mTot = m1 + m2; + + scalar gamma = d1/max(d2, 1.0e-12); + scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma; + + vector momMax = m1*U1; + vector momMin = m2*U2; + + // use mass-averaged temperature to calculate We number + scalar Tm = (T1*m1 + T2*m2)/mTot; + + // and mass averaged fractions ... + //scalarField Yav((m1*Y1 + m2*Y2)/mTot; + + // interpolate the averaged surface tension + scalar sigma = sigma1 + (sigma2 - sigma1)*(Tm - T1)/(T2 - T1); + + sigma = max(1.0e-6, sigma); + scalar Vtot = m1/rho1 + m2/rho2; + scalar rho = mTot/Vtot; + + scalar dMean = sqrt(d1*d2); + scalar WeColl = max(1.0e-12, 0.5*rho*magSqr(vRel)*dMean/sigma); + + scalar coalesceProb = min(1.0, 2.4*f/WeColl); + + scalar prob = rndGen.sample01(); + + // Coalescence + if ( prob < coalesceProb && coalescence_) + { + coalescence = true; + // How 'many' of the droplets coalesce + scalar nProb = prob*N2/N1; + + // Conservation of mass, momentum and energy + scalar m2Org = m2; + scalar dm = N1*nProb*mdMin; + m2 -= dm; + scalar V2 = constant::mathematical::pi*pow3(d2)/6.0; + N2 = m2/(rho2*V2); + + scalar m1Org = m1; + m1 += dm; + T1 = (Tm*mTot - m2*T2)/m1; + + U1 =(momMax + (1.0 - m2/m2Org)*momMin)/m1; + + // update the liquid mass fractions + Y1 = (m1Org*Y1 + dm*Y2)/m1; + } + // Grazing collision (no coalescence) + else + { + scalar gf = sqrt(prob) - sqrt(coalesceProb); + scalar denom = 1.0 - sqrt(coalesceProb); + if (denom < 1.0e-5) + { + denom = 1.0; + } + gf /= denom; + + // if gf negative, this means that coalescence is turned off + // and these parcels should have coalesced + gf = max(0.0, gf); + + // gf -> 1 => v1p -> p1().U() ... + // gf -> 0 => v1p -> momentum/(m1 + m2) + + vector mr = m1*U1 + m2*U2; + vector v1p = (mr + m2*gf*vRel)/(m1 + m2); + vector v2p = (mr - m1*gf*vRel)/(m1 + m2); + + if (N1 < N2) + { + U1 = v1p; + U2 = (N1*v2p + (N2 - N1)*U2)/N2; + } + else + { + U1 = (N2*v1p + (N1 - N2)*U1)/N1; + U2 = v2p; + } + } + + return coalescence; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H new file mode 100644 index 0000000000..7de45fcfd1 --- /dev/null +++ b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::TrajectoryCollision + +Description + Trajectory collision model by N. Nordin. + +\*---------------------------------------------------------------------------*/ + +#ifndef TrajectoryCollision_H +#define TrajectoryCollision_H + +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class TrajectoryCollision Declaration +\*---------------------------------------------------------------------------*/ + +template +class TrajectoryCollision +: + public StochasticCollisionModel +{ +private: + + // Private data + + scalar cSpace_; + scalar cTime_; + Switch coalescence_; + + +public: + + //- Runtime type information + TypeName("trajectory"); + + + // Constructors + + //- Construct from dictionary + TrajectoryCollision(const dictionary& dict, CloudType& cloud); + + //- Construct copy + TrajectoryCollision(const TrajectoryCollision& cm); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new TrajectoryCollision(*this) + ); + } + + + //- Destructor + virtual ~TrajectoryCollision(); + + + // Member Functions + + virtual bool update + ( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj + ) const; + + // 1 is the larger drop and 2 is the smaller + bool collideSorted + ( + const scalar dt, + cachedRandom& rndGen, + vector& pos1, + scalar& m1, + scalar& d1, + scalar& N1, + vector& U, + scalar& rho1, + scalar& T1, + scalarField& Y1, + const scalar sigma1, + const label celli, + const scalar voli, + vector& pos2, + scalar& m2, + scalar& d2, + scalar& N2, + vector& U2, + scalar& rho2, + scalar& T2, + scalarField& Y2, + const scalar sigma2, + const label cellj, + const scalar volj + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "TrajectoryCollision.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H index 2b4a7cea96..20876115ac 100644 --- a/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H +++ b/src/thermophysicalModels/thermophysicalFunctions/NSRDSfunctions/NSRDSfunc14/NSRDSfunc14.H @@ -105,9 +105,11 @@ public: //- Evaluate the function and return the result scalar f(scalar, scalar T) const { - scalar t = 1.0 - T/Tc_; + scalar Tdash = min(T, Tc_ - ROOTVSMALL); + + scalar t = 1.0 - Tdash/Tc_; return - a_*a_/t + b_ - t + a_*a_/(t + ROOTVSMALL) + b_ - t *( 2.0*a_*c_ + t*(a_*d_ + t*(c_*c_/3.0 + t*(0.5*c_*d_ + 0.2*d_*d_*t))) diff --git a/tutorials/combustion/dieselFoam/aachenBomb/0/N2 b/tutorials/combustion/dieselFoam/aachenBomb/0/N2 index f15397bef0..291efd9c59 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/0/N2 +++ b/tutorials/combustion/dieselFoam/aachenBomb/0/N2 @@ -24,17 +24,6 @@ boundaryField { type zeroGradient; } - - front - { - type wedge; - } - - back - { - type wedge; - } - } // ************************************************************************* // diff --git a/tutorials/combustion/dieselFoam/aachenBomb/0/O2 b/tutorials/combustion/dieselFoam/aachenBomb/0/O2 index ca30375832..bacf89cb28 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/0/O2 +++ b/tutorials/combustion/dieselFoam/aachenBomb/0/O2 @@ -16,7 +16,7 @@ FoamFile dimensions [ 0 0 0 0 0 0 0 ]; -internalField uniform 0.233; +internalField uniform 0.234; boundaryField { @@ -24,17 +24,6 @@ boundaryField { type zeroGradient; } - - front - { - type wedge; - } - - back - { - type wedge; - } - } // ************************************************************************* // diff --git a/tutorials/combustion/dieselFoam/aachenBomb/0/T b/tutorials/combustion/dieselFoam/aachenBomb/0/T index 9d2f8a8803..b6ffeed49c 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/0/T +++ b/tutorials/combustion/dieselFoam/aachenBomb/0/T @@ -24,17 +24,6 @@ boundaryField { type zeroGradient; } - - front - { - type wedge; - } - - back - { - type wedge; - } - } // ************************************************************************* // diff --git a/tutorials/combustion/dieselFoam/aachenBomb/0/U b/tutorials/combustion/dieselFoam/aachenBomb/0/U index 4777f8ff7d..98260b8fb4 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/0/U +++ b/tutorials/combustion/dieselFoam/aachenBomb/0/U @@ -25,17 +25,6 @@ boundaryField type fixedValue; value uniform ( 0 0 0 ); } - - front - { - type wedge; - } - - back - { - type wedge; - } - } // ************************************************************************* // diff --git a/tutorials/combustion/dieselFoam/aachenBomb/0/Ydefault b/tutorials/combustion/dieselFoam/aachenBomb/0/Ydefault index 0111a785f6..aa09e6037d 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/0/Ydefault +++ b/tutorials/combustion/dieselFoam/aachenBomb/0/Ydefault @@ -24,17 +24,6 @@ boundaryField { type zeroGradient; } - - front - { - type wedge; - } - - back - { - type wedge; - } - } // ************************************************************************* // diff --git a/tutorials/combustion/dieselFoam/aachenBomb/0/p b/tutorials/combustion/dieselFoam/aachenBomb/0/p index be93534121..ec8fdc7ad1 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/0/p +++ b/tutorials/combustion/dieselFoam/aachenBomb/0/p @@ -22,18 +22,7 @@ boundaryField { walls { - type buoyantPressure; - value uniform 5e+06; - } - - front - { - type wedge; - } - - back - { - type wedge; + type zeroGradient; } } diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/N2 b/tutorials/lagrangian/sprayFoam/aachenBomb/0/N2 new file mode 100644 index 0000000000..291efd9c59 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/N2 @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object N2; +} +// ************************************************************************* // + +dimensions [ 0 0 0 0 0 0 0 ]; + +internalField uniform 0.766; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/O2 b/tutorials/lagrangian/sprayFoam/aachenBomb/0/O2 new file mode 100644 index 0000000000..bacf89cb28 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/O2 @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object O2; +} +// ************************************************************************* // + +dimensions [ 0 0 0 0 0 0 0 ]; + +internalField uniform 0.234; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/T b/tutorials/lagrangian/sprayFoam/aachenBomb/0/T new file mode 100644 index 0000000000..b6ffeed49c --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/T @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// ************************************************************************* // + +dimensions [ 0 0 0 1 0 0 0 ]; + +internalField uniform 800; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/U b/tutorials/lagrangian/sprayFoam/aachenBomb/0/U new file mode 100644 index 0000000000..98260b8fb4 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/U @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// ************************************************************************* // + +dimensions [ 0 1 -1 0 0 0 0 ]; + +internalField uniform ( 0 0 0 ); + +boundaryField +{ + walls + { + type fixedValue; + value uniform ( 0 0 0 ); + } +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/Ydefault b/tutorials/lagrangian/sprayFoam/aachenBomb/0/Ydefault new file mode 100644 index 0000000000..1039e373fe --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/Ydefault @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object Ydefault; +} +// ************************************************************************* // + +dimensions [ 0 0 0 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/alphat b/tutorials/lagrangian/sprayFoam/aachenBomb/0/alphat new file mode 100644 index 0000000000..e4dedc2b7c --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/alphat @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type alphatWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/epsilon b/tutorials/lagrangian/sprayFoam/aachenBomb/0/epsilon new file mode 100644 index 0000000000..6f3bc5bfc6 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/epsilon @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 90; + +boundaryField +{ + walls + { + type compressible::epsilonWallFunction; + value uniform 90; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/k b/tutorials/lagrangian/sprayFoam/aachenBomb/0/k new file mode 100644 index 0000000000..29b4aafe91 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/k @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 1; + +boundaryField +{ + walls + { + type compressible::kqRWallFunction; + value uniform 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/mut b/tutorials/lagrangian/sprayFoam/aachenBomb/0/mut new file mode 100644 index 0000000000..c57432b38a --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/mut @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0"; + object mut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type mutkWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/0/p b/tutorials/lagrangian/sprayFoam/aachenBomb/0/p new file mode 100644 index 0000000000..ec8fdc7ad1 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/0/p @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// ************************************************************************* // + +dimensions [ 1 -1 -2 0 0 0 0 ]; + +internalField uniform 5e+06; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/chem.inp b/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/chem.inp new file mode 100644 index 0000000000..0d91472425 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/chem.inp @@ -0,0 +1,11 @@ +ELEMENTS + H O C N AR +END +SPECIE +C7H16 O2 N2 CO2 H2O +END +REACTIONS + C7H16 + 11O2 => 7CO2 + 8H2O 5.00E+8 0.0 15780.0! 1 + FORD / C7H16 0.25 / + FORD / O2 1.5 / +END diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/RASProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/RASProperties new file mode 100644 index 0000000000..b94225f096 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/chemistryProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/chemistryProperties new file mode 100644 index 0000000000..3a7d1a555b --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/chemistryProperties @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object chemistryProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +psiChemistryModel ODEChemistryModel; + +chemistry off; + +chemistrySolver ode; + +initialChemicalTimeStep 1e-07; + +turbulentReaction yes; + +Cmix Cmix [0 0 0 0 0] 1; + +odeCoeffs +{ + ODESolver SIBS; + eps 0.05; +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/g b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/g new file mode 100644 index 0000000000..24985ce802 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0 ); + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/polyMesh/blockMeshDict b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000..822baede79 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/polyMesh/blockMeshDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + (-10 0 -10) + (-10 0 10) + (10 0 10) + (10 0 -10) + (-10 100 -10) + (-10 100 10) + (10 100 10) + (10 100 -10) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (41 41 100) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + wall walls + ( + (2 6 5 1) + (0 4 7 3) + (0 1 5 4) + (4 5 6 7) + (7 6 2 3) + (3 2 1 0) + ) +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/polyMesh/boundary b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/polyMesh/boundary new file mode 100644 index 0000000000..278bfcb94f --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/polyMesh/boundary @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +1 +( + walls + { + type wall; + nFaces 19762; + startFace 494419; + } +) + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/radiationProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/radiationProperties new file mode 100644 index 0000000000..3e3cafa0a5 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/radiationProperties @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation off; + +radiationModel none; + +solverFreq 10; + +P1Coeffs +{ + C C [ 0 0 0 0 0 0 0 ] 0; +} + +absorptionEmissionModel binaryAbsorptionEmission; + +binaryAbsorptionEmissionCoeffs +{ + model1 + { + absorptionEmissionModel constantAbsorptionEmission; + constantAbsorptionEmissionCoeffs + { + a a [ 0 -1 0 0 0 0 0 ] 0.5; + e e [ 0 -1 0 0 0 0 0 ] 0.5; + E E [ 1 -1 -3 0 0 0 0 ] 0; + } + } + model2 + { + absorptionEmissionModel cloudAbsorptionEmission; + cloudAbsorptionEmissionCoeffs + { + cloudNames + ( + sprayCloud + ); + } + } +} + +scatterModel cloudScatter; + +cloudScatterCoeffs +{ + cloudNames + ( + sprayCloud + ); +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties new file mode 100644 index 0000000000..4a033313dc --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties @@ -0,0 +1,215 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class dictionary; + location "constant"; + object SprayCloudProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solution +{ + active true; + coupled true; + transient yes; + cellValueSourceCorrection on; + + sourceTerms + { + schemes + { + rho explicit 1; + U explicit 1; + Yi explicit 1; + hs explicit 1; + } + } + + interpolationSchemes + { + rho cell; + U cellPoint; + mu cell; + T cell; + Cp cell; + p cell; + } + + integrationSchemes + { + U Euler; + T analytical; + } +} + + +constantProperties +{ + parcelTypeId 1; + + rhoMin 1e-15; + TMin 200; + pMin 1000; + minParticleMass 1e-15; + + rho0 1000; + T0 300; + Cp0 4187; + + youngsModulus 1e9; + poissonsRatio 0.35; + + epsilon0 1; + f0 0.5; + Pr 0.7; + Tvap 273; + Tbp 373; + + constantVolume false; +} + + +subModels +{ + particleForces + { + sphereDrag; + } + + injectionModel coneNozzleInjection; + + dispersionModel none; + + patchInteractionModel standardWallInteraction; + + heatTransferModel RanzMarshall; + + compositionModel singlePhaseMixture; + + phaseChangeModel liquidEvaporation; + + surfaceFilmModel none; + + atomizationModel none; + + breakupModel PilchErdman; + + stochasticCollisionModel none; + + radiation off; + + coneNozzleInjectionCoeffs + { + SOI 0; + massTotal 6.0e-6; + parcelBasisType mass; + injectionMethod disc; + outerNozzleDiameter 1.9e-4; + innerNozzleDiameter 0; + duration 1.25e-3; + position ( 0 0.0995 0 ); + direction ( 0 -1 0 ); + parcelsPerSecond 100000000; + volumeFlowRate table + ( + (0 0.1272) + (4.16667e-05 6.1634) + (8.33333e-05 9.4778) + (0.000125 9.5806) + (0.000166667 9.4184) + (0.000208333 9.0926) + (0.00025 8.7011) + (0.000291667 8.2239) + (0.000333333 8.0401) + (0.000375 8.845) + (0.000416667 8.9174) + (0.000458333 8.8688) + (0.0005 8.8882) + (0.000541667 8.6923) + (0.000583333 8.0014) + (0.000625 7.2582) + (0.000666667 7.2757) + (0.000708333 6.968) + (0.00075 6.7608) + (0.000791667 6.6502) + (0.000833333 6.7695) + (0.000875 5.5774) + (0.000916667 4.8649) + (0.000958333 5.0805) + (0.001 4.9547) + (0.00104167 4.5613) + (0.00108333 4.4536) + (0.001125 5.2651) + (0.00116667 5.256) + (0.00120833 5.1737) + (0.00125 3.9213) + ); + + Cd constant 0.85; + + thetaInner constant 0.0; + thetaOuter constant 10.0; + + sizeDistribution + { + type uniform; + + uniformDistribution + { + minValue 1.0e-4; + maxValue 1.1e-4; + } + + } + } + + standardWallInteractionCoeffs + { + type rebound; + } + + RanzMarshallCoeffs + { + BirdCorrection true; + } + + singlePhaseMixtureCoeffs + { + phases + ( + liquid + { + C7H16 1; + } + ); + } + + liquidEvaporationCoeffs + { + enthalpyTransfer enthalpyDifference; + + activeLiquids ( C7H16 ); + } + + PilchErdmanCoeffs + { + solveOscillationEq false; + B1 0.375; + B2 0.236; + } +} + + +cloudFunctions +{} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties new file mode 100644 index 0000000000..8c8ddf3c6d --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType hsPsiMixtureThermo>; + +CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; + +CHEMKINThermoFile "~OpenFOAM/thermoData/therm.dat"; + +inertSpecie N2; + + +liquids +{ + liquidComponents ( C7H16 ); + C7H16 + { + defaultCoeffs yes; + } +} + +solids +{ + solidComponents ( ); +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/turbulenceProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/turbulenceProperties new file mode 100644 index 0000000000..8750aee18e --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/system/controlDict b/tutorials/lagrangian/sprayFoam/aachenBomb/system/controlDict new file mode 100644 index 0000000000..38dd94a7dc --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/system/controlDict @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application sprayFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.01; + +deltaT 2.5e-06; + +writeControl adjustableRunTime; + +writeInterval 5e-05; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +adjustTimeStep yes; + +maxCo 0.1; + +runTimeModifiable yes; + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSchemes b/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSchemes new file mode 100644 index 0000000000..6c5f4f9422 --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSchemes @@ -0,0 +1,72 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss upwind; + div(phid,p) Gauss upwind; + div(phiU,p) Gauss linear; + div(phi,hs) Gauss upwind; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(U) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; + div(phi,Yi_h) Gauss upwind; +} + +laplacianSchemes +{ + default Gauss linear corrected; + laplacian(muEff,U) Gauss linear corrected; + laplacian(mut,U) Gauss linear corrected; + laplacian(DkEff,k) Gauss linear corrected; + laplacian(DepsilonEff,epsilon) Gauss linear corrected; + laplacian(DREff,R) Gauss linear corrected; + laplacian((rho*(1|A(U))),p) Gauss linear corrected; + laplacian(alphaEff,hs) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p ; +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSolution b/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSolution new file mode 100644 index 0000000000..5391299bfc --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSolution @@ -0,0 +1,94 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver PCG; + preconditioner DIC; + tolerance 1e-05; + relTol 0.1; + } + + rhoFinal + { + $rho; + tolerance 1e-05; + relTol 0; + } + + "(U|hs)" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + } + + p + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0.1; + } + + pFinal + { + $p; + tolerance 1e-06; + relTol 0; + } + + "(U|hs)Final" + { + $U; + tolerance 1e-05; + relTol 0; + } + + "(k|epsilon)" + { + $U; + } + + "(k|epsilon)Final" + { + $UFinal; + } + + "(Yi|O2|N2|H2O)" + { + $UFinal; + } +} + +PIMPLE +{ + transonic no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + momentumPredictor yes; +} + +relaxationFactors +{ + ".*Final" 1; +} + +// ************************************************************************* //