diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index 5f6d70e0..eb97fe49 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -17,7 +17,7 @@ ( "phiHbyA", ( - (fvc::interpolate(rho*U) & mesh.Sf()) + (fvc::interpolate(rho*HbyA) & mesh.Sf()) + rAUf*fvc::ddtCorr(rho, U, phi) ) + phig diff --git a/applications/solvers/multiphase/cavitatingFoam/CourantNo.H b/applications/solvers/multiphase/cavitatingFoam/CourantNo.H index 02a6c86d..a5bae745 100644 --- a/applications/solvers/multiphase/cavitatingFoam/CourantNo.H +++ b/applications/solvers/multiphase/cavitatingFoam/CourantNo.H @@ -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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,7 @@ if (mesh.nInternalFaces()) { scalarField sumPhi ( - fvc::surfaceSum(mag(phiv))().internalField() + fvc::surfaceSum(mag(phi))().internalField() ); CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); @@ -54,7 +54,7 @@ if (mesh.nInternalFaces()) )*runTime.deltaTValue(); } -Info<< "phiv Courant Number mean: " << meanCoNum +Info<< "phi Courant Number mean: " << meanCoNum << " max: " << CoNum << " acoustic max: " << acousticCoNum << endl; diff --git a/applications/solvers/multiphase/cavitatingFoam/UEqn.H b/applications/solvers/multiphase/cavitatingFoam/UEqn.H index 1ca0b9f0..8edf0d39 100644 --- a/applications/solvers/multiphase/cavitatingFoam/UEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/UEqn.H @@ -1,7 +1,7 @@ fvVectorMatrix UEqn ( fvm::ddt(rho, U) - + fvm::div(phi, U) + + fvm::div(rhoPhi, U) + turbulence->divDevRhoReff(rho, U) ); diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C index c3fde6b3..284ca97b 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "createUf.H" #include "createPcorrTypes.H" - #include "compressibleCourantNo.H" + #include "CourantNo.H" #include "setInitialDeltaT.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -86,12 +86,12 @@ int main(int argc, char *argv[]) if (correctPhi) { // Calculate absolute flux from the mapped surface velocity - phiv = mesh.Sf() & Uf; + phi = mesh.Sf() & Uf; #include "correctPhi.H" // Make the flux relative to the mesh motion - fvc::makeRelative(phiv, U); + fvc::makeRelative(phi, U); } } diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H index c05d6648..4bb1ce9d 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H @@ -14,7 +14,7 @@ if (mesh.changing()) { U.boundaryField()[patchI].evaluate(); - phiv.boundaryField()[patchI] = + phi.boundaryField()[patchI] = U.boundaryField()[patchI] & mesh.Sf().boundaryField()[patchI]; } @@ -37,21 +37,21 @@ if (mesh.changing()) pcorrTypes ); - surfaceScalarField rhof(fvc::interpolate(rho, "div(phiv,rho)")); + surfaceScalarField rhof(fvc::interpolate(rho, "div(phi,rho)")); dimensionedScalar rAUf("rAUf", dimTime, 1.0); while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( - fvm::laplacian(rAUf, pcorr) == fvc::ddt(rho) + fvc::div(phiv*rhof) + fvm::laplacian(rAUf, pcorr) == fvc::ddt(rho) + fvc::div(phi*rhof) ); pcorrEqn.solve(); if (pimple.finalNonOrthogonalIter()) { - phiv -= pcorrEqn.flux()/rhof; + phi -= pcorrEqn.flux()/rhof; } } } diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H index a0e0e6c7..b07846b6 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H @@ -17,13 +17,13 @@ volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn.H(); - phiv = (fvc::interpolate(HbyA) & mesh.Sf()) + phi = (fvc::interpolate(HbyA) & mesh.Sf()) + rhorAUf*fvc::ddtCorr(U, Uf); - fvc::makeRelative(phiv, U); + fvc::makeRelative(phi, U); surfaceScalarField phiGradp(rhorAUf*mesh.magSf()*fvc::snGrad(p)); - phiv -= phiGradp/rhof; + phi -= phiGradp/rhof; volScalarField rho0(rho - psi*p); @@ -33,7 +33,7 @@ ( fvc::ddt(rho) + psi*correction(fvm::ddt(p)) - + fvc::div(phiv, rho) + + fvc::div(phi, rho) + fvc::div(phiGradp) - fvm::laplacian(rhorAUf, p) ); @@ -42,7 +42,7 @@ if (pimple.finalNonOrthogonalIter()) { - phiv += (phiGradp + pEqn.flux())/rhof; + phi += (phiGradp + pEqn.flux())/rhof; } } @@ -85,6 +85,6 @@ { Uf = fvc::interpolate(U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - Uf += n*(phiv/mesh.magSf() - (n & Uf)); + Uf += n*(phi/mesh.magSf() - (n & Uf)); } } diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C index c4453df3..2b04d58f 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) #include "readControls.H" #include "createFields.H" #include "initContinuityErrs.H" - #include "compressibleCourantNo.H" + #include "CourantNo.H" #include "setInitialDeltaT.H" pimpleControl pimple(mesh); diff --git a/applications/solvers/multiphase/cavitatingFoam/createFields.H b/applications/solvers/multiphase/cavitatingFoam/createFields.H index 605c0dee..2c834dc5 100644 --- a/applications/solvers/multiphase/cavitatingFoam/createFields.H +++ b/applications/solvers/multiphase/cavitatingFoam/createFields.H @@ -39,12 +39,25 @@ mesh ); - #include "createPhiv.H" - #include "compressibleCreatePhi.H" + #include "createPhi.H" + + // Mass flux (corrected by rhoEqn.H) + surfaceScalarField rhoPhi + ( + IOobject + ( + "rhoPhi", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + fvc::interpolate(rho)*phi + ); Info<< "Reading transportProperties\n" << endl; - incompressibleTwoPhaseMixture twoPhaseProperties(U, phiv); + incompressibleTwoPhaseMixture twoPhaseProperties(U, phi); volScalarField& alphav(twoPhaseProperties.alpha1()); alphav.oldTime(); @@ -72,5 +85,5 @@ // Create incompressible turbulence model autoPtr turbulence ( - incompressible::turbulenceModel::New(U, phiv, twoPhaseProperties) + incompressible::turbulenceModel::New(U, phi, twoPhaseProperties) ); diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H index 210a30fd..da804791 100644 --- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H @@ -17,12 +17,12 @@ volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn.H(); - phiv = (fvc::interpolate(HbyA) & mesh.Sf()) - + rhorAUf*fvc::ddtCorr(U, phiv); + phi = (fvc::interpolate(HbyA) & mesh.Sf()) + + rhorAUf*fvc::ddtCorr(U, phi); surfaceScalarField phiGradp(rhorAUf*mesh.magSf()*fvc::snGrad(p)); - phiv -= phiGradp/rhof; + phi -= phiGradp/rhof; while (pimple.correctNonOrthogonal()) { @@ -30,7 +30,7 @@ ( fvm::ddt(psi, p) - (rhol0 + (psil - psiv)*pSat)*fvc::ddt(alphav) - pSat*fvc::ddt(psi) - + fvc::div(phiv, rho) + + fvc::div(phi, rho) + fvc::div(phiGradp) - fvm::laplacian(rhorAUf, p) ); @@ -39,7 +39,7 @@ if (pimple.finalNonOrthogonalIter()) { - phiv += (phiGradp + pEqn.flux())/rhof; + phi += (phiGradp + pEqn.flux())/rhof; } } diff --git a/applications/solvers/multiphase/cavitatingFoam/rhoEqn.H b/applications/solvers/multiphase/cavitatingFoam/rhoEqn.H index d0bd6e1d..a01823ad 100644 --- a/applications/solvers/multiphase/cavitatingFoam/rhoEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/rhoEqn.H @@ -2,12 +2,12 @@ fvScalarMatrix rhoEqn ( fvm::ddt(rho) - + fvm::div(phiv, rho) + + fvm::div(phi, rho) ); rhoEqn.solve(); - phi = rhoEqn.flux(); + rhoPhi = rhoEqn.flux(); Info<< "max-min rho: " << max(rho).value() << " " << min(rho).value() << endl; diff --git a/applications/solvers/multiphase/driftFluxFoam/Allwclean b/applications/solvers/multiphase/driftFluxFoam/Allwclean new file mode 100755 index 00000000..3254f968 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/Allwclean @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wclean libso viscosityModels +wclean libso relativeVelocityModels +wclean + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/driftFluxFoam/Allwmake b/applications/solvers/multiphase/driftFluxFoam/Allwmake new file mode 100755 index 00000000..6e719c51 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/Allwmake @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake libso viscosityModels +wmake libso relativeVelocityModels +wmake + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/driftFluxFoam/Make/options b/applications/solvers/multiphase/driftFluxFoam/Make/options index ce089874..b97b1fd5 100644 --- a/applications/solvers/multiphase/driftFluxFoam/Make/options +++ b/applications/solvers/multiphase/driftFluxFoam/Make/options @@ -2,10 +2,18 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ - -I$(LIB_SRC)/fvOptions/lnInclude + -I$(LIB_SRC)/fvOptions/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I./relativeVelocityModels/lnInclude EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lsampling \ - -lfvOptions + -lfvOptions \ + -lincompressibleTransportModels \ + -ldriftFluxTransportModels \ + -ldriftFluxRelativeVelocityModels diff --git a/applications/solvers/multiphase/driftFluxFoam/UEqn.H b/applications/solvers/multiphase/driftFluxFoam/UEqn.H index b6d87564..8933a082 100644 --- a/applications/solvers/multiphase/driftFluxFoam/UEqn.H +++ b/applications/solvers/multiphase/driftFluxFoam/UEqn.H @@ -4,11 +4,7 @@ ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) - + fvc::div - ( - (alpha/(scalar(1.001) - alpha))*((rhoc*rhod)/rho)*Vdj*Vdj, - "div(phiVdj,Vdj)" - ) + + fvc::div(uRelModel.tau(), "div(phiUkm,Ukm)") - fvm::laplacian(muEff, U) - fvc::div(muEff*dev2(T(fvc::grad(U)))) == diff --git a/applications/solvers/multiphase/driftFluxFoam/alphaControls.H b/applications/solvers/multiphase/driftFluxFoam/alphaControls.H deleted file mode 100644 index 5a3d10bd..00000000 --- a/applications/solvers/multiphase/driftFluxFoam/alphaControls.H +++ /dev/null @@ -1,4 +0,0 @@ -const dictionary& alphaControls = mesh.solverDict(alpha.name()); - -label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); diff --git a/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H b/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H index 89c139df..817a0c91 100644 --- a/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H +++ b/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H @@ -2,30 +2,118 @@ word alphaScheme("div(phi,alpha)"); word alpharScheme("div(phirb,alpha)"); + if (MULESCorr) + { + fvScalarMatrix alpha1Eqn + ( + #ifdef LTSSOLVE + fv::localEulerDdtScheme(mesh, rDeltaT.name()).fvmDdt(alpha1) + #else + fv::EulerDdtScheme(mesh).fvmDdt(alpha1) + #endif + + fv::gaussConvectionScheme + ( + mesh, + phi, + upwind(mesh, phi) + ).fvmDiv(phi, alpha1) + - fv::gaussLaplacianScheme + ( + mesh, + linear(mesh), + fv::uncorrectedSnGrad(mesh) + ).fvmLaplacian(fvc::interpolate(mut/rho), alpha1) + ); + + alpha1Eqn.solve(); + + Info<< "Phase-1 volume fraction = " + << alpha1.weightedAverage(mesh.Vsc()).value() + << " Min(alpha1) = " << min(alpha1).value() + << " Max(alpha1) = " << max(alpha1).value() + << endl; + + tmp tphiAlphaUD(alpha1Eqn.flux()); + phiAlpha = tphiAlphaUD(); + + if (alphaApplyPrevCorr && tphiAlphaCorr0.valid()) + { + Info<< "Applying the previous iteration correction flux" << endl; + #ifdef LTSSOLVE + MULES::LTScorrect(alpha1, phiAlpha, tphiAlphaCorr0(), 1, 0); + #else + MULES::correct(alpha1, phiAlpha, tphiAlphaCorr0(), 1, 0); + #endif + + phiAlpha += tphiAlphaCorr0(); + } + + // Cache the upwind-flux + tphiAlphaCorr0 = tphiAlphaUD; + } + for (int aCorr=0; aCorr tphiAlphaUn ( fvc::flux ( phi, - alpha, + alpha1, alphaScheme ) + fvc::flux ( phir, - alpha, + alpha1, alpharScheme ) ); - MULES::explicitSolve(alpha, phi, phiAlpha, 1, 0); + if (MULESCorr) + { + tmp tphiAlphaCorr(tphiAlphaUn() - phiAlpha); + volScalarField alpha10(alpha1); + + #ifdef LTSSOLVE + MULES::LTScorrect(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); + #else + MULES::correct(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); + #endif + + // Under-relax the correction for all but the 1st corrector + if (aCorr == 0) + { + phiAlpha += tphiAlphaCorr(); + } + else + { + alpha1 = 0.5*alpha1 + 0.5*alpha10; + phiAlpha += 0.5*tphiAlphaCorr(); + } + } + else + { + phiAlpha = tphiAlphaUn; + + #ifdef LTSSOLVE + MULES::explicitLTSSolve(alpha1, phi, phiAlpha, 1, 0); + #else + MULES::explicitSolve(alpha1, phi, phiAlpha, 1, 0); + #endif + } } + if (alphaApplyPrevCorr && MULESCorr) + { + tphiAlphaCorr0 = phiAlpha - tphiAlphaCorr0; + } + + alpha2 = 1.0 - alpha1; + Info<< "Phase-1 volume fraction = " - << alpha.weightedAverage(mesh.Vsc()).value() - << " Min(alpha) = " << min(alpha).value() - << " Max(alpha) = " << max(alpha).value() + << alpha1.weightedAverage(mesh.Vsc()).value() + << " Min(alpha1) = " << min(alpha1).value() + << " Max(alpha1) = " << max(alpha1).value() << endl; } diff --git a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H index d0c08ba9..218ef2d9 100644 --- a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H @@ -13,7 +13,7 @@ surfaceScalarField phir ( - rhoc*(mesh.Sf() & fvc::interpolate(Vdj/rho)) + mesh.Sf() & fvc::interpolate(uRelModel.Udm()) ); if (nAlphaSubCycles > 1) @@ -33,7 +33,7 @@ for ( - subCycle alphaSubCycle(alpha, nAlphaSubCycles); + subCycle alphaSubCycle(alpha1, nAlphaSubCycles); !(++alphaSubCycle).end(); ) { @@ -50,24 +50,26 @@ // Apply the diffusion term separately to allow implicit solution // and boundedness of the explicit advection + if (!MULESCorr) { - fvScalarMatrix alphaEqn + fvScalarMatrix alpha1Eqn ( - fvm::ddt(alpha) - fvc::ddt(alpha) - - fvm::laplacian(mut/rho, alpha) + fvm::ddt(alpha1) - fvc::ddt(alpha1) + - fvm::laplacian(mut/rho, alpha1) ); - alphaEqn.solve(); + alpha1Eqn.solve(mesh.solver("alpha1Diffusion")); - phiAlpha += alphaEqn.flux(); + phiAlpha += alpha1Eqn.flux(); + alpha2 = 1.0 - alpha1; + + Info<< "Phase-1 volume fraction = " + << alpha1.weightedAverage(mesh.Vsc()).value() + << " Min(alpha1) = " << min(alpha1).value() + << " Max(alpha1) = " << max(alpha1).value() + << endl; } - Info<< "Phase-1 volume fraction = " - << alpha.weightedAverage(mesh.Vsc()).value() - << " Min(alpha) = " << min(alpha).value() - << " Max(alpha) = " << max(alpha).value() - << endl; - - rhoPhi = phiAlpha*(rhod - rhoc) + phi*rhoc; - rho == alpha*rhod + (scalar(1) - alpha)*rhoc; + rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2; + rho == alpha1*rho1 + alpha2*rho2; } diff --git a/applications/solvers/multiphase/driftFluxFoam/calcVdj.H b/applications/solvers/multiphase/driftFluxFoam/calcVdj.H deleted file mode 100644 index 7a921ef7..00000000 --- a/applications/solvers/multiphase/driftFluxFoam/calcVdj.H +++ /dev/null @@ -1,20 +0,0 @@ -if (VdjModel == "general") -{ - Vdj = V0* - ( - exp(-a*max(alpha - alphaMin, scalar(0))) - - exp(-a1*max(alpha - alphaMin, scalar(0))) - ); -} -else if (VdjModel == "simple") -{ - Vdj = V0*pow(10.0, -a*max(alpha, scalar(0))); -} -else -{ - FatalErrorIn(args.executable()) - << "Unknown VdjModel : " << VdjModel - << abort(FatalError); -} - -Vdj.correctBoundaryConditions(); diff --git a/applications/solvers/multiphase/driftFluxFoam/correctViscosity.H b/applications/solvers/multiphase/driftFluxFoam/correctViscosity.H deleted file mode 100644 index 0bf086a4..00000000 --- a/applications/solvers/multiphase/driftFluxFoam/correctViscosity.H +++ /dev/null @@ -1,39 +0,0 @@ -{ - mul = muc + - plasticViscosity - ( - plasticViscosityCoeff, - plasticViscosityExponent, - alpha - ); - - if (BinghamPlastic) - { - volScalarField tauy = yieldStress - ( - yieldStressCoeff, - yieldStressExponent, - yieldStressOffset, - alpha - ); - - mul = - tauy/ - ( - mag(fvc::grad(U)) - + 1.0e-4* - ( - tauy - + dimensionedScalar - ( - "deltaTauy", - tauy.dimensions(), - 1.0e-15 - ) - )/mul - ) - + mul; - } - - mul = min(mul, muMax); -} diff --git a/applications/solvers/multiphase/driftFluxFoam/createFields.H b/applications/solvers/multiphase/driftFluxFoam/createFields.H index 950235cf..13a5cf81 100644 --- a/applications/solvers/multiphase/driftFluxFoam/createFields.H +++ b/applications/solvers/multiphase/driftFluxFoam/createFields.H @@ -12,20 +12,6 @@ mesh ); - Info<< "Reading field alpha\n" << endl; - volScalarField alpha - ( - IOobject - ( - "alpha", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - Info<< "Reading field U\n" << endl; volVectorField U ( @@ -43,7 +29,17 @@ #include "createPhi.H" + // Transport + // ~~~~~~~~~ + Info<< "Reading transportProperties\n" << endl; + incompressibleTwoPhaseMixture twoPhaseProperties(U, phi); + + volScalarField& alpha1(twoPhaseProperties.alpha1()); + volScalarField& alpha2(twoPhaseProperties.alpha2()); + + const dimensionedScalar& rho1 = twoPhaseProperties.rho1(); + const dimensionedScalar& rho2 = twoPhaseProperties.rho2(); IOdictionary transportProperties ( @@ -57,41 +53,7 @@ ) ); - - dimensionedScalar rhoc(transportProperties.lookup("rhoc")); - - dimensionedScalar rhod(transportProperties.lookup("rhod")); - - dimensionedScalar muc(transportProperties.lookup("muc")); - dimensionedScalar muMax(transportProperties.lookup("muMax")); - - dimensionedScalar plasticViscosityCoeff - ( - transportProperties.lookup("plasticViscosityCoeff") - ); - - dimensionedScalar plasticViscosityExponent - ( - transportProperties.lookup("plasticViscosityExponent") - ); - - dimensionedScalar yieldStressCoeff - ( - transportProperties.lookup("yieldStressCoeff") - ); - - dimensionedScalar yieldStressExponent - ( - transportProperties.lookup("yieldStressExponent") - ); - - dimensionedScalar yieldStressOffset - ( - transportProperties.lookup("yieldStressOffset") - ); - - Switch BinghamPlastic(transportProperties.lookup("BinghamPlastic")); - + // Mixture density volScalarField rho ( IOobject @@ -102,7 +64,7 @@ IOobject::NO_READ, IOobject::NO_WRITE ), - alpha*rhod + (scalar(1) - alpha)*rhoc + alpha1*rho1 + alpha2*rho2 ); rho.oldTime(); @@ -120,63 +82,24 @@ fvc::interpolate(rho)*phi ); - Info<< "Calculating field mul\n" << endl; - volScalarField mul + + // Relative Velocity + // ~~~~~~~~~~~~~~~~~ + + autoPtr uRelModelPtr ( - IOobject + relativeVelocityModel::New ( - "mul", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - muc - + plasticViscosity - ( - plasticViscosityCoeff, - plasticViscosityExponent, - alpha + transportProperties, + twoPhaseProperties ) ); - - Info<< "Initialising field Vdj\n" << endl; - volVectorField Vdj - ( - IOobject - ( - "Vdj", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedVector("0.0", U.dimensions(), vector::zero), - U.boundaryField().types() - ); + relativeVelocityModel& uRelModel(uRelModelPtr()); - Info<< "Selecting Drift-Flux model " << endl; - - const word VdjModel(transportProperties.lookup("VdjModel")); - - Info<< tab << VdjModel << " selected\n" << endl; - - const dictionary& VdjModelCoeffs - ( - transportProperties.subDict(VdjModel + "Coeffs") - ); - - dimensionedVector V0(VdjModelCoeffs.lookup("V0")); - - dimensionedScalar a(VdjModelCoeffs.lookup("a")); - - dimensionedScalar a1(VdjModelCoeffs.lookup("a1")); - - dimensionedScalar alphaMin(VdjModelCoeffs.lookup("alphaMin")); - + // Turbulence + // ~~~~~~~~~~ IOdictionary RASProperties ( @@ -283,7 +206,6 @@ << "wallFunctionCoeffs" << wallFunctionDict << endl; } - nearWallDist y(mesh); Info<< "Reading field k\n" << endl; @@ -328,7 +250,6 @@ Cmu*rho*sqr(k)/epsilon ); - Info<< "Calculating field muEff\n" << endl; volScalarField muEff ( @@ -340,10 +261,13 @@ IOobject::NO_READ, IOobject::AUTO_WRITE ), - mut + mul + mut + twoPhaseProperties.mu() ); + // Pressure + // ~~~~~~~~ + Info<< "Calculating field (g.h)f\n" << endl; volScalarField gh("gh", g & mesh.C()); surfaceScalarField ghf("gh", g & mesh.Cf()); @@ -382,3 +306,9 @@ ); p_rgh = p - rho*gh; } + + + // MULES Correction + // ~~~~~~~~~~~~~~~~ + + tmp tphiAlphaCorr0; diff --git a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C index d0aafc6e..72a86c6e 100644 --- a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C +++ b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C @@ -36,15 +36,17 @@ Description #include "fvCFD.H" #include "CMULES.H" #include "subCycle.H" +#include "incompressibleTwoPhaseMixture.H" +#include "relativeVelocityModel.H" #include "nearWallDist.H" #include "wallFvPatch.H" #include "bound.H" #include "Switch.H" -#include "plasticViscosity.H" -#include "yieldStress.H" #include "pimpleControl.H" #include "fvIOoptionList.H" #include "fixedFluxPressureFvPatchScalarField.H" +#include "gaussLaplacianScheme.H" +#include "uncorrectedSnGrad.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -80,9 +82,11 @@ int main(int argc, char *argv[]) { #include "alphaControls.H" - #include "calcVdj.H" + uRelModel.update(); + #include "alphaEqnSubCycle.H" - #include "correctViscosity.H" + + twoPhaseProperties.correct(); #include "UEqn.H" diff --git a/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H b/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H index 5aaccab8..20d46617 100644 --- a/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H +++ b/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H @@ -21,6 +21,8 @@ if (turbulence) Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilonMin) ); + volScalarField muc(twoPhaseProperties.nuModel2().nu()*rho2); + #include "wallFunctions.H" // Dissipation equation @@ -75,4 +77,4 @@ if (turbulence) #include "wallViscosity.H" } -muEff = mut + mul; +muEff = mut + twoPhaseProperties.mu(); diff --git a/applications/solvers/multiphase/driftFluxFoam/plasticViscosity.H b/applications/solvers/multiphase/driftFluxFoam/plasticViscosity.H deleted file mode 100644 index 4be4e6ea..00000000 --- a/applications/solvers/multiphase/driftFluxFoam/plasticViscosity.H +++ /dev/null @@ -1,21 +0,0 @@ -volScalarField plasticViscosity -( - const dimensionedScalar& plasticViscosityCoeff, - const dimensionedScalar& plasticViscosityExponent, - const volScalarField& Alpha -) -{ - tmp tfld - ( - plasticViscosityCoeff* - ( - pow - ( - 10.0, - plasticViscosityExponent*Alpha + SMALL - ) - scalar(1) - ) - ); - - return tfld(); -} diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/files b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/files new file mode 100644 index 00000000..01436506 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/files @@ -0,0 +1,5 @@ +relativeVelocityModel/relativeVelocityModel.C +simple/simple.C +general/general.C + +LIB = $(FOAM_LIBBIN)/libdriftFluxRelativeVelocityModels diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/options b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/options new file mode 100644 index 00000000..badd30f2 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lincompressibleTransportModels diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/noDrag/noDrag.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C similarity index 61% rename from applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/noDrag/noDrag.C rename to applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C index d955c9e7..f39aa747 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/noDrag/noDrag.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C @@ -23,68 +23,55 @@ License \*---------------------------------------------------------------------------*/ -#include "noDrag.H" -#include "phasePair.H" +#include "general.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -namespace dragModels +namespace relativeVelocityModels { - defineTypeNameAndDebug(noDrag, 0); - addToRunTimeSelectionTable(dragModel, noDrag, dictionary); + defineTypeNameAndDebug(general, 0); + addToRunTimeSelectionTable(relativeVelocityModel, general, dictionary); } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::dragModels::noDrag::noDrag +Foam::relativeVelocityModels::general::general ( const dictionary& dict, - const phasePair& pair, - const bool registerObject + const incompressibleTwoPhaseMixture& mixture ) : - dragModel(pair, registerObject) + relativeVelocityModel(dict, mixture), + a_(dict.lookup("a")), + a1_(dict.lookup("a1")), + V0_(dict.lookup("V0")), + residualAlpha_(dict.lookup("residualAlpha")) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::dragModels::noDrag::~noDrag() +Foam::relativeVelocityModels::general::~general() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp Foam::dragModels::noDrag::CdRe() const +Foam::tmp +Foam::relativeVelocityModels::general::Ur() const { - const fvMesh& mesh(this->pair_.phase1().mesh()); - return - tmp - ( - new volScalarField - ( - IOobject - ( - "Cd", - mesh.time().timeName(), - mesh - ), - mesh, - dimensionedScalar("Cd", dimless, 0) - ) - ); -} - - -Foam::tmp Foam::dragModels::noDrag::K() const -{ - return CdRe()*dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0); + V0_ + *( + exp(-a_*max(alphaD_ - residualAlpha_, scalar(0))) + - exp(-a1_*max(alphaD_ - residualAlpha_, scalar(0))) + ) + /max(alphaC_, residualAlpha_); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/noHeatTransfer/noHeatTransfer.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H similarity index 70% rename from applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/noHeatTransfer/noHeatTransfer.H rename to applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H index 5b171814..34f5247a 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/noHeatTransfer/noHeatTransfer.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H @@ -22,68 +22,81 @@ License along with OpenFOAM. If not, see . Class - Foam::heatTransferModels::noHeatTransfer + Foam::general Description + General relative velocity model SourceFiles - noHeatTransfer.C + general.C \*---------------------------------------------------------------------------*/ -#ifndef noHeatTransfer_H -#define noHeatTransfer_H +#ifndef general_H +#define general_H -#include "heatTransferModel.H" +#include "relativeVelocityModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - -class phasePair; - -namespace heatTransferModels +namespace relativeVelocityModels { /*---------------------------------------------------------------------------*\ - Class noHeatTransfer Declaration + Class general Declaration \*---------------------------------------------------------------------------*/ -class noHeatTransfer +class general : - public heatTransferModel + public relativeVelocityModel { + // Private data + + //- a coefficient + dimensionedScalar a_; + + //- a1 coefficient + dimensionedScalar a1_; + + //- Drift velocity + dimensionedVector V0_; + + //- Residual phase fraction + dimensionedScalar residualAlpha_; + + public: //- Runtime type information - TypeName("none"); + TypeName("general"); // Constructors - //- Construct from a dictionary and a phase pair - noHeatTransfer + //- Construct from components + general ( const dictionary& dict, - const phasePair& pair + const incompressibleTwoPhaseMixture& mixture ); //- Destructor - virtual ~noHeatTransfer(); + ~general(); // Member Functions - //- The heat transfer function K used in the enthalpy equation - tmp K() const; + //- Relative velocity + virtual tmp Ur() const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace heatTransferModels +} // End namespace relativeVelocityModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C new file mode 100644 index 00000000..5b0e51a2 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "relativeVelocityModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(relativeVelocityModel, 0); + defineRunTimeSelectionTable(relativeVelocityModel, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::relativeVelocityModel::relativeVelocityModel +( + const dictionary& dict, + const incompressibleTwoPhaseMixture& mixture +) +: + mixture_(mixture), + + continuousPhaseName_(dict.lookup("continuousPhase")), + + alphaC_ + ( + mixture.phase1Name() == continuousPhaseName_ + ? mixture.alpha1() + : mixture.alpha2() + ), + + alphaD_ + ( + mixture.phase1Name() == continuousPhaseName_ + ? mixture.alpha2() + : mixture.alpha1() + ), + + rhoC_ + ( + mixture.phase1Name() == continuousPhaseName_ + ? mixture.rho1() + : mixture.rho2() + ), + + rhoD_ + ( + mixture.phase1Name() == continuousPhaseName_ + ? mixture.rho2() + : mixture.rho1() + ), + + Udm_ + ( + IOobject + ( + "Udm", + alphaC_.time().timeName(), + alphaC_.mesh() + ), + alphaC_.mesh(), + dimensionedVector("Udm", dimVelocity, vector::zero), + mixture.U().boundaryField().types() + ), + + tau_ + ( + IOobject + ( + "Udm", + alphaC_.time().timeName(), + alphaC_.mesh() + ), + alphaC_.mesh(), + dimensionedSymmTensor + ( + "Udm", + sqr(dimVelocity)*dimDensity, + symmTensor::zero + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::relativeVelocityModel::New +( + const dictionary& dict, + const incompressibleTwoPhaseMixture& mixture +) +{ + word modelType(dict.lookup(typeName)); + + Info<< "Selecting relative velocity model " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "relativeVelocityModel::New" + "(" + "const dictionary&" + ")" + ) << "Unknown time scale model type " << modelType + << ", constructor not in hash table" << nl << nl + << " Valid time scale model types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); + } + + return + autoPtr + ( + cstrIter() + ( + dict.subDict(modelType + "Coeffs"), + mixture + ) + ); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::relativeVelocityModel::~relativeVelocityModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::relativeVelocityModel::update() +{ + tmp URel(Ur()); + + tmp betaC(alphaC_*rhoC_); + tmp betaD(alphaD_*rhoD_); + tmp rhoM(betaC() + betaD()); + + tmp Udm = URel()*betaC()/rhoM; + tmp Ucm = Udm() - URel; + + Udm_ = Udm(); + tau_ = betaD*sqr(Udm) + betaC*sqr(Ucm); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H new file mode 100644 index 00000000..73277bc3 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::relativeVelocityModel + +Description + +SourceFiles + relativeVelocityModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef relativeVelocityModel_H +#define relativeVelocityModel_H + +#include "fvCFD.H" +#include "dictionary.H" +#include "incompressibleTwoPhaseMixture.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class relativeVelocityModel Declaration +\*---------------------------------------------------------------------------*/ + +class relativeVelocityModel +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + relativeVelocityModel(const relativeVelocityModel&); + + //- Disallow default bitwise assignment + void operator=(const relativeVelocityModel&); + +protected: + + // Protected data + + //- Mixture properties + const incompressibleTwoPhaseMixture& mixture_; + + //- Name of the continuous phase + const word continuousPhaseName_; + + //- Continuous phase fraction + const volScalarField& alphaC_; + + //- Dispersed phase fraction + const volScalarField& alphaD_; + + //- Continuous density + const dimensionedScalar& rhoC_; + + //- Dispersed density + const dimensionedScalar& rhoD_; + + //- Dispersed diffusion velocity + volVectorField Udm_; + + //- Stress + volSymmTensorField tau_; + + +public: + + //- Runtime type information + TypeName("relativeVelocityModel"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + relativeVelocityModel, + dictionary, + (const dictionary& dict, const incompressibleTwoPhaseMixture& mixture), + (dict, mixture) + ); + + + // Constructors + + //- Construct from components + relativeVelocityModel + ( + const dictionary& dict, + const incompressibleTwoPhaseMixture& mixture + ); + + + // Selector + static autoPtr New + ( + const dictionary& dict, + const incompressibleTwoPhaseMixture& mixture + ); + + + //- Destructor + virtual ~relativeVelocityModel(); + + + // Member Functions + + //- Calculate the relative velocity of the dispersed phase + virtual tmp Ur() const = 0; + + //- Return the diffusion velocity of the dispersed phase + const volVectorField& Udm() const + { + return Udm_; + } + + //- Return the stress tensor due to the phase transport + const volSymmTensorField& tau() const + { + return tau_; + } + + //- Update the stored diffusion velocity and stress + void update(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/noHeatTransfer/noHeatTransfer.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C similarity index 61% rename from applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/noHeatTransfer/noHeatTransfer.C rename to applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C index 1a4b3744..a8e99b25 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/noHeatTransfer/noHeatTransfer.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C @@ -23,64 +23,51 @@ License \*---------------------------------------------------------------------------*/ -#include "noHeatTransfer.H" -#include "phasePair.H" +#include "simple.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -namespace heatTransferModels +namespace relativeVelocityModels { - defineTypeNameAndDebug(noHeatTransfer, 0); - addToRunTimeSelectionTable(heatTransferModel, noHeatTransfer, dictionary); + defineTypeNameAndDebug(simple, 0); + addToRunTimeSelectionTable(relativeVelocityModel, simple, dictionary); } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::heatTransferModels::noHeatTransfer::noHeatTransfer +Foam::relativeVelocityModels::simple::simple ( const dictionary& dict, - const phasePair& pair + const incompressibleTwoPhaseMixture& mixture ) : - heatTransferModel(dict, pair) + relativeVelocityModel(dict, mixture), + a_(dict.lookup("a")), + V0_(dict.lookup("V0")), + residualAlpha_(dict.lookup("residualAlpha")) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::heatTransferModels::noHeatTransfer::~noHeatTransfer() +Foam::relativeVelocityModels::simple::~simple() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp -Foam::heatTransferModels::noHeatTransfer::K() const +Foam::tmp +Foam::relativeVelocityModels::simple::Ur() const { - const fvMesh& mesh(this->pair_.phase1().mesh()); - return - tmp - ( - new volScalarField - ( - IOobject - ( - "zero", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("zero", dimensionSet(1, -1, -3, -1, 0), 0) - ) - ); + V0_ + *pow(scalar(10), -a_*max(alphaD_, scalar(0))) + /max(alphaC_, residualAlpha_); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/noDrag/noDrag.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H similarity index 71% rename from applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/noDrag/noDrag.H rename to applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H index b24267ee..e94f854e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/noDrag/noDrag.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H @@ -22,72 +22,78 @@ License along with OpenFOAM. If not, see . Class - Foam::dragModels::noDrag + Foam::simple Description + Simple relative velocity model SourceFiles - noDrag.C + simple.C \*---------------------------------------------------------------------------*/ -#ifndef noDrag_H -#define noDrag_H +#ifndef simple_H +#define simple_H -#include "dragModel.H" +#include "relativeVelocityModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - -class phasePair; - -namespace dragModels +namespace relativeVelocityModels { /*---------------------------------------------------------------------------*\ - Class noDrag Declaration + Class simple Declaration \*---------------------------------------------------------------------------*/ -class noDrag +class simple : - public dragModel + public relativeVelocityModel { + // Private data + + //- a coefficient + dimensionedScalar a_; + + //- Drift velocity + dimensionedVector V0_; + + //- Residual phase fraction + dimensionedScalar residualAlpha_; + + public: //- Runtime type information - TypeName("none"); + TypeName("simple"); // Constructors - //- Construct from a dictionary and a phase pair - noDrag + //- Construct from components + simple ( const dictionary& dict, - const phasePair& pair, - const bool registerObject + const incompressibleTwoPhaseMixture& mixture ); //- Destructor - virtual ~noDrag(); + ~simple(); // Member Functions - //- Drag coefficient - virtual tmp CdRe() const; - - //- The drag function used in the momentum equation - virtual tmp K() const; + //- Relative velocity + virtual tmp Ur() const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace dragModels +} // End namespace relativeVelocityModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.C b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.C new file mode 100644 index 00000000..f75355f8 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.C @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "BinghamPlastic.H" +#include "addToRunTimeSelectionTable.H" +#include "surfaceFields.H" +#include "fvc.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace viscosityModels +{ + defineTypeNameAndDebug(BinghamPlastic, 0); + + addToRunTimeSelectionTable + ( + viscosityModel, + BinghamPlastic, + dictionary + ); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::viscosityModels::BinghamPlastic::correctionNu +( + const dimensionedScalar& rhoc, + const dimensionedScalar& rhop, + const volScalarField& nuc +) const +{ + volScalarField + tauy + ( + yieldStressCoeff_ + *( + pow + ( + scalar(10), + yieldStressExponent_ + *(max(alpha_, scalar(0)) + yieldStressOffset_) + ) + - pow + ( + scalar(10), + yieldStressExponent_*yieldStressOffset_ + ) + ) + ); + + volScalarField + nup + ( + plastic::correctionNu(rhoc, rhop, nuc) + ); + + dimensionedScalar tauySmall("tauySmall", tauy.dimensions(), SMALL); + + return + tauy + /( + mag(fvc::grad(U_)) + + 1.0e-4*(tauy + tauySmall)/(nup + (rhoc/rhop)*nuc) + ) + + nup; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::viscosityModels::BinghamPlastic::BinghamPlastic +( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi +) +: + plastic(name, viscosityProperties, U, phi, typeName), + yieldStressCoeff_(plasticCoeffs_.lookup("yieldStressCoeff")), + yieldStressExponent_(plasticCoeffs_.lookup("yieldStressExponent")), + yieldStressOffset_(plasticCoeffs_.lookup("yieldStressOffset")), + U_(U) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::viscosityModels::BinghamPlastic::read +( + const dictionary& viscosityProperties +) +{ + plastic::read(viscosityProperties); + + plasticCoeffs_.lookup("yieldStressCoeff") >> yieldStressCoeff_; + plasticCoeffs_.lookup("yieldStressExponent") >> yieldStressExponent_; + plasticCoeffs_.lookup("yieldStressOffset") >> yieldStressOffset_; + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.H b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.H new file mode 100644 index 00000000..829f42b7 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.H @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::viscosityModels::BinghamPlastic + +Description + Viscosity correction model for Bingham plastics. + +SourceFiles + BinghamPlastic.C + +\*---------------------------------------------------------------------------*/ + +#ifndef BinghamPlastic_H +#define BinghamPlastic_H + +#include "plastic.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace viscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class BinghamPlastic Declaration +\*---------------------------------------------------------------------------*/ + +class BinghamPlastic +: + public plastic +{ +protected: + + // Protected data + + //- Yield stress coefficient + dimensionedScalar yieldStressCoeff_; + + //- Yield stress exponent + dimensionedScalar yieldStressExponent_; + + //- Yield stress offset + dimensionedScalar yieldStressOffset_; + + //- Velocity + const volVectorField& U_; + + + // Protected Member Functions + + //- Calculate and return the laminar viscosity correction + virtual tmp correctionNu + ( + const dimensionedScalar& rhoc, + const dimensionedScalar& rhop, + const volScalarField& nuc + ) const; + + +public: + + //- Runtime type information + TypeName("BinghamPlastic"); + + + // Constructors + + //- Construct from components + BinghamPlastic + ( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi + ); + + + //- Destructor + ~BinghamPlastic() + {} + + + // Member Functions + + //- Read transportProperties dictionary + bool read(const dictionary& viscosityProperties); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace viscosityModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/files b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/files new file mode 100644 index 00000000..db148b46 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/files @@ -0,0 +1,4 @@ +plastic/plastic.C +BinghamPlastic/BinghamPlastic.C + +LIB = $(FOAM_LIBBIN)/libdriftFluxTransportModels diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/options b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/options new file mode 100644 index 00000000..6c72f3a6 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude + +LIB_LIBS = \ + -ltwoPhaseMixture \ + -lincompressibleTransportModels \ + -lfiniteVolume diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.C b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.C new file mode 100644 index 00000000..12b89e4c --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.C @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "plastic.H" +#include "addToRunTimeSelectionTable.H" +#include "surfaceFields.H" +#include "incompressibleTwoPhaseMixture.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace viscosityModels +{ + defineTypeNameAndDebug(plastic, 0); + + addToRunTimeSelectionTable + ( + viscosityModel, + plastic, + dictionary + ); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::viscosityModels::plastic::calcNu() const +{ + const incompressibleTwoPhaseMixture& twoPhaseProperties = + alpha_.mesh().lookupObject + ( + "transportProperties" + ); + + bool isThisIsPhase1(&twoPhaseProperties.nuModel1() == this); + + dimensionedScalar + rhoc + ( + isThisIsPhase1 + ? twoPhaseProperties.rho2() + : twoPhaseProperties.rho1() + ); + + dimensionedScalar + rhop + ( + isThisIsPhase1 + ? twoPhaseProperties.rho1() + : twoPhaseProperties.rho2() + ); + + volScalarField + nuc + ( + ( + isThisIsPhase1 + ? twoPhaseProperties.nuModel2() + : twoPhaseProperties.nuModel1() + ).nu() + ); + + volScalarField + nup + ( + correctionNu(rhoc, rhop, nuc) + ); + + return + max + ( + nuMin_, + min + ( + nuMax_, + ( + nup + (rhoc/rhop)*nuc*alpha_ + ) + ) + ) + /max(alpha_, SMALL); +} + + +Foam::tmp +Foam::viscosityModels::plastic::correctionNu +( + const dimensionedScalar& rhoc, + const dimensionedScalar& rhop, + const volScalarField& nuc +) const +{ + return + plasticViscosityCoeff_ + *( + pow + ( + scalar(10), + plasticViscosityExponent_*alpha_ + ) - scalar(1) + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::viscosityModels::plastic::plastic +( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi, + const word modelName +) +: + viscosityModel(name, viscosityProperties, U, phi), + plasticCoeffs_(viscosityProperties.subDict(modelName + "Coeffs")), + plasticViscosityCoeff_ + ( + plasticCoeffs_.lookup("plasticViscosityCoeff") + ), + plasticViscosityExponent_ + ( + plasticCoeffs_.lookup("plasticViscosityExponent") + ), + nuMin_(plasticCoeffs_.lookup("nuMin")), + nuMax_(plasticCoeffs_.lookup("nuMax")), + alpha_ + ( + U.mesh().lookupObject + ( + IOobject::groupName + ( + viscosityProperties.lookupOrDefault("alpha", "alpha"), + viscosityProperties.dictName() + ) + ) + ), + nu_ + ( + IOobject + ( + name, + U_.time().timeName(), + U_.db(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + U_.mesh(), + dimensionedScalar("nu", dimViscosity, 0) + ) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::viscosityModels::plastic::read +( + const dictionary& viscosityProperties +) +{ + viscosityModel::read(viscosityProperties); + + plasticCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs"); + + plasticCoeffs_.lookup("k") >> plasticViscosityCoeff_; + plasticCoeffs_.lookup("n") >> plasticViscosityExponent_; + plasticCoeffs_.lookup("nuMin") >> nuMin_; + plasticCoeffs_.lookup("nuMax") >> nuMax_; + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.H b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.H new file mode 100644 index 00000000..3ac9ae29 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::viscosityModels::plastic + +Description + Viscosity correction model for a generic power-law plastic. + +SourceFiles + plastic.C + +\*---------------------------------------------------------------------------*/ + +#ifndef plastic_H +#define plastic_H + +#include "viscosityModel.H" +#include "dimensionedScalar.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class incompressibleTwoPhaseMixture; + +namespace viscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class plastic Declaration +\*---------------------------------------------------------------------------*/ + +class plastic +: + public viscosityModel +{ +protected: + + // Protected data + + //- Dictionary + dictionary plasticCoeffs_; + + //- Plastic viscosity coefficient + dimensionedScalar plasticViscosityCoeff_; + + //- Plastic viscosity exponent + dimensionedScalar plasticViscosityExponent_; + + //- Minimum viscosity + dimensionedScalar nuMin_; + + //- Maximum viscosity + dimensionedScalar nuMax_; + + //- Plastic phase fraction + const volScalarField& alpha_; + + //- Viscosity + volScalarField nu_; + + + // Protected Member Functions + + //- Calculate and return the laminar viscosity + virtual tmp calcNu() const; + + //- Calculate and return the laminar viscosity correction + virtual tmp correctionNu + ( + const dimensionedScalar& rhoc, + const dimensionedScalar& rhop, + const volScalarField& nuc + ) const; + + +public: + + //- Runtime type information + TypeName("plastic"); + + + // Constructors + + //- Construct from components + plastic + ( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi, + const word modelName=typeName + ); + + + //- Destructor + ~plastic() + {} + + + // Member Functions + + //- Return the laminar viscosity + tmp nu() const + { + return nu_; + } + + //- Return the laminar viscosity for patch + tmp nu(const label patchi) const + { + return nu_.boundaryField()[patchi]; + } + + //- Correct the laminar viscosity + void correct() + { + nu_ = calcNu(); + } + + //- Read transportProperties dictionary + bool read(const dictionary& viscosityProperties); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace viscosityModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H b/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H index 149d787c..b9ff8481 100644 --- a/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H +++ b/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H @@ -4,7 +4,6 @@ const scalar Cmu25 = ::pow(Cmu.value(), 0.25); const scalar Cmu75 = ::pow(Cmu.value(), 0.75); const scalar kappa_ = kappa.value(); - const scalar muc_ = muc.value(); const fvPatchList& patches = mesh.boundary(); @@ -34,6 +33,7 @@ if (isA(curPatch)) { const scalarField& mutw = mut.boundaryField()[patchi]; + const scalarField& mucw = muc.boundaryField()[patchi]; scalarField magFaceGradU ( @@ -55,7 +55,7 @@ /(kappa_*y[patchi][facei]); G[faceCelli] += - (mutw[facei] + muc_) + (mutw[facei] + mucw[facei]) *magFaceGradU[facei] *Cmu25*::sqrt(k[faceCelli]) /(kappa_*y[patchi][facei]); diff --git a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H index d63f7e79..2b54f6c2 100644 --- a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H +++ b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H @@ -2,8 +2,6 @@ const scalar Cmu25 = ::pow(Cmu.value(), 0.25); const scalar kappa_ = kappa.value(); const scalar E_ = E.value(); - const scalar muc_ = muc.value(); - const scalar nuc_ = muc_/rhoc.value(); const fvPatchList& patches = mesh.boundary(); @@ -14,6 +12,7 @@ if (isA(curPatch)) { scalarField& mutw = mut.boundaryField()[patchi]; + const scalarField& mucw = muc.boundaryField()[patchi]; forAll(curPatch, facei) { @@ -21,12 +20,12 @@ scalar yPlus = Cmu25*y[patchi][facei]*::sqrt(k[faceCelli]) - /nuc_; + /(mucw[facei]/rho2.value()); if (yPlus > 11.6) { mutw[facei] = - muc_*(yPlus*kappa_/::log(E_*yPlus) - 1); + mucw[facei]*(yPlus*kappa_/::log(E_*yPlus) - 1); } else { diff --git a/applications/solvers/multiphase/driftFluxFoam/yieldStress.H b/applications/solvers/multiphase/driftFluxFoam/yieldStress.H deleted file mode 100644 index eda55d2e..00000000 --- a/applications/solvers/multiphase/driftFluxFoam/yieldStress.H +++ /dev/null @@ -1,27 +0,0 @@ -volScalarField yieldStress -( - const dimensionedScalar& yieldStressCoeff, - const dimensionedScalar& yieldStressExponent, - const dimensionedScalar& yieldStressOffset, - const volScalarField& alpha -) -{ - tmp tfld - ( - yieldStressCoeff* - ( - pow - ( - 10.0, - yieldStressExponent*(max(alpha, scalar(0)) + yieldStressOffset) - ) - - pow - ( - 10.0, - yieldStressExponent*yieldStressOffset - ) - ) - ); - - return tfld(); -} diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files index 4457f8ea..9a0afbd7 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files @@ -1,6 +1,5 @@ dragModels/dragModel/dragModel.C dragModels/dragModel/newDragModel.C -dragModels/noDrag/noDrag.C dragModels/segregated/segregated.C dragModels/Ergun/Ergun.C dragModels/Gibilaro/Gibilaro.C @@ -25,7 +24,6 @@ liftModels/TomiyamaLift/TomiyamaLift.C heatTransferModels/heatTransferModel/heatTransferModel.C heatTransferModels/heatTransferModel/newHeatTransferModel.C -heatTransferModels/noHeatTransfer/noHeatTransfer.C heatTransferModels/RanzMarshall/RanzMarshall.C virtualMassModels/virtualMassModel/virtualMassModel.C diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C index b05277db..b71bb4f8 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/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-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -127,10 +127,12 @@ bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read() { coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); - Fr_.readIfPresent(coeffDict_); - eta_.readIfPresent(coeffDict_); - p_.readIfPresent(coeffDict_); - phi_.readIfPresent(coeffDict_); + Fr_.read(coeffDict_); + eta_.read(coeffDict_); + p_.read(coeffDict_); + + phi_.read(coeffDict_); + phi_ *= constant::mathematical::pi/180.0; return true; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C index 537a76fe..705b66d6 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/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-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,9 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer frictionalStressModel(dict), coeffDict_(dict.subDict(typeName + "Coeffs")), phi_("phi", dimless, coeffDict_.lookup("phi")) -{} +{ + phi_ *= constant::mathematical::pi/180.0; +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -158,7 +160,8 @@ bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read() { coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); - phi_.readIfPresent(coeffDict_); + phi_.read(coeffDict_); + phi_ *= constant::mathematical::pi/180.0; return true; } diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/options b/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/options index 8b00d9a6..01b25c79 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/options +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/options @@ -1,7 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude -EXE_LIBS = \ +LIB_LIBS = \ -lfiniteVolume \ -lincompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \ diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H index 9487aefe..21bc8e61 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,7 +130,7 @@ class domainDecomposition //- Append single element to list static void append(labelList&, const label); - //- Add face to interProcessor patch. + //- Add face to inter-processor patch void addInterProcFace ( const label facei, @@ -141,6 +141,19 @@ class domainDecomposition List > >& ) const; + //- Generate sub patch info for processor cyclics + template + void processInterCyclics + ( + const polyBoundaryMesh& patches, + List > >& interPatchFaces, + List >& procNbrToInterPatch, + List& subPatchIDs, + List& subPatchStarts, + bool owner, + BinaryOp bop + ) const; + public: @@ -187,6 +200,12 @@ public: } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "domainDecompositionTemplates.C" +#endif + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C index 14512332..f5a76722 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,9 +32,7 @@ Description #include "domainDecomposition.H" #include "IOstreams.H" -#include "SLPtrList.H" #include "boolList.H" -#include "primitiveMesh.H" #include "cyclicPolyPatch.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -209,10 +207,11 @@ void Foam::domainDecomposition::decomposeMesh() // Done internal bits of the new mesh and the ordinary patches. - // Per processor, from neighbour processor to the interprocessorpatch that - // communicates with that neighbour. + // Per processor, from neighbour processor to the inter-processor patch + // that communicates with that neighbour List > procNbrToInterPatch(nProcs_); - // Per processor the faces per interprocessorpatch. + + // Per processor the faces per inter-processor patch List > > interPatchFaces(nProcs_); // Processor boundaries from internal faces @@ -248,95 +247,73 @@ void Foam::domainDecomposition::decomposeMesh() subPatchStarts[procI].setSize(nInterfaces, labelList(1, label(0))); } - // Processor boundaries from split cyclics - forAll(patches, patchi) - { - if (isA(patches[patchi])) - { - const cyclicPolyPatch& pp = refCast - ( - patches[patchi] - ); - // cyclic: check opposite side on this processor - const labelUList& patchFaceCells = pp.faceCells(); - const labelUList& nbrPatchFaceCells = - pp.neighbPatch().faceCells(); + // Special handling needed for the case that multiple processor cyclic + // patches are created on each local processor domain, e.g. if a 3x3 case + // is decomposed using the decomposition: + // + // | 1 | 0 | 2 | + // cyclic left | 2 | 0 | 1 | cyclic right + // | 2 | 0 | 1 | + // + // - processors 1 and 2 will both have pieces of both cyclic left- and + // right sub-patches present + // - the interface patch faces are stored in a single list, where each + // sub-patch is referenced into the list using a patch start index and + // size + // - if the patches are in order (in the boundary file) of left, right + // - processor 1 will send: left, right + // - processor 1 will need to receive in reverse order: right, left + // - similarly for processor 2 + // - the sub-patches are therefore generated in 4 passes of the patch lists + // 1. add faces from owner patch where local proc i < nbr proc i + // 2. add faces from nbr patch where local proc i < nbr proc i + // 3. add faces from owner patch where local proc i > nbr proc i + // 4. add faces from nbr patch where local proc i > nbr proc i - // Store old sizes. Used to detect which inter-proc patches - // have been added to. - labelListList oldInterfaceSizes(nProcs_); - forAll(oldInterfaceSizes, procI) - { - labelList& curOldSizes = oldInterfaceSizes[procI]; + processInterCyclics + ( + patches, + interPatchFaces, + procNbrToInterPatch, + subPatchIDs, + subPatchStarts, + true, + lessOp