diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H index 06997e52ec..0b7ec84dfe 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H @@ -38,6 +38,7 @@ // calculated from the relaxed pressure U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf); U.correctBoundaryConditions(); + fvOptions.correct(U); } } diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H index c07a344017..53fec2e1b6 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H @@ -41,6 +41,7 @@ // calculated from the relaxed pressure U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf); U.correctBoundaryConditions(); + fvOptions.correct(U); } } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwclean b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwclean index cc138bc068..8af1402435 100755 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwclean +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwclean @@ -2,9 +2,9 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wclean libso phaseModel +wclean libso twoPhaseSystem wclean libso interfacialModels -wclean libso kineticTheoryModels +wclean libso phaseIncompressibleTurbulenceModels wclean # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwmake b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwmake index 29294d166a..6ba04af789 100755 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwmake +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Allwmake @@ -2,9 +2,10 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wmake libso phaseModel +wmakeLnInclude interfacialModels +wmake libso twoPhaseSystem wmake libso interfacialModels -wmake libso kineticTheoryModels +wmake libso phaseIncompressibleTurbulenceModels wmake # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H index 1810bdd4d9..3127450f00 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H @@ -1,22 +1,12 @@ { - volScalarField k1 - ( - "k1", - alpha1*(thermo1.alpha()/rho1 + sqr(Ct)*nut2*thermo1.CpByCpv()/Prt) - ); - - volScalarField k2 - ( - "k2", - alpha2*(thermo2.alpha()/rho2 + nut2*thermo2.CpByCpv()/Prt) - ); - volScalarField& he1 = thermo1.he(); volScalarField& he2 = thermo2.he(); volScalarField Cpv1(thermo1.Cpv()); volScalarField Cpv2(thermo2.Cpv()); + volScalarField heatTransferCoeff(fluid.heatTransferCoeff()); + fvScalarMatrix he1Eqn ( fvm::ddt(alpha1, he1) + fvm::div(alphaPhi1, he1) @@ -32,7 +22,8 @@ : -alpha1*dpdt )/rho1 - - fvm::laplacian(k1, he1) + //***HGW- fvm::laplacian(alpha1*turbulence1->alphaEff(), he1) + - fvm::laplacian(alpha1*turbulence1->nuEff(), he1) == heatTransferCoeff*(thermo2.T() - thermo1.T())/rho1 + heatTransferCoeff*he1/Cpv1/rho1 @@ -54,7 +45,8 @@ : -alpha2*dpdt )/rho2 - - fvm::laplacian(k2, he2) + //***HGW- fvm::laplacian(alpha2*turbulence2->alphaEff(), he2) + - fvm::laplacian(alpha2*turbulence2->nuEff(), he2) == heatTransferCoeff*(thermo1.T() - thermo2.T())/rho2 + heatTransferCoeff*he2/Cpv2/rho2 diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options index d90ba7bbbd..ac52ae02ae 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options @@ -2,18 +2,22 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ - -IturbulenceModel \ - -IkineticTheoryModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ + -IphaseIncompressibleTurbulenceModels/lnInclude \ -IinterfacialModels/lnInclude \ - -IphaseModel/lnInclude \ + -ItwoPhaseSystem/lnInclude \ -Iaveraging EXE_LIBS = \ -lfluidThermophysicalModels \ -lspecie \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lphaseIncompressibleTurbulenceModels \ -lincompressibleTransportModels \ - -lcompressiblePhaseModel \ + -lcompressibleTwoPhaseSystem \ -lcompressibleEulerianInterfacialModels \ - -lcompressibleKineticTheoryModel \ -lfiniteVolume \ -lmeshTools diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H index ae22926c4e..dea48be335 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H @@ -5,31 +5,12 @@ mrfZones.correctBoundaryVelocity(U); fvVectorMatrix U1Eqn(U1, U1.dimensions()*dimVol/dimTime); fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); +volScalarField dragCoeff(fluid.dragCoeff()); + { + volVectorField liftForce(fluid.liftForce(U)); + { - volTensorField gradU1T(fvc::grad(U1)().T()); - - if (kineticTheory.on()) - { - kineticTheory.solve(gradU1T); - nuEff1 = kineticTheory.mu1()/rho1; - } - else // If not using kinetic theory is using Ct model - { - nuEff1 = sqr(Ct)*nut2 + thermo1.mu()/rho1; - } - - volTensorField Rc1 - ( - "Rc", - (((2.0/3.0)*I)*nuEff1)*tr(gradU1T) - nuEff1*gradU1T - ); - - if (kineticTheory.on()) - { - Rc1 -= ((kineticTheory.lambda()/rho1)*tr(gradU1T))*tensor(I); - } - U1Eqn = ( fvm::ddt(alpha1, U1) @@ -38,31 +19,23 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); // Compressibity correction - fvm::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), U1) - + Cvm*rho2*alpha1*alpha2/rho1* + + fluid.Cvm()*rho2*alpha1*alpha2/rho1* ( fvm::ddt(U1) + fvm::div(phi1, U1) - fvm::Sp(fvc::div(phi1), U1) ) - - fvm::laplacian(alpha1*nuEff1, U1) - + fvc::div(alpha1*Rc1) + + turbulence1->divDevReff(U1) == - fvm::Sp(dragCoeff/rho1, U1) - - alpha1*alpha2/rho1*(liftForce - Cvm*rho2*DDtU2) + - alpha1*alpha2/rho1*(liftForce - fluid.Cvm()*rho2*DDtU2) ); - mrfZones.addCoriolis(alpha1*(1 + Cvm*rho2*alpha2/rho1), U1Eqn); + mrfZones.addCoriolis(alpha1*(1 + fluid.Cvm()*rho2*alpha2/rho1), U1Eqn); U1Eqn.relax(); } { - volTensorField gradU2T(fvc::grad(U2)().T()); - volTensorField Rc2 - ( - "Rc", - (((2.0/3.0)*I)*nuEff2)*tr(gradU2T) - nuEff2*gradU2T - ); - U2Eqn = ( fvm::ddt(alpha2, U2) @@ -71,20 +44,18 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); // Compressibity correction - fvm::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), U2) - + Cvm*rho2*alpha1*alpha2/rho2* + + fluid.Cvm()*rho2*alpha1*alpha2/rho2* ( fvm::ddt(U2) + fvm::div(phi2, U2) - fvm::Sp(fvc::div(phi2), U2) ) - - - fvm::laplacian(alpha2*nuEff2, U2) - + fvc::div(alpha2*Rc2) + + turbulence2->divDevReff(U2) == - fvm::Sp(dragCoeff/rho2, U2) - + alpha1*alpha2/rho2*(liftForce + Cvm*rho2*DDtU1) + + alpha1*alpha2/rho2*(liftForce + fluid.Cvm()*rho2*DDtU1) ); - mrfZones.addCoriolis(alpha2*(1 + Cvm*rho2*alpha1/rho2), U2Eqn); + mrfZones.addCoriolis(alpha2*(1 + fluid.Cvm()*rho2*alpha1/rho2), U2Eqn); U2Eqn.relax(); } } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H index 601ff0e919..2bd8277caa 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H @@ -1,6 +1,3 @@ -surfaceScalarField alphaPhi1("alphaPhi" + phase1Name, phi1); -surfaceScalarField alphaPhi2("alphaPhi" + phase2Name, phi2); - { word alphaScheme("div(phi," + alpha1.name() + ')'); word alpharScheme("div(phir," + alpha1.name() + ')'); @@ -8,12 +5,23 @@ surfaceScalarField alphaPhi2("alphaPhi" + phase2Name, phi2); surfaceScalarField phic("phic", phi); surfaceScalarField phir("phir", phi1 - phi2); - if (g0.value() > 0.0) + surfaceScalarField alpha1f(fvc::interpolate(max(alpha1, 0.0))); + + tmp pPrimeByA; + + if (implicitPhasePressure) { - surfaceScalarField alpha1f(fvc::interpolate(alpha1)); - surfaceScalarField phipp(ppMagf*fvc::snGrad(alpha1)*mesh.magSf()); - phir += phipp; - phic += alpha1f*phipp; + pPrimeByA = + fvc::interpolate((1.0/rho1)*rAU1*turbulence1().pPrime()) + + fvc::interpolate((1.0/rho2)*rAU2*turbulence2().pPrime()); + + surfaceScalarField phiP + ( + pPrimeByA()*fvc::snGrad(alpha1, "bounded")*mesh.magSf() + ); + + phic += alpha1f*phiP; + phir += phiP; } for (int acorr=0; acorr 0 ? alphaMax : 1), + 1, 0 ); @@ -104,61 +112,19 @@ surfaceScalarField alphaPhi2("alphaPhi" + phase2Name, phi2); { alphaPhi1 = alphaPhic1; } - - /* - // Legacy semi-implicit and potentially unbounded form - fvScalarMatrix alpha1Eqn - ( - fvm::ddt(alpha1) - + fvm::div(phic, alpha1, alphaScheme) - + fvm::div - ( - -fvc::flux(-phir, alpha2, alpharScheme), - alpha1, - alpharScheme - ) - == - fvm::Sp(Sp, alpha1) + Su - ); - - alpha1Eqn.relax(); - alpha1Eqn.solve(); - - if (nAlphaSubCycles > 1) - { - alphaPhi1 += (runTime.deltaT()/totalDeltaT)*alpha1Eqn.flux(); - } - else - { - alphaPhi1 = alpha1Eqn.flux(); - } - */ } - if (g0.value() > 0.0) + if (implicitPhasePressure) { - surfaceScalarField alpha1f(fvc::interpolate(alpha1)); - - ppMagf = - fvc::interpolate((1.0/rho1)*rAU1) - *g0*min(exp(preAlphaExp*(alpha1f - alphaMax)), expMax); - fvScalarMatrix alpha1Eqn ( fvm::ddt(alpha1) - fvc::ddt(alpha1) - - fvm::laplacian - ( - alpha1f*ppMagf, - alpha1, - "laplacian(alpha1PpMag,alpha1)" - ) + - fvm::laplacian(alpha1f*pPrimeByA, alpha1, "bounded") ); alpha1Eqn.relax(); alpha1Eqn.solve(); - #include "packingLimiter.H" - alphaPhi1 += alpha1Eqn.flux(); } @@ -173,4 +139,4 @@ surfaceScalarField alphaPhi2("alphaPhi" + phase2Name, phi2); } } -rho = alpha1*rho1 + alpha2*rho2; +rho = fluid.rho(); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C index 50266a195e..22018f9d8c 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C @@ -34,21 +34,11 @@ Description #include "MULES.H" #include "subCycle.H" #include "rhoThermo.H" -#include "nearWallDist.H" -#include "wallFvPatch.H" -#include "fixedValueFvsPatchFields.H" -#include "Switch.H" - -#include "IFstream.H" -#include "OFstream.H" - -#include "phaseModel.H" +#include "twoPhaseSystem.H" #include "dragModel.H" #include "heatTransferModel.H" -#include "kineticTheoryModel.H" - +#include "PhaseIncompressibleTurbulenceModel.H" #include "pimpleControl.H" - #include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -62,7 +52,6 @@ int main(int argc, char *argv[]) #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createMRFZones.H" - #include "readPPProperties.H" #include "initContinuityErrs.H" #include "readTimeControls.H" #include "CourantNos.H" @@ -87,8 +76,6 @@ int main(int argc, char *argv[]) while (pimple.loop()) { #include "alphaEqn.H" - #include "kEpsilon.H" - #include "interfacialCoeffs.H" #include "EEqns.H" #include "UEqns.H" @@ -99,6 +86,12 @@ int main(int argc, char *argv[]) } #include "DDtU.H" + + if (pimple.turbCorr()) + { + turbulence1->correct(); + turbulence2->correct(); + } } #include "write.H" diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H index 5b030b95ea..f279445cf6 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H @@ -1,64 +1,38 @@ - Info<< "Reading transportProperties\n" << endl; + Info<< "Creating twoPhaseSystem\n" << endl; - IOdictionary transportProperties + twoPhaseSystem fluid(mesh); + + phaseModel& phase1 = fluid.phase1(); + phaseModel& phase2 = fluid.phase2(); + + volScalarField& alpha1 = phase1; + volScalarField& alpha2 = phase2; + + volVectorField& U1 = phase1.U(); + surfaceScalarField& phi1 = phase1.phi(); + surfaceScalarField alphaPhi1 ( - IOobject - ( - "transportProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) + IOobject::groupName("alphaPhi", phase1.name()), + fvc::interpolate(alpha1)*phi1 ); - word phase1Name + volVectorField& U2 = phase2.U(); + surfaceScalarField& phi2 = phase2.phi(); + surfaceScalarField alphaPhi2 ( - transportProperties.found("phases") - ? wordList(transportProperties.lookup("phases"))[0] - : "1" + IOobject::groupName("alphaPhi", phase2.name()), + fvc::interpolate(alpha2)*phi2 ); - word phase2Name - ( - transportProperties.found("phases") - ? wordList(transportProperties.lookup("phases"))[1] - : "2" - ); - - autoPtr phase1 = phaseModel::New - ( - mesh, - transportProperties, - phase1Name - ); - - autoPtr phase2 = phaseModel::New - ( - mesh, - transportProperties, - phase2Name - ); - - volScalarField& alpha1 = phase1(); - volScalarField& alpha2 = phase2(); - alpha2 = scalar(1) - alpha1; - - volVectorField& U1 = phase1->U(); - surfaceScalarField& phi1 = phase1->phi(); - - volVectorField& U2 = phase2->U(); - surfaceScalarField& phi2 = phase2->phi(); - dimensionedScalar pMin ( "pMin", dimPressure, - transportProperties.lookup("pMin") + fluid.lookup("pMin") ); - rhoThermo& thermo1 = phase1->thermo(); - rhoThermo& thermo2 = phase2->thermo(); + rhoThermo& thermo1 = phase1.thermo(); + rhoThermo& thermo2 = phase2.thermo(); volScalarField& p = thermo1.p(); @@ -78,7 +52,7 @@ IOobject::NO_READ, IOobject::AUTO_WRITE ), - alpha1*U1 + alpha2*U2 + fluid.U() ); surfaceScalarField phi @@ -91,7 +65,7 @@ IOobject::NO_READ, IOobject::AUTO_WRITE ), - fvc::interpolate(alpha1)*phi1 + fvc::interpolate(alpha2)*phi2 + fluid.phi() ); volScalarField rho @@ -104,7 +78,7 @@ IOobject::NO_READ, IOobject::AUTO_WRITE ), - alpha1*rho1 + alpha2*rho2 + fluid.rho() ); Info<< "Calculating field DDtU1 and DDtU2\n" << endl; @@ -127,119 +101,11 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - dimensionedScalar Cvm - ( - "Cvm", - dimless, - transportProperties.lookup("Cvm") - ); - - dimensionedScalar Cl - ( - "Cl", - dimless, - transportProperties.lookup("Cl") - ); - - dimensionedScalar Ct - ( - "Ct", - dimless, - transportProperties.lookup("Ct") - ); - - #include "createRASTurbulence.H" - - IOdictionary interfacialProperties - ( - IOobject - ( - "interfacialProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - autoPtr drag1 = dragModel::New - ( - interfacialProperties, - alpha1, - phase1, - phase2 - ); - - autoPtr drag2 = dragModel::New - ( - interfacialProperties, - alpha2, - phase2, - phase1 - ); - - autoPtr heatTransfer1 = heatTransferModel::New - ( - interfacialProperties, - alpha1, - phase1, - phase2 - ); - - autoPtr heatTransfer2 = heatTransferModel::New - ( - interfacialProperties, - alpha2, - phase2, - phase1 - ); - - word dispersedPhase(interfacialProperties.lookup("dispersedPhase")); - - if - ( - !( - dispersedPhase == phase1Name - || dispersedPhase == phase2Name - || dispersedPhase == "both" - ) - ) - { - FatalErrorIn(args.executable()) - << "invalid dispersedPhase " << dispersedPhase - << exit(FatalError); - } - - Info << "dispersedPhase is " << dispersedPhase << endl; - - scalar residualPhaseFraction - ( - readScalar - ( - interfacialProperties.lookup("residualPhaseFraction") - ) - ); - - dimensionedScalar residualSlip - ( - "residualSlip", - dimVelocity, - interfacialProperties.lookup("residualSlip") - ); - - kineticTheoryModel kineticTheory - ( - phase1, - U2, - alpha1, - drag1 - ); - volScalarField rAU1 ( IOobject ( - "rAU" + phase1Name, + IOobject::groupName("rAU", phase1.name()), runTime.timeName(), mesh, IOobject::NO_READ, @@ -249,21 +115,20 @@ dimensionedScalar("zero", dimensionSet(0, 0, 1, 0, 0), 0.0) ); - surfaceScalarField ppMagf + volScalarField rAU2 ( IOobject ( - "ppMagf", + IOobject::groupName("rAU", phase2.name()), runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, - dimensionedScalar("zero", dimensionSet(0, 2, -1, 0, 0), 0.0) + dimensionedScalar("zero", dimensionSet(0, 0, 1, 0, 0), 0.0) ); - label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue); @@ -290,5 +155,31 @@ Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K1("K" + phase1Name, 0.5*magSqr(U1)); - volScalarField K2("K" + phase2Name, 0.5*magSqr(U2)); + volScalarField K1(IOobject::groupName("K", phase1.name()), 0.5*magSqr(U1)); + volScalarField K2(IOobject::groupName("K", phase2.name()), 0.5*magSqr(U2)); + + autoPtr > + turbulence1 + ( + PhaseIncompressibleTurbulenceModel::New + ( + alpha1, + U1, + alphaPhi1, + phi1, + phase1 + ) + ); + + autoPtr > + turbulence2 + ( + PhaseIncompressibleTurbulenceModel::New + ( + alpha2, + U2, + alphaPhi2, + phi2, + phase2 + ) + ); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createRASTurbulence.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createRASTurbulence.H deleted file mode 100644 index 0a782ef51e..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createRASTurbulence.H +++ /dev/null @@ -1,189 +0,0 @@ - IOdictionary RASProperties - ( - IOobject - ( - "RASProperties", - runTime.constant(), - mesh, - //IOobject::MUST_READ_IF_MODIFIED, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - - Switch turbulence - ( - RASProperties.lookup("turbulence") - ); - - dictionary kEpsilonDict - ( - RASProperties.subDictPtr("kEpsilonCoeffs") - ); - - dimensionedScalar Cmu - ( - dimensionedScalar::lookupOrAddToDict - ( - "Cmu", - kEpsilonDict, - 0.09 - ) - ); - - dimensionedScalar C1 - ( - dimensionedScalar::lookupOrAddToDict - ( - "C1", - kEpsilonDict, - 1.44 - ) - ); - - dimensionedScalar C2 - ( - dimensionedScalar::lookupOrAddToDict - ( - "C2", - kEpsilonDict, - 1.92 - ) - ); - - dimensionedScalar alpha1k - ( - dimensionedScalar::lookupOrAddToDict - ( - "alpha1k", - kEpsilonDict, - 1.0 - ) - ); - - dimensionedScalar alpha1Eps - ( - dimensionedScalar::lookupOrAddToDict - ( - "alpha1Eps", - kEpsilonDict, - 0.76923 - ) - ); - - dimensionedScalar Prt - ( - dimensioned::lookupOrAddToDict - ( - "Prt", - kEpsilonDict, - 1.0 - ) - ); - - dictionary wallFunctionDict - ( - RASProperties.subDictPtr("wallFunctionCoeffs") - ); - - dimensionedScalar kappa - ( - dimensionedScalar::lookupOrAddToDict - ( - "kappa", - wallFunctionDict, - 0.41 - ) - ); - - dimensionedScalar E - ( - dimensionedScalar::lookupOrAddToDict - ( - "E", - wallFunctionDict, - 9.8 - ) - ); - - if (RASProperties.lookupOrDefault("printCoeffs", false)) - { - Info<< "kEpsilonCoeffs" << kEpsilonDict << nl - << "wallFunctionCoeffs" << wallFunctionDict << endl; - } - - - nearWallDist y(mesh); - - - Info<< "Reading field k\n" << endl; - volScalarField k - ( - IOobject - ( - "k", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< "Reading field epsilon\n" << endl; - volScalarField epsilon - ( - IOobject - ( - "epsilon", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - - Info<< "Calculating field nut2\n" << endl; - volScalarField nut2 - ( - IOobject - ( - "nut" + phase2Name, - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - Cmu*sqr(k)/epsilon - ); - - Info<< "Calculating field nuEff1\n" << endl; - volScalarField nuEff1 - ( - IOobject - ( - "nuEff" + phase1Name, - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - sqr(Ct)*nut2 + thermo1.mu()/rho1 - ); - - Info<< "Calculating field nuEff2\n" << endl; - volScalarField nuEff2 - ( - IOobject - ( - "nuEff" + phase2Name, - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - nut2 + thermo2.mu()/rho2 - ); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialCoeffs.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialCoeffs.H deleted file mode 100644 index d53bec5ea4..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialCoeffs.H +++ /dev/null @@ -1,88 +0,0 @@ -volScalarField dragCoeff -( - IOobject - ( - "dragCoeff", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar("dragCoeff", dimensionSet(1, -3, -1, 0, 0), 0) -); - -volVectorField liftForce -( - IOobject - ( - "liftForce", - runTime.timeName(), - mesh - ), - mesh, - dimensionedVector("liftForce", dimensionSet(1, -2, -2, 0, 0), vector::zero) -); - -volScalarField heatTransferCoeff -( - IOobject - ( - "heatTransferCoeff", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar("heatTransferCoeff", dimensionSet(1, -1, -3, -1, 0), 0) -); - -{ - volVectorField Ur(U1 - U2); - volScalarField magUr(mag(Ur) + residualSlip); - - if (dispersedPhase == phase1Name) - { - dragCoeff = drag1->K(magUr); - heatTransferCoeff = heatTransfer1->K(magUr); - } - else if (dispersedPhase == phase2Name) - { - dragCoeff = drag2->K(magUr); - heatTransferCoeff = heatTransfer2->K(magUr); - } - else if (dispersedPhase == "both") - { - dragCoeff = - ( - alpha2*drag1->K(magUr) - + alpha1*drag2->K(magUr) - ); - - heatTransferCoeff = - ( - alpha2*heatTransfer1->K(magUr) - + alpha1*heatTransfer2->K(magUr) - ); - } - else - { - FatalErrorIn(args.executable()) - << "dispersedPhase: " << dispersedPhase << " is incorrect" - << exit(FatalError); - } - - volScalarField alphaCoeff(max(alpha1*alpha2, residualPhaseFraction)); - dragCoeff *= alphaCoeff; - heatTransferCoeff *= alphaCoeff; - - liftForce = Cl*(alpha1*rho1 + alpha2*rho2)*(Ur ^ fvc::curl(U)); - - // Remove lift, drag and phase heat-transfer at fixed-flux boundaries - forAll(phi1.boundaryField(), patchi) - { - if (isA(phi1.boundaryField()[patchi])) - { - dragCoeff.boundaryField()[patchi] = 0.0; - heatTransferCoeff.boundaryField()[patchi] = 0.0; - liftForce.boundaryField()[patchi] = vector::zero; - } - } -} diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options index f031e05898..e7e60696ec 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options @@ -1,9 +1,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/transportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I../phaseModel/lnInclude + -I../twoPhaseSystem/lnInclude LIB_LIBS = \ - -lcompressiblePhaseModel \ + -lcompressibleTwoPhaseSystem \ -lfluidThermophysicalModels \ -lspecie diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C index 00be8a338f..9159b28784 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C @@ -37,7 +37,7 @@ Foam::autoPtr Foam::dragModel::New { word dragModelType ( - interfaceDict.lookup("dragModel" + phase1.name()) + interfaceDict.lookup(phase1.name()) ); Info << "Selecting dragModel for phase " diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/newHeatTransferModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/newHeatTransferModel.C index aaa972032d..cf3ae97412 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/newHeatTransferModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/newHeatTransferModel.C @@ -37,7 +37,7 @@ Foam::autoPtr Foam::heatTransferModel::New { word heatTransferModelType ( - interfaceDict.lookup("heatTransferModel" + phase1.name()) + interfaceDict.lookup(phase1.name()) ); Info<< "Selecting heatTransferModel for phase " diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/files b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/files deleted file mode 100644 index 2b36d0bc31..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/files +++ /dev/null @@ -1,32 +0,0 @@ -kineticTheoryModel/kineticTheoryModel.C - -viscosityModel/viscosityModel/viscosityModel.C -viscosityModel/viscosityModel/newViscosityModel.C -viscosityModel/Gidaspow/GidaspowViscosity.C -viscosityModel/Syamlal/SyamlalViscosity.C -viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C -viscosityModel/none/noneViscosity.C - -conductivityModel/conductivityModel/conductivityModel.C -conductivityModel/conductivityModel/newConductivityModel.C -conductivityModel/Gidaspow/GidaspowConductivity.C -conductivityModel/Syamlal/SyamlalConductivity.C -conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C - -radialModel/radialModel/radialModel.C -radialModel/radialModel/newRadialModel.C -radialModel/CarnahanStarling/CarnahanStarlingRadial.C -radialModel/LunSavage/LunSavageRadial.C -radialModel/SinclairJackson/SinclairJacksonRadial.C - -granularPressureModel/granularPressureModel/granularPressureModel.C -granularPressureModel/granularPressureModel/newGranularPressureModel.C -granularPressureModel/Lun/LunPressure.C -granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C - -frictionalStressModel/frictionalStressModel/frictionalStressModel.C -frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C -frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C -frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C - -LIB = $(FOAM_LIBBIN)/libcompressibleKineticTheoryModel diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/options deleted file mode 100644 index 7fdabf5730..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/options +++ /dev/null @@ -1,6 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/foam/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I../phaseModel/lnInclude \ - -I../interfacialModels/lnInclude diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C deleted file mode 100644 index 8139356820..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ /dev/null @@ -1,389 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ 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 "kineticTheoryModel.H" -#include "surfaceInterpolate.H" -#include "mathematicalConstants.H" -#include "fvCFD.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::kineticTheoryModel::kineticTheoryModel -( - const Foam::phaseModel& phase1, - const Foam::volVectorField& U2, - const Foam::volScalarField& alpha1, - const Foam::dragModel& draga -) -: - phase1_(phase1), - U1_(phase1.U()), - U2_(U2), - alpha1_(alpha1), - phi1_(phase1.phi()), - draga_(draga), - - rho1_(phase1.rho()), - - kineticTheoryProperties_ - ( - IOobject - ( - "kineticTheoryProperties", - U1_.time().constant(), - U1_.mesh(), - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ), - kineticTheory_(kineticTheoryProperties_.lookup("kineticTheory")), - equilibrium_(kineticTheoryProperties_.lookup("equilibrium")), - - viscosityModel_ - ( - kineticTheoryModels::viscosityModel::New - ( - kineticTheoryProperties_ - ) - ), - conductivityModel_ - ( - kineticTheoryModels::conductivityModel::New - ( - kineticTheoryProperties_ - ) - ), - radialModel_ - ( - kineticTheoryModels::radialModel::New - ( - kineticTheoryProperties_ - ) - ), - granularPressureModel_ - ( - kineticTheoryModels::granularPressureModel::New - ( - kineticTheoryProperties_ - ) - ), - frictionalStressModel_ - ( - kineticTheoryModels::frictionalStressModel::New - ( - kineticTheoryProperties_ - ) - ), - e_(kineticTheoryProperties_.lookup("e")), - alphaMax_(kineticTheoryProperties_.lookup("alphaMax")), - alphaMinFriction_(kineticTheoryProperties_.lookup("alphaMinFriction")), - Fr_(kineticTheoryProperties_.lookup("Fr")), - eta_(kineticTheoryProperties_.lookup("eta")), - p_(kineticTheoryProperties_.lookup("p")), - phi_(dimensionedScalar(kineticTheoryProperties_.lookup("phi"))*M_PI/180.0), - Theta_ - ( - IOobject - ( - "Theta", - U1_.time().timeName(), - U1_.mesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - U1_.mesh() - ), - mu1_ - ( - IOobject - ( - "mu" + phase1.name(), - U1_.time().timeName(), - U1_.mesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - U1_.mesh(), - dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0) - ), - lambda_ - ( - IOobject - ( - "lambda", - U1_.time().timeName(), - U1_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - U1_.mesh(), - dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0) - ), - pa_ - ( - IOobject - ( - "pa", - U1_.time().timeName(), - U1_.mesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - U1_.mesh(), - dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0) - ), - kappa_ - ( - IOobject - ( - "kappa", - U1_.time().timeName(), - U1_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - U1_.mesh(), - dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0) - ), - gs0_ - ( - IOobject - ( - "gs0", - U1_.time().timeName(), - U1_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - U1_.mesh(), - dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 1.0) - ) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::kineticTheoryModel::~kineticTheoryModel() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::kineticTheoryModel::solve(const volTensorField& gradU1t) -{ - if (!kineticTheory_) - { - return; - } - - const scalar sqrtPi = sqrt(constant::mathematical::pi); - - volScalarField da_(phase1_.d()); - - surfaceScalarField phi(1.5*phi1_*fvc::interpolate(rho1_*alpha1_)); - - volTensorField dU(gradU1t.T()); - volSymmTensorField D(symm(dU)); - - // NB, drag = K*alpha1*alpha2, - // (the alpha1 and alpha2 has been extracted from the drag function for - // numerical reasons) - volScalarField Ur(mag(U1_ - U2_)); - volScalarField alpha2Prim(alpha1_*(1.0 - alpha1_)*draga_.K(Ur)); - - // Calculating the radial distribution function (solid volume fraction is - // limited close to the packing limit, but this needs improvements) - // The solution is higly unstable close to the packing limit. - gs0_ = radialModel_->g0 - ( - min(max(alpha1_, scalar(1e-6)), alphaMax_ - 0.01), - alphaMax_ - ); - - // particle pressure - coefficient in front of Theta (Eq. 3.22, p. 45) - volScalarField PsCoeff - ( - granularPressureModel_->granularPressureCoeff - ( - alpha1_, - gs0_, - rho1_, - e_ - ) - ); - - // 'thermal' conductivity (Table 3.3, p. 49) - kappa_ = conductivityModel_->kappa(alpha1_, Theta_, gs0_, rho1_, da_, e_); - - // particle viscosity (Table 3.2, p.47) - mu1_ = viscosityModel_->mu1(alpha1_, Theta_, gs0_, rho1_, da_, e_); - - dimensionedScalar Tsmall - ( - "small", - dimensionSet(0 , 2 ,-2 ,0 , 0, 0, 0), - 1.0e-6 - ); - - dimensionedScalar TsmallSqrt = sqrt(Tsmall); - volScalarField ThetaSqrt(sqrt(Theta_)); - - // dissipation (Eq. 3.24, p.50) - volScalarField gammaCoeff - ( - 12.0*(1.0 - sqr(e_))*sqr(alpha1_)*rho1_*gs0_*(1.0/da_)*ThetaSqrt/sqrtPi - ); - - // Eq. 3.25, p. 50 Js = J1 - J2 - volScalarField J1(3.0*alpha2Prim); - volScalarField J2 - ( - 0.25*sqr(alpha2Prim)*da_*sqr(Ur) - /(max(alpha1_, scalar(1e-6))*rho1_*sqrtPi*(ThetaSqrt + TsmallSqrt)) - ); - - // bulk viscosity p. 45 (Lun et al. 1984). - lambda_ = (4.0/3.0)*sqr(alpha1_)*rho1_*da_*gs0_*(1.0+e_)*ThetaSqrt/sqrtPi; - - // stress tensor, Definitions, Table 3.1, p. 43 - volSymmTensorField tau(2.0*mu1_*D + (lambda_ - (2.0/3.0)*mu1_)*tr(D)*I); - - if (!equilibrium_) - { - // construct the granular temperature equation (Eq. 3.20, p. 44) - // NB. note that there are two typos in Eq. 3.20 - // no grad infront of Ps - // wrong sign infront of laplacian - fvScalarMatrix ThetaEqn - ( - fvm::ddt(1.5*alpha1_*rho1_, Theta_) - + fvm::div(phi, Theta_, "div(phi,Theta)") - == - fvm::SuSp(-((PsCoeff*I) && dU), Theta_) - + (tau && dU) - + fvm::laplacian(kappa_, Theta_, "laplacian(kappa,Theta)") - + fvm::Sp(-gammaCoeff, Theta_) - + fvm::Sp(-J1, Theta_) - + fvm::Sp(J2/(Theta_ + Tsmall), Theta_) - ); - - ThetaEqn.relax(); - ThetaEqn.solve(); - } - else - { - // equilibrium => dissipation == production - // Eq. 4.14, p.82 - volScalarField K1(2.0*(1.0 + e_)*rho1_*gs0_); - volScalarField K3 - ( - 0.5*da_*rho1_* - ( - (sqrtPi/(3.0*(3.0-e_))) - *(1.0 + 0.4*(1.0 + e_)*(3.0*e_ - 1.0)*alpha1_*gs0_) - +1.6*alpha1_*gs0_*(1.0 + e_)/sqrtPi - ) - ); - - volScalarField K2 - ( - 4.0*da_*rho1_*(1.0 + e_)*alpha1_*gs0_/(3.0*sqrtPi) - 2.0*K3/3.0 - ); - - volScalarField K4(12.0*(1.0 - sqr(e_))*rho1_*gs0_/(da_*sqrtPi)); - - volScalarField trD(tr(D)); - volScalarField tr2D(sqr(trD)); - volScalarField trD2(tr(D & D)); - - volScalarField t1(K1*alpha1_ + rho1_); - volScalarField l1(-t1*trD); - volScalarField l2(sqr(t1)*tr2D); - volScalarField l3 - ( - 4.0 - *K4 - *max(alpha1_, scalar(1e-6)) - *(2.0*K3*trD2 + K2*tr2D) - ); - - Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha1_ + 1.0e-4)*K4)); - } - - Theta_.max(1.0e-15); - Theta_.min(1.0e+3); - - volScalarField pf - ( - frictionalStressModel_->frictionalPressure - ( - alpha1_, - alphaMinFriction_, - alphaMax_, - Fr_, - eta_, - p_ - ) - ); - - PsCoeff += pf/(Theta_+Tsmall); - - PsCoeff.min(1.0e+10); - PsCoeff.max(-1.0e+10); - - // update particle pressure - pa_ = PsCoeff*Theta_; - - // frictional shear stress, Eq. 3.30, p. 52 - volScalarField muf - ( - frictionalStressModel_->muf - ( - alpha1_, - alphaMax_, - pf, - D, - phi_ - ) - ); - - // add frictional stress - mu1_ += muf; - mu1_.min(1.0e+2); - mu1_.max(0.0); - - Info<< "kinTheory: max(Theta) = " << max(Theta_).value() << endl; - - volScalarField ktn(mu1_/rho1_); - - Info<< "kinTheory: min(nu1) = " << min(ktn).value() - << ", max(nu1) = " << max(ktn).value() << endl; - - Info<< "kinTheory: min(pa) = " << min(pa_).value() - << ", max(pa) = " << max(pa_).value() << endl; -} - - -// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H deleted file mode 100644 index a5861ae129..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H +++ /dev/null @@ -1,196 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ 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::kineticTheoryModel - -Description - -SourceFiles - kineticTheoryModel.C - -\*---------------------------------------------------------------------------*/ - -#ifndef kineticTheoryModel_H -#define kineticTheoryModel_H - -#include "dragModel.H" -#include "phaseModel.H" -#include "autoPtr.H" -#include "viscosityModel.H" -#include "conductivityModel.H" -#include "radialModel.H" -#include "granularPressureModel.H" -#include "frictionalStressModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class kineticTheoryModel Declaration -\*---------------------------------------------------------------------------*/ - -class kineticTheoryModel -{ - // Private data - - const phaseModel& phase1_; - const volVectorField& U1_; - const volVectorField& U2_; - const volScalarField& alpha1_; - const surfaceScalarField& phi1_; - - const dragModel& draga_; - - const volScalarField& rho1_; - - //- dictionary holding the modeling info - IOdictionary kineticTheoryProperties_; - - //- use kinetic theory or not. - Switch kineticTheory_; - - //- use generation == dissipation - Switch equilibrium_; - - autoPtr viscosityModel_; - - autoPtr conductivityModel_; - - autoPtr radialModel_; - - autoPtr - granularPressureModel_; - - autoPtr - frictionalStressModel_; - - //- coefficient of restitution - const dimensionedScalar e_; - - //- maximum packing - const dimensionedScalar alphaMax_; - - //- min value for which the frictional stresses are zero - const dimensionedScalar alphaMinFriction_; - - //- material constant for frictional normal stress - const dimensionedScalar Fr_; - - //- material constant for frictional normal stress - const dimensionedScalar eta_; - - //- material constant for frictional normal stress - const dimensionedScalar p_; - - //- angle of internal friction - const dimensionedScalar phi_; - - //- The granular energy/temperature - volScalarField Theta_; - - //- The granular viscosity - volScalarField mu1_; - - //- The granular bulk viscosity - volScalarField lambda_; - - //- The granular pressure - volScalarField pa_; - - //- The granular temperature conductivity - volScalarField kappa_; - - //- The radial distribution function - volScalarField gs0_; - - - // Private Member Functions - - //- Disallow default bitwise copy construct - kineticTheoryModel(const kineticTheoryModel&); - - //- Disallow default bitwise assignment - void operator=(const kineticTheoryModel&); - - -public: - - // Constructors - - //- Construct from components - kineticTheoryModel - ( - const phaseModel& phase1, - const volVectorField& U2, - const volScalarField& alpha1, - const dragModel& draga - ); - - - //- Destructor - virtual ~kineticTheoryModel(); - - - // Member Functions - - void solve(const volTensorField& gradU1t); - - bool on() const - { - return kineticTheory_; - } - - const volScalarField& mu1() const - { - return mu1_; - } - - const volScalarField& pa() const - { - return pa_; - } - - const volScalarField& lambda() const - { - return lambda_; - } - - const volScalarField& kappa() const - { - return kappa_; - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H index 756a231fc2..e9211def7f 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H @@ -3,15 +3,23 @@ surfaceScalarField alpha2f(scalar(1) - alpha1f); rAU1 = 1.0/U1Eqn.A(); - volScalarField rAU2(1.0/U2Eqn.A()); + rAU2 = 1.0/U2Eqn.A(); surfaceScalarField rAlphaAU1f(fvc::interpolate(alpha1*rAU1)); surfaceScalarField rAlphaAU2f(fvc::interpolate(alpha2*rAU2)); - volVectorField HbyA1("HbyA" + phase1Name, U1); + volVectorField HbyA1 + ( + IOobject::groupName("HbyA", phase1.name()), + U1 + ); HbyA1 = rAU1*U1Eqn.H(); - volVectorField HbyA2("HbyA" + phase2Name, U2); + volVectorField HbyA2 + ( + IOobject::groupName("HbyA", phase2.name()), + U2 + ); HbyA2 = rAU2*U2Eqn.H(); mrfZones.absoluteFlux(phi1.oldTime()); @@ -19,30 +27,32 @@ mrfZones.absoluteFlux(phi2.oldTime()); mrfZones.absoluteFlux(phi2); - surfaceScalarField ppDrag("ppDrag", 0.0*phi1); + // Phase-1 pressure flux (e.g. due to particle-particle pressure) + surfaceScalarField phiP1 + ( + "phiP1", + fvc::interpolate((1.0/rho1)*rAU1*turbulence1().pPrime()) + *fvc::snGrad(alpha1)*mesh.magSf() + ); - if (g0.value() > 0.0) - { - ppDrag -= ppMagf*fvc::snGrad(alpha1)*mesh.magSf(); - } - - if (kineticTheory.on()) - { - ppDrag -= - fvc::interpolate(1.0/rho1)*rAlphaAU1f - *fvc::snGrad(kineticTheory.pa())*mesh.magSf(); - } + // Phase-2 pressure flux (e.g. due to particle-particle pressure) + surfaceScalarField phiP2 + ( + "phiP2", + fvc::interpolate((1.0/rho2)*rAU2*turbulence2().pPrime()) + *fvc::snGrad(alpha2)*mesh.magSf() + ); surfaceScalarField phiHbyA1 ( - "phiHbyA" + phase1Name, + IOobject::groupName("phiHbyA", phase1.name()), (fvc::interpolate(HbyA1) & mesh.Sf()) + fvc::ddtPhiCorr(rAU1, alpha1, U1, phi1) ); surfaceScalarField phiHbyA2 ( - "phiHbyA" + phase2Name, + IOobject::groupName("phiHbyA", phase2.name()), (fvc::interpolate(HbyA2) & mesh.Sf()) + fvc::ddtPhiCorr(rAU2, alpha2, U2, phi2) ); @@ -53,7 +63,7 @@ phiHbyA1 += ( fvc::interpolate((1.0/rho1)*rAU1*dragCoeff)*phi2 - + ppDrag + - phiP1 + rAlphaAU1f*(g & mesh.Sf()) ); mrfZones.relativeFlux(phiHbyA1); @@ -61,6 +71,7 @@ phiHbyA2 += ( fvc::interpolate((1.0/rho2)*rAU2*dragCoeff)*phi1 + - phiP2 + rAlphaAU2f*(g & mesh.Sf()) ); mrfZones.relativeFlux(phiHbyA2); @@ -92,12 +103,12 @@ { surfaceScalarField phid1 ( - "phid" + phase1Name, + IOobject::groupName("phid", phase1.name()), fvc::interpolate(psi1)*phi1 ); surfaceScalarField phid2 ( - "phid" + phase2Name, + IOobject::groupName("phid", phase2.name()), fvc::interpolate(psi2)*phi2 ); @@ -173,29 +184,30 @@ mSfGradp = pEqnIncomp.flux()/Dp; U1 = HbyA1 - + fvc::reconstruct - ( - ppDrag - + rAlphaAU1f - *( - (g & mesh.Sf()) - + mSfGradp/fvc::interpolate(rho1) - ) - ); + + fvc::reconstruct + ( + rAlphaAU1f + *( + (g & mesh.Sf()) + + mSfGradp/fvc::interpolate(rho1) + ) + - phiP1 + ); U1.correctBoundaryConditions(); U2 = HbyA2 - + fvc::reconstruct - ( - rAlphaAU2f - *( + + fvc::reconstruct + ( + rAlphaAU2f + *( (g & mesh.Sf()) + mSfGradp/fvc::interpolate(rho2) ) - ); + - phiP2 + ); U2.correctBoundaryConditions(); - U = alpha1*U1 + alpha2*U2; + U = fluid.U(); } } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/packingLimiter.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/packingLimiter.H deleted file mode 100644 index 249f1035a1..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/packingLimiter.H +++ /dev/null @@ -1,36 +0,0 @@ - if (packingLimiter) - { - // Calculating exceeding volume fractions - volScalarField alpha1Ex(max(alpha1 - alphaMax, scalar(0))); - - // Finding neighbouring cells of the whole domain - labelListList neighbour = mesh.cellCells(); - scalarField cellVolumes(mesh.cellVolumes()); - - forAll (alpha1Ex, celli) - { - // Finding the labels of the neighbouring cells - labelList neighbourCell = neighbour[celli]; - - // Initializing neighbouring cells contribution - scalar neighboursEx = 0.0; - - forAll (neighbourCell, cellj) - { - labelList neighboursNeighbour = neighbour[neighbourCell[cellj]]; - scalar neighboursNeighbourCellVolumes = 0.0; - - forAll (neighboursNeighbour, cellk) - { - neighboursNeighbourCellVolumes += - cellVolumes[neighboursNeighbour[cellk]]; - } - - neighboursEx += - alpha1Ex[neighbourCell[cellj]]*cellVolumes[celli] - /neighboursNeighbourCellVolumes; - } - - alpha1[celli] += neighboursEx - alpha1Ex[celli]; - } - } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/files b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/files new file mode 100644 index 0000000000..96f9c63e4a --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/files @@ -0,0 +1,35 @@ +phaseIncompressibleTurbulenceModels.C +phasePressureModel/phasePressureModel.C + +kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C + +kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.C +kineticTheoryModels/viscosityModel/viscosityModel/newViscosityModel.C +kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C +kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C +kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C +kineticTheoryModels/viscosityModel/none/noneViscosity.C + +kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C +kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C +kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C +kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C +kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C + +kineticTheoryModels/radialModel/radialModel/radialModel.C +kineticTheoryModels/radialModel/radialModel/newRadialModel.C +kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C +kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C +kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C + +kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C +kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C +kineticTheoryModels/granularPressureModel/Lun/LunPressure.C +kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C + +kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C +kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C +kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C + +LIB = $(FOAM_LIBBIN)/libphaseIncompressibleTurbulenceModels diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/options new file mode 100644 index 0000000000..8608cd8610 --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I$(LIB_SRC)/foam/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/transportModel \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ + -I../twoPhaseSystem/lnInclude \ + -I../interfacialModels/lnInclude diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C similarity index 98% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C index ced65bf823..8f9289293e 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C @@ -80,7 +80,7 @@ Foam::kineticTheoryModels::conductivityModels::Gidaspow::kappa { const scalar sqrtPi = sqrt(constant::mathematical::pi); - return rho1*da*sqrt(Theta)* + return da*sqrt(Theta)* ( 2.0*sqr(alpha1)*g0*(1.0 + e)/sqrtPi + (9.0/8.0)*sqrtPi*g0*0.5*(1.0 + e)*sqr(alpha1) diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.H similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C similarity index 90% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C index b103a1afe2..2d2e1f6551 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C @@ -56,8 +56,8 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::HrenyaSinclair ) : conductivityModel(dict), - coeffsDict_(dict.subDict(typeName + "Coeffs")), - L_(coeffsDict_.lookup("L")) + coeffDict_(dict.subDict(typeName + "Coeffs")), + L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_.lookup("L")) {} @@ -88,7 +88,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::kappa scalar(1) + da/(6.0*sqrt(2.0)*(alpha1 + scalar(1.0e-5)))/L_ ); - return rho1*da*sqrt(Theta)* + return da*sqrt(Theta)* ( 2.0*sqr(alpha1)*g0*(1.0 + e)/sqrtPi + (9.0/8.0)*sqrtPi*0.25*sqr(1.0 + e)*(2.0*e - 1.0)*sqr(alpha1) @@ -101,4 +101,14 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::kappa } +bool Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::read() +{ + coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + + L_.readIfPresent(coeffDict_); + + return true; +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H similarity index 97% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H index e2ab8b8cca..0280a23596 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H @@ -53,12 +53,12 @@ class HrenyaSinclair : public conductivityModel { - - dictionary coeffsDict_; + dictionary coeffDict_; //- characteristic length of geometry dimensionedScalar L_; + public: //- Runtime type information @@ -86,6 +86,8 @@ public: const volScalarField& da, const dimensionedScalar& e ) const; + + virtual bool read(); }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C similarity index 98% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C index a50c6ceec4..d7dac43706 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C @@ -80,7 +80,7 @@ Foam::kineticTheoryModels::conductivityModels::Syamlal::kappa { const scalar sqrtPi = sqrt(constant::mathematical::pi); - return rho1*da*sqrt(Theta)* + return da*sqrt(Theta)* ( 2.0*sqr(alpha1)*g0*(1.0 + e)/sqrtPi + (9.0/8.0)*sqrtPi*g0*0.25*sqr(1.0 + e)*(2.0*e - 1.0)*sqr(alpha1) diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.H similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H similarity index 97% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H index 7981a2b141..f4a8a2566e 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H @@ -113,6 +113,11 @@ public: const volScalarField& da, const dimensionedScalar& e ) const = 0; + + virtual bool read() + { + return true; + } }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C similarity index 68% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C index eb7d029294..b05277dbb1 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "JohnsonJacksonFrictionalStress.H" #include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -55,8 +56,15 @@ JohnsonJackson const dictionary& dict ) : - frictionalStressModel(dict) -{} + frictionalStressModel(dict), + coeffDict_(dict.subDict(typeName + "Coeffs")), + Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_.lookup("Fr")), + eta_("eta", dimless, coeffDict_.lookup("eta")), + p_("p", dimless, coeffDict_.lookup("p")), + phi_("phi", dimless, coeffDict_.lookup("phi")) +{ + phi_ *= constant::mathematical::pi/180.0; +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -74,16 +82,13 @@ frictionalPressure ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const { return - Fr*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta) - /pow(max(alphaMax - alpha1, scalar(5.0e-2)), p); + Fr_*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta_) + /pow(max(alphaMax - alpha1, scalar(5.0e-2)), p_); } @@ -93,32 +98,41 @@ frictionalPressurePrime ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const { - return Fr* + return Fr_* ( - eta*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta - 1.0) + eta_*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta_ - 1.0) *(alphaMax-alpha1) - + p*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta) - )/pow(max(alphaMax - alpha1, scalar(5.0e-2)), p + 1.0); + + p_*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta_) + )/pow(max(alphaMax - alpha1, scalar(5.0e-2)), p_ + 1.0); } Foam::tmp -Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::muf +Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::nu ( const volScalarField& alpha1, const dimensionedScalar& alphaMax, const volScalarField& pf, - const volSymmTensorField& D, - const dimensionedScalar& phi + const volSymmTensorField& D ) const { - return dimensionedScalar("0.5", dimTime, 0.5)*pf*sin(phi); + return dimensionedScalar("0.5", dimTime, 0.5)*pf*sin(phi_); +} + + +bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read() +{ + coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + + Fr_.readIfPresent(coeffDict_); + eta_.readIfPresent(coeffDict_); + p_.readIfPresent(coeffDict_); + phi_.readIfPresent(coeffDict_); + + return true; } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H similarity index 81% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H index 985338b741..2b59c0a043 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,6 +53,22 @@ class JohnsonJackson : public frictionalStressModel { + // Private data + + dictionary coeffDict_; + + //- Material constant for frictional normal stress + dimensionedScalar Fr_; + + //- Material constant for frictional normal stress + dimensionedScalar eta_; + + //- Material constant for frictional normal stress + dimensionedScalar p_; + + //- Angle of internal friction + dimensionedScalar phi_; + public: @@ -76,30 +92,25 @@ public: ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const; virtual tmp frictionalPressurePrime ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const; - virtual tmp muf + virtual tmp nu ( const volScalarField& alpha1, const dimensionedScalar& alphaMax, const volScalarField& pf, - const volSymmTensorField& D, - const dimensionedScalar& phi + const volSymmTensorField& D ) const; + + virtual bool read(); }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C similarity index 76% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C index ec6f55ab65..537a76fecd 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,7 +54,9 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer const dictionary& dict ) : - frictionalStressModel(dict) + frictionalStressModel(dict), + coeffDict_(dict.subDict(typeName + "Coeffs")), + phi_("phi", dimless, coeffDict_.lookup("phi")) {} @@ -72,10 +74,7 @@ frictionalPressure ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const { return @@ -90,10 +89,7 @@ frictionalPressurePrime ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const { return @@ -103,42 +99,44 @@ frictionalPressurePrime Foam::tmp -Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::muf +Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu ( const volScalarField& alpha1, const dimensionedScalar& alphaMax, const volScalarField& pf, - const volSymmTensorField& D, - const dimensionedScalar& phi + const volSymmTensorField& D ) const { const scalar I2Dsmall = 1.0e-15; - // Creating muf assuming it should be 0 on the boundary which may not be + // Creating nu assuming it should be 0 on the boundary which may not be // true - tmp tmuf + tmp tnu ( new volScalarField ( IOobject ( - "muf", + "Schaeffer:nu", alpha1.mesh().time().timeName(), - alpha1.mesh() + alpha1.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false ), alpha1.mesh(), - dimensionedScalar("muf", dimensionSet(1, -1, -1, 0, 0), 0.0) + dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0.0) ) ); - volScalarField& muff = tmuf(); + volScalarField& nuf = tnu(); forAll (D, celli) { if (alpha1[celli] > alphaMax.value() - 5e-2) { - muff[celli] = - 0.5*pf[celli]*sin(phi.value()) + nuf[celli] = + 0.5*pf[celli]*sin(phi_.value()) /( sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy()) + sqr(D[celli].yy() - D[celli].zz()) @@ -149,9 +147,20 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::muf } } - muff.correctBoundaryConditions(); + // Correct coupled BCs + nuf.correctBoundaryConditions(); - return tmuf; + return tnu; +} + + +bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read() +{ + coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + + phi_.readIfPresent(coeffDict_); + + return true; } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H similarity index 84% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H index d99da3a32d..1de4d5042f 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,6 +53,13 @@ class Schaeffer : public frictionalStressModel { + // Private data + + dictionary coeffDict_; + + //- Angle of internal friction + dimensionedScalar phi_; + public: @@ -76,30 +83,25 @@ public: ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const; virtual tmp frictionalPressurePrime ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& n, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const; - virtual tmp muf + virtual tmp nu ( const volScalarField& alpha1, const dimensionedScalar& alphaMax, const volScalarField& pf, - const volSymmTensorField& D, - const dimensionedScalar& phi + const volSymmTensorField& D ) const; + + virtual bool read(); }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C similarity index 96% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C index 3b59e3615f..02e1dc702f 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H similarity index 87% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H index 913b2ad105..0da14115cf 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,6 +63,7 @@ protected: // Protected data + //- Reference to higher-level dictionary for re-read const dictionary& dict_; @@ -108,30 +109,25 @@ public: ( const volScalarField& alpha1, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const = 0; virtual tmp frictionalPressurePrime ( const volScalarField& alpha1f, const dimensionedScalar& alphaMinFriction, - const dimensionedScalar& alphaMax, - const dimensionedScalar& Fr, - const dimensionedScalar& eta, - const dimensionedScalar& p + const dimensionedScalar& alphaMax ) const = 0; - virtual tmp muf + virtual tmp nu ( const volScalarField& alpha1, const dimensionedScalar& alphaMax, const volScalarField& pf, - const volSymmTensorField& D, - const dimensionedScalar& phi + const volSymmTensorField& D ) const = 0; + + virtual bool read() = 0; }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/Lun/LunPressure.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/Lun/LunPressure.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/Lun/LunPressure.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.H similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/Lun/LunPressure.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H similarity index 98% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H index df3ef7e8c1..d30373ac2c 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H @@ -122,6 +122,11 @@ public: const volScalarField& rho1, const dimensionedScalar& e ) const = 0; + + virtual bool read() + { + return true; + } }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C new file mode 100644 index 0000000000..3af90199a6 --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -0,0 +1,546 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 "kineticTheoryModel.H" +#include "surfaceInterpolate.H" +#include "mathematicalConstants.H" +#include "twoPhaseSystem.H" +#include "fvcDiv.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModel::kineticTheoryModel +( + const volScalarField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& phase, + const word& propertiesName, + const word& type +) +: + RASModels::eddyViscosity > + ( + type, + alpha, + rho, + U, + alphaPhi, + phi, + phase, + propertiesName + ), + + phase_(phase), + + draga_(phase.fluid().drag1()), + + viscosityModel_ + ( + kineticTheoryModels::viscosityModel::New + ( + this->coeffDict_ + ) + ), + conductivityModel_ + ( + kineticTheoryModels::conductivityModel::New + ( + this->coeffDict_ + ) + ), + radialModel_ + ( + kineticTheoryModels::radialModel::New + ( + this->coeffDict_ + ) + ), + granularPressureModel_ + ( + kineticTheoryModels::granularPressureModel::New + ( + this->coeffDict_ + ) + ), + frictionalStressModel_ + ( + kineticTheoryModels::frictionalStressModel::New + ( + this->coeffDict_ + ) + ), + + equilibrium_(this->coeffDict_.lookup("equilibrium")), + e_("e", dimless, this->coeffDict_.lookup("e")), + alphaMax_("alphaMax", dimless, this->coeffDict_.lookup("alphaMax")), + alphaMinFriction_ + ( + "alphaMinFriction", + dimless, + this->coeffDict_.lookup("alphaMinFriction") + ), + + Theta_ + ( + IOobject + ( + IOobject::groupName("Theta", phase.name()), + U.time().timeName(), + U.mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + U.mesh() + ), + + lambda_ + ( + IOobject + ( + IOobject::groupName("lambda", phase.name()), + U.time().timeName(), + U.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U.mesh(), + dimensionedScalar("zero", dimensionSet(0, 2, -1, 0, 0), 0.0) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModel::~kineticTheoryModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::kineticTheoryModel::correct() +{ + // Local references + volScalarField alpha(max(this->alpha_, 0.0)); + const volScalarField& rho = phase_.rho(); + const surfaceScalarField& alphaPhi = this->alphaPhi_; + const volVectorField& U = this->U_; + const volVectorField& Uc_ = phase_.fluid().otherPhase(phase_).U(); + + const scalar sqrtPi = sqrt(constant::mathematical::pi); + dimensionedScalar ThetaSmall("ThetaSmall", Theta_.dimensions(), 1.0e-6); + dimensionedScalar ThetaSmallSqrt(sqrt(ThetaSmall)); + + tmp tda(phase_.d()); + const volScalarField& da = tda(); + + tmp tgradU(fvc::grad(this->U_)); + const volTensorField& gradU(tgradU()); + volSymmTensorField D(symm(gradU)); + + // Calculating the radial distribution function + volScalarField gs0(radialModel_->g0(alpha, alphaMinFriction_, alphaMax_)); + + if (!equilibrium_) + { + // particle viscosity (Table 3.2, p.47) + nut_ = viscosityModel_->nu(alpha, Theta_, gs0, rho, da, e_); + + volScalarField ThetaSqrt(sqrt(Theta_)); + + // Bulk viscosity p. 45 (Lun et al. 1984). + lambda_ = (4.0/3.0)*sqr(alpha)*da*gs0*(1.0 + e_)*ThetaSqrt/sqrtPi; + + // Stress tensor, Definitions, Table 3.1, p. 43 + volSymmTensorField tau(2.0*nut_*D + (lambda_ - (2.0/3.0)*nut_)*tr(D)*I); + + // Dissipation (Eq. 3.24, p.50) + volScalarField gammaCoeff + ( + 12.0*(1.0 - sqr(e_)) + *max(sqr(alpha), phase_.fluid().residualPhaseFraction()) + *gs0*(1.0/da)*ThetaSqrt/sqrtPi + ); + + // NB, drag = K*alpha*alpha2, + // (the alpha and alpha2 has been extracted from the drag function for + // numerical reasons) + volScalarField magUr(mag(U - Uc_)); + + volScalarField alpha2Prim + ( + max + ( + alpha*(1.0 - alpha), + phase_.fluid().residualPhaseFraction() + )*draga_.K(magUr + phase_.fluid().residualSlip())/rho + ); + + // Eq. 3.25, p. 50 Js = J1 - J2 + volScalarField J1(3.0*alpha2Prim); + volScalarField J2 + ( + 0.25*sqr(alpha2Prim)*da*sqr(magUr) + /( + max(alpha, phase_.fluid().residualPhaseFraction()) + *sqrtPi*(ThetaSqrt + ThetaSmallSqrt) + ) + ); + + // particle pressure - coefficient in front of Theta (Eq. 3.22, p. 45) + volScalarField PsCoeff + ( + granularPressureModel_->granularPressureCoeff + ( + alpha, + gs0, + rho, + e_ + )/rho + ); + + // 'thermal' conductivity (Table 3.3, p. 49) + volScalarField kappa + ( + conductivityModel_->kappa(alpha, Theta_, gs0, rho, da, e_) + ); + + // Construct the granular temperature equation (Eq. 3.20, p. 44) + // NB. note that there are two typos in Eq. 3.20: + // Ps should be without grad + // the laplacian has the wrong sign + fvScalarMatrix ThetaEqn + ( + 1.5* + ( + fvm::ddt(alpha, Theta_) + + fvm::div(alphaPhi, Theta_) + - fvc::Sp(fvc::ddt(alpha) + fvc::div(alphaPhi), Theta_) + ) + - fvm::laplacian(kappa, Theta_, "laplacian(kappa, Theta)") + == + fvm::SuSp(-((PsCoeff*I) && gradU), Theta_) + + (tau && gradU) + + fvm::Sp(-gammaCoeff, Theta_) + + fvm::Sp(-J1, Theta_) + + fvm::Sp(J2/(Theta_ + ThetaSmall), Theta_) + ); + + ThetaEqn.relax(); + ThetaEqn.solve(); + } + else + { + // Equilibrium => dissipation == production + // Eq. 4.14, p.82 + volScalarField K1(2.0*(1.0 + e_)*rho*gs0); + volScalarField K3 + ( + 0.5*da*rho* + ( + (sqrtPi/(3.0*(3.0-e_))) + *(1.0 + 0.4*(1.0 + e_)*(3.0*e_ - 1.0)*alpha*gs0) + +1.6*alpha*gs0*(1.0 + e_)/sqrtPi + ) + ); + + volScalarField K2 + ( + 4.0*da*rho*(1.0 + e_)*alpha*gs0/(3.0*sqrtPi) - 2.0*K3/3.0 + ); + + volScalarField K4(12.0*(1.0 - sqr(e_))*rho*gs0/(da*sqrtPi)); + + volScalarField trD + ( + alpha/(alpha + phase_.fluid().residualPhaseFraction()) + *fvc::div(this->phi_) + ); + volScalarField tr2D(sqr(trD)); + volScalarField trD2(tr(D & D)); + + volScalarField t1(K1*alpha + rho); + volScalarField l1(-t1*trD); + volScalarField l2(sqr(t1)*tr2D); + volScalarField l3 + ( + 4.0 + *K4 + *alpha + *(2.0*K3*trD2 + K2*tr2D) + ); + + Theta_ = sqr + ( + (l1 + sqrt(l2 + l3)) + /(2.0*max(alpha, phase_.fluid().residualPhaseFraction())*K4) + ); + } + + Theta_.max(0); + Theta_.min(100); + + { + // particle viscosity (Table 3.2, p.47) + nut_ = viscosityModel_->nu(alpha, Theta_, gs0, rho, da, e_); + + volScalarField ThetaSqrt(sqrt(Theta_)); + + // Bulk viscosity p. 45 (Lun et al. 1984). + lambda_ = (4.0/3.0)*sqr(alpha)*da*gs0*(1.0 + e_)*ThetaSqrt/sqrtPi; + + // Frictional pressure + volScalarField pf + ( + frictionalStressModel_->frictionalPressure + ( + alpha, + alphaMinFriction_, + alphaMax_ + ) + ); + + // Add frictional shear viscosity, Eq. 3.30, p. 52 + nut_ += frictionalStressModel_->nu + ( + alpha, + alphaMax_, + pf/rho, + D + ); + + // Limit viscosity + nut_.min(100); + } + + if (debug) + { + Info<< typeName << ':' << nl + << " max(Theta) = " << max(Theta_).value() << nl + << " max(nut) = " << max(nut_).value() << endl; + } +} + + +/* +Foam::tmp Foam::kineticTheoryModel::pp() const +{ + + // Particle pressure coefficient + // Coefficient in front of Theta (Eq. 3.22, p. 45) + volScalarField PsCoeff + ( + granularPressureModel_->granularPressureCoeff + ( + alpha, + gs0, + rho, + e_ + ) + ); + + // Frictional pressure + volScalarField pf + ( + frictionalStressModel_->frictionalPressure + ( + alpha, + alphaMinFriction_, + alphaMax_ + ) + ); + + // Return total particle pressure + return PsCoeff*Theta_ + pf; +} +*/ + + +Foam::tmp Foam::kineticTheoryModel::pPrime() const +{ + // Local references + const volScalarField& alpha = this->alpha_; + const volScalarField& rho = phase_.rho(); + + return + ( + Theta_ + *granularPressureModel_->granularPressureCoeffPrime + ( + alpha, + radialModel_->g0(alpha, alphaMinFriction_, alphaMax_), + radialModel_->g0prime(alpha, alphaMinFriction_, alphaMax_), + rho, + e_ + ) + + frictionalStressModel_->frictionalPressurePrime + ( + alpha, + alphaMinFriction_, + alphaMax_ + ) + ); +} + + +Foam::tmp Foam::kineticTheoryModel::pPrimef() const +{ + // Local references + const volScalarField& alpha = this->alpha_; + const volScalarField& rho = phase_.rho(); + + return fvc::interpolate + ( + Theta_ + *granularPressureModel_->granularPressureCoeffPrime + ( + alpha, + radialModel_->g0(alpha, alphaMinFriction_, alphaMax_), + radialModel_->g0prime(alpha, alphaMinFriction_, alphaMax_), + rho, + e_ + ) + + frictionalStressModel_->frictionalPressurePrime + ( + alpha, + alphaMinFriction_, + alphaMax_ + ) + ); +} + + +void Foam::kineticTheoryModel::correctNut() +{} + + +Foam::tmp Foam::kineticTheoryModel::k() const +{ + notImplemented("kineticTheoryModel::k()"); + return nut_; +} + + +Foam::tmp Foam::kineticTheoryModel::epsilon() const +{ + notImplemented("kineticTheoryModel::epsilon()"); + return nut_; +} + + +Foam::tmp Foam::kineticTheoryModel::R() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + IOobject::groupName("R", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + - (this->nut_)*dev(twoSymm(fvc::grad(this->U_))) + - (lambda_*fvc::div(this->phi_))*symmTensor::I + ) + ); +} + + +Foam::tmp Foam::kineticTheoryModel::devRhoReff() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + IOobject::groupName("devRhoReff", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + - (this->rho_*this->nut_) + *dev(twoSymm(fvc::grad(this->U_))) + - ((this->rho_*lambda_)*fvc::div(this->phi_))*symmTensor::I + ) + ); +} + + +Foam::tmp Foam::kineticTheoryModel::divDevRhoReff +( + volVectorField& U +) const +{ + return + ( + - fvm::laplacian(this->rho_*this->nut_, U) + - fvc::div + ( + (this->rho_*this->nut_)*dev2(T(fvc::grad(U))) + + ((this->rho_*lambda_)*fvc::div(this->phi_)) + *dimensioned("I", dimless, symmTensor::I) + ) + ); +} + + +bool Foam::kineticTheoryModel::read() +{ + if + ( + RASModels::eddyViscosity + < + PhaseIncompressibleTurbulenceModel + >::read() + ) + { + this->coeffDict().lookup("equilibrium") >> equilibrium_; + e_.readIfPresent(this->coeffDict()); + alphaMax_.readIfPresent(this->coeffDict()); + alphaMinFriction_.readIfPresent(this->coeffDict()); + + viscosityModel_->read(); + conductivityModel_->read(); + radialModel_->read(); + granularPressureModel_->read(); + frictionalStressModel_->read(); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H new file mode 100644 index 0000000000..e7146f8e62 --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H @@ -0,0 +1,214 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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::kineticTheoryModel + +Description + +SourceFiles + kineticTheoryModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kineticTheoryModel_H +#define kineticTheoryModel_H + +#include "eddyViscosity.H" +#include "PhaseIncompressibleTurbulenceModel.H" +#include "dragModel.H" +#include "phaseModel.H" +#include "autoPtr.H" +#include "viscosityModel.H" +#include "conductivityModel.H" +#include "radialModel.H" +#include "granularPressureModel.H" +#include "frictionalStressModel.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class kineticTheoryModel Declaration +\*---------------------------------------------------------------------------*/ + +class kineticTheoryModel +: + public RASModels::eddyViscosity + < + PhaseIncompressibleTurbulenceModel + > +{ + // Private data + + // Input Fields + + const phaseModel& phase_; + + + //- Drag model + const dragModel& draga_; + + // Sub-models + + //- Run-time selected viscosity model + autoPtr viscosityModel_; + + //- Run-time selected conductivity model + autoPtr conductivityModel_; + + //- Run-time selected radial distribution model + autoPtr radialModel_; + + //- Run-time selected granular pressure model + autoPtr + granularPressureModel_; + + //- Run-time selected frictional stress model + autoPtr + frictionalStressModel_; + + + // Kinetic Theory Model coefficients + + //- Use equilibrium approximation: generation == dissipation + Switch equilibrium_; + + //- Coefficient of restitution + dimensionedScalar e_; + + //- Maximum packing phase-fraction + dimensionedScalar alphaMax_; + + //- Min value for which the frictional stresses are zero + dimensionedScalar alphaMinFriction_; + + + // Kinetic Theory Model Fields + + //- The granular energy/temperature + volScalarField Theta_; + + //- The granular bulk viscosity + volScalarField lambda_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + kineticTheoryModel(const kineticTheoryModel&); + + //- Disallow default bitwise assignment + void operator=(const kineticTheoryModel&); + + +protected: + + // Protected member functions + + virtual void correctNut(); + + +public: + + //- Runtime type information + TypeName("kineticTheory"); + + + // Constructors + + //- Construct from components + kineticTheoryModel + ( + const volScalarField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const phaseModel& transport, + const word& propertiesName = turbulenceModel::propertiesName, + const word& type = typeName + ); + + + //- Destructor + virtual ~kineticTheoryModel(); + + + // Member Functions + + //- Return the effective viscosity + virtual tmp nuEff() const + { + return this->nut(); + } + + //- Return the effective viscosity on patch + virtual tmp nuEff(const label patchi) const + { + return this->nut(patchi); + } + + //- Return the turbulence kinetic energy + virtual tmp k() const; + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp epsilon() const; + + //- Return the Reynolds stress tensor + virtual tmp R() const; + + //- Return the phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrime() const; + + //- Return the face-phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrimef() const; + + //- Return the effective stress tensor + virtual tmp devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevRhoReff(volVectorField& U) const; + + //- Solve the kinetic theory equations and correct the viscosity + virtual void correct(); + + //- Re-read model coefficients if they have changed + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C similarity index 90% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C index cfe74982a8..bedc303500 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,6 +70,7 @@ Foam::tmp Foam::kineticTheoryModels::radialModels::CarnahanStarling::g0 ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { @@ -77,7 +78,7 @@ Foam::kineticTheoryModels::radialModels::CarnahanStarling::g0 return 1.0/(1.0 - alpha) + 3.0*alpha/(2.0*sqr(1.0 - alpha)) - + sqr(alpha)/(2.0*pow(1.0 - alpha, 3)); + + sqr(alpha)/(2.0*pow3(1.0 - alpha)); } @@ -85,13 +86,14 @@ Foam::tmp Foam::kineticTheoryModels::radialModels::CarnahanStarling::g0prime ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { return 2.5/sqr(1.0 - alpha) - + 4.0*alpha/pow(1.0 - alpha, 3.0) - + 1.5*sqr(alpha)/pow(1.0 - alpha, 4.0); + + 4.0*alpha/pow3(1.0 - alpha) + + 1.5*sqr(alpha)/pow4(1.0 - alpha); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H similarity index 93% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H index ee61b18099..77396863ea 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,12 +76,14 @@ public: tmp g0 ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; tmp g0prime ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C similarity index 91% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C index 9f029288dd..e9a4cfb522 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,6 +70,7 @@ Foam::tmp Foam::kineticTheoryModels::radialModels::LunSavage::g0 ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { @@ -82,10 +83,11 @@ Foam::tmp Foam::kineticTheoryModels::radialModels::LunSavage::g0prime ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { - return 2.5*pow(1.0 - alpha/alphaMax, -1.0 - 2.5*alphaMax); + return 2.5*pow(1.0 - alpha/alphaMax, -2.5*alphaMax - 1); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H similarity index 93% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H index 81333790fd..53492c9c65 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,12 +75,14 @@ public: tmp g0 ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; tmp g0prime ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C similarity index 86% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C index 0109f756b5..da1d658f5d 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,10 +70,11 @@ Foam::tmp Foam::kineticTheoryModels::radialModels::SinclairJackson::g0 ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { - return 1.0/(1.0 - pow(alpha/alphaMax, 1.0/3.0)); + return 1.0/(1.0 - cbrt(min(alpha, alphaMinFriction)/alphaMax)); } @@ -81,12 +82,16 @@ Foam::tmp Foam::kineticTheoryModels::radialModels::SinclairJackson::g0prime ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { - return - (1.0/3.0)*pow(max(alpha, scalar(1.0e-6))/alphaMax, -2.0/3.0) - /(alphaMax*sqr(1.0 - pow(alpha/alphaMax, 1.0/3.0))); + volScalarField aByaMax + ( + cbrt(min(max(alpha, 1e-3), alphaMinFriction)/alphaMax) + ); + + return (1.0/(3*alphaMax))/sqr(aByaMax - sqr(aByaMax)); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H similarity index 93% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H index 56931e9f01..bc8f44be79 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,12 +75,14 @@ public: tmp g0 ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; tmp g0prime ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/newRadialModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/newRadialModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/newRadialModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/newRadialModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/radialModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/radialModel.C similarity index 95% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/radialModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/radialModel.C index 7caf81d366..893117a811 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/radialModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/radialModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/radialModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/radialModel.H similarity index 93% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/radialModel.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/radialModel.H index e67a02c5c6..fc0a583c44 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/radialModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/radialModel/radialModel/radialModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -108,6 +108,7 @@ public: virtual tmp g0 ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const = 0; @@ -115,8 +116,14 @@ public: virtual tmp g0prime ( const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const = 0; + + virtual bool read() + { + return true; + } }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C similarity index 96% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C index e3bf99518c..22e5761436 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C @@ -62,7 +62,7 @@ Foam::kineticTheoryModels::viscosityModels::Gidaspow::~Gidaspow() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp -Foam::kineticTheoryModels::viscosityModels::Gidaspow::mu1 +Foam::kineticTheoryModels::viscosityModels::Gidaspow::nu ( const volScalarField& alpha1, const volScalarField& Theta, @@ -74,7 +74,7 @@ Foam::kineticTheoryModels::viscosityModels::Gidaspow::mu1 { const scalar sqrtPi = sqrt(constant::mathematical::pi); - return rho1*da*sqrt(Theta)* + return da*sqrt(Theta)* ( (4.0/5.0)*sqr(alpha1)*g0*(1.0 + e)/sqrtPi + (1.0/15.0)*sqrtPi*g0*(1.0 + e)*sqr(alpha1) diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H similarity index 98% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H index 0e3631ac0b..325f4f06c0 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H @@ -71,7 +71,7 @@ public: // Member functions - tmp mu1 + tmp nu ( const volScalarField& alpha1, const volScalarField& Theta, diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C similarity index 87% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C index 9f7fdd22cc..e1bcc67e92 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C @@ -56,8 +56,8 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::HrenyaSinclair ) : viscosityModel(dict), - coeffsDict_(dict.subDict(typeName + "Coeffs")), - L_(coeffsDict_.lookup("L")) + coeffDict_(dict.subDict(typeName + "Coeffs")), + L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_.lookup("L")) {} @@ -70,7 +70,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::~HrenyaSinclair() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp -Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::mu1 +Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::nu ( const volScalarField& alpha1, const volScalarField& Theta, @@ -87,7 +87,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::mu1 scalar(1) + da/(6.0*sqrt(2.0)*(alpha1 + scalar(1.0e-5)))/L_ ); - return rho1*da*sqrt(Theta)* + return da*sqrt(Theta)* ( (4.0/5.0)*sqr(alpha1)*g0*(1.0 + e)/sqrtPi + (1.0/15.0)*sqrtPi*g0*(1.0 + e)*(3.0*e - 1)*sqr(alpha1)/(3.0-e) @@ -98,4 +98,14 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::mu1 } +bool Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::read() +{ + coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + + L_.readIfPresent(coeffDict_); + + return true; +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H similarity index 95% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H index 80b0e863ae..90fe892f86 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H @@ -55,9 +55,9 @@ class HrenyaSinclair { // Private data - dictionary coeffsDict_; + dictionary coeffDict_; - //- characteristic length of geometry + //- Characteristic length of geometry dimensionedScalar L_; @@ -79,7 +79,7 @@ public: // Member functions - tmp mu1 + tmp nu ( const volScalarField& alpha1, const volScalarField& Theta, @@ -88,6 +88,8 @@ public: const volScalarField& da, const dimensionedScalar& e ) const; + + virtual bool read(); }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C similarity index 96% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C index fa7ba802d2..ed5df62c86 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C @@ -62,7 +62,7 @@ Foam::kineticTheoryModels::viscosityModels::Syamlal::~Syamlal() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp -Foam::kineticTheoryModels::viscosityModels::Syamlal::mu1 +Foam::kineticTheoryModels::viscosityModels::Syamlal::nu ( const volScalarField& alpha1, const volScalarField& Theta, @@ -74,7 +74,7 @@ Foam::kineticTheoryModels::viscosityModels::Syamlal::mu1 { const scalar sqrtPi = sqrt(constant::mathematical::pi); - return rho1*da*sqrt(Theta)* + return da*sqrt(Theta)* ( (4.0/5.0)*sqr(alpha1)*g0*(1.0 + e)/sqrtPi + (1.0/15.0)*sqrtPi*g0*(1.0 + e)*(3.0*e - 1.0)*sqr(alpha1)/(3.0 - e) diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H similarity index 98% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H index f82ef8af06..7d2583e561 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H @@ -72,7 +72,7 @@ public: // Member functions - tmp mu1 + tmp nu ( const volScalarField& alpha1, const volScalarField& Theta, diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/none/noneViscosity.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/none/noneViscosity.C similarity index 97% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/none/noneViscosity.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/none/noneViscosity.C index 85f495cca5..44c54a5168 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/none/noneViscosity.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/none/noneViscosity.C @@ -53,7 +53,7 @@ Foam::kineticTheoryModels::noneViscosity::~noneViscosity() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp Foam::kineticTheoryModels::noneViscosity::mu1 +Foam::tmp Foam::kineticTheoryModels::noneViscosity::nu ( const volScalarField& alpha1, const volScalarField& Theta, @@ -66,7 +66,7 @@ Foam::tmp Foam::kineticTheoryModels::noneViscosity::mu1 return dimensionedScalar ( "0", - dimensionSet(1, -1, -1, 0, 0, 0, 0), + dimensionSet(0, 2, -1, 0, 0, 0, 0), 0.0 )*alpha1; } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/none/noneViscosity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/none/noneViscosity.H similarity index 98% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/none/noneViscosity.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/none/noneViscosity.H index 641ebe30eb..25fe4ce7b8 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/none/noneViscosity.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/none/noneViscosity.H @@ -70,7 +70,7 @@ public: // Member functions - tmp mu1 + tmp nu ( const volScalarField& alpha1, const volScalarField& Theta, diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/viscosityModel/newViscosityModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/viscosityModel/newViscosityModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/viscosityModel/newViscosityModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/viscosityModel/newViscosityModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.H similarity index 96% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.H index 91007f0538..bfd021a4b1 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/viscosityModel/viscosityModel.H @@ -106,7 +106,7 @@ public: // Member Functions - virtual tmp mu1 + virtual tmp nu ( const volScalarField& alpha1, const volScalarField& Theta, @@ -115,6 +115,11 @@ public: const volScalarField& da, const dimensionedScalar& e ) const = 0; + + virtual bool read() + { + return true; + } }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phaseIncompressibleTurbulenceModels.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phaseIncompressibleTurbulenceModels.C new file mode 100644 index 0000000000..f47e3943a1 --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phaseIncompressibleTurbulenceModels.C @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "PhaseIncompressibleTurbulenceModel.H" +#include "laminar.H" +#include "RASModel.H" +#include "kEpsilon.H" +#include "LaheyKEpsilon.H" +#include "continuousGasKEpsilon.H" +#include "kineticTheoryModel.H" +#include "phasePressureModel.H" +#include "phaseModel.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ + typedef TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + phaseModel + > basePhaseIncompressibleTransportTurbulenceModel; + + defineTemplateRunTimeSelectionTable + ( + basePhaseIncompressibleTransportTurbulenceModel, + dictionary + ); + + typedef PhaseIncompressibleTurbulenceModel + incompressibleTransportTurbulenceModel; + + typedef laminar + incompressibleLaminar; + + defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0); + + addToRunTimeSelectionTable + ( + basePhaseIncompressibleTransportTurbulenceModel, + incompressibleLaminar, + dictionary + ); + + + typedef RASModel + incompressibleRASModel; + + defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0); + + defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary); + + addToRunTimeSelectionTable + ( + basePhaseIncompressibleTransportTurbulenceModel, + incompressibleRASModel, + dictionary + ); + + namespace RASModels + { + typedef kEpsilon + incompressiblekEpsilon; + + defineNamedTemplateTypeNameAndDebug(incompressiblekEpsilon, 0); + + addToRunTimeSelectionTable + ( + incompressibleRASModel, + incompressiblekEpsilon, + dictionary + ); + } + + namespace RASModels + { + typedef LaheyKEpsilon + incompressibleLaheyKEpsilon; + + defineNamedTemplateTypeNameAndDebug(incompressibleLaheyKEpsilon, 0); + + addToRunTimeSelectionTable + ( + incompressibleRASModel, + incompressibleLaheyKEpsilon, + dictionary + ); + } + + namespace RASModels + { + typedef continuousGasKEpsilon + incompressiblecontinuousGasKEpsilon; + + defineNamedTemplateTypeNameAndDebug + ( + incompressiblecontinuousGasKEpsilon, + 0 + ); + + addToRunTimeSelectionTable + ( + incompressibleRASModel, + incompressiblecontinuousGasKEpsilon, + dictionary + ); + } +} + + +namespace Foam +{ + typedef PhaseIncompressibleTurbulenceModel + incompressibleTransportTurbulenceModel; + + typedef RASModel + incompressibleRASModel; + + defineTypeNameAndDebug(kineticTheoryModel, 0); + + addToRunTimeSelectionTable + ( + incompressibleRASModel, + kineticTheoryModel, + dictionary + ); +} + + +namespace Foam +{ + typedef PhaseIncompressibleTurbulenceModel + incompressibleTransportTurbulenceModel; + + typedef RASModel + incompressibleRASModel; + + defineTypeNameAndDebug(phasePressureModel, 0); + + addToRunTimeSelectionTable + ( + incompressibleRASModel, + phasePressureModel, + dictionary + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C new file mode 100644 index 0000000000..99cc91994c --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C @@ -0,0 +1,219 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "phasePressureModel.H" +#include "surfaceInterpolate.H" +#include "twoPhaseSystem.H" +#include "dimensionedType.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phasePressureModel::phasePressureModel +( + const volScalarField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& phase, + const word& propertiesName, + const word& type +) +: + RASModels::eddyViscosity > + ( + type, + alpha, + rho, + U, + alphaPhi, + phi, + phase, + propertiesName + ), + + phase_(phase), + + alphaMax_(readScalar(this->coeffDict_.lookup("alphaMax"))), + preAlphaExp_(readScalar(this->coeffDict_.lookup("preAlphaExp"))), + expMax_(readScalar(this->coeffDict_.lookup("expMax"))), + g0_ + ( + "g0", + dimensionSet(1, -1, -2, 0, 0), + this->coeffDict_.lookup("g0") + ) +{ + this->nut_ == dimensionedScalar("zero", this->nut_.dimensions(), 0.0); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phasePressureModel::~phasePressureModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::phasePressureModel::correct() +{} + + +void Foam::phasePressureModel::correctNut() +{} + + +Foam::tmp Foam::phasePressureModel::pPrime() const +{ + return + g0_ + *min + ( + exp(preAlphaExp_*(this->alpha_ - alphaMax_)), + expMax_ + ); +} + + +Foam::tmp Foam::phasePressureModel::pPrimef() const +{ + return + g0_ + *min + ( + exp(preAlphaExp_*(fvc::interpolate(this->alpha_) - alphaMax_)), + expMax_ + ); +} + + +Foam::tmp Foam::phasePressureModel::k() const +{ + notImplemented("phasePressureModel::k()"); + return nut_; +} + + +Foam::tmp Foam::phasePressureModel::epsilon() const +{ + notImplemented("phasePressureModel::epsilon()"); + return nut_; +} + + +Foam::tmp Foam::phasePressureModel::R() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + IOobject::groupName("R", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh_, + dimensioned + ( + "R", + dimensionSet(0, 2, -2, 0, 0), + symmTensor::zero + ) + ) + ); +} + + +Foam::tmp Foam::phasePressureModel::devRhoReff() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + IOobject::groupName("devRhoReff", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh_, + dimensioned + ( + "R", + this->rho_.dimensions()*dimensionSet(0, 2, -2, 0, 0), + symmTensor::zero + ) + ) + ); +} + + +Foam::tmp Foam::phasePressureModel::divDevRhoReff +( + volVectorField& U +) const +{ + return tmp + ( + new fvVectorMatrix + ( + U, + this->rho_.dimensions()*dimensionSet(0, 4, -2, 0, 0) + ) + ); +} + + +bool Foam::phasePressureModel::read() +{ + if + ( + RASModels::eddyViscosity + < + PhaseIncompressibleTurbulenceModel + >::read() + ) + { + this->coeffDict().lookup("alphaMax") >> alphaMax_; + this->coeffDict().lookup("preAlphaExp") >> preAlphaExp_; + this->coeffDict().lookup("expMax") >> expMax_; + g0_.readIfPresent(this->coeffDict()); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.H new file mode 100644 index 0000000000..1c4028f16a --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.H @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::phasePressureModel + +Description + +SourceFiles + phasePressureModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phasePressureModel_H +#define phasePressureModel_H + +#include "eddyViscosity.H" +#include "PhaseIncompressibleTurbulenceModel.H" +#include "dragModel.H" +#include "phaseModel.H" +#include "autoPtr.H" +#include "viscosityModel.H" +#include "conductivityModel.H" +#include "radialModel.H" +#include "granularPressureModel.H" +#include "frictionalStressModel.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class phasePressureModel Declaration +\*---------------------------------------------------------------------------*/ + +class phasePressureModel +: + public RASModels::eddyViscosity + < + PhaseIncompressibleTurbulenceModel + > +{ + // Private data + + // Input Fields + + const phaseModel& phase_; + + + // Kinetic Theory Model coefficients + + //- Maximum packing phase-fraction + scalar alphaMax_; + + //- Pre-exponential factor + scalar preAlphaExp_; + + //- Maximum limit of the exponential + scalar expMax_; + + //- g0 + dimensionedScalar g0_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + phasePressureModel(const phasePressureModel&); + + //- Disallow default bitwise assignment + void operator=(const phasePressureModel&); + + +protected: + + // Protected member functions + + virtual void correctNut(); + + +public: + + //- Runtime type information + TypeName("phasePressure"); + + + // Constructors + + //- Construct from components + phasePressureModel + ( + const volScalarField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const phaseModel& transport, + const word& propertiesName = turbulenceModel::propertiesName, + const word& type = typeName + ); + + + //- Destructor + virtual ~phasePressureModel(); + + + // Member Functions + + //- Return the effective viscosity + virtual tmp nuEff() const + { + return this->nut(); + } + + //- Return the effective viscosity on patch + virtual tmp nuEff(const label patchi) const + { + return this->nut(patchi); + } + + //- Return the turbulence kinetic energy + virtual tmp k() const; + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp epsilon() const; + + //- Return the Reynolds stress tensor + virtual tmp R() const; + + //- Return the phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrime() const; + + //- Return the face-phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrimef() const; + + //- Return the effective stress tensor + virtual tmp devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevRhoReff(volVectorField& U) const; + + //- Solve the kinetic theory equations and correct the viscosity + virtual void correct(); + + //- Re-read model coefficients if they have changed + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readPPProperties.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readPPProperties.H index 3acbf758d0..4f32564a48 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readPPProperties.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readPPProperties.H @@ -29,8 +29,3 @@ ( ppProperties.lookup("g0") ); - - Switch packingLimiter - ( - ppProperties.lookup("packingLimiter") - ); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H index 9913595cf2..29353a8fa1 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H @@ -1,2 +1,7 @@ #include "readTimeControls.H" #include "alphaControls.H" + + Switch implicitPhasePressure + ( + alphaControls.lookupOrDefault("implicitPhasePressure", false) + ); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/kEpsilon.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/kEpsilon.H deleted file mode 100644 index b74e1b18d7..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/kEpsilon.H +++ /dev/null @@ -1,72 +0,0 @@ -if (turbulence) -{ - if (mesh.changing()) - { - y.correct(); - } - - tmp tgradU2(fvc::grad(U2)); - volScalarField G(2*nut2*(tgradU2() && dev(symm(tgradU2())))); - tgradU2.clear(); - - #include "wallFunctions.H" - - // Dissipation equation - fvScalarMatrix epsEqn - ( - fvm::ddt(alpha2, epsilon) - + fvm::div(alphaPhi2, epsilon) - - // Compressibity correction - - fvm::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), epsilon) - - - fvm::laplacian - ( - alpha1Eps*nuEff2, epsilon, - "laplacian(DepsilonEff,epsilon)" - ) - == - C1*alpha2*G*epsilon/k - - fvm::Sp(C2*alpha2*epsilon/k, epsilon) - ); - - #include "wallDissipation.H" - - - - epsEqn.relax(); - epsEqn.solve(); - - epsilon.max(dimensionedScalar("zero", epsilon.dimensions(), 1.0e-15)); - - - // Turbulent kinetic energy equation - fvScalarMatrix kEqn - ( - fvm::ddt(alpha2, k) - + fvm::div(alphaPhi2, k) - - // Compressibity correction - - fvm::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), k) - - - fvm::laplacian - ( - alpha1k*nuEff2, k, - "laplacian(DkEff,k)" - ) - == - alpha2*G - - fvm::Sp(alpha2*epsilon/k, k) - ); - kEqn.relax(); - kEqn.solve(); - - k.max(dimensionedScalar("zero", k.dimensions(), 1.0e-8)); - - //- Re-calculate turbulence viscosity - nut2 = Cmu*sqr(k)/epsilon; - - #include "wallViscosity.H" -} - -nuEff2 = nut2 + thermo2.mu()/rho2; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallFunctions.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallFunctions.H deleted file mode 100644 index d85181cba2..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallFunctions.H +++ /dev/null @@ -1,83 +0,0 @@ -{ - labelList cellBoundaryFaceCount(epsilon.size(), 0); - - scalar Cmu25 = ::pow(Cmu.value(), 0.25); - scalar Cmu75 = ::pow(Cmu.value(), 0.75); - scalar kappa_ = kappa.value(); - - const fvPatchList& patches = mesh.boundary(); - - //- Initialise the near-wall P field to zero - forAll(patches, patchi) - { - const fvPatch& currPatch = patches[patchi]; - - if (isA(currPatch)) - { - forAll(currPatch, facei) - { - label faceCelli = currPatch.faceCells()[facei]; - - epsilon[faceCelli] = 0.0; - G[faceCelli] = 0.0; - } - } - } - - //- Accumulate the wall face contributions to epsilon and G - // Increment cellBoundaryFaceCount for each face for averaging - forAll(patches, patchi) - { - const fvPatch& currPatch = patches[patchi]; - const scalarField& mu2_ = thermo2.mu().boundaryField()[patchi]; - const scalarField& rho2_ = rho2.boundaryField()[patchi]; - - if (isA(currPatch)) - { - const scalarField& nut2w = nut2.boundaryField()[patchi]; - - scalarField magFaceGradU(mag(U2.boundaryField()[patchi].snGrad())); - - forAll(currPatch, facei) - { - label faceCelli = currPatch.faceCells()[facei]; - - // For corner cells (with two boundary or more faces), - // epsilon and G in the near-wall cell are calculated - // as an average - - cellBoundaryFaceCount[faceCelli]++; - - epsilon[faceCelli] += - Cmu75*::pow(k[faceCelli], 1.5) - /(kappa_*y[patchi][facei]); - - G[faceCelli] += - (nut2w[facei] + mu2_[facei]/rho2_[facei]) - *magFaceGradU[facei] - *Cmu25*::sqrt(k[faceCelli]) - /(kappa_*y[patchi][facei]); - } - } - } - - - // perform the averaging - - forAll(patches, patchi) - { - const fvPatch& curPatch = patches[patchi]; - - if (isA(curPatch)) - { - forAll(curPatch, facei) - { - label faceCelli = curPatch.faceCells()[facei]; - - epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli]; - G[faceCelli] /= cellBoundaryFaceCount[faceCelli]; - cellBoundaryFaceCount[faceCelli] = 1; - } - } - } -} diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallViscosity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallViscosity.H deleted file mode 100644 index 9aa032149c..0000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallViscosity.H +++ /dev/null @@ -1,40 +0,0 @@ -{ - scalar Cmu25 = ::pow(Cmu.value(), 0.25); - scalar kappa_ = kappa.value(); - scalar E_ = E.value(); - - const fvPatchList& patches = mesh.boundary(); - - forAll(patches, patchi) - { - const fvPatch& currPatch = patches[patchi]; - const scalarField& mu2_ = thermo2.mu().boundaryField()[patchi]; - const scalarField& rho2_ = rho2.boundaryField()[patchi]; - - if (isA(currPatch)) - { - scalarField& nutw = nut2.boundaryField()[patchi]; - - forAll(currPatch, facei) - { - label faceCelli = currPatch.faceCells()[facei]; - - // calculate yPlus - scalar yPlus = - Cmu25*y[patchi][facei]*::sqrt(k[faceCelli]) - /(mu2_[facei]/rho2_[facei]); - - if (yPlus > 11.6) - { - nutw[facei] = - (mu2_[facei]/rho2_[facei]) - *(yPlus*kappa_/::log(E_*yPlus) - 1); - } - else - { - nutw[facei] = 0.0; - } - } - } - } -} diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/files b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/Make/files similarity index 76% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/files rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/Make/files index c465aaa454..fb49c3cef7 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/files +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/Make/files @@ -4,4 +4,6 @@ diameterModels/diameterModel/newDiameterModel.C diameterModels/constantDiameter/constantDiameter.C diameterModels/isothermalDiameter/isothermalDiameter.C -LIB = $(FOAM_LIBBIN)/libcompressiblePhaseModel +twoPhaseSystem.C + +LIB = $(FOAM_LIBBIN)/libcompressibleTwoPhaseSystem diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/Make/options similarity index 80% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/options rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/Make/options index e441b0417b..ab3c396f57 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/options +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/Make/options @@ -1,4 +1,6 @@ EXE_INC = \ + -I../twoPhaseSystem \ + -I../interfacialModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/constantDiameter/constantDiameter.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/constantDiameter/constantDiameter.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/constantDiameter/constantDiameter.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.H similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/constantDiameter/constantDiameter.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/diameterModel/diameterModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/diameterModel/diameterModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/diameterModel/diameterModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.H similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/diameterModel/diameterModel.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/diameterModel/newDiameterModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/newDiameterModel.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/diameterModel/newDiameterModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/newDiameterModel.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/isothermalDiameter/isothermalDiameter.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.C similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/isothermalDiameter/isothermalDiameter.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.C diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/isothermalDiameter/isothermalDiameter.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.H similarity index 100% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/isothermalDiameter/isothermalDiameter.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C similarity index 76% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index 112a302188..e0275a6238 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -24,7 +24,10 @@ License \*---------------------------------------------------------------------------*/ #include "phaseModel.H" +#include "twoPhaseSystem.H" #include "diameterModel.H" +#include "dragModel.H" +#include "heatTransferModel.H" #include "fixedValueFvPatchFields.H" #include "slipFvPatchFields.H" #include "surfaceInterpolate.H" @@ -33,8 +36,8 @@ License Foam::phaseModel::phaseModel ( - const fvMesh& mesh, - const dictionary& transportProperties, + const twoPhaseSystem& fluid, + const dictionary& phaseProperties, const word& phaseName ) : @@ -42,48 +45,44 @@ Foam::phaseModel::phaseModel ( IOobject ( - "alpha" + phaseName, - mesh.time().timeName(), - mesh, + IOobject::groupName("alpha", phaseName), + fluid.mesh().time().timeName(), + fluid.mesh(), IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), - mesh, + fluid.mesh(), dimensionedScalar("alpha", dimless, 0) ), + fluid_(fluid), name_(phaseName), phaseDict_ ( - transportProperties.subDict - ( - phaseName == "1" || phaseName == "2" - ? "phase" + phaseName - : word(phaseName) - ) + phaseProperties.subDict(name_) ), - thermo_(rhoThermo::New(mesh, phaseName)), + thermo_(rhoThermo::New(fluid.mesh(), name_)), U_ ( IOobject ( - "U" + phaseName, - mesh.time().timeName(), - mesh, + IOobject::groupName("U", name_), + fluid.mesh().time().timeName(), + fluid.mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh + fluid.mesh() ) { - thermo_->validate("phaseModel " + phaseName, "h", "e"); + thermo_->validate("phaseModel " + name_, "h", "e"); - const word phiName = "phi" + phaseName; + const word phiName = IOobject::groupName("phi", name_); IOobject phiHeader ( phiName, - mesh.time().timeName(), - mesh, + fluid_.mesh().time().timeName(), + fluid_.mesh(), IOobject::NO_READ ); @@ -98,12 +97,12 @@ Foam::phaseModel::phaseModel IOobject ( phiName, - mesh.time().timeName(), - mesh, + fluid_.mesh().time().timeName(), + fluid_.mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh + fluid_.mesh() ) ); } @@ -136,12 +135,12 @@ Foam::phaseModel::phaseModel IOobject ( phiName, - mesh.time().timeName(), - mesh, + fluid_.mesh().time().timeName(), + fluid_.mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), - fvc::interpolate(U_) & mesh.Sf(), + fvc::interpolate(U_) & fluid_.mesh().Sf(), phiTypes ) ); @@ -155,20 +154,6 @@ Foam::phaseModel::phaseModel } -Foam::autoPtr Foam::phaseModel::New -( - const fvMesh& mesh, - const dictionary& transportProperties, - const word& phaseName -) -{ - return autoPtr - ( - new phaseModel(mesh, transportProperties, phaseName) - ); -} - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::phaseModel::~phaseModel() diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H similarity index 86% rename from applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.H rename to applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H index 87c6f0b562..ed2a611546 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H @@ -36,6 +36,7 @@ SourceFiles #include "dimensionedScalar.H" #include "volFields.H" #include "surfaceFields.H" +#include "transportModel.H" #include "rhoThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,18 +45,24 @@ namespace Foam { // Forward declarations +class twoPhaseSystem; class diameterModel; + /*---------------------------------------------------------------------------*\ Class phaseModel Declaration \*---------------------------------------------------------------------------*/ class phaseModel : - public volScalarField + public volScalarField, + public transportModel { // Private data + //- Reference to the twoPhaseSystem to which this phase belongs + const twoPhaseSystem& fluid_; + //- Name of phase word name_; @@ -80,19 +87,8 @@ public: phaseModel ( - const fvMesh& mesh, - const dictionary& transportProperties, - const word& phaseName - ); - - - // Selectors - - //- Return a reference to the selected turbulence model - static autoPtr New - ( - const fvMesh& mesh, - const dictionary& transportProperties, + const twoPhaseSystem& fluid, + const dictionary& phaseProperties, const word& phaseName ); @@ -103,6 +99,12 @@ public: // Member Functions + //- Return the twoPhaseSystem to which this phase belongs + const twoPhaseSystem& fluid() const + { + return fluid_; + } + const word& name() const { return name_; @@ -165,6 +167,16 @@ public: { return phiPtr_(); } + + //- Dummy correct + void correct() + {} + + //- Dummy read + bool read() + { + return true; + } }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C new file mode 100644 index 0000000000..83902a7b7d --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -0,0 +1,390 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "twoPhaseSystem.H" +#include "surfaceInterpolate.H" +#include "fixedValueFvsPatchFields.H" +#include "fvcCurl.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::twoPhaseSystem::twoPhaseSystem +( + const fvMesh& mesh +) +: + IOdictionary + ( + IOobject + ( + "phaseProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ), + + mesh_(mesh), + + phase1_ + ( + *this, + *this, + wordList(lookup("phases"))[0] + ), + + phase2_ + ( + *this, + *this, + wordList(lookup("phases"))[1] + ), + + Cvm_ + ( + "Cvm", + dimless, + lookup("Cvm") + ), + + Cl_ + ( + "Cl", + dimless, + lookup("Cl") + ), + + drag1_ + ( + dragModel::New + ( + subDict("drag"), + phase1_, + phase1_, + phase2_ + ) + ), + + drag2_ + ( + dragModel::New + ( + subDict("drag"), + phase2_, + phase2_, + phase1_ + ) + ), + + heatTransfer1_ + ( + heatTransferModel::New + ( + subDict("heatTransfer"), + phase1_, + phase1_, + phase2_ + ) + ), + + heatTransfer2_ + ( + heatTransferModel::New + ( + subDict("heatTransfer"), + phase2_, + phase2_, + phase1_ + ) + ), + + dispersedPhase_(lookup("dispersedPhase")), + + residualPhaseFraction_ + ( + readScalar(lookup("residualPhaseFraction")) + ), + + residualSlip_ + ( + "residualSlip", + dimVelocity, + lookup("residualSlip") + ) +{ + if + ( + !( + dispersedPhase_ == phase1_.name() + || dispersedPhase_ == phase2_.name() + || dispersedPhase_ == "both" + ) + ) + { + FatalErrorIn("twoPhaseSystem::twoPhaseSystem(const fvMesh& mesh)") + << "invalid dispersedPhase " << dispersedPhase_ + << exit(FatalError); + } + + Info << "dispersedPhase is " << dispersedPhase_ << endl; + + // Ensure the phase-fractions sum to 1 + phase2_.volScalarField::operator=(scalar(1) - phase1_); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp Foam::twoPhaseSystem::rho() const +{ + return phase1_*phase1_.thermo().rho() + phase2_*phase2_.thermo().rho(); +} + + +Foam::tmp Foam::twoPhaseSystem::U() const +{ + return phase1_*phase1_.U() + phase2_*phase2_.U(); +} + + +Foam::tmp Foam::twoPhaseSystem::phi() const +{ + return + fvc::interpolate(phase1_)*phase1_.phi() + + fvc::interpolate(phase2_)*phase2_.phi(); +} + + +Foam::tmp Foam::twoPhaseSystem::dragCoeff() const +{ + tmp tdragCoeff + ( + new volScalarField + ( + IOobject + ( + "dragCoeff", + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedScalar("dragCoeff", dimensionSet(1, -3, -1, 0, 0), 0) + ) + ); + volScalarField& dragCoeff = tdragCoeff(); + + volVectorField Ur(phase1_.U() - phase2_.U()); + volScalarField magUr(mag(Ur) + residualSlip_); + + if (dispersedPhase_ == phase1_.name()) + { + dragCoeff = drag1().K(magUr); + } + else if (dispersedPhase_ == phase2_.name()) + { + dragCoeff = drag2().K(magUr); + } + else if (dispersedPhase_ == "both") + { + dragCoeff = + ( + phase2_*drag1().K(magUr) + + phase1_*drag2().K(magUr) + ); + } + else + { + FatalErrorIn("twoPhaseSystem::dragCoeff()") + << "dispersedPhase: " << dispersedPhase_ << " is incorrect" + << exit(FatalError); + } + + volScalarField alphaCoeff(max(phase1_*phase2_, residualPhaseFraction_)); + dragCoeff *= alphaCoeff; + + // Remove drag at fixed-flux boundaries + forAll(phase1_.phi().boundaryField(), patchi) + { + if + ( + isA + ( + phase1_.phi().boundaryField()[patchi] + ) + ) + { + dragCoeff.boundaryField()[patchi] = 0.0; + } + } + + return tdragCoeff; +} + + +Foam::tmp Foam::twoPhaseSystem::liftForce +( + const volVectorField& U +) const +{ + tmp tliftForce + ( + new volVectorField + ( + IOobject + ( + "liftForce", + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedVector + ( + "liftForce", + dimensionSet(1, -2, -2, 0, 0), + vector::zero + ) + ) + ); + volVectorField& liftForce = tliftForce(); + + volVectorField Ur(phase1_.U() - phase2_.U()); + + liftForce = + Cl_*(phase1_*phase1_.rho() + phase2_*phase2_.rho()) + *(Ur ^ fvc::curl(U)); + + // Remove lift at fixed-flux boundaries + forAll(phase1_.phi().boundaryField(), patchi) + { + if + ( + isA + ( + phase1_.phi().boundaryField()[patchi] + ) + ) + { + liftForce.boundaryField()[patchi] = vector::zero; + } + } + + return tliftForce; +} + + +Foam::tmp Foam::twoPhaseSystem::heatTransferCoeff() const +{ + tmp theatTransferCoeff + ( + new volScalarField + ( + IOobject + ( + "heatTransferCoeff", + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedScalar + ( + "heatTransferCoeff", + dimensionSet(1, -1, -3, -1, 0), + 0 + ) + ) + ); + volScalarField& heatTransferCoeff = theatTransferCoeff(); + + volVectorField Ur(phase1_.U() - phase2_.U()); + volScalarField magUr(mag(Ur) + residualSlip_); + + if (dispersedPhase_ == phase1_.name()) + { + heatTransferCoeff = heatTransfer1().K(magUr); + } + else if (dispersedPhase_ == phase2_.name()) + { + heatTransferCoeff = heatTransfer2().K(magUr); + } + else if (dispersedPhase_ == "both") + { + heatTransferCoeff = + ( + phase2_*heatTransfer1().K(magUr) + + phase1_*heatTransfer2().K(magUr) + ); + } + else + { + FatalErrorIn("twoPhaseSystem::heatTransferCoeff()") + << "dispersedPhase: " << dispersedPhase_ << " is incorrect" + << exit(FatalError); + } + + volScalarField alphaCoeff(max(phase1_*phase2_, residualPhaseFraction_)); + heatTransferCoeff *= alphaCoeff; + + // Remove heatTransfer at fixed-flux boundaries + forAll(phase1_.phi().boundaryField(), patchi) + { + if + ( + isA + ( + phase1_.phi().boundaryField()[patchi] + ) + ) + { + heatTransferCoeff.boundaryField()[patchi] = 0.0; + } + } + + return theatTransferCoeff; +} + + +bool Foam::twoPhaseSystem::read() +{ + if (regIOobject::read()) + { + bool readOK = true; + + readOK &= phase1_.read(); + readOK &= phase2_.read(); + + lookup("Cvm") >> Cvm_; + lookup("Cl") >> Cl_; + + return readOK; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H new file mode 100644 index 0000000000..3a7896ea02 --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H @@ -0,0 +1,228 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::twoPhaseSystem + +Description + Incompressible multi-phase mixture with built in solution for the + phase fractions with interface compression for interface-capturing. + + Derived from transportModel so that it can be unsed in conjunction with + the incompressible turbulence models. + + Surface tension and contact-angle is handled for the interface + between each phase-pair. + +SourceFiles + twoPhaseSystem.C + +\*---------------------------------------------------------------------------*/ + +#ifndef twoPhaseSystem_H +#define twoPhaseSystem_H + +#include "IOdictionary.H" +#include "phaseModel.H" +#include "dragModel.H" +#include "heatTransferModel.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declarations +class dragModel; +class heatTransferModel; + + +/*---------------------------------------------------------------------------*\ + Class twoPhaseSystem Declaration +\*---------------------------------------------------------------------------*/ + +class twoPhaseSystem +: + public IOdictionary +{ + // Private data + + const fvMesh& mesh_; + + phaseModel phase1_; + phaseModel phase2_; + + dimensionedScalar Cvm_; + dimensionedScalar Cl_; + + autoPtr drag1_; + autoPtr drag2_; + + autoPtr heatTransfer1_; + autoPtr heatTransfer2_; + + word dispersedPhase_; + scalar residualPhaseFraction_; + dimensionedScalar residualSlip_; + + +public: + + // Constructors + + //- Construct from fvMesh + twoPhaseSystem(const fvMesh&); + + + //- Destructor + virtual ~twoPhaseSystem() + {} + + + // Member Functions + + const fvMesh& mesh() const + { + return mesh_; + } + + const phaseModel& phase1() const + { + return phase1_; + } + + const phaseModel& phase2() const + { + return phase2_; + } + + const phaseModel& otherPhase(const phaseModel& phase) const + { + if (&phase == &phase1_) + { + return phase2_; + } + else + { + return phase1_; + } + } + + phaseModel& phase1() + { + return phase1_; + } + + phaseModel& phase2() + { + return phase2_; + } + + const dragModel& drag1() const + { + return drag1_(); + } + + const dragModel& drag2() const + { + return drag2_(); + } + + const dragModel& drag(const phaseModel& phase) const + { + if (&phase == &phase1_) + { + return drag1_(); + } + else + { + return drag2_(); + } + } + + scalar residualPhaseFraction() const + { + return residualPhaseFraction_; + } + + const dimensionedScalar& residualSlip() const + { + return residualSlip_; + } + + tmp dragCoeff() const; + tmp liftForce(const volVectorField& U) const; + + const heatTransferModel& heatTransfer1() const + { + return heatTransfer1_(); + } + + const heatTransferModel& heatTransfer2() const + { + return heatTransfer2_(); + } + + tmp heatTransferCoeff() const; + + //- Return the mixture density + tmp rho() const; + + //- Return the mixture velocity + tmp U() const; + + //- Return the mixture flux + tmp phi() const; + + //- Return the virtual-mass coefficient + dimensionedScalar Cvm() const + { + return Cvm_; + } + + //- Return the lift coefficient + dimensionedScalar Cl() const + { + return Cl_; + } + + //- Dummy correct + void correct() + {} + + //- Read base phaseProperties dictionary + bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/test/PisoFoam/Make/options b/applications/test/PisoFoam/Make/options index 259f95f7b9..8e32793a19 100644 --- a/applications/test/PisoFoam/Make/options +++ b/applications/test/PisoFoam/Make/options @@ -1,13 +1,13 @@ EXE_INC = \ - -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ - -lincompressibleTurbulenceModel \ - -lincompressibleRASModels \ - -lincompressibleLESModels \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ -lincompressibleTransportModels \ -lfiniteVolume \ -lmeshTools diff --git a/applications/test/PisoFoam/PisoFoam.C b/applications/test/PisoFoam/PisoFoam.C index 1713e9747c..bbd28e6f88 100644 --- a/applications/test/PisoFoam/PisoFoam.C +++ b/applications/test/PisoFoam/PisoFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,12 +33,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" -#include "turbulenceModel.H" - -#include "LduMatrix.H" -#include "diagTensorField.H" - -typedef LduMatrix lduVectorMatrix; +#include "IncompressibleTurbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,50 +68,12 @@ int main(int argc, char *argv[]) + turbulence->divDevReff(U) ); - //UEqn.relax(); + UEqn.relax(); - fvVectorMatrix UEqnp(UEqn == -fvc::grad(p)); - - lduVectorMatrix U3Eqnp(mesh); - U3Eqnp.diag() = UEqnp.diag(); - U3Eqnp.upper() = UEqnp.upper(); - U3Eqnp.lower() = UEqnp.lower(); - U3Eqnp.source() = UEqnp.source(); - - UEqnp.addBoundaryDiag(U3Eqnp.diag(), 0); - UEqnp.addBoundarySource(U3Eqnp.source(), false); - - U3Eqnp.interfaces() = U.boundaryField().interfaces(); - U3Eqnp.interfacesUpper() = UEqnp.boundaryCoeffs().component(0); - U3Eqnp.interfacesLower() = UEqnp.internalCoeffs().component(0); - - autoPtr U3EqnpSolver = - lduVectorMatrix::solver::New - ( - U.name(), - U3Eqnp, - dictionary - ( - IStringStream - ( - "{" - " /*solver SmoothSolver;*/" - " smoother GaussSeidel;" - " solver PBiCCCG;" - " preconditioner none;" - " tolerance (1e-7 1e-7 1);" - " relTol (0 0 0);" - "}" - )() - ) - ); - - //for (int i=0; i<3; i++) + if (momentumPredictor) { - U3EqnpSolver->solve(U).print(Info); - U.correctBoundaryConditions(); + solve(UEqn == -fvc::grad(p)); } - //solve(UEqnp); // --- PISO loop @@ -173,6 +130,7 @@ int main(int argc, char *argv[]) } } + laminarTransport.correct(); turbulence->correct(); runTime.write(); diff --git a/applications/test/PisoFoam/createFields.H b/applications/test/PisoFoam/createFields.H index 7cae304f6f..d543396a8d 100644 --- a/applications/test/PisoFoam/createFields.H +++ b/applications/test/PisoFoam/createFields.H @@ -26,7 +26,7 @@ mesh ); -# include "createPhi.H" + #include "createPhi.H" label pRefCell = 0; @@ -36,7 +36,13 @@ singlePhaseTransportModel laminarTransport(U, phi); - autoPtr turbulence + autoPtr > + turbulence ( - incompressible::turbulenceModel::New(U, phi, laminarTransport) + IncompressibleTurbulenceModel::New + ( + U, + phi, + laminarTransport + ) ); diff --git a/applications/test/RhoPimpleFoam/EEqn.H b/applications/test/RhoPimpleFoam/EEqn.H new file mode 100644 index 0000000000..9972bdfff7 --- /dev/null +++ b/applications/test/RhoPimpleFoam/EEqn.H @@ -0,0 +1,33 @@ +{ + volScalarField& he = thermo.he(); + + fvScalarMatrix EEqn + ( + fvm::ddt(rho, he) + fvm::div(phi, he) + + fvc::ddt(rho, K) + fvc::div(phi, K) + + ( + he.name() == "e" + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) + : -dpdt + ) + //- fvm::laplacian(turbulence->alphaEff(), he) + - fvm::laplacian(turbulence->muEff(), he) + == + fvOptions(rho, he) + ); + + EEqn.relax(); + + fvOptions.constrain(EEqn); + + EEqn.solve(); + + fvOptions.correct(he); + + thermo.correct(); +} diff --git a/applications/test/RhoPimpleFoam/Make/files b/applications/test/RhoPimpleFoam/Make/files new file mode 100644 index 0000000000..087a67d213 --- /dev/null +++ b/applications/test/RhoPimpleFoam/Make/files @@ -0,0 +1,3 @@ +rhoPimpleFoam.C + +EXE = $(FOAM_USER_APPBIN)/RhoPimpleFoam diff --git a/applications/test/RhoPimpleFoam/Make/options b/applications/test/RhoPimpleFoam/Make/options new file mode 100644 index 0000000000..cc667ece05 --- /dev/null +++ b/applications/test/RhoPimpleFoam/Make/options @@ -0,0 +1,20 @@ +EXE_INC = \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fvOptions/lnInclude + +EXE_LIBS = \ + -lfluidThermophysicalModels \ + -lspecie \ + -lturbulenceModels \ + -lcompressibleTurbulenceModels \ + -lincompressibleTransportModels \ + -lfiniteVolume \ + -lmeshTools \ + -lsampling \ + -lfvOptions diff --git a/applications/test/RhoPimpleFoam/UEqn.H b/applications/test/RhoPimpleFoam/UEqn.H new file mode 100644 index 0000000000..1adabbc1f0 --- /dev/null +++ b/applications/test/RhoPimpleFoam/UEqn.H @@ -0,0 +1,22 @@ +// Solve the Momentum equation + +tmp UEqn +( + fvm::ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) + == + fvOptions(rho, U) +); + +UEqn().relax(); + +fvOptions.constrain(UEqn()); + +if (pimple.momentumPredictor()) +{ + solve(UEqn() == -fvc::grad(p)); + + fvOptions.correct(U); + K = 0.5*magSqr(U); +} diff --git a/applications/test/RhoPimpleFoam/createFields.H b/applications/test/RhoPimpleFoam/createFields.H new file mode 100644 index 0000000000..3a94360376 --- /dev/null +++ b/applications/test/RhoPimpleFoam/createFields.H @@ -0,0 +1,73 @@ + Info<< "Reading thermophysical properties\n" << endl; + + autoPtr pThermo + ( + psiThermo::New(mesh) + ); + psiThermo& thermo = pThermo(); + thermo.validate(args.executable(), "h", "e"); + + volScalarField& p = thermo.p(); + const volScalarField& psi = thermo.psi(); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() + ); + + Info<< "Reading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + #include "compressibleCreatePhi.H" + + dimensionedScalar rhoMax(pimple.dict().lookup("rhoMax")); + dimensionedScalar rhoMin(pimple.dict().lookup("rhoMin")); + + Info<< "Creating turbulence model\n" << endl; + + autoPtr > + turbulence + ( + CompressibleTurbulenceModel::New + ( + rho, + U, + phi, + thermo + ) + ); + + Info<< "Creating field dpdt\n" << endl; + volScalarField dpdt + ( + IOobject + ( + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) + ); + + Info<< "Creating field kinetic energy K\n" << endl; + volScalarField K("K", 0.5*magSqr(U)); diff --git a/applications/test/RhoPimpleFoam/pEqn.H b/applications/test/RhoPimpleFoam/pEqn.H new file mode 100644 index 0000000000..78f4ddb031 --- /dev/null +++ b/applications/test/RhoPimpleFoam/pEqn.H @@ -0,0 +1,113 @@ +rho = thermo.rho(); +rho = max(rho, rhoMin); +rho = min(rho, rhoMax); +rho.relax(); + +volScalarField rAU(1.0/UEqn().A()); +volVectorField HbyA("HbyA", U); +HbyA = rAU*UEqn().H(); + +if (pimple.nCorrPISO() <= 1) +{ + UEqn.clear(); +} + +if (pimple.transonic()) +{ + surfaceScalarField phid + ( + "phid", + fvc::interpolate(psi) + *( + (fvc::interpolate(HbyA) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phi) + ) + ); + + fvOptions.relativeFlux(fvc::interpolate(psi), phid); + + volScalarField Dp("Dp", rho*rAU); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvm::div(phid, p) + - fvm::laplacian(Dp, p) + == + fvOptions(psi, p, rho.name()) + ); + + fvOptions.constrain(pEqn); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi == pEqn.flux(); + } + } +} +else +{ + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::interpolate(rho) + *( + (fvc::interpolate(HbyA) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phi) + ) + ); + + fvOptions.relativeFlux(fvc::interpolate(rho), phiHbyA); + + volScalarField Dp("Dp", rho*rAU); + + while (pimple.correctNonOrthogonal()) + { + // Pressure corrector + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvc::div(phiHbyA) + - fvm::laplacian(Dp, p) + == + fvOptions(psi, p, rho.name()) + ); + + fvOptions.constrain(pEqn); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqn.flux(); + } + } +} + +#include "rhoEqn.H" +#include "compressibleContinuityErrs.H" + +// Explicitly relax pressure for momentum corrector +p.relax(); + +// Recalculate density from the relaxed pressure +rho = thermo.rho(); +rho = max(rho, rhoMin); +rho = min(rho, rhoMax); +rho.relax(); +Info<< "rho max/min : " << max(rho).value() + << " " << min(rho).value() << endl; + +U = HbyA - rAU*fvc::grad(p); +U.correctBoundaryConditions(); +fvOptions.correct(U); +K = 0.5*magSqr(U); + +if (thermo.dpdt()) +{ + dpdt = fvc::ddt(p); +} diff --git a/applications/test/RhoPimpleFoam/rhoPimpleFoam.C b/applications/test/RhoPimpleFoam/rhoPimpleFoam.C new file mode 100644 index 0000000000..2a17c938f4 --- /dev/null +++ b/applications/test/RhoPimpleFoam/rhoPimpleFoam.C @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 + rhoPimpleFoam + +Description + Transient solver for laminar or turbulent flow of compressible fluids + for HVAC and similar applications. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient simulations. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "psiThermo.H" +#include "CompressibleTurbulenceModel.H" +#include "bound.H" +#include "pimpleControl.H" +#include "fvIOoptionList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + + pimpleControl pimple(mesh); + + #include "createFields.H" + #include "createFvOptions.H" + #include "initContinuityErrs.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + 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; + + if (pimple.nCorrPIMPLE() <= 1) + { + #include "rhoEqn.H" + } + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "UEqn.H" + #include "EEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/Allwmake b/src/Allwmake index d5177cfafc..bafcd93df7 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -64,6 +64,7 @@ wmake $makeType randomProcesses thermophysicalModels/Allwmake $* transportModels/Allwmake $* turbulenceModels/Allwmake $* +TurbulenceModels/Allwmake $* wmake $makeType combustionModels regionModels/Allwmake $* lagrangian/Allwmake $* diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C index 002e4fab5b..b711b2d17f 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C @@ -97,6 +97,8 @@ void Foam::functionObjectFile::createFiles() filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat"))); writeFileHeader(i); + + i++; } } } @@ -240,6 +242,13 @@ Foam::OFstream& Foam::functionObjectFile::file() << endl; } + if (!filePtrs_.set(0)) + { + FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::file()") + << "File pointer at index " << 0 << " not allocated" + << abort(FatalError); + } + return filePtrs_[0]; } @@ -269,6 +278,13 @@ Foam::OFstream& Foam::functionObjectFile::file(const label i) << abort(FatalError); } + if (!filePtrs_.set(i)) + { + FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::file()") + << "File pointer at index " << i << " not allocated" + << abort(FatalError); + } + return filePtrs_[i]; } diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangle.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangle.H index de339b172e..6e8030c797 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangle.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangle.H @@ -40,6 +40,7 @@ SourceFiles #include "tensor.H" #include "pointHit.H" #include "Random.H" +#include "cachedRandom.H" #include "FixedList.H" #include "UList.H" #include "linePointRef.H" @@ -162,6 +163,10 @@ public: // distribution inline Point randomPoint(Random& rndGen) const; + //- Return a random point on the triangle from a uniform + // distribution + inline Point randomPoint(cachedRandom& rndGen) const; + //- Calculate the barycentric coordinates of the given // point, in the same order as a, b, c. Returns the // determinant of the solution. diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H index 1f4465637f..fbc5a14286 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H @@ -244,6 +244,25 @@ inline Point Foam::triangle::randomPoint(Random& rndGen) const } +template +inline Point Foam::triangle::randomPoint +( + cachedRandom& rndGen +) const +{ + // Generating Random Points in Triangles + // by Greg Turk + // from "Graphics Gems", Academic Press, 1990 + // http://tog.acm.org/GraphicsGems/gems/TriPoints.c + + scalar s = rndGen.sample01(); + + scalar t = sqrt(rndGen.sample01()); + + return (1 - t)*a_ + (1 - s)*t*b_ + s*t*c_; +} + + template Foam::scalar Foam::triangle::barycentric ( diff --git a/src/TurbulenceModels/Allwmake b/src/TurbulenceModels/Allwmake new file mode 100755 index 0000000000..c0daf57343 --- /dev/null +++ b/src/TurbulenceModels/Allwmake @@ -0,0 +1,12 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +makeType=${1:-libso} +set -x + +wmake libso turbulenceModel +wmake libso incompressible +wmake libso compressible +wmakeLnInclude phaseIncompressible +wmakeLnInclude phaseCompressible + +# ----------------------------------------------------------------- end-of-file diff --git a/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.C b/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.C new file mode 100644 index 0000000000..918331d8ec --- /dev/null +++ b/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "CompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::CompressibleTurbulenceModel:: +CompressibleTurbulenceModel +( + const geometricOneField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +: + TurbulenceModel + < + geometricOneField, + volScalarField, + compressibleTurbulenceModel, + transportModel + > + ( + alpha, + rho, + U, + alphaPhi, + phi, + transport, + propertiesName + ) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::CompressibleTurbulenceModel::New +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +{ + return autoPtr + ( + static_cast( + TurbulenceModel + < + geometricOneField, + volScalarField, + compressibleTurbulenceModel, + transportModel + >::New + ( + geometricOneField(), + rho, + U, + phi, + phi, + transport, + propertiesName + ).ptr()) + ); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.H b/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.H new file mode 100644 index 0000000000..ba118c0b02 --- /dev/null +++ b/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::CompressibleTurbulenceModel + +Description + Templated abstract base class for single-phase compressible + turbulence models. + +SourceFiles + CompressibleTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CompressibleTurbulenceModel_H +#define CompressibleTurbulenceModel_H + +#include "TurbulenceModel.H" +#include "compressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class CompressibleTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class CompressibleTurbulenceModel +: + public TurbulenceModel + < + geometricOneField, + volScalarField, + compressibleTurbulenceModel, + TransportModel + > +{ + +public: + + typedef geometricOneField alphaField; + typedef volScalarField rhoField; + typedef TransportModel transportModel; + + + // Constructors + + //- Construct + CompressibleTurbulenceModel + ( + const geometricOneField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& trasport, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr New + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const transportModel& trasportModel, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~CompressibleTurbulenceModel() + {} + + + // Member Functions + + //- Return the laminar dynamic viscosity + virtual tmp mu() const + { + return this->transport_.mu(); + } + + //- Return the laminar dynamic viscosity on patch + virtual tmp mu(const label patchi) const + { + return this->transport_.mu(patchi); + } + + //- Return the turbulence dynamic viscosity + virtual tmp mut() const + { + return this->rho_*this->nut(); + } + + //- Return the turbulence dynamic viscosity on patch + virtual tmp mut(const label patchi) const + { + return this->rho_.boundaryField()[patchi]*this->nut(patchi); + } + + //- Return the effective dynamic viscosity + virtual tmp muEff() const + { + return mut() + mu(); + } + + //- Return the effective dynamic viscosity on patch + virtual tmp muEff(const label patchi) const + { + return mut(patchi) + mu(patchi); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "CompressibleTurbulenceModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/Make/files b/src/TurbulenceModels/compressible/Make/files new file mode 100644 index 0000000000..c4107f1050 --- /dev/null +++ b/src/TurbulenceModels/compressible/Make/files @@ -0,0 +1,4 @@ +compressibleTurbulenceModel.C +compressibleTurbulenceModels.C + +LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModels diff --git a/src/TurbulenceModels/compressible/Make/options b/src/TurbulenceModels/compressible/Make/options new file mode 100644 index 0000000000..73c2a143ce --- /dev/null +++ b/src/TurbulenceModels/compressible/Make/options @@ -0,0 +1,12 @@ +EXE_INC = \ + -I../turbulenceModel/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lfluidThermophysicalModels \ + -lspecie diff --git a/src/TurbulenceModels/compressible/compressibleTurbulenceModel.C b/src/TurbulenceModels/compressible/compressibleTurbulenceModel.C new file mode 100644 index 0000000000..a9e7794cff --- /dev/null +++ b/src/TurbulenceModels/compressible/compressibleTurbulenceModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "compressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(compressibleTurbulenceModel, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::compressibleTurbulenceModel::compressibleTurbulenceModel +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const word& propertiesName +) +: + turbulenceModel + ( + U, + alphaPhi, + phi, + propertiesName + ), + rho_(rho) +{} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/compressibleTurbulenceModel.H b/src/TurbulenceModels/compressible/compressibleTurbulenceModel.H new file mode 100644 index 0000000000..d762dc5a05 --- /dev/null +++ b/src/TurbulenceModels/compressible/compressibleTurbulenceModel.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::compressibleTurbulenceModel + +Description + Abstract base class for turbulence models (RAS, LES and laminar). + +SourceFiles + compressibleTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef compressibleTurbulenceModel_H +#define compressibleTurbulenceModel_H + +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declarations +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class compressibleTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +class compressibleTurbulenceModel +: + public turbulenceModel +{ + +protected: + + // Protected data + + const volScalarField& rho_; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + compressibleTurbulenceModel(const compressibleTurbulenceModel&); + + //- Disallow default bitwise assignment + void operator=(const compressibleTurbulenceModel&); + + +public: + + //- Runtime type information + TypeName("compressibleTurbulenceModel"); + + + // Constructors + + //- Construct from components + compressibleTurbulenceModel + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const word& propertiesName + ); + + + //- Destructor + virtual ~compressibleTurbulenceModel() + {} + + + // Member Functions + + //- Return the effective stress tensor including the laminar stress + virtual tmp devRhoReff() const = 0; + + //- Return the source term for the momentum equation + virtual tmp divDevRhoReff(volVectorField& U) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/compressibleTurbulenceModels.C b/src/TurbulenceModels/compressible/compressibleTurbulenceModels.C new file mode 100644 index 0000000000..b8779c591e --- /dev/null +++ b/src/TurbulenceModels/compressible/compressibleTurbulenceModels.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "CompressibleTurbulenceModel.H" +#include "laminar.H" +#include "RASModel.H" +#include "kEpsilon.H" +#include "fluidThermo.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ + typedef TurbulenceModel + < + geometricOneField, + volScalarField, + compressibleTurbulenceModel, + fluidThermo + > baseCompressibleFluidThermoTurbulenceModel; + + defineTemplateRunTimeSelectionTable + ( + baseCompressibleFluidThermoTurbulenceModel, + dictionary + ); + + + typedef CompressibleTurbulenceModel + compressibleFluidThermoTurbulenceModel; + + typedef laminar compressibleLaminar; + + defineNamedTemplateTypeNameAndDebug(compressibleLaminar, 0); + + addToRunTimeSelectionTable + ( + baseCompressibleFluidThermoTurbulenceModel, + compressibleLaminar, + dictionary + ); + + + typedef RASModel + compressibleRASModel; + + defineNamedTemplateTypeNameAndDebug(compressibleRASModel, 0); + + defineTemplateRunTimeSelectionTable(compressibleRASModel, dictionary); + + addToRunTimeSelectionTable + ( + baseCompressibleFluidThermoTurbulenceModel, + compressibleRASModel, + dictionary + ); + + + namespace RASModels + { + typedef kEpsilon + compressibleKEpsilon; + + defineNamedTemplateTypeNameAndDebug(compressibleKEpsilon, 0); + + addToRunTimeSelectionTable + ( + compressibleRASModel, + compressibleKEpsilon, + dictionary + ); + } +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.C b/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.C new file mode 100644 index 0000000000..96179e22b8 --- /dev/null +++ b/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.C @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "IncompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::IncompressibleTurbulenceModel:: +IncompressibleTurbulenceModel +( + const geometricOneField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName +) +: + TurbulenceModel + < + geometricOneField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + > + ( + alpha, + rho, + U, + alphaPhi, + phi, + transportModel, + propertiesName + ) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::IncompressibleTurbulenceModel::New +( + const volVectorField& U, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName +) +{ + return autoPtr + ( + static_cast( + TurbulenceModel + < + geometricOneField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + >::New + ( + geometricOneField(), + geometricOneField(), + U, + phi, + phi, + transportModel, + propertiesName + ).ptr()) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp +Foam::IncompressibleTurbulenceModel::devReff() const +{ + return devRhoReff(); +} + + +template +Foam::tmp +Foam::IncompressibleTurbulenceModel::divDevReff +( + volVectorField& U +) const +{ + return divDevRhoReff(U); +} + + +template +Foam::tmp +Foam::IncompressibleTurbulenceModel:: +devRhoReff() const +{ + notImplemented + ( + "IncompressibleTurbulenceModel::" + "devRhoReff()" + ); + + return devReff(); +} + + +template +Foam::tmp +Foam::IncompressibleTurbulenceModel:: +divDevRhoReff +( + volVectorField& U +) const +{ + notImplemented + ( + "IncompressibleTurbulenceModel::" + "divDevRhoReff(volVectorField& U)" + ); + + return divDevReff(U); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.H b/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.H new file mode 100644 index 0000000000..d774ff9177 --- /dev/null +++ b/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::IncompressibleTurbulenceModel + +Description + Templated abstract base class for single-phase incompressible + turbulence models. + +SourceFiles + IncompressibleTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IncompressibleTurbulenceModel_H +#define IncompressibleTurbulenceModel_H + +#include "TurbulenceModel.H" +#include "incompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IncompressibleTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class IncompressibleTurbulenceModel +: + public TurbulenceModel + < + geometricOneField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + > +{ + +public: + + typedef geometricOneField alphaField; + typedef geometricOneField rhoField; + typedef TransportModel transportModel; + + + // Constructors + + //- Construct + IncompressibleTurbulenceModel + ( + const geometricOneField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const TransportModel& trasportModel, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr New + ( + const volVectorField& U, + const surfaceScalarField& phi, + const TransportModel& trasportModel, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~IncompressibleTurbulenceModel() + {} + + + // Member Functions + + //- Return the effective stress tensor + virtual tmp devReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevReff(volVectorField& U) const; + + //- Return the effective stress tensor + virtual tmp devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevRhoReff(volVectorField& U) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "IncompressibleTurbulenceModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/Make/files b/src/TurbulenceModels/incompressible/Make/files new file mode 100644 index 0000000000..4b3ca65c16 --- /dev/null +++ b/src/TurbulenceModels/incompressible/Make/files @@ -0,0 +1,4 @@ +incompressibleTurbulenceModel.C +incompressibleTurbulenceModels.C + +LIB = $(FOAM_LIBBIN)/libincompressibleTurbulenceModels diff --git a/src/TurbulenceModels/incompressible/Make/options b/src/TurbulenceModels/incompressible/Make/options new file mode 100644 index 0000000000..0763d29c16 --- /dev/null +++ b/src/TurbulenceModels/incompressible/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I../turbulenceModel/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude + +LIB_LIBS = \ + -lincompressibleTransportModels \ + -lfiniteVolume \ + -lmeshTools diff --git a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.C b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.C new file mode 100644 index 0000000000..232a31fc83 --- /dev/null +++ b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "incompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(incompressibleTurbulenceModel, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::incompressibleTurbulenceModel::incompressibleTurbulenceModel +( + const geometricOneField&, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const word& propertiesName +) +: + turbulenceModel + ( + U, + alphaPhi, + phi, + propertiesName + ) +{} + + +Foam::tmp +Foam::incompressibleTurbulenceModel::mu() const +{ + return nu(); +} + + +Foam::tmp +Foam::incompressibleTurbulenceModel::mu(const label patchi) const +{ + return nu(patchi); +} + + +Foam::tmp +Foam::incompressibleTurbulenceModel::mut() const +{ + return nut(); +} + + +Foam::tmp +Foam::incompressibleTurbulenceModel::mut(const label patchi) const +{ + return nut(patchi); +} + + +Foam::tmp +Foam::incompressibleTurbulenceModel::muEff() const +{ + return nuEff(); +} + + +Foam::tmp +Foam::incompressibleTurbulenceModel::muEff(const label patchi) const +{ + return nuEff(patchi); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H new file mode 100644 index 0000000000..6876d88a48 --- /dev/null +++ b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::incompressibleTurbulenceModel + +Description + Abstract base class for turbulence models (RAS, LES and laminar). + +SourceFiles + incompressibleTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef incompressibleTurbulenceModel_H +#define incompressibleTurbulenceModel_H + +#include "turbulenceModel.H" +#include "geometricOneField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declarations +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class incompressibleTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +class incompressibleTurbulenceModel +: + public turbulenceModel +{ + +protected: + + // Protected data + + geometricOneField rho_; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + incompressibleTurbulenceModel(const incompressibleTurbulenceModel&); + + //- Disallow default bitwise assignment + void operator=(const incompressibleTurbulenceModel&); + + +public: + + //- Runtime type information + TypeName("incompressibleTurbulenceModel"); + + + // Constructors + + //- Construct from components + incompressibleTurbulenceModel + ( + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const word& propertiesName + ); + + + //- Destructor + virtual ~incompressibleTurbulenceModel() + {} + + + // Member Functions + + //- Return the laminar dynamic viscosity + virtual tmp mu() const; + + //- Return the laminar dynamic viscosity on patch + virtual tmp mu(const label patchi) const; + + //- Return the turbulence dynamic viscosity + virtual tmp mut() const; + + //- Return the turbulence dynamic viscosity on patch + virtual tmp mut(const label patchi) const; + + //- Return the effective dynamic viscosity + virtual tmp muEff() const; + + //- Return the effective dynamic viscosity on patch + virtual tmp muEff(const label patchi) const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp devReff() const = 0; + + //- Return the source term for the momentum equation + virtual tmp divDevReff(volVectorField& U) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModels.C b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModels.C new file mode 100644 index 0000000000..6d3b8aef5f --- /dev/null +++ b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModels.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "IncompressibleTurbulenceModel.H" +#include "laminar.H" +#include "RASModel.H" +#include "kEpsilon.H" +#include "transportModel.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ + typedef TurbulenceModel + < + geometricOneField, + geometricOneField, + incompressibleTurbulenceModel, + transportModel + > baseIncompressibleTransportTurbulenceModel; + + defineTemplateRunTimeSelectionTable + ( + baseIncompressibleTransportTurbulenceModel, + dictionary + ); + + typedef IncompressibleTurbulenceModel + < + transportModel + > incompressibleTransportTurbulenceModel; + + typedef laminar + incompressibleLaminar; + + defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0); + + addToRunTimeSelectionTable + ( + baseIncompressibleTransportTurbulenceModel, + incompressibleLaminar, + dictionary + ); + + + typedef RASModel + incompressibleRASModel; + + defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0); + + defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary); + + addToRunTimeSelectionTable + ( + baseIncompressibleTransportTurbulenceModel, + incompressibleRASModel, + dictionary + ); + + namespace RASModels + { + typedef kEpsilon + incompressibleKEpsilon; + + defineNamedTemplateTypeNameAndDebug(incompressibleKEpsilon, 0); + + addToRunTimeSelectionTable + ( + incompressibleRASModel, + incompressibleKEpsilon, + dictionary + ); + } +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.C b/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.C new file mode 100644 index 0000000000..70b60a64fa --- /dev/null +++ b/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "PhaseCompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::PhaseCompressibleTurbulenceModel:: +PhaseCompressibleTurbulenceModel +( + const volScalarField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +: + TurbulenceModel + < + volScalarField, + volScalarField, + compressibleTurbulenceModel, + transportModel + > + ( + alpha, + rho, + U, + alphaPhi, + phi, + transport, + propertiesName + ) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::PhaseCompressibleTurbulenceModel::New +( + const volScalarField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +{ + return autoPtr + ( + static_cast( + TurbulenceModel + < + volScalarField, + volScalarField, + compressibleTurbulenceModel, + transportModel + >::New + ( + alpha, + rho, + U, + alphaPhi, + phi, + transport, + propertiesName + ).ptr()) + ); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.H b/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.H new file mode 100644 index 0000000000..5eefb4ea3d --- /dev/null +++ b/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.H @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::PhaseCompressibleTurbulenceModel + +Description + Templated abstract base class for multiphase compressible + turbulence models. + +SourceFiles + PhaseCompressibleTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PhaseCompressibleTurbulenceModel_H +#define PhaseCompressibleTurbulenceModel_H + +#include "TurbulenceModel.H" +#include "compressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class PhaseCompressibleTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class PhaseCompressibleTurbulenceModel +: + public TurbulenceModel + < + volScalarField, + volScalarField, + compressibleTurbulenceModel, + TransportModel + > +{ + +public: + + typedef volScalarField alphaField; + typedef volScalarField rhoField; + typedef TransportModel transportModel; + + + // Constructors + + //- Construct + PhaseCompressibleTurbulenceModel + ( + const alphaField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& trasport, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr New + ( + const alphaField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& trasportModel, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~PhaseCompressibleTurbulenceModel() + {} + + + // Member Functions + + //- Return the laminar dynamic viscosity + virtual tmp mu() const + { + return this->transport_.mu(); + } + + //- Return the laminar dynamic viscosity on patch + virtual tmp mu(const label patchi) const + { + return this->transport_.mu(patchi); + } + + //- Return the turbulence dynamic viscosity + virtual tmp mut() const + { + return this->rho_*this->nut(); + } + + //- Return the turbulence dynamic viscosity on patch + virtual tmp mut(const label patchi) const + { + return this->rho_.boundaryField()[patchi]*this->nut(patchi); + } + + //- Return the effective dynamic viscosity + virtual tmp muEff() const + { + return mut() + mu(); + } + + //- Return the effective dynamic viscosity on patch + virtual tmp muEff(const label patchi) const + { + return mut(patchi) + mu(patchi); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "PhaseCompressibleTurbulenceModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C new file mode 100644 index 0000000000..003c86794b --- /dev/null +++ b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C @@ -0,0 +1,199 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "PhaseIncompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::PhaseIncompressibleTurbulenceModel:: +PhaseIncompressibleTurbulenceModel +( + const volScalarField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName +) +: + TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + > + ( + alpha, + rho, + U, + alphaPhi, + phi, + transportModel, + propertiesName + ) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::PhaseIncompressibleTurbulenceModel::New +( + const volScalarField& alpha, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName +) +{ + return autoPtr + ( + static_cast( + TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + >::New + ( + alpha, + geometricOneField(), + U, + alphaPhi, + phi, + transportModel, + propertiesName + ).ptr()) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp +Foam::PhaseIncompressibleTurbulenceModel::pPrime() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + IOobject::groupName("pPrime", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh_, + dimensionedScalar("pPrimef", dimPressure, 0.0) + ) + ); +} + + +template +Foam::tmp +Foam::PhaseIncompressibleTurbulenceModel::pPrimef() const +{ + return tmp + ( + new surfaceScalarField + ( + IOobject + ( + IOobject::groupName("pPrimef", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh_, + dimensionedScalar("pPrimef", dimPressure, 0.0) + ) + ); +} + + +template +Foam::tmp +Foam::PhaseIncompressibleTurbulenceModel::devReff() const +{ + return devRhoReff(); +} + + +template +Foam::tmp +Foam::PhaseIncompressibleTurbulenceModel::divDevReff +( + volVectorField& U +) const +{ + return divDevRhoReff(U); +} + + +template +Foam::tmp +Foam::PhaseIncompressibleTurbulenceModel:: +devRhoReff() const +{ + notImplemented + ( + "PhaseIncompressibleTurbulenceModel::" + "devRhoReff()" + ); + + return devReff(); +} + + +template +Foam::tmp +Foam::PhaseIncompressibleTurbulenceModel:: +divDevRhoReff +( + volVectorField& U +) const +{ + notImplemented + ( + "PhaseIncompressibleTurbulenceModel::" + "divDevRhoReff(volVectorField& U)" + ); + + return divDevReff(U); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H new file mode 100644 index 0000000000..c15b54e92a --- /dev/null +++ b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::PhaseIncompressibleTurbulenceModel + +Description + Templated abstract base class for multiphase incompressible + turbulence models. + +SourceFiles + PhaseIncompressibleTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PhaseIncompressibleTurbulenceModel_H +#define PhaseIncompressibleTurbulenceModel_H + +#include "TurbulenceModel.H" +#include "incompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class PhaseIncompressibleTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class PhaseIncompressibleTurbulenceModel +: + public TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + > +{ + +public: + + typedef volScalarField alphaField; + typedef geometricOneField rhoField; + typedef TransportModel transportModel; + + + // Constructors + + //- Construct + PhaseIncompressibleTurbulenceModel + ( + const alphaField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const TransportModel& trasportModel, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr New + ( + const alphaField& alpha, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const TransportModel& trasportModel, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~PhaseIncompressibleTurbulenceModel() + {} + + + // Member Functions + + //- Return the phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrime() const; + + //- Return the face-phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrimef() const; + + //- Return the effective stress tensor + virtual tmp devReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevReff(volVectorField& U) const; + + //- Return the effective stress tensor + virtual tmp devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevRhoReff(volVectorField& U) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "PhaseIncompressibleTurbulenceModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C b/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C new file mode 100644 index 0000000000..2194280174 --- /dev/null +++ b/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C @@ -0,0 +1,265 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "LaheyKEpsilon.H" +#include "addToRunTimeSelectionTable.H" +#include "twoPhaseSystem.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +LaheyKEpsilon::LaheyKEpsilon +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName, + const word& type +) +: + kEpsilon + ( + alpha, + rho, + U, + alphaPhi, + phi, + transport, + propertiesName, + type + ), + + gasTurbulencePtr_(NULL), + + alphaInversion_ + ( + dimensioned::lookupOrAddToDict + ( + "alphaInversion", + this->coeffDict_, + 0.3 + ) + ), + + Cp_ + ( + dimensioned::lookupOrAddToDict + ( + "Cp", + this->coeffDict_, + 0.25 + ) + ), + + Cmub_ + ( + dimensioned::lookupOrAddToDict + ( + "Cmub", + this->coeffDict_, + 0.6 + ) + ) +{ + if (type == typeName) + { + correctNut(); + this->printCoeffs(type); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool LaheyKEpsilon::read() +{ + if (kEpsilon::read()) + { + alphaInversion_.readIfPresent(this->coeffDict()); + Cp_.readIfPresent(this->coeffDict()); + Cmub_.readIfPresent(this->coeffDict()); + + return true; + } + else + { + return false; + } +} + + +template +const PhaseIncompressibleTurbulenceModel +< + typename BasicTurbulenceModel::transportModel +>& +LaheyKEpsilon::gasTurbulence() const +{ + if (!gasTurbulencePtr_) + { + const volVectorField& U = this->U_; + + const transportModel& liquid = this->transport(); + const twoPhaseSystem& fluid = liquid.fluid(); + const transportModel& gas = fluid.otherPhase(liquid); + + gasTurbulencePtr_ = + &U.db() + .lookupObject > + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + gas.name() + ) + ); + } + + return *gasTurbulencePtr_; +} + + +template +void LaheyKEpsilon::correctNut() +{ + const PhaseIncompressibleTurbulenceModel& gasTurbulence = + this->gasTurbulence(); + + this->nut_ = + this->Cmu_*sqr(this->k_)/this->epsilon_ + + Cmub_*gasTurbulence.transport().d()*gasTurbulence.alpha() + *(mag(this->U_ - gasTurbulence.U())); + + this->nut_.correctBoundaryConditions(); +} + + +template +tmp LaheyKEpsilon::bubbleG() const +{ + const PhaseIncompressibleTurbulenceModel& gasTurbulence = + this->gasTurbulence(); + + const transportModel& liquid = this->transport(); + const twoPhaseSystem& fluid = liquid.fluid(); + const transportModel& gas = fluid.otherPhase(liquid); + + volScalarField magUr(mag(this->U_ - gasTurbulence.U())); + + tmp bubbleG + ( + Cp_ + *( + pow3(magUr) + + pow(fluid.drag(gas).K(magUr)*gas.d()/liquid.rho(), 3.0/4.0) + *pow(magUr, 9.0/4.0) + ) + *gas + /gas.d() + ); + + return bubbleG; +} + + +template +tmp +LaheyKEpsilon::phaseTransferCoeff() const +{ + const volVectorField& U = this->U_; + const alphaField& alpha = this->alpha_; + const rhoField& rho = this->rho_; + + const turbulenceModel& gasTurbulence = this->gasTurbulence(); + + return + ( + max(alphaInversion_ - alpha, 0.0) + *rho + *min(gasTurbulence.epsilon()/gasTurbulence.k(), 1.0/U.time().deltaT()) + ); +} + + +template +tmp LaheyKEpsilon::kSource() const +{ + const alphaField& alpha = this->alpha_; + const rhoField& rho = this->rho_; + + const PhaseIncompressibleTurbulenceModel& gasTurbulence = + this->gasTurbulence(); + + const volScalarField phaseTransferCoeff(this->phaseTransferCoeff()); + + return + alpha*rho*bubbleG() + + phaseTransferCoeff*gasTurbulence.k() + - fvm::Sp(phaseTransferCoeff, this->k_); +} + + +template +tmp LaheyKEpsilon::epsilonSource() const +{ + const alphaField& alpha = this->alpha_; + const rhoField& rho = this->rho_; + + const PhaseIncompressibleTurbulenceModel& gasTurbulence = + this->gasTurbulence(); + + const volScalarField phaseTransferCoeff(this->phaseTransferCoeff()); + + return + alpha*rho*this->C2_*this->epsilon_*bubbleG()/this->k_ + + phaseTransferCoeff*gasTurbulence.epsilon() + - fvm::Sp(phaseTransferCoeff, this->epsilon_); +} + + +template +void LaheyKEpsilon::correct() +{ + kEpsilon::correct(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.H b/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.H new file mode 100644 index 0000000000..8766fe454f --- /dev/null +++ b/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.H @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::RASModels::LaheyKEpsilon + +Group + grpRASTurbulence + +Description + +SourceFiles + LaheyKEpsilon.C + +\*---------------------------------------------------------------------------*/ + +#ifndef LaheyKEpsilon_H +#define LaheyKEpsilon_H + +#include "kEpsilon.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class LaheyKEpsilon Declaration +\*---------------------------------------------------------------------------*/ + +template +class LaheyKEpsilon +: + public kEpsilon +{ + // Private data + + mutable const PhaseIncompressibleTurbulenceModel + < + typename BasicTurbulenceModel::transportModel + > *gasTurbulencePtr_; + + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar alphaInversion_; + dimensionedScalar Cp_; + dimensionedScalar Cmub_; + + + // Protected member functions + + virtual void correctNut(); + tmp bubbleG() const; + tmp phaseTransferCoeff() const; + virtual tmp kSource() const; + virtual tmp epsilonSource() const; + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + + //- Runtime type information + TypeName("LaheyKEpsilon"); + + + // Constructors + + //- Construct from components + LaheyKEpsilon + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName, + const word& type = typeName + ); + + + //- Destructor + virtual ~LaheyKEpsilon() + {} + + + // Member Functions + + //- Return the turbulence model for the gas phase + const PhaseIncompressibleTurbulenceModel& + gasTurbulence() const; + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "LaheyKEpsilon.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C b/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C new file mode 100644 index 0000000000..a237a8998c --- /dev/null +++ b/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C @@ -0,0 +1,280 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "continuousGasKEpsilon.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +continuousGasKEpsilon::continuousGasKEpsilon +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName, + const word& type +) +: + kEpsilon + ( + alpha, + rho, + U, + alphaPhi, + phi, + transport, + propertiesName, + type + ), + + liquidTurbulencePtr_(NULL), + + nutEff_ + ( + IOobject + ( + IOobject::groupName("nutEff", U.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + this->nut_ + ), + + alphaInversion_ + ( + dimensioned::lookupOrAddToDict + ( + "alphaInversion", + this->coeffDict_, + 0.7 + ) + ) +{ + if (type == typeName) + { + kEpsilon::correctNut(); + this->printCoeffs(type); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool continuousGasKEpsilon::read() +{ + if (kEpsilon::read()) + { + alphaInversion_.readIfPresent(this->coeffDict()); + + return true; + } + else + { + return false; + } +} + + +template +void continuousGasKEpsilon::correctNut() +{ + kEpsilon::correctNut(); + + const turbulenceModel& liquidTurbulence = this->liquidTurbulence(); + const transportModel& gas = this->transport(); + const twoPhaseSystem& fluid = gas.fluid(); + const transportModel& liquid = fluid.otherPhase(gas); + + volScalarField thetal(liquidTurbulence.k()/liquidTurbulence.epsilon()); + volScalarField thetag((1.0/(18*liquid.nu()))*sqr(gas.d())); + volScalarField expThetar(exp(min(thetal/thetag, 50.0))); + volScalarField omega(sqr(expThetar - 1)/(sqr(expThetar) - 1)); + + nutEff_ = omega*liquidTurbulence.nut(); +} + + +template +const turbulenceModel& +continuousGasKEpsilon::liquidTurbulence() const +{ + if (!liquidTurbulencePtr_) + { + const volVectorField& U = this->U_; + + const transportModel& gas = this->transport(); + const twoPhaseSystem& fluid = gas.fluid(); + const transportModel& liquid = fluid.otherPhase(gas); + + liquidTurbulencePtr_ = + &U.db().lookupObject + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + liquid.name() + ) + ); + } + + return *liquidTurbulencePtr_; +} + + +template +tmp +continuousGasKEpsilon::nuEff() const +{ + volScalarField blend + ( + max(min((this->alpha_ - 0.5)/(alphaInversion_ - 0.5), 1.0), 0.0) + ); + + return tmp + ( + new volScalarField + ( + IOobject::groupName("nuEff", this->U_.group()), + blend*this->nut_ + + (1.0 - blend)*rhoEff()*nutEff_/this->transport().rho() + + this->nu() + ) + ); +} + + +template +tmp +continuousGasKEpsilon::rhoEff() const +{ + const transportModel& gas = this->transport(); + const twoPhaseSystem& fluid = gas.fluid(); + const transportModel& liquid = fluid.otherPhase(gas); + + return tmp + ( + new volScalarField + ( + IOobject::groupName("rhoEff", this->U_.group()), + gas.rho() + (fluid.Cvm() + 3.0/20.0)*liquid.rho() + ) + ); +} + + +template +tmp +continuousGasKEpsilon::phaseTransferCoeff() const +{ + const volVectorField& U = this->U_; + const alphaField& alpha = this->alpha_; + const rhoField& rho = this->rho_; + + const turbulenceModel& liquidTurbulence = this->liquidTurbulence(); + + return + ( + max(alphaInversion_ - alpha, 0.0) + *rho + *min + ( + liquidTurbulence.epsilon()/liquidTurbulence.k(), + 1.0/U.time().deltaT() + ) + ); +} + + +template +tmp +continuousGasKEpsilon::kSource() const +{ + const turbulenceModel& liquidTurbulence = this->liquidTurbulence(); + const volScalarField phaseTransferCoeff(this->phaseTransferCoeff()); + + return + phaseTransferCoeff*liquidTurbulence.k() + - fvm::Sp(phaseTransferCoeff, this->k_); +} + + +template +tmp +continuousGasKEpsilon::epsilonSource() const +{ + const turbulenceModel& liquidTurbulence = this->liquidTurbulence(); + const volScalarField phaseTransferCoeff(this->phaseTransferCoeff()); + + return + phaseTransferCoeff*liquidTurbulence.epsilon() + - fvm::Sp(phaseTransferCoeff, this->epsilon_); +} + + +template +tmp +continuousGasKEpsilon::R() const +{ + tmp tk(this->k()); + + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + IOobject::groupName("R", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + ((2.0/3.0)*I)*tk() - (nutEff_)*dev(twoSymm(fvc::grad(this->U_))), + tk().boundaryField().types() + ) + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.H b/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.H new file mode 100644 index 0000000000..ecb9486339 --- /dev/null +++ b/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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::RASModels::continuousGasKEpsilon + +Group + grpRASTurbulence + +Description + +SourceFiles + continuousGasKEpsilon.C + +\*---------------------------------------------------------------------------*/ + +#ifndef continuousGasKEpsilon_H +#define continuousGasKEpsilon_H + +#include "kEpsilon.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class continuousGasKEpsilon Declaration +\*---------------------------------------------------------------------------*/ + +template +class continuousGasKEpsilon +: + public kEpsilon +{ + // Private data + + mutable const turbulenceModel *liquidTurbulencePtr_; + + volScalarField nutEff_; + + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar alphaInversion_; + + + // Protected member functions + + virtual void correctNut(); + tmp phaseTransferCoeff() const; + virtual tmp kSource() const; + virtual tmp epsilonSource() const; + + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + + //- Runtime type information + TypeName("continuousGasKEpsilon"); + + + // Constructors + + //- Construct from components + continuousGasKEpsilon + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName, + const word& type = typeName + ); + + + //- Destructor + virtual ~continuousGasKEpsilon() + {} + + + // Member Functions + + //- Return the turbulence model for the liquid phase + const turbulenceModel& liquidTurbulence() const; + + //- Return the effective viscosity + virtual tmp nuEff() const; + + //- Return the effective density for the stress + virtual tmp rhoEff() const; + + //- Return the Reynolds stress tensor + virtual tmp R() const; + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "continuousGasKEpsilon.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/Make/files b/src/TurbulenceModels/turbulenceModel/Make/files new file mode 100644 index 0000000000..b1b166316c --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/Make/files @@ -0,0 +1,49 @@ +turbulenceModel.C + +derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C +derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C + +/* Wall functions */ +wallFunctions = RAS/derivedFvPatchFields/wallFunctions + +nutWallFunctions = $(wallFunctions)/nutWallFunctions +$(nutWallFunctions)/nutWallFunction/nutWallFunctionFvPatchScalarField.C + +$(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C +$(nutWallFunctions)/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C +$(nutWallFunctions)/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C + +$(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C +$(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C +$(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C +$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C +$(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C + +epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions +$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +$(epsilonWallFunctions)/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C + +omegaWallFunctions = $(wallFunctions)/omegaWallFunctions +$(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C + +kqRWallFunctions = $(wallFunctions)/kqRWallFunctions +$(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C +$(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C + +/* +v2WallFunctions = $(wallFunctions)/v2WallFunctions +$(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C + +fWallFunctions = $(wallFunctions)/fWallFunctions +$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C +*/ + +/* Patch fields */ +RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C + +/* backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C */ + +LIB = $(FOAM_LIBBIN)/libturbulenceModels diff --git a/src/TurbulenceModels/turbulenceModel/Make/options b/src/TurbulenceModels/turbulenceModel/Make/options new file mode 100644 index 0000000000..a3ae8da833 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.C b/src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.C new file mode 100644 index 0000000000..44a46a97bb --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.C @@ -0,0 +1,184 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 "RASModel.H" + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::RASModel::printCoeffs(const word& type) +{ + if (printCoeffs_) + { + Info<< type << "Coeffs" << coeffDict_ << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::RASModel::RASModel +( + const word& type, + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +: + BasicTurbulenceModel + ( + alpha, + rho, + U, + alphaPhi, + phi, + transport, + propertiesName + ), + + RASDict_(this->subOrEmptyDict("RAS")), + turbulence_(RASDict_.lookup("turbulence")), + printCoeffs_(RASDict_.lookupOrDefault("printCoeffs", false)), + coeffDict_(RASDict_.subOrEmptyDict(type + "Coeffs")), + + kMin_("kMin", sqr(dimVelocity), SMALL), + epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL), + omegaMin_("omegaMin", dimless/dimTime, SMALL) +{ + kMin_.readIfPresent(RASDict_); + epsilonMin_.readIfPresent(RASDict_); + omegaMin_.readIfPresent(RASDict_); + + // Force the construction of the mesh deltaCoeffs which may be needed + // for the construction of the derived models and BCs + this->mesh_.deltaCoeffs(); +} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::RASModel::New +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +{ + // get model name, but do not register the dictionary + // otherwise it is registered in the database twice + const word modelType + ( + IOdictionary + ( + IOobject + ( + IOobject::groupName(propertiesName, U.group()), + U.time().constant(), + U.db(), + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ) + ).subDict("RAS").lookup("RASModel") + ); + + Info<< "Selecting RAS turbulence model " << modelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "RASModel::New" + "(" + "const volScalarField&, " + "const volVectorField&, " + "const surfaceScalarField&, " + "transportModel&, " + "const word&" + ")" + ) << "Unknown RASModel type " + << modelType << nl << nl + << "Valid RASModel types:" << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr + ( + cstrIter()(alpha, rho, U, alphaPhi, phi, transport, propertiesName) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::RASModel::correct() +{ + BasicTurbulenceModel::correct(); +} + + +template +bool Foam::RASModel::read() +{ + if (turbulenceModel::read()) + { + RASDict_ <<= this->subDict("RAS"); + RASDict_.lookup("turbulence") >> turbulence_; + + if (const dictionary* dictPtr = RASDict_.subDictPtr(type() + "Coeffs")) + { + coeffDict_ <<= *dictPtr; + } + + kMin_.readIfPresent(RASDict_); + epsilonMin_.readIfPresent(RASDict_); + omegaMin_.readIfPresent(RASDict_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.H b/src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.H new file mode 100644 index 0000000000..61aefd784f --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.H @@ -0,0 +1,267 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 . + +Namespace + Foam::RASModels + +Description + Namespace for RAS turbulence models. + +Class + Foam::RASModel + +Description + Templated abstract base class for RAS turbulence models + +SourceFiles + RASModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef RASModel_H +#define RASModel_H + +#include "TurbulenceModel.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "fvm.H" +#include "fvc.H" +#include "fvMatrices.H" +#include "IOdictionary.H" +#include "Switch.H" +#include "bound.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class RASModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class RASModel +: + public BasicTurbulenceModel +{ + +protected: + + // Protected data + + //- RAS coefficients dictionary + dictionary RASDict_; + + //- Turbulence on/off flag + Switch turbulence_; + + //- Flag to print the model coeffs at run-time + Switch printCoeffs_; + + //- Model coefficients dictionary + dictionary coeffDict_; + + //- Lower limit of k + dimensionedScalar kMin_; + + //- Lower limit of epsilon + dimensionedScalar epsilonMin_; + + //- Lower limit for omega + dimensionedScalar omegaMin_; + + + // Protected Member Functions + + //- Print model coefficients + virtual void printCoeffs(const word& type); + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + RASModel(const RASModel&); + + //- Disallow default bitwise assignment + void operator=(const RASModel&); + + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + + //- Runtime type information + TypeName("RAS"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + RASModel, + dictionary, + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName + ), + (alpha, rho, U, alphaPhi, phi, transport, propertiesName) + ); + + + // Constructors + + //- Construct from components + RASModel + ( + const word& type, + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected RAS model + static autoPtr New + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~RASModel() + {} + + + // Member Functions + + // Access + + //- Return the lower allowable limit for k (default: SMALL) + const dimensionedScalar& kMin() const + { + return kMin_; + } + + //- Return the lower allowable limit for epsilon (default: SMALL) + const dimensionedScalar& epsilonMin() const + { + return epsilonMin_; + } + + //- Return the lower allowable limit for omega (default: SMALL) + const dimensionedScalar& omegaMin() const + { + return omegaMin_; + } + + //- Allow kMin to be changed + dimensionedScalar& kMin() + { + return kMin_; + } + + //- Allow epsilonMin to be changed + dimensionedScalar& epsilonMin() + { + return epsilonMin_; + } + + //- Allow omegaMin to be changed + dimensionedScalar& omegaMin() + { + return omegaMin_; + } + + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const + { + return coeffDict_; + } + + + //- Return the effective viscosity + virtual tmp nuEff() const + { + return tmp + ( + new volScalarField + ( + IOobject::groupName("nuEff", this->U_.group()), + this->nut() + this->nu() + ) + ); + } + + //- Return the effective viscosity on patch + virtual tmp nuEff(const label patchi) const + { + return this->nut(patchi) + this->nu(patchi); + } + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "RASModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C new file mode 100644 index 0000000000..d621d88845 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -0,0 +1,199 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 "atmBoundaryLayerInletEpsilonFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +atmBoundaryLayerInletEpsilonFvPatchScalarField:: +atmBoundaryLayerInletEpsilonFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + z_(vector::zero), + kappa_(0.41), + Uref_(0), + Href_(0), + z0_(0), + zGround_(0), + Ustar_(0) +{} + + +atmBoundaryLayerInletEpsilonFvPatchScalarField:: +atmBoundaryLayerInletEpsilonFvPatchScalarField +( + const atmBoundaryLayerInletEpsilonFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + z_(ptf.z_), + kappa_(ptf.kappa_), + Uref_(ptf.Uref_), + Href_(ptf.Href_), + z0_(ptf.z0_, mapper), + zGround_(ptf.zGround_, mapper), + Ustar_(ptf.Ustar_, mapper) +{} + + +atmBoundaryLayerInletEpsilonFvPatchScalarField:: +atmBoundaryLayerInletEpsilonFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF), + z_(dict.lookup("z")), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + Uref_(readScalar(dict.lookup("Uref"))), + Href_(readScalar(dict.lookup("Href"))), + z0_("z0", dict, p.size()), + zGround_("zGround", dict, p.size()), + Ustar_(p.size()) +{ + if (mag(z_) < SMALL) + { + FatalErrorIn + ( + "atmBoundaryLayerInletEpsilonFvPatchScalarField" + "(" + "const fvPatch&, " + "const DimensionedField&, " + "const dictionary&" + ")" + ) + << "magnitude of z vector must be greater than zero" + << abort(FatalError); + } + + forAll (Ustar_, i) + { + Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001))); + } + + z_ /= mag(z_); + + const vectorField& c = patch().Cf(); + scalarField::operator=(pow3(Ustar_)/(kappa_*((c & z_) - zGround_ + z0_))); +} + + +atmBoundaryLayerInletEpsilonFvPatchScalarField:: +atmBoundaryLayerInletEpsilonFvPatchScalarField +( + const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(blpsf, iF), + z_(blpsf.z_), + kappa_(blpsf.kappa_), + Uref_(blpsf.Uref_), + Href_(blpsf.Href_), + z0_(blpsf.z0_), + zGround_(blpsf.zGround_), + Ustar_(blpsf.Ustar_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void atmBoundaryLayerInletEpsilonFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + z0_.autoMap(m); + zGround_.autoMap(m); + Ustar_.autoMap(m); +} + + +void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const atmBoundaryLayerInletEpsilonFvPatchScalarField& blptf = + refCast(ptf); + + z0_.rmap(blptf.z0_, addr); + zGround_.rmap(blptf.zGround_, addr); + Ustar_.rmap(blptf.Ustar_, addr); +} + + +void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + os.writeKeyword("z") + << z_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") + << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("Uref") + << Uref_ << token::END_STATEMENT << nl; + os.writeKeyword("Href") + << Href_ << token::END_STATEMENT << nl; + z0_.writeEntry("z0", os); + zGround_.writeEntry("zGround", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + atmBoundaryLayerInletEpsilonFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H new file mode 100644 index 0000000000..f18ce28dba --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H @@ -0,0 +1,249 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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::atmBoundaryLayerInletEpsilonFvPatchScalarField + +Group + grpRASBoundaryConditions grpInletBoundaryConditions + +Description + This boundary condition specifies an inlet value for the turbulence + dissipation, \f$\epsilon\f$ (\c epsilon), appropriate for atmospheric + boundary layers (ABL), and designed to be used in conjunction with the + \c ABLInletVelocity inlet velocity boundary condition. + + \f[ + \epsilon = \frac{(U^*)^3}{K(z - z_g + z_0)} + \f] + + where + \vartable + U^* | frictional velocity + K | Karman's constant + z | vertical co-ordinate [m] + z_0 | surface roughness length [m] + z_g | minimum vlaue in z direction [m] + \endvartable + + and: + + \f[ + U^* = K \frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)} + \f] + + where: + \vartable + U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s] + Z_{ref} | reference height [m] + \endvartable + + \heading Patch usage + + \table + Property | Description | Required | Default value + z | vertical co-ordinate [m] | yes | + kappa | Karman's constanat | no | 0.41 + Uref | reference velocity [m/s] | yes | + Href | reference height [m] | yes | + z0 | surface roughness length [m] | yes | + zGround | minimum z co-ordinate [m] | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type atmBoundaryLayerInletEpsilon; + z 1.0; + kappa 0.41; + Uref 1.0; + Href 0.0; + z0 uniform 0.0; + zGround uniform 0.0; + } + \endverbatim + + Reference: + D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model + in commercial CFD software to model the neutral atmospheric boundary + layer", Journal of Wind Engineering and Industrial Aerodynamics + 95(2007), pp 355-369. + +SourceFiles + atmBoundaryLayerInletEpsilonFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmBoundaryLayerInletEpsilonFvPatchScalarField_H +#define atmBoundaryLayerInletEpsilonFvPatchScalarField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class atmBoundaryLayerInletEpsilonFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class atmBoundaryLayerInletEpsilonFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Direction of the z-coordinate + vector z_; + + //- Von Karman constant + const scalar kappa_; + + //- Reference velocity + const scalar Uref_; + + //- Reference height + const scalar Href_; + + //- Surface roughness length + scalarField z0_; + + //- Minimum co-ordinate value in z direction + scalarField zGround_; + + //- Frictional velocity + scalarField Ustar_; + + +public: + + //- Runtime type information + TypeName("atmBoundaryLayerInletEpsilon"); + + + // Constructors + + //- Construct from patch and internal field + atmBoundaryLayerInletEpsilonFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmBoundaryLayerInletEpsilonFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // atmBoundaryLayerInletEpsilonFvPatchScalarField onto a new patch + atmBoundaryLayerInletEpsilonFvPatchScalarField + ( + const atmBoundaryLayerInletEpsilonFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmBoundaryLayerInletEpsilonFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmBoundaryLayerInletEpsilonFvPatchScalarField + ( + const atmBoundaryLayerInletEpsilonFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmBoundaryLayerInletEpsilonFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return max value + const scalarField& Ustar() const + { + return Ustar_; + } + + //- Return z direction + const vector& z() const + { + return z_; + } + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C new file mode 100644 index 0000000000..0966e50607 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -0,0 +1,223 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 "atmBoundaryLayerInletVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +atmBoundaryLayerInletVelocityFvPatchVectorField:: +atmBoundaryLayerInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + Ustar_(0), + n_(pTraits::zero), + z_(pTraits::zero), + z0_(0), + kappa_(0.41), + Uref_(0), + Href_(0), + zGround_(0) +{} + + +atmBoundaryLayerInletVelocityFvPatchVectorField:: +atmBoundaryLayerInletVelocityFvPatchVectorField +( + const atmBoundaryLayerInletVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + Ustar_(ptf.Ustar_, mapper), + n_(ptf.n_), + z_(ptf.z_), + z0_(ptf.z0_, mapper), + kappa_(ptf.kappa_), + Uref_(ptf.Uref_), + Href_(ptf.Href_), + zGround_(ptf.zGround_, mapper) +{} + + +atmBoundaryLayerInletVelocityFvPatchVectorField:: +atmBoundaryLayerInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + Ustar_(p.size()), + n_(dict.lookup("n")), + z_(dict.lookup("z")), + z0_("z0", dict, p.size()), + kappa_(dict.lookupOrDefault("kappa", 0.41)), + Uref_(readScalar(dict.lookup("Uref"))), + Href_(readScalar(dict.lookup("Href"))), + zGround_("zGround", dict, p.size()) +{ + if (mag(n_) < SMALL || mag(z_) < SMALL) + { + FatalErrorIn + ( + "atmBoundaryLayerInletVelocityFvPatchVectorField" + "(" + "const fvPatch&, " + "const DimensionedField&, " + "onst dictionary&" + ")" + ) + << "magnitude of n or z must be greater than zero" + << abort(FatalError); + } + + n_ /= mag(n_); + z_ /= mag(z_); + + forAll (Ustar_, i) + { + Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001))); + } + + const vectorField& c = patch().Cf(); + const scalarField coord(c & z_); + scalarField Un(coord.size()); + + forAll(coord, i) + { + if ((coord[i] - zGround_[i]) < Href_) + { + Un[i] = + (Ustar_[i]/kappa_) + * log((coord[i] - zGround_[i] + z0_[i])/max(z0_[i], 0.001)); + } + else + { + Un[i] = Uref_; + } + } + + vectorField::operator=(n_*Un); +} + + +atmBoundaryLayerInletVelocityFvPatchVectorField:: +atmBoundaryLayerInletVelocityFvPatchVectorField +( + const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(blpvf, iF), + Ustar_(blpvf.Ustar_), + n_(blpvf.n_), + z_(blpvf.z_), + z0_(blpvf.z0_), + kappa_(blpvf.kappa_), + Uref_(blpvf.Uref_), + Href_(blpvf.Href_), + zGround_(blpvf.zGround_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void atmBoundaryLayerInletVelocityFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchVectorField::autoMap(m); + z0_.autoMap(m); + zGround_.autoMap(m); + Ustar_.autoMap(m); +} + + +void atmBoundaryLayerInletVelocityFvPatchVectorField::rmap +( + const fvPatchVectorField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchVectorField::rmap(ptf, addr); + + const atmBoundaryLayerInletVelocityFvPatchVectorField& blptf = + refCast(ptf); + + z0_.rmap(blptf.z0_, addr); + zGround_.rmap(blptf.zGround_, addr); + Ustar_.rmap(blptf.Ustar_, addr); +} + + +void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + z0_.writeEntry("z0", os) ; + os.writeKeyword("n") + << n_ << token::END_STATEMENT << nl; + os.writeKeyword("z") + << z_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") + << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("Uref") + << Uref_ << token::END_STATEMENT << nl; + os.writeKeyword("Href") + << Href_ << token::END_STATEMENT << nl; + zGround_.writeEntry("zGround", os) ; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + atmBoundaryLayerInletVelocityFvPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H new file mode 100644 index 0000000000..b2f7245ccb --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H @@ -0,0 +1,266 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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::atmBoundaryLayerInletVelocityFvPatchVectorField + +Group + grpRASBoundaryConditions grpInletBoundaryConditions + +Description + This boundary condition specifies a velocity inlet profile appropriate + for atmospheric boundary layers (ABL). The profile is derived from the + friction velocity, flow direction and the direction of the parabolic + co-ordinate \c z. + + \f[ + U = \frac{U^*}{K} ln\left(\frac{z - z_g + z_0}{z_0}\right) + \f] + + where + \vartable + U^* | frictional velocity + K | Karman's constant + z | vertical co-ordinate [m] + z_0 | surface roughness length [m] + z_g | minimum vlaue in z direction [m] + \endvartable + + and: + + \f[ + U^* = K \frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)} + \f] + + where: + \vartable + U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s] + Z_{ref} | reference height [m] + \endvartable + + Reference: + D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model + in commercial CFD software to model the neutral atmospheric boundary + layer", Journal of Wind Engineering and Industrial Aerodynamics + 95(2007), pp 355-369. + + \heading Patch usage + + \table + Property | Description | Required | Default value + n | flow direction | yes | + z | vertical co-ordinate [m] | yes | + kappa | Karman's constanat | no | 0.41 + Uref | reference velocity [m/s] | yes | + Href | reference height [m] | yes | + z0 | surface roughness length [m] | yes | + zGround | minimum z co-ordinate [m] | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type atmBoundaryLayerInletVelocity; + n (0 1 0); + z 1.0; + kappa 0.41; + Uref 1.0; + Href 0.0; + z0 uniform 0.0; + zGround uniform 0.0; + } + \endverbatim + +Note + D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the + k-epsilon model should be changed from 1.3 to 1.11 for consistency. + The roughness height (Er) is given by Er = 20 z0 following the same + reference. + +SourceFiles + atmBoundaryLayerInletVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmBoundaryLayerInletVelocityFvPatchVectorField_H +#define atmBoundaryLayerInletVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class atmBoundaryLayerInletVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class atmBoundaryLayerInletVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Frictional velocity + scalarField Ustar_; + + //- Flow direction + vector n_; + + //- Direction of the z-coordinate + vector z_; + + //- Surface roughness lenght + scalarField z0_; + + //- Von Karman constant + const scalar kappa_; + + //- Reference velocity + const scalar Uref_; + + //- Reference hight + const scalar Href_; + + //- Minimum corrdinate value in z direction + scalarField zGround_; + + +public: + + //- Runtime type information + TypeName("atmBoundaryLayerInletVelocity"); + + + // Constructors + + //- Construct from patch and internal field + atmBoundaryLayerInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmBoundaryLayerInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // atmBoundaryLayerInletVelocityFvPatchVectorField onto a new patch + atmBoundaryLayerInletVelocityFvPatchVectorField + ( + const atmBoundaryLayerInletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmBoundaryLayerInletVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmBoundaryLayerInletVelocityFvPatchVectorField + ( + const atmBoundaryLayerInletVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmBoundaryLayerInletVelocityFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return Ustar + const scalarField& Ustar() const + { + return Ustar_; + } + + //- Return flow direction + const vector& n() const + { + return n_; + } + + //- Return z direction + const vector& z() const + { + return z_; + } + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchVectorField&, + const labelList& + ); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/doc/incompressibleRASBoundaryConditionsDoc.H b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/doc/incompressibleRASBoundaryConditionsDoc.H new file mode 100644 index 0000000000..3cdbb45d35 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/doc/incompressibleRASBoundaryConditionsDoc.H @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\defgroup grpRASBoundaryConditions RAS boundary conditions +@{ + \ingroup grpRASTurbulence + This group contains RAS turbulence model boundary conditions +@} + +\defgroup grpWallFunctions RAS wall functions +@{ + \ingroup grpRASBoundaryConditions + This group contains RAS turbulence model wall functions +@} + + +\*---------------------------------------------------------------------------*/ diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C new file mode 100644 index 0000000000..4714ec09ed --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 "turbulentMixingLengthDissipationRateInletFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "surfaceFields.H" +#include "volFields.H" +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +turbulentMixingLengthDissipationRateInletFvPatchScalarField:: +turbulentMixingLengthDissipationRateInletFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + inletOutletFvPatchScalarField(p, iF), + mixingLength_(0.0), + phiName_("phi"), + kName_("k") +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} + + +turbulentMixingLengthDissipationRateInletFvPatchScalarField:: +turbulentMixingLengthDissipationRateInletFvPatchScalarField +( + const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + inletOutletFvPatchScalarField(ptf, p, iF, mapper), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) +{} + + +turbulentMixingLengthDissipationRateInletFvPatchScalarField:: +turbulentMixingLengthDissipationRateInletFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + inletOutletFvPatchScalarField(p, iF), + mixingLength_(readScalar(dict.lookup("mixingLength"))), + phiName_(dict.lookupOrDefault("phi", "phi")), + kName_(dict.lookupOrDefault("k", "k")) +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} + + +turbulentMixingLengthDissipationRateInletFvPatchScalarField:: +turbulentMixingLengthDissipationRateInletFvPatchScalarField +( + const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf +) +: + inletOutletFvPatchScalarField(ptf), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) +{} + + +turbulentMixingLengthDissipationRateInletFvPatchScalarField:: +turbulentMixingLengthDissipationRateInletFvPatchScalarField +( + const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + inletOutletFvPatchScalarField(ptf, iF), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Lookup Cmu corresponding to the turbulence model selected + const turbulenceModel& turbulence = db().lookupObject + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + dimensionedInternalField().group() + ) + ); + + const scalar Cmu = + turbulence.coeffDict().lookupOrDefault("Cmu", 0.09); + + const scalar Cmu75 = pow(Cmu, 0.75); + + const fvPatchScalarField& kp = + patch().lookupPatchField(kName_); + + const fvsPatchScalarField& phip = + patch().lookupPatchField(phiName_); + + this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_; + this->valueFraction() = 1.0 - pos(phip); + + inletOutletFvPatchScalarField::updateCoeffs(); +} + + +void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchScalarField::write(os); + os.writeKeyword("mixingLength") + << mixingLength_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + turbulentMixingLengthDissipationRateInletFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H new file mode 100644 index 0000000000..d9b5e481c0 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H @@ -0,0 +1,202 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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::turbulentMixingLengthDissipationRateInletFvPatchScalarField + +Group + grpRASBoundaryConditions grpInletBoundaryConditions + +Description + This boundary condition provides a turbulence dissipation, \f$\epsilon\f$ + (epsilon) inlet condition based on a specified mixing length. The patch + values are calculated using: + + \f[ + \epsilon_p = \frac{C_{\mu}^{0.75} k^{1.5}}{L} + \f] + + where + + \vartable + \epsilon_p | patch epsilon values + C_{\mu} | Model coefficient, set to 0.09 + k | turbulence kinetic energy + L | length scale + \endvartable + + \heading Patch usage + + \table + Property | Description | Required | Default value + mixingLength | Length scale [m] | yes | + phi | flux field name | no | phi + k | turbulence kinetic energy field name | no | k + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type turbulentMixingLengthDissipationRateInlet; + mixingLength 0.005; + value uniform 200; // placeholder + } + \endverbatim + +Note + In the event of reverse flow, a zero-gradient condition is applied + +SeeAlso + Foam::inletOutletFvPatchField + +SourceFiles + turbulentMixingLengthDissipationRateInletFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef turbulentMixingLengthDissipationRateInlet_H +#define turbulentMixingLengthDissipationRateInlet_H + +#include "inletOutletFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class turbulentMixingLengthDissipationRateInletFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class turbulentMixingLengthDissipationRateInletFvPatchScalarField +: + public inletOutletFvPatchScalarField +{ + // Private data + + //- turbulent length scale + scalar mixingLength_; + + //- Name of the flux field + word phiName_; + + //- Name of the turbulent kinetic energy field + word kName_; + + +public: + + //- Runtime type information + TypeName("turbulentMixingLengthDissipationRateInlet"); + + + // Constructors + + //- Construct from patch and internal field + turbulentMixingLengthDissipationRateInletFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + turbulentMixingLengthDissipationRateInletFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // turbulentMixingLengthDissipationRateInletFvPatchScalarField + // onto a new patch + turbulentMixingLengthDissipationRateInletFvPatchScalarField + ( + const turbulentMixingLengthDissipationRateInletFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + turbulentMixingLengthDissipationRateInletFvPatchScalarField + ( + const turbulentMixingLengthDissipationRateInletFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new turbulentMixingLengthDissipationRateInletFvPatchScalarField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + turbulentMixingLengthDissipationRateInletFvPatchScalarField + ( + const turbulentMixingLengthDissipationRateInletFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new turbulentMixingLengthDissipationRateInletFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C new file mode 100644 index 0000000000..0ce1cd6763 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 "turbulentMixingLengthFrequencyInletFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "surfaceFields.H" +#include "volFields.H" +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + inletOutletFvPatchScalarField(p, iF), + mixingLength_(0.0), + phiName_("undefined-phi"), + kName_("undefined-k") +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + inletOutletFvPatchScalarField(ptf, p, iF, mapper), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) +{} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + inletOutletFvPatchScalarField(p, iF), + mixingLength_(readScalar(dict.lookup("mixingLength"))), + phiName_(dict.lookupOrDefault("phi", "phi")), + kName_(dict.lookupOrDefault("k", "k")) +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf +) +: + inletOutletFvPatchScalarField(ptf), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) +{} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + inletOutletFvPatchScalarField(ptf, iF), + mixingLength_(ptf.mixingLength_), + phiName_(ptf.phiName_), + kName_(ptf.kName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Lookup Cmu corresponding to the turbulence model selected + const turbulenceModel& turbulence = db().lookupObject + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + dimensionedInternalField().group() + ) + ); + + const scalar Cmu = + turbulence.coeffDict().lookupOrDefault("Cmu", 0.09); + + const scalar Cmu25 = pow(Cmu, 0.25); + + const fvPatchScalarField& kp = + patch().lookupPatchField(kName_); + + const fvsPatchScalarField& phip = + patch().lookupPatchField(phiName_); + + this->refValue() = sqrt(kp)/(Cmu25*mixingLength_); + this->valueFraction() = 1.0 - pos(phip); + + inletOutletFvPatchScalarField::updateCoeffs(); +} + + +void turbulentMixingLengthFrequencyInletFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchScalarField::write(os); + os.writeKeyword("mixingLength") + << mixingLength_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + turbulentMixingLengthFrequencyInletFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H new file mode 100644 index 0000000000..f16d5a4648 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H @@ -0,0 +1,203 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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::turbulentMixingLengthFrequencyInletFvPatchScalarField + +Group + grpRASBoundaryConditions grpInletBoundaryConditions + +Description + This boundary condition provides a turbulence specific dissipation, + \f$\omega\f$ (omega) inlet condition based on a specified mixing length. + The patch values are calculated using: + + \f[ + \omega_p = \frac{k^{0.5}}{C_{\mu}^{0.25} L} + \f] + + where + + \vartable + \omega_p | patch omega values + C_{\mu} | Model coefficient, set to 0.09 + k | turbulence kinetic energy + L | length scale + \endvartable + + \heading Patch usage + + \table + Property | Description | Required | Default value + mixingLength | Length scale [m] | yes | + phi | flux field name | no | phi + k | turbulence kinetic energy field name | no | k + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type turbulentMixingLengthFrequencyInlet; + mixingLength 0.005; + value uniform 200; // placeholder + } + \endverbatim + +Note + In the event of reverse flow, a zero-gradient condition is applied + +SeeAlso + Foam::inletOutletFvPatchField + + +SourceFiles + turbulentMixingLengthFrequencyInletFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef turbulentMixingLengthFrequencyInletFvPatchScalarField_H +#define turbulentMixingLengthFrequencyInletFvPatchScalarField_H + +#include "inletOutletFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class turbulentMixingLengthFrequencyInletFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class turbulentMixingLengthFrequencyInletFvPatchScalarField +: + public inletOutletFvPatchScalarField +{ + // Private data + + //- Turbulent length scale + scalar mixingLength_; + + //- Name of the flux field + word phiName_; + + //- Name of the turbulent kinetic energy field + word kName_; + + +public: + + //- Runtime type information + TypeName("turbulentMixingLengthFrequencyInlet"); + + + // Constructors + + //- Construct from patch and internal field + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // turbulentMixingLengthFrequencyInletFvPatchScalarField + // onto a new patch + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const turbulentMixingLengthFrequencyInletFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const turbulentMixingLengthFrequencyInletFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..85ff9c446a --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,189 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\/ 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 "epsilonLowReWallFunctionFvPatchScalarField.H" +#include "turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +void epsilonLowReWallFunctionFvPatchScalarField::calculate +( + const turbulenceModel& turbulence, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G, + scalarField& epsilon +) +{ + const label patchi = patch.index(); + + const scalarField& y = turbulence.y()[patchi]; + + const scalar Cmu25 = pow025(Cmu_); + const scalar Cmu75 = pow(Cmu_, 0.75); + + const tmp tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp tnuw = turbulence.nu(patchi); + const scalarField& nuw = tnuw(); + + const tmp tnutw = turbulence.nut(patchi); + const scalarField& nutw = tnutw(); + + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchi]; + + const scalarField magGradUw(mag(Uw.snGrad())); + + // Set epsilon and G + forAll(nutw, faceI) + { + label cellI = patch.faceCells()[faceI]; + + scalar yPlus = Cmu25*sqrt(k[cellI])*y[faceI]/nuw[faceI]; + + scalar w = cornerWeights[faceI]; + + if (yPlus > yPlusLam_) + { + epsilon[cellI] = w*Cmu75*pow(k[cellI], 1.5)/(kappa_*y[faceI]); + } + else + { + epsilon[cellI] = w*2.0*k[cellI]*nuw[faceI]/sqr(y[faceI]); + } + + G[cellI] = + w + *(nutw[faceI] + nuw[faceI]) + *magGradUw[faceI] + *Cmu25*sqrt(k[cellI]) + /(kappa_*y[faceI]); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + yPlusLam_(ptf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + epsilonWallFunctionFvPatchScalarField(p, iF, dict), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf, iF), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + epsilonLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..ac9f3650a2 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,191 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\/ 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::epsilonLowReWallFunctionFvPatchScalarField + +Group + grpWallFunctions + +Description + This boundary condition provides a turbulence dissipation wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The condition can be applied to wall boundaries, whereby it inserts near + wall epsilon values directly into the epsilon equation to act as a + constraint. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type epsilonLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::epsilonWallFunctionFvPatchScalarField + +SourceFiles + epsilonLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef epsilonLowReWallFunctionFvPatchScalarField_H +#define epsilonLowReWallFunctionFvPatchScalarField_H + +#include "epsilonWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class epsilonLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class epsilonLowReWallFunctionFvPatchScalarField +: + public epsilonWallFunctionFvPatchScalarField +{ + +protected: + + // Protected data + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + //- Calculate the epsilon and G + virtual void calculate + ( + const turbulenceModel& turbulence, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G, + scalarField& epsilon + ); + + +public: + + //- Runtime type information + TypeName("epsilonLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // epsilonLowReWallFunctionFvPatchScalarField + // onto a new patch + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + //- Destructor + virtual ~epsilonLowReWallFunctionFvPatchScalarField() + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..8cffac6db6 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModel/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -0,0 +1,590 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 "epsilonWallFunctionFvPatchScalarField.H" +#include "turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "fvMatrix.H" +#include "volFields.H" +#include "wallFvPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void epsilonWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("epsilonWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const +{ + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; +} + + +void epsilonWallFunctionFvPatchScalarField::setMaster() +{ + if (master_ != -1) + { + return; + } + + const volScalarField& epsilon = + static_cast(this->dimensionedInternalField()); + + const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField(); + + label master = -1; + forAll(bf, patchi) + { + if (isA(bf[patchi])) + { + epsilonWallFunctionFvPatchScalarField& epf = epsilonPatch(patchi); + + if (master == -1) + { + master = patchi; + } + + epf.master() = master; + } + } +} + + +void epsilonWallFunctionFvPatchScalarField::createAveragingWeights() +{ + if (initialised_) + { + return; + } + + const volScalarField& epsilon = + static_cast(this->dimensionedInternalField()); + + const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField(); + + const fvMesh& mesh = epsilon.mesh(); + + volScalarField weights + ( + IOobject + ( + "weights", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false // do not register + ), + mesh, + dimensionedScalar("zero", dimless, 0.0) + ); + + DynamicList