diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 208b7b9ce9816741241969f37bc9ff11e89ba6dc..475e48a1cc02d1eb38652be80d74955b90762f75 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -37,7 +37,7 @@ Description #include "fvCFD.H" #include "turbulenceModel.H" -#include "fluidThermoCloud.H" +#include "basicThermoCloud.H" #include "coalCloud.H" #include "psiCombustionModel.H" #include "fvIOoptionList.H" diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H b/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H index 87c882c9a6a34a67136fe5c844e1c175830ea23a..5dcfe1df4fa11c97439b34517bb6edf4ebae649e 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H @@ -9,7 +9,7 @@ coalCloud coalParcels ); Info<< "\nConstructing limestone cloud" << endl; -fluidThermoCloud limestoneParcels +basicThermoCloud limestoneParcels ( "limestoneCloud1", rho, diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H index be34ab52ed0638ee53e17931059e32e0b0159389..accc3197ad99e84a3a305077a58302550d7f7f3d 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H @@ -1,7 +1,5 @@ { - label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); + #include "alphaControls.H" surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H index 1a718434a81f998e90476ddc61d48fc6e24ae6c6..cf509804604443692b63e8a000493d6953ef7f55 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H @@ -1,17 +1,5 @@ #include "readTimeControls.H" - label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - - if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } - bool correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index a42d9119804c8e61031ee217ec38b8722781f236..ed5faa7c86a515ad69565b24d1269267b1e2ade1 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readControls.H" + #include "readTimeControls.H" #include "initContinuityErrs.H" #include "createFields.H" #include "CourantNo.H" @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "readControls.H" + #include "readTimeControls.H" #include "CourantNo.H" #include "setDeltaT.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 73babb08f04ae70d23f2b3ed58831060ec0c771e..13193788219fbe0ba68353f9e4fec7cd1902d5bd 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -85,8 +85,8 @@ if (pimple.finalNonOrthogonalIter()) { - //p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); - //p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh; + p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); + p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh; dgdt = ( @@ -102,7 +102,7 @@ } } - p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); + // p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); // Update densities from change in p_rgh rho1 += psi1*(p_rgh - p_rgh_0); diff --git a/applications/solvers/multiphase/compressibleInterFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/readControls.H deleted file mode 100644 index 87a055d641f44e76ee10348cc43fb17c5d558390..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/readControls.H +++ /dev/null @@ -1,13 +0,0 @@ - #include "readTimeControls.H" - - label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - - if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO operation, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H index 1f12fc9a121bcdafe7f9ea906210bbd83d6c140c..1810bdd4d9f07377f8f7cb42702f3bd4e4a19ef9 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H @@ -28,8 +28,8 @@ + ( he1.name() == thermo1.phasePropertyName("e") - ? fvc::div(alphaPhi1, p) - : -dalpha1pdt + ? fvc::ddt(alpha1)*p + fvc::div(alphaPhi1, p) + : -alpha1*dpdt )/rho1 - fvm::laplacian(k1, he1) @@ -50,8 +50,8 @@ + ( he2.name() == thermo2.phasePropertyName("e") - ? fvc::div(alphaPhi2, p) - : -dalpha2pdt + ? fvc::ddt(alpha2)*p + fvc::div(alphaPhi2, p) + : -alpha2*dpdt )/rho2 - fvm::laplacian(k2, he2) diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H index cc5b3ebe21915bc2b19c97c32a3bc067a28b73d7..5b030b95ea64522589ec0583b07e58b51f61d73f 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H @@ -275,8 +275,8 @@ ); - Info<< "Creating field dalpha1pdt\n" << endl; - volScalarField dalpha1pdt + Info<< "Creating field dpdt\n" << endl; + volScalarField dpdt ( IOobject ( @@ -285,21 +285,9 @@ mesh ), mesh, - dimensionedScalar("dalpha1pdt", p.dimensions()/dimTime, 0) + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) ); - Info<< "Creating field dalpha2pdt\n" << endl; - volScalarField dalpha2pdt - ( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar("dalpha2pdt", p.dimensions()/dimTime, 0) - ); Info<< "Creating field kinetic energy K\n" << endl; volScalarField K1("K" + phase1Name, 0.5*magSqr(U1)); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H index 02e49b56618430559a3482700ec6fa02971f22c9..756a231fc2f589ad5bb35bc021d44737260d38b5 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H @@ -208,13 +208,8 @@ K1 = 0.5*magSqr(U1); K2 = 0.5*magSqr(U2); - if (thermo1.dpdt()) + if (thermo1.dpdt() || thermo2.dpdt()) { - dalpha1pdt = fvc::ddt(alpha1, p); - } - - if (thermo2.dpdt()) - { - dalpha2pdt = fvc::ddt(alpha2, p); + dpdt = fvc::ddt(p); } } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H index cb8b4efc3bbd290c25087d8d39672e0734690d2f..9913595cf296cb67ab33cc3e503ef111cd610475 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H @@ -1,4 +1,2 @@ #include "readTimeControls.H" - - int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr"))); - int nAlphaSubCycles(readInt(pimple.dict().lookup("nAlphaSubCycles"))); + #include "alphaControls.H" diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H index 57c78027a471f712cf06e17486b62fcd05cd3014..428876fd2297f7e39ee228d688bc51307dc49c00 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H @@ -1,5 +1,4 @@ -label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H index 8525a8bf6738a5b230f524e8ffae6af08063e2b2..f419153506c1ef5962aad3693546bf00ee6a8ae1 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H @@ -130,10 +130,7 @@ << ", " << gMax(1/rDeltaT.internalField()) << endl; } - label nAlphaSubCycles - ( - readLabel(pimpleDict.lookup("nAlphaSubCycles")) - ); + #include "alphaControls.H" rSubDeltaT = rDeltaT*nAlphaSubCycles; } diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H index 57c78027a471f712cf06e17486b62fcd05cd3014..428876fd2297f7e39ee228d688bc51307dc49c00 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H @@ -1,5 +1,4 @@ -label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H index 97a09ce017d3b753ddf4a91c7dc37d06e41e46c3..9e3f4f6bd47104f5d2bd52ac09e335fb641a1d37 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H @@ -1,6 +1,4 @@ -const dictionary& pimpleDict = pimple.dict(); -label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C index e16f83bd2e8cd79ba3a112dc4763085e4a0c1e8c..f812b472e0873fea65145819ca645c87bfe494ea 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.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 @@ -174,8 +174,10 @@ Foam::threePhaseInterfaceProperties::threePhaseInterfaceProperties ( readScalar ( - mixture.U().mesh().solutionDict().subDict("PIMPLE"). - lookup("cAlpha") + mixture.U().mesh().solverDict + ( + mixture_.alpha1().name() + ).lookup("cAlpha") ) ), sigma12_(mixture.lookup("sigma12")), diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H index 75015542b554c22e0d6d678a44f3cfe549e1e379..9e5461614be9f75ed7360d7719ef0e5ea71b5e93 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H @@ -4,9 +4,41 @@ surfaceScalarField phir("phir", phic*interface.nHatf()); - for (int gCorr=0; gCorr<nAlphaCorr; gCorr++) + Pair<tmp<volScalarField> > vDotAlphal = + twoPhaseProperties->vDotAlphal(); + const volScalarField& vDotcAlphal = vDotAlphal[0](); + const volScalarField& vDotvAlphal = vDotAlphal[1](); + const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal); + + tmp<surfaceScalarField> tphiAlpha; + + if (MULESCorr) { - surfaceScalarField phiAlpha + fvScalarMatrix alpha1Eqn + ( + fvm::ddt(alpha1) + + fvm::div(phi, alpha1, "UD") - fvm::Sp(divU, alpha1) + == + fvm::Sp(vDotvmcAlphal, alpha1) + + vDotcAlphal + ); + + alpha1Eqn.solve(); + + Info<< "Phase-1 volume fraction = " + << alpha1.weightedAverage(mesh.Vsc()).value() + << " Min(alpha1) = " << min(alpha1).value() + << " Max(alpha1) = " << max(alpha1).value() + << endl; + + tphiAlpha = alpha1Eqn.flux(); + } + + volScalarField alpha10("alpha10", alpha1); + + for (int aCorr=0; aCorr<nAlphaCorr; aCorr++) + { + tmp<surfaceScalarField> tphiAlphaCorr ( fvc::flux ( @@ -22,66 +54,52 @@ ) ); - Pair<tmp<volScalarField> > vDotAlphal = - twoPhaseProperties->vDotAlphal(); - const volScalarField& vDotcAlphal = vDotAlphal[0](); - const volScalarField& vDotvAlphal = vDotAlphal[1](); + if (MULESCorr) + { + tphiAlphaCorr() -= tphiAlpha(); - volScalarField Sp - ( - IOobject + + volScalarField alpha100("alpha100", alpha10); + alpha10 = alpha1; + + MULES::correct ( - "Sp", - runTime.timeName(), - mesh - ), - vDotvAlphal - vDotcAlphal - ); + geometricOneField(), + alpha1, + tphiAlphaCorr(), + vDotvmcAlphal, + ( + divU*(alpha10 - alpha100) + - vDotvmcAlphal*alpha10 + )(), + 1, + 0 + ); - volScalarField Su - ( - IOobject + tphiAlpha() += tphiAlphaCorr(); + } + else + { + MULES::explicitSolve ( - "Su", - runTime.timeName(), - mesh - ), - // Divergence term is handled explicitly to be - // consistent with the explicit transport solution - divU*alpha1 - + vDotcAlphal - ); + geometricOneField(), + alpha1, + phi, + tphiAlphaCorr(), + vDotvmcAlphal, + (divU*alpha1 + vDotcAlphal)(), + 1, + 0 + ); - //MULES::explicitSolve - //( - // geometricOneField(), - // alpha1, - // phi, - // phiAlpha, - // Sp, - // Su, - // 1, - // 0 - //); - - MULES::implicitSolve - ( - geometricOneField(), - alpha1, - phi, - phiAlpha, - Sp, - Su, - 1, - 0 - ); + tphiAlpha = tphiAlphaCorr; + } alpha2 = 1.0 - alpha1; - rhoPhi += - (runTime.deltaT()/totalDeltaT) - *(phiAlpha*(rho1 - rho2) + phi*rho2); } + rhoPhi = tphiAlpha()*(rho1 - rho2) + phi*rho2; + Info<< "Liquid phase volume fraction = " << alpha1.weightedAverage(mesh.V()).value() << " Min(alpha1) = " << min(alpha1).value() diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H index 5e7fd27f7528e9e1d38756c4e35b6e5cd52c4897..a4338b907f8c0f633d89919d4896d276d21cc16e 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H @@ -11,21 +11,18 @@ surfaceScalarField rhoPhi ); { - const dictionary& pimpleDict = pimple.dict(); - - label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); + #include "alphaControls.H" surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); volScalarField divU(fvc::div(phi)); - dimensionedScalar totalDeltaT = runTime.deltaT(); - if (nAlphaSubCycles > 1) { + dimensionedScalar totalDeltaT = runTime.deltaT(); + surfaceScalarField rhoPhiSum("rhoPhiSum", rhoPhi); + for ( subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles); @@ -33,7 +30,10 @@ surfaceScalarField rhoPhi ) { #include "alphaEqn.H" + rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; } + + rhoPhi = rhoPhiSum; } else { diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index edfc34dfb83d56b9243f8a99b74311b1e435fc56..bc6af055f0c7e39e904101bf8695299e4dbd311b 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -41,7 +41,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "IMULES.H" +#include "MULES.H" #include "subCycle.H" #include "interfaceProperties.H" #include "phaseChangeTwoPhaseMixture.H" diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index 0cde87042d997622c9745f2edd793dfce867c46a..a19b6a3d9b5f61d9d5fd0028438cf6712f9cd468 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -812,9 +812,8 @@ void Foam::multiphaseSystem::solve() const Time& runTime = mesh_.time(); - const dictionary& pimpleDict = mesh_.solutionDict().subDict("PIMPLE"); - - label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); + const dictionary& alphaControls = mesh_.solverDict(phases_.first().name()); + label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index b3c4ecb11154126969467151b9862a9beda48bce..76b4dab8dd89cf68c35e4981ba9dc66c882d16c5 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -249,15 +249,12 @@ void Foam::multiphaseMixture::solve() const Time& runTime = mesh_.time(); - const dictionary& pimpleDict = mesh_.solutionDict().subDict("PIMPLE"); - - label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); - - scalar cAlpha(readScalar(pimpleDict.lookup("cAlpha"))); - - volScalarField& alpha = phases_.first(); + const dictionary& alphaControls = mesh_.solverDict(alpha.name()); + label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); + scalar cAlpha(readScalar(alphaControls.lookup("cAlpha"))); + if (nAlphaSubCycles > 1) { surfaceScalarField rhoPhiSum(0.0*rhoPhi_); diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H index 57c78027a471f712cf06e17486b62fcd05cd3014..428876fd2297f7e39ee228d688bc51307dc49c00 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H @@ -1,5 +1,4 @@ -label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H b/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H index 1abe3ef10d4346899ae7b3875b770374ce543a48..813fdd8f10398b062d20b468e59ce8b7b36ba10d 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H @@ -1,5 +1,4 @@ #include "readTimeControls.H" + #include "alphaControls.H" - int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr"))); - int nAlphaSubCycles(readInt(pimple.dict().lookup("nAlphaSubCycles"))); Switch correctAlpha(pimple.dict().lookup("correctAlpha")); diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 5e142f9d857dc756bb5d81246e7a4907d64416dd..9d7acc986d5dc09e02f8a2ef66dac353d58de8ae 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -148,7 +148,7 @@ bool Foam::checkWedges { Info<< " ***Wedge patch " << pp.name() << " not planar." << " Point " << pt << " is not in patch plane by " - << d << " meter." + << d << " metre." << endl; } return true; diff --git a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C index 00df77dfc522e7579b92dd2f32cde08872ca957c..9be145648fa8ae53ee6e0c9c6090b5f71288ea2a 100644 --- a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C +++ b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) boundBox bb(points); Info<< "bounding box: min = " << bb.min() - << " max = " << bb.max() << " meters." + << " max = " << bb.max() << " metres." << endl; diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C index 26d472c44d8b0577ed1eb478770de710e0822bbd..afe8c1ce63dda2e47d52fe7be7112ebe091a7988 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.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,7 @@ Foam::label Foam::mergePolyMesh::patchIndex(const polyPatch& p) { if (patchNames_[patchI] == pName) { - if (patchTypes_[patchI] == pType) + if (word(patchDicts_[patchI]["type"]) == pType) { // Found name and types match return patchI; @@ -68,7 +68,11 @@ Foam::label Foam::mergePolyMesh::patchIndex(const polyPatch& p) } // Patch not found. Append to the list - patchTypes_.append(pType); + { + OStringStream os; + p.write(os); + patchDicts_.append(dictionary(IStringStream(os.str())())); + } if (nameFound) { @@ -121,20 +125,22 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io) : polyMesh(io), meshMod_(*this), - patchTypes_(2*boundaryMesh().size()), patchNames_(2*boundaryMesh().size()), + patchDicts_(2*boundaryMesh().size()), pointZoneNames_(), faceZoneNames_(), cellZoneNames_() { // Insert the original patches into the list - wordList curPatchTypes = boundaryMesh().types(); wordList curPatchNames = boundaryMesh().names(); - forAll(curPatchTypes, patchI) + forAll(boundaryMesh(), patchI) { - patchTypes_.append(curPatchTypes[patchI]); - patchNames_.append(curPatchNames[patchI]); + patchNames_.append(boundaryMesh()[patchI].name()); + + OStringStream os; + boundaryMesh()[patchI].write(os); + patchDicts_.append(dictionary(IStringStream(os.str())())); } // Insert point, face and cell zones into the list @@ -379,7 +385,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m) void Foam::mergePolyMesh::merge() { Info<< "patch names: " << patchNames_ << nl - << "patch types: " << patchTypes_ << nl + << "patch dicts: " << patchDicts_ << nl << "point zone names: " << pointZoneNames_ << nl << "face zone names: " << faceZoneNames_ << nl << "cell zone names: " << cellZoneNames_ << endl; @@ -409,14 +415,16 @@ void Foam::mergePolyMesh::merge() for (; patchI < patchNames_.size(); patchI++) { // Add a patch + dictionary dict(patchDicts_[patchI]); + dict.set("nFaces", 0); + dict.set("startFace", endOfLastPatch); + newPatches[patchI] = ( polyPatch::New ( - patchTypes_[patchI], patchNames_[patchI], - 0, - endOfLastPatch, + dict, patchI, oldPatches ).ptr() diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.H b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.H index ef6c2f0ee43427d5b333a1d5c997646dd96f79f4..a9db4fb32e3f28c95de3dc98aaa4fd0cc22a591b 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.H +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,12 +58,12 @@ class mergePolyMesh //- Topological change to accumulated all mesh changes polyTopoChange meshMod_; - //- Patch types - DynamicList<word> patchTypes_; - //- Patch names DynamicList<word> patchNames_; + //- Patch dictionaries + DynamicList<dictionary> patchDicts_; + //- Point zone names DynamicList<word> pointZoneNames_; diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index d29bfeca1a21cb8199fed3ed79782365e0a8200f..d253be35178eefcf1885e8f148f0b4761b9b98a5 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -1043,7 +1043,6 @@ int main(int argc, char *argv[]) surfaceMeshWriter writer ( - vMesh, binary, pp, fz.name(), diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.C index dc37b02d457dbca1212d53acf0d578d99b64aef0..08840858049eb45779373a2a18cc63cdd7c115bc 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.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 @@ -30,14 +30,12 @@ License Foam::surfaceMeshWriter::surfaceMeshWriter ( - const vtkMesh& vMesh, const bool binary, const indirectPrimitivePatch& pp, const word& name, const fileName& fName ) : - vMesh_(vMesh), binary_(binary), pp_(pp), fName_(fName), @@ -78,8 +76,4 @@ Foam::surfaceMeshWriter::surfaceMeshWriter } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - - // ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.H index 66bfbdb91b0eca36ef09c2ac3884d2673227360e..a89ba19582136085737dc053c672aaf7a050daf8 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,13 +53,11 @@ namespace Foam class volPointInterpolation; /*---------------------------------------------------------------------------*\ - Class surfaceMeshWriter Declaration + Class surfaceMeshWriter Declaration \*---------------------------------------------------------------------------*/ class surfaceMeshWriter { - const vtkMesh& vMesh_; - const bool binary_; const indirectPrimitivePatch& pp_; @@ -68,9 +66,6 @@ class surfaceMeshWriter std::ofstream os_; -// label nPoints_; -// -// label nFaces_; public: @@ -79,7 +74,6 @@ public: //- Construct from components surfaceMeshWriter ( - const vtkMesh&, const bool binary, const indirectPrimitivePatch& pp, const word& name, @@ -94,19 +88,6 @@ public: return os_; } -// label nPoints() const -// { -// return nPoints_; -// } -// -// label nFaces() const -// { -// return nFaces_; -// } -// -// //- Write cellIDs -// void writePatchIDs(); - //- Extract face data template<class Type> tmp<Field<Type> > getFaceField diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriterTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriterTemplates.C index f3c3db6bdcf2b98c895b80bf4c118c929e7b73d5..3ae7b08be26cb3671fba616b9c258490260f0358 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriterTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriterTemplates.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/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C b/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C index b4fc7858b22302ad4cb4ebf5a64b99a5ed1369a4..c04f2be85a555c52be5a1f4fc3a8db339bbeddf8 100644 --- a/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C @@ -179,12 +179,13 @@ void Foam::vtkPV398Foam::convertMeshPatches const word patchName = getPartName(partId); - labelHashSet patchIds(patches.patchSet(List<wordRe>(1, patchName))); + labelHashSet + patchIds(patches.patchSet(List<wordRe>(1, wordRe(patchName)))); if (debug) { Info<< "Creating VTK mesh for patches [" << patchIds <<"] " - << patchName << endl; + << patchName << endl; } vtkPolyData* vtkmesh = NULL; diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C index 2e3a56007b22561df858fd9675a9534e928b3c9a..ee9339d0f919689701fc87845e4cc039c3faf253 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.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 @@ -40,6 +40,7 @@ Description #include "pairPatchAgglomeration.H" #include "labelListIOList.H" #include "syncTools.H" +#include "globalIndex.H" using namespace Foam; @@ -53,7 +54,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createNamedMesh.H" - const word dictName("faceAgglomerateDict"); + const word dictName("viewFactorsDict"); #include "setConstantMeshDictionaryIO.H" @@ -79,16 +80,16 @@ int main(int argc, char *argv[]) boundary.size() ); - forAll(boundary, patchId) - { - const polyPatch& pp = boundary[patchId]; + label nCoarseFaces = 0; - label patchI = pp.index(); - finalAgglom[patchI].setSize(pp.size(), 0); - - if (!pp.coupled()) + forAllConstIter(dictionary, agglomDict, iter) + { + labelList patchIds = boundary.findIndices(iter().keyword()); + forAll(patchIds, i) { - if (agglomDict.found(pp.name())) + label patchI = patchIds[i]; + const polyPatch& pp = boundary[patchI]; + if (!pp.coupled()) { Info << "\nAgglomerating patch : " << pp.name() << endl; pairPatchAgglomeration agglomObject @@ -99,12 +100,11 @@ int main(int argc, char *argv[]) agglomObject.agglomerate(); finalAgglom[patchI] = agglomObject.restrictTopBottomAddressing(); - } - else - { - FatalErrorIn(args.executable()) - << "Patch " << pp.name() << " not found in dictionary: " - << agglomDict.name() << exit(FatalError); + + if (finalAgglom[patchI].size()) + { + nCoarseFaces += max(finalAgglom[patchI] + 1); + } } } } @@ -144,6 +144,7 @@ int main(int argc, char *argv[]) if (writeAgglom) { + globalIndex index(nCoarseFaces); volScalarField facesAgglomeration ( IOobject @@ -158,14 +159,26 @@ int main(int argc, char *argv[]) dimensionedScalar("facesAgglomeration", dimless, 0) ); + label coarsePatchIndex = 0; forAll(boundary, patchId) { - fvPatchScalarField& bFacesAgglomeration = - facesAgglomeration.boundaryField()[patchId]; - - forAll(bFacesAgglomeration, j) + const polyPatch& pp = boundary[patchId]; + if (pp.size() > 0) { - bFacesAgglomeration[j] = finalAgglom[patchId][j]; + fvPatchScalarField& bFacesAgglomeration = + facesAgglomeration.boundaryField()[patchId]; + + forAll(bFacesAgglomeration, j) + { + bFacesAgglomeration[j] = + index.toGlobal + ( + Pstream::myProcNo(), + finalAgglom[patchId][j] + coarsePatchIndex + ); + } + + coarsePatchIndex += max(finalAgglom[patchId]) + 1; } } diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict b/applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict similarity index 91% rename from applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict rename to applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict index 9c164f15092a651ef06fa0b1f871dbee69d2fa82..931511380fd587bdd568d071ae2dfa99535fec0e 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict +++ b/applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict @@ -17,6 +17,12 @@ FoamFile // Write agglomeration as a volScalarField with calculated boundary values writeFacesAgglomeration true; +//Debug option +debug 0; + +//Dump connectivity rays +dumpRays false; + // Per patch (wildcard possible) the coarsening level bottomAir_to_heater { diff --git a/applications/utilities/preProcessing/mapFieldsNew/Make/files b/applications/utilities/preProcessing/mapFieldsNew/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..d4d439083d4a643251a51731916b639e36bde601 --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/Make/files @@ -0,0 +1,4 @@ +mapLagrangian.C +mapFields.C + +EXE = $(FOAM_APPBIN)/mapFieldsNew diff --git a/applications/utilities/preProcessing/mapFieldsNew/Make/options b/applications/utilities/preProcessing/mapFieldsNew/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..b4ed87bf74c96bb804916b668df8d38ec702d335 --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/Make/options @@ -0,0 +1,13 @@ +EXE_INC = \ + -DFULLDEBUG -g -O0 \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +EXE_LIBS = \ + -lsampling \ + -lmeshTools \ + -llagrangian \ + -lfiniteVolume \ + -lgenericPatchFields diff --git a/applications/utilities/preProcessing/mapFieldsNew/MapLagrangianFields.H b/applications/utilities/preProcessing/mapFieldsNew/MapLagrangianFields.H new file mode 100644 index 0000000000000000000000000000000000000000..5f3c4230d5e78a132b25f6131c918a3c1725927c --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/MapLagrangianFields.H @@ -0,0 +1,184 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +InNamespace + Foam + +Description + Gets the indices of (source)particles that have been appended to the + target cloud and maps the lagrangian fields accordingly. + +\*---------------------------------------------------------------------------*/ + +#ifndef MapLagrangianFields_H +#define MapLagrangianFields_H + +#include "cloud.H" +#include "GeometricField.H" +#include "meshToMeshNew.H" +#include "IOobjectList.H" +#include "CompactIOField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +//- Gets the indices of (source)particles that have been appended to the +// target cloud and maps the lagrangian fields accordingly. +template<class Type> +void MapLagrangianFields +( + const string& cloudName, + const IOobjectList& objects, + const polyMesh& meshTarget, + const labelList& addParticles +) +{ + { + IOobjectList fields = objects.lookupClass(IOField<Type>::typeName); + + forAllIter(IOobjectList, fields, fieldIter) + { + const word& fieldName = fieldIter()->name(); + + Info<< " mapping lagrangian field " << fieldName << endl; + + // Read field (does not need mesh) + IOField<Type> fieldSource(*fieldIter()); + + // Map + IOField<Type> fieldTarget + ( + IOobject + ( + fieldName, + meshTarget.time().timeName(), + cloud::prefix/cloudName, + meshTarget, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + addParticles.size() + ); + + forAll(addParticles, i) + { + fieldTarget[i] = fieldSource[addParticles[i]]; + } + + // Write field + fieldTarget.write(); + } + } + + { + IOobjectList fieldFields = + objects.lookupClass(IOField<Field<Type> >::typeName); + + forAllIter(IOobjectList, fieldFields, fieldIter) + { + const word& fieldName = fieldIter()->name(); + + Info<< " mapping lagrangian fieldField " << fieldName << endl; + + // Read field (does not need mesh) + IOField<Field<Type> > fieldSource(*fieldIter()); + + // Map - use CompactIOField to automatically write in + // compact form for binary format. + CompactIOField<Field<Type>, Type> fieldTarget + ( + IOobject + ( + fieldName, + meshTarget.time().timeName(), + cloud::prefix/cloudName, + meshTarget, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + addParticles.size() + ); + + forAll(addParticles, i) + { + fieldTarget[i] = fieldSource[addParticles[i]]; + } + + // Write field + fieldTarget.write(); + } + } + + { + IOobjectList fieldFields = + objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName); + + forAllIter(IOobjectList, fieldFields, fieldIter) + { + Info<< " mapping lagrangian fieldField " + << fieldIter()->name() << endl; + + // Read field (does not need mesh) + CompactIOField<Field<Type>, Type> fieldSource(*fieldIter()); + + // Map + CompactIOField<Field<Type>, Type> fieldTarget + ( + IOobject + ( + fieldIter()->name(), + meshTarget.time().timeName(), + cloud::prefix/cloudName, + meshTarget, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + addParticles.size() + ); + + forAll(addParticles, i) + { + fieldTarget[i] = fieldSource[addParticles[i]]; + } + + // Write field + fieldTarget.write(); + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/MapMeshes.H b/applications/utilities/preProcessing/mapFieldsNew/MapMeshes.H new file mode 100644 index 0000000000000000000000000000000000000000..c03c1a76eab00e498d98cc6ce228c74a402ba05c --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/MapMeshes.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef MapMeshes_H +#define MapMeshes_H + +#include "MapVolFields.H" +#include "mapLagrangian.H" +#include "UnMapped.H" +#include "pointMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<template<class> class CombineOp> +void MapMesh +( + const meshToMeshNew& interp, + const HashSet<word>& selectedFields, + const bool noLagrangian +) +{ + { + const polyMesh& meshSource = interp.srcRegion(); + + // Search for list of objects for this time + IOobjectList objects(meshSource, meshSource.time().timeName()); + + // Map volFields + // ~~~~~~~~~~~~~ + MapVolFields<scalar> + ( + objects, + selectedFields, + interp, + CombineOp<scalar>() + ); + + MapVolFields<vector> + ( + objects, + selectedFields, + interp, + CombineOp<vector>() + ); + MapVolFields<sphericalTensor> + ( + objects, + selectedFields, + interp, + CombineOp<sphericalTensor>() + ); + MapVolFields<symmTensor> + ( + objects, + selectedFields, + interp, + CombineOp<symmTensor>() + ); + MapVolFields<tensor> + ( + objects, + selectedFields, + interp, + CombineOp<tensor>() + ); + } + + { + const polyMesh& meshTarget = interp.tgtRegion(); + + // Search for list of target objects for this time + IOobjectList objects(meshTarget, meshTarget.time().timeName()); + + // Mark surfaceFields as unmapped + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + UnMapped<surfaceScalarField>(objects); + UnMapped<surfaceVectorField>(objects); + UnMapped<surfaceSphericalTensorField>(objects); + UnMapped<surfaceSymmTensorField>(objects); + UnMapped<surfaceTensorField>(objects); + + // Mark pointFields as unmapped + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + UnMapped<pointScalarField>(objects); + UnMapped<pointVectorField>(objects); + UnMapped<pointSphericalTensorField>(objects); + UnMapped<pointSymmTensorField>(objects); + UnMapped<pointTensorField>(objects); + } + + if (!noLagrangian) + { + mapLagrangian(interp); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/MapVolFields.H b/applications/utilities/preProcessing/mapFieldsNew/MapVolFields.H new file mode 100644 index 0000000000000000000000000000000000000000..fc59c5733656d71fe6936699934a8b18ce6575ab --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/MapVolFields.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef MapConsistentVolFields_H +#define MapConsistentVolFields_H + +#include "GeometricField.H" +#include "meshToMeshNew.H" +#include "IOobjectList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<class Type, class CombineOp> +void MapVolFields +( + const IOobjectList& objects, + const HashSet<word>& selectedFields, + const meshToMeshNew& interp, + const CombineOp& cop +) +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + const fvMesh& meshSource = static_cast<const fvMesh&>(interp.srcRegion()); + const fvMesh& meshTarget = static_cast<const fvMesh&>(interp.tgtRegion()); + + IOobjectList fields = objects.lookupClass(fieldType::typeName); + + forAllIter(IOobjectList, fields, fieldIter) + { + const word& fieldName = fieldIter()->name(); + + if (selectedFields.empty() || selectedFields.found(fieldName)) + { + Info<< " interpolating " << fieldName << endl; + + const fieldType fieldSource(*fieldIter(), meshSource); + + IOobject targetIO + ( + fieldName, + meshTarget.time().timeName(), + meshTarget, + IOobject::MUST_READ + ); + + if (targetIO.headerOk()) + { + fieldType fieldTarget(targetIO, meshTarget); + + interp.mapSrcToTgt(fieldSource, cop, fieldTarget); + + fieldTarget.write(); + } + else + { + targetIO.readOpt() = IOobject::NO_READ; + + tmp<fieldType> + tfieldTarget(interp.mapSrcToTgt(fieldSource, cop)); + + fieldType fieldTarget(targetIO, tfieldTarget); + + fieldTarget.write(); + } + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/UnMapped.H b/applications/utilities/preProcessing/mapFieldsNew/UnMapped.H new file mode 100644 index 0000000000000000000000000000000000000000..aa67e3c666c5bc6494a0284361466220dafd9dfd --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/UnMapped.H @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef UnMapped_H +#define UnMapped_H + +#include "IOobjectList.H" +#include "OSspecific.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<class Type> +void UnMapped(const IOobjectList& objects) +{ + IOobjectList fields = objects.lookupClass(Type::typeName); + + forAllConstIter(IOobjectList, fields, fieldIter) + { + mvBak(fieldIter()->objectPath(), "unmapped"); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/createTimes.H b/applications/utilities/preProcessing/mapFieldsNew/createTimes.H new file mode 100644 index 0000000000000000000000000000000000000000..f5fd92b607544939d01f0b67f0109c5098c7c07b --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/createTimes.H @@ -0,0 +1,11 @@ + Info<< "\nCreate databases as time" << endl; + + HashTable<string> srcOptions(args.options()); + srcOptions.erase("case"); + srcOptions.insert("case", fileName(rootDirSource/caseDirSource)); + + argList argsSrc(args, srcOptions, false, false, false); + + Time runTimeSource(Time::controlDictName, argsSrc); + + Time runTimeTarget(Time::controlDictName, args); diff --git a/applications/utilities/preProcessing/mapFieldsNew/mapFields.C b/applications/utilities/preProcessing/mapFieldsNew/mapFields.C new file mode 100644 index 0000000000000000000000000000000000000000..2c8757fbf0821da1034b42d1ab0f1f8bb7180e23 --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/mapFields.C @@ -0,0 +1,343 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Application + mapFields + +Description + Maps volume fields from one mesh to another, reading and + interpolating all fields present in the time directory of both cases. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "meshToMeshNew.H" +#include "processorPolyPatch.H" +#include "MapMeshes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +void mapConsistentMesh +( + const fvMesh& meshSource, + const fvMesh& meshTarget, + const meshToMeshNew::interpolationMethod& mapMethod, + const bool subtract, + const HashSet<word>& selectedFields, + const bool noLagrangian +) +{ + Info<< nl << "Consistently creating and mapping fields for time " + << meshSource.time().timeName() << nl << endl; + + meshToMeshNew interp(meshSource, meshTarget, mapMethod); + + if (subtract) + { + MapMesh<minusEqOp> + ( + interp, + selectedFields, + noLagrangian + ); + } + else + { + MapMesh<plusEqOp> + ( + interp, + selectedFields, + noLagrangian + ); + } +} + + +void mapSubMesh +( + const fvMesh& meshSource, + const fvMesh& meshTarget, + const HashTable<word>& patchMap, + const wordList& cuttingPatches, + const meshToMeshNew::interpolationMethod& mapMethod, + const bool subtract, + const HashSet<word>& selectedFields, + const bool noLagrangian +) +{ + Info<< nl << "Creating and mapping fields for time " + << meshSource.time().timeName() << nl << endl; + + meshToMeshNew interp + ( + meshSource, + meshTarget, + mapMethod, + patchMap, + cuttingPatches + ); + + if (subtract) + { + MapMesh<minusEqOp> + ( + interp, + selectedFields, + noLagrangian + ); + } + else + { + MapMesh<plusEqOp> + ( + interp, + selectedFields, + noLagrangian + ); + } +} + + +wordList addProcessorPatches +( + const fvMesh& meshTarget, + const wordList& cuttingPatches +) +{ + // Add the processor patches to the cutting list + HashSet<word> cuttingPatchTable; + forAll(cuttingPatches, i) + { + cuttingPatchTable.insert(cuttingPatches[i]); + } + + const polyBoundaryMesh& pbm = meshTarget.boundaryMesh(); + + forAll(pbm, patchI) + { + if (isA<processorPolyPatch>(pbm[patchI])) + { + const word& patchName = pbm[patchI].name(); + cuttingPatchTable.insert(patchName); + } + } + + return cuttingPatchTable.toc(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::addNote + ( + "map volume fields from one mesh to another" + ); + + argList::validArgs.append("sourceCase"); + + argList::addOption + ( + "sourceTime", + "scalar|'latestTime'", + "specify the source time" + ); + argList::addOption + ( + "sourceRegion", + "word", + "specify the source region" + ); + argList::addOption + ( + "targetRegion", + "word", + "specify the target region" + ); + argList::addBoolOption + ( + "consistent", + "source and target geometry and boundary conditions identical" + ); + argList::addOption + ( + "mapMethod", + "word", + "specify the mapping method" + ); + argList::addBoolOption + ( + "subtract", + "subtract mapped source from target" + ); + argList::addOption + ( + "fields", + "list", + "specify a list of fields to be mapped. Eg, '(U T p)' - " + "regular expressions not currently supported" + ); + argList::addBoolOption + ( + "noLagrangian", + "skip mapping lagrangian positions and fields" + ); + + argList args(argc, argv); + + fileName rootDirTarget(args.rootPath()); + fileName caseDirTarget(args.globalCaseName()); + + const fileName casePath = args[1]; + const fileName rootDirSource = casePath.path(); + const fileName caseDirSource = casePath.name(); + + Info<< "Source: " << rootDirSource << " " << caseDirSource << endl; + word sourceRegion = fvMesh::defaultRegion; + if (args.optionFound("sourceRegion")) + { + sourceRegion = args["sourceRegion"]; + Info<< "Source region: " << sourceRegion << endl; + } + + Info<< "Target: " << rootDirTarget << " " << caseDirTarget << endl; + word targetRegion = fvMesh::defaultRegion; + if (args.optionFound("targetRegion")) + { + targetRegion = args["targetRegion"]; + Info<< "Target region: " << targetRegion << endl; + } + + const bool consistent = args.optionFound("consistent"); + + meshToMeshNew::interpolationMethod mapMethod = + meshToMeshNew::imCellVolumeWeight; + + if (args.optionFound("mapMethod")) + { + mapMethod = meshToMeshNew::interpolationMethodNames_[args["mapMethod"]]; + + Info<< "Mapping method: " + << meshToMeshNew::interpolationMethodNames_[mapMethod] << endl; + } + + const bool subtract = args.optionFound("subtract"); + if (subtract) + { + Info<< "Subtracting mapped source field from target" << endl; + } + + HashSet<word> selectedFields; + if (args.optionFound("fields")) + { + args.optionLookup("fields")() >> selectedFields; + } + + const bool noLagrangian = args.optionFound("noLagrangian"); + + #include "createTimes.H" + + HashTable<word> patchMap; + wordList cuttingPatches; + + if (!consistent) + { + IOdictionary mapFieldsDict + ( + IOobject + ( + "mapFieldsDict", + runTimeTarget.system(), + runTimeTarget, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ) + ); + + mapFieldsDict.lookup("patchMap") >> patchMap; + mapFieldsDict.lookup("cuttingPatches") >> cuttingPatches; + } + + #include "setTimeIndex.H" + + Info<< "\nCreate meshes\n" << endl; + + fvMesh meshSource + ( + IOobject + ( + sourceRegion, + runTimeSource.timeName(), + runTimeSource + ) + ); + + fvMesh meshTarget + ( + IOobject + ( + targetRegion, + runTimeTarget.timeName(), + runTimeTarget + ) + ); + + Info<< "Source mesh size: " << meshSource.nCells() << tab + << "Target mesh size: " << meshTarget.nCells() << nl << endl; + + if (consistent) + { + mapConsistentMesh + ( + meshSource, + meshTarget, + mapMethod, + subtract, + selectedFields, + noLagrangian + ); + } + else + { + mapSubMesh + ( + meshSource, + meshTarget, + patchMap, + addProcessorPatches(meshTarget, cuttingPatches), + mapMethod, + subtract, + selectedFields, + noLagrangian + ); + } + + Info<< "\nEnd\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/mapFieldsDict b/applications/utilities/preProcessing/mapFieldsNew/mapFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..00a190cc77e4ee16f157198cee7af4e5ce19e8f1 --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/mapFieldsDict @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object mapFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// List of pairs of source/target patches for mapping +patchMap +( + lid movingWall +); + +// List of target patches cutting the source domain (these need to be +// handled specially e.g. interpolated from internal values) +cuttingPatches +( + fixedWalls +); + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/mapLagrangian.C b/applications/utilities/preProcessing/mapFieldsNew/mapLagrangian.C new file mode 100644 index 0000000000000000000000000000000000000000..c868336e2f9652d39295de7607d59966fd457d8c --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/mapLagrangian.C @@ -0,0 +1,303 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "MapLagrangianFields.H" +#include "passiveParticleCloud.H" +#include "meshSearch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +static const scalar perturbFactor = 1e-6; + + +// Special version of findCell that generates a cell guaranteed to be +// compatible with tracking. +static label findCell(const Cloud<passiveParticle>& cloud, const point& pt) +{ + label cellI = -1; + label tetFaceI = -1; + label tetPtI = -1; + + const polyMesh& mesh = cloud.pMesh(); + + mesh.findCellFacePt(pt, cellI, tetFaceI, tetPtI); + + if (cellI >= 0) + { + return cellI; + } + else + { + // See if particle on face by finding nearest face and shifting + // particle. + + meshSearch meshSearcher + ( + mesh, + polyMesh::FACEPLANES // no decomposition needed + ); + + label faceI = meshSearcher.findNearestBoundaryFace(pt); + + if (faceI >= 0) + { + const point& cc = mesh.cellCentres()[mesh.faceOwner()[faceI]]; + + const point perturbPt = (1-perturbFactor)*pt+perturbFactor*cc; + + mesh.findCellFacePt(perturbPt, cellI, tetFaceI, tetPtI); + + return cellI; + } + } + + return -1; +} + + +void mapLagrangian(const meshToMeshNew& interp) +{ + // Determine which particles are in meshTarget + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + const polyMesh& meshSource = interp.srcRegion(); + const polyMesh& meshTarget = interp.tgtRegion(); + const labelListList& sourceToTarget = interp.srcToTgtCellAddr(); + + const pointField& targetCc = meshTarget.cellCentres(); + + fileNameList cloudDirs + ( + readDir + ( + meshSource.time().timePath()/cloud::prefix, + fileName::DIRECTORY + ) + ); + + forAll(cloudDirs, cloudI) + { + // Search for list of lagrangian objects for this time + IOobjectList objects + ( + meshSource, + meshSource.time().timeName(), + cloud::prefix/cloudDirs[cloudI] + ); + + IOobject* positionsPtr = objects.lookup(word("positions")); + + if (positionsPtr) + { + Info<< nl << " processing cloud " << cloudDirs[cloudI] << endl; + + // Read positions & cell + passiveParticleCloud sourceParcels + ( + meshSource, + cloudDirs[cloudI], + false + ); + Info<< " read " << sourceParcels.size() + << " parcels from source mesh." << endl; + + // Construct empty target cloud + passiveParticleCloud targetParcels + ( + meshTarget, + cloudDirs[cloudI], + IDLList<passiveParticle>() + ); + + particle::TrackingData<passiveParticleCloud> td(targetParcels); + + label sourceParticleI = 0; + + // Indices of source particles that get added to targetParcels + DynamicList<label> addParticles(sourceParcels.size()); + + // Unmapped particles + labelHashSet unmappedSource(sourceParcels.size()); + + + // Initial: track from fine-mesh cell centre to particle position + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // This requires there to be no boundary in the way. + + + forAllConstIter(Cloud<passiveParticle>, sourceParcels, iter) + { + bool foundCell = false; + + // Assume that cell from read parcel is the correct one... + if (iter().cell() >= 0) + { + const labelList& targetCells = + sourceToTarget[iter().cell()]; + + // Particle probably in one of the targetcells. Try + // all by tracking from their cell centre to the parcel + // position. + + forAll(targetCells, i) + { + // Track from its cellcentre to position to make sure. + autoPtr<passiveParticle> newPtr + ( + new passiveParticle + ( + meshTarget, + targetCc[targetCells[i]], + targetCells[i] + ) + ); + passiveParticle& newP = newPtr(); + + label faceI = newP.track(iter().position(), td); + + if (faceI < 0 && newP.cell() >= 0) + { + // Hit position. + foundCell = true; + addParticles.append(sourceParticleI); + targetParcels.addParticle(newPtr.ptr()); + break; + } + } + } + + if (!foundCell) + { + // Store for closer analysis + unmappedSource.insert(sourceParticleI); + } + + sourceParticleI++; + } + + Info<< " after meshToMesh addressing found " + << targetParcels.size() + << " parcels in target mesh." << endl; + + + // Do closer inspection for unmapped particles + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + if (unmappedSource.size()) + { + sourceParticleI = 0; + + forAllIter(Cloud<passiveParticle>, sourceParcels, iter) + { + if (unmappedSource.found(sourceParticleI)) + { + label targetCell = + findCell(targetParcels, iter().position()); + + if (targetCell >= 0) + { + unmappedSource.erase(sourceParticleI); + addParticles.append(sourceParticleI); + iter().cell() = targetCell; + targetParcels.addParticle + ( + sourceParcels.remove(&iter()) + ); + } + } + sourceParticleI++; + } + } + addParticles.shrink(); + + Info<< " after additional mesh searching found " + << targetParcels.size() << " parcels in target mesh." << endl; + + if (addParticles.size()) + { + IOPosition<passiveParticleCloud>(targetParcels).write(); + + // addParticles now contains the indices of the sourceMesh + // particles that were appended to the target mesh. + + // Map lagrangian fields + // ~~~~~~~~~~~~~~~~~~~~~ + + MapLagrangianFields<label> + ( + cloudDirs[cloudI], + objects, + meshTarget, + addParticles + ); + MapLagrangianFields<scalar> + ( + cloudDirs[cloudI], + objects, + meshTarget, + addParticles + ); + MapLagrangianFields<vector> + ( + cloudDirs[cloudI], + objects, + meshTarget, + addParticles + ); + MapLagrangianFields<sphericalTensor> + ( + cloudDirs[cloudI], + objects, + meshTarget, + addParticles + ); + MapLagrangianFields<symmTensor> + ( + cloudDirs[cloudI], + objects, + meshTarget, + addParticles + ); + MapLagrangianFields<tensor> + ( + cloudDirs[cloudI], + objects, + meshTarget, + addParticles + ); + } + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/mapLagrangian.H b/applications/utilities/preProcessing/mapFieldsNew/mapLagrangian.H new file mode 100644 index 0000000000000000000000000000000000000000..47904fbabdfa43704ccb3809482655017888d931 --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/mapLagrangian.H @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +InNamespace + Foam + +Description + Maps lagrangian positions and fields + +SourceFiles + mapLagrangian.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mapLagrangian_H +#define mapLagrangian_H + +#include "meshToMeshNew.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +//- Maps lagrangian positions and fields +void mapLagrangian(const meshToMeshNew& interp); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFieldsNew/setTimeIndex.H b/applications/utilities/preProcessing/mapFieldsNew/setTimeIndex.H new file mode 100644 index 0000000000000000000000000000000000000000..a468d50648ebd176c14fbf3716319c6b0ee5e2fb --- /dev/null +++ b/applications/utilities/preProcessing/mapFieldsNew/setTimeIndex.H @@ -0,0 +1,33 @@ +{ + instantList sourceTimes = runTimeSource.times(); + label sourceTimeIndex = runTimeSource.timeIndex(); + if (args.optionFound("sourceTime")) + { + if (args["sourceTime"] == "latestTime") + { + sourceTimeIndex = sourceTimes.size() - 1; + } + else + { + sourceTimeIndex = Time::findClosestTimeIndex + ( + sourceTimes, + args.optionRead<scalar>("sourceTime") + ); + } + } + else + { + sourceTimeIndex = Time::findClosestTimeIndex + ( + sourceTimes, + runTimeTarget.time().value() + ); + } + + runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex); + + Info<< "\nSource time: " << runTimeSource.value() + << "\nTarget time: " << runTimeTarget.value() + << endl; +} diff --git a/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H b/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H index a48fd193f124c43532892acfb27ede445b7a7ac4..ed1d9031ec055d74e0c34168d0a5262474b38539 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H +++ b/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H @@ -32,6 +32,19 @@ forAll(patches, patchI) } } +labelList triSurfaceToAgglom(5*nFineFaces); + +const triSurface localSurface = triangulate +( + patches, + includePatches, + finalAgglom, + triSurfaceToAgglom, + globalNumbering, + coarsePatches +); + + distributedTriSurfaceMesh surfacesMesh ( IOobject @@ -43,12 +56,13 @@ distributedTriSurfaceMesh surfacesMesh IOobject::NO_READ, IOobject::NO_WRITE ), - triSurfaceTools::triangulate - ( - patches, - includePatches - ), + localSurface, dict ); + +triSurfaceToAgglom.resize(surfacesMesh.size()); + //surfacesMesh.searchableSurface::write(); + +surfacesMesh.setField(triSurfaceToAgglom); diff --git a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H index 095436b1a115f3a745ebc540e9d033ff1e172e1f..9cc1ccbcd32d8facff75264f06c8ac4ae714bf3d 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H +++ b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H @@ -2,7 +2,7 @@ // Pre-size by assuming a certain percentage is visible. // Maximum lenght for dynamicList -const label maxDynListLength = 10000; +const label maxDynListLength = 100000; for (label procI = 0; procI < Pstream::nProcs(); procI++) { @@ -14,12 +14,17 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) DynamicList<label> startIndex(start.size()); DynamicList<label> endIndex(start.size()); + DynamicList<label> startAgg(start.size()); + DynamicList<label> endAgg(start.size()); + const pointField& myFc = remoteCoarseCf[Pstream::myProcNo()]; const vectorField& myArea = remoteCoarseSf[Pstream::myProcNo()]; + const labelField& myAgg = remoteCoarseAgg[Pstream::myProcNo()]; const pointField& remoteArea = remoteCoarseSf[procI]; const pointField& remoteFc = remoteCoarseCf[procI]; + const labelField& remoteAgg = remoteCoarseAgg[procI]; label i = 0; label j = 0; @@ -29,6 +34,7 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) { const point& fc = myFc[i]; const vector& fA = myArea[i]; + const label& fAgg = myAgg[i]; for (; j < remoteFc.size(); j++)// { @@ -36,26 +42,32 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) { const point& remFc = remoteFc[j]; const vector& remA = remoteArea[j]; + const label& remAgg = remoteAgg[j]; + const vector& d = remFc - fc; if (((d & fA) < 0.) && ((d & remA) > 0)) { - start.append(fc + 0.0001*d); + start.append(fc + 0.001*d); startIndex.append(i); - end.append(fc + 0.9999*d); + startAgg.append(globalNumbering.toGlobal(procI, fAgg)); + end.append(fc + 0.999*d); label globalI = globalNumbering.toGlobal(procI, j); endIndex.append(globalI); + endAgg.append(globalNumbering.toGlobal(procI, remAgg)); if (startIndex.size() > maxDynListLength) { - break; + FatalErrorIn + ( + "shootRays" + ) << "Dynamic list need from capacity." + << "Actual size maxDynListLength : " + << maxDynListLength + << abort(FatalError); } } } } - if (startIndex.size() > maxDynListLength) - { - break; - } if (j == remoteFc.size()) { @@ -63,23 +75,102 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) } } - List<pointIndexHit> hitInfo(startIndex.size()); - surfacesMesh.findLine(start, end, hitInfo); + }while (returnReduce(i < myFc.size(), orOp<bool>())); + + List<pointIndexHit> hitInfo(startIndex.size()); + surfacesMesh.findLine(start, end, hitInfo); + + // Return hit global agglo index + labelList aggHitIndex; + surfacesMesh.getField(hitInfo, aggHitIndex); + + DynamicList<label> dRayIs; - forAll (hitInfo, rayI) + // Collect the rays which has not abstacle in bettween in rayStartFace + // and rayEndFace. If the ray hit itself get stored in dRayIs + forAll (hitInfo, rayI) + { + if (!hitInfo[rayI].hit()) + { + rayStartFace.append(startIndex[rayI]); + rayEndFace.append(endIndex[rayI]); + } + else if (aggHitIndex[rayI] == startAgg[rayI]) + { + dRayIs.append(rayI); + } + } + + start.clear(); + + + // Continue rays which hit themself. If they hit the target + // agglomeration are added to rayStartFace and rayEndFace + + bool firstLoop = true; + DynamicField<point> startHitItself; + DynamicField<point> endHitItself; + label iter = 0; + + do + { + labelField rayIs; + rayIs.transfer(dRayIs); + dRayIs.clear(); + forAll (rayIs, rayI) { - if (!hitInfo[rayI].hit()) + const label rayID = rayIs[rayI]; + label hitIndex = -1; + + if (firstLoop) { - rayStartFace.append(startIndex[rayI]); - rayEndFace.append(endIndex[rayI]); + hitIndex = rayIs[rayI]; + } + else + { + hitIndex = rayI; + } + + if (hitInfo[hitIndex].hit()) + { + if (aggHitIndex[hitIndex] == startAgg[rayID]) + { + const vector& endP = end[rayID]; + const vector& startP = hitInfo[hitIndex].hitPoint(); + const vector& d = endP - startP; + + startHitItself.append(startP + 0.01*d); + endHitItself.append(startP + 1.01*d); + + dRayIs.append(rayID); + } + else if (aggHitIndex[hitIndex] == endAgg[rayID]) + { + rayStartFace.append(startIndex[rayID]); + rayEndFace.append(endIndex[rayID]); + } + } } - start.clear(); - startIndex.clear(); - end.clear(); - endIndex.clear(); + hitInfo.clear(); + hitInfo.resize(dRayIs.size()); - }while (returnReduce(i < myFc.size(), orOp<bool>())); + surfacesMesh.findLine(startHitItself, endHitItself, hitInfo); + + surfacesMesh.getField(hitInfo, aggHitIndex); + + + endHitItself.clear(); + startHitItself.clear(); + firstLoop = false; + iter ++; + + }while (returnReduce(hitInfo.size(), orOp<bool>()) > 0 && iter < 10); + startIndex.clear(); + end.clear(); + endIndex.clear(); + startAgg.clear(); + endAgg.clear(); } diff --git a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C index 140ac3da8aaa19a9d293c18e0600e01b143a9497..c9aa219d13227b7b5d4eb56c7ac1e53964017ded 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C +++ b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C @@ -68,6 +68,101 @@ Description using namespace Foam; + +triSurface triangulate +( + const polyBoundaryMesh& bMesh, + const labelHashSet& includePatches, + const labelListIOList& finalAgglom, + labelList& triSurfaceToAgglom, + const globalIndex& globalNumbering, + const polyBoundaryMesh& coarsePatches +) +{ + const polyMesh& mesh = bMesh.mesh(); + + // Storage for surfaceMesh. Size estimate. + DynamicList<labelledTri> triangles + ( + mesh.nFaces() - mesh.nInternalFaces() + ); + + label newPatchI = 0; + label localTriFaceI = 0; + + forAllConstIter(labelHashSet, includePatches, iter) + { + const label patchI = iter.key(); + const polyPatch& patch = bMesh[patchI]; + const pointField& points = patch.points(); + + label nTriTotal = 0; + + forAll(patch, patchFaceI) + { + const face& f = patch[patchFaceI]; + + faceList triFaces(f.nTriangles(points)); + + label nTri = 0; + + f.triangles(points, nTri, triFaces); + + forAll(triFaces, triFaceI) + { + const face& f = triFaces[triFaceI]; + + triangles.append(labelledTri(f[0], f[1], f[2], newPatchI)); + + nTriTotal++; + + triSurfaceToAgglom[localTriFaceI++] = globalNumbering.toGlobal + ( + Pstream::myProcNo(), + finalAgglom[patchI][patchFaceI] + + coarsePatches[patchI].start() + ); + } + } + + newPatchI++; + } + + triSurfaceToAgglom.resize(localTriFaceI-1); + + triangles.shrink(); + + // Create globally numbered tri surface + triSurface rawSurface(triangles, mesh.points()); + + // Create locally numbered tri surface + triSurface surface + ( + rawSurface.localFaces(), + rawSurface.localPoints() + ); + + // Add patch names to surface + surface.patches().setSize(newPatchI); + + newPatchI = 0; + + forAllConstIter(labelHashSet, includePatches, iter) + { + const label patchI = iter.key(); + const polyPatch& patch = bMesh[patchI]; + + surface.patches()[newPatchI].index() = patchI; + surface.patches()[newPatchI].name() = patch.name(); + surface.patches()[newPatchI].geometricType() = patch.type(); + + newPatchI++; + } + + return surface; +} + + void writeRays ( const fileName& fName, @@ -213,7 +308,7 @@ int main(int argc, char *argv[]) if (debug) { - Info << "\nCreating single cell mesh..." << endl; + Pout << "\nCreating single cell mesh..." << endl; } singleCellFvMesh coarseMesh @@ -230,6 +325,11 @@ int main(int argc, char *argv[]) finalAgglom ); + if (debug) + { + Pout << "\nCreated single cell mesh..." << endl; + } + // Calculate total number of fine and coarse faces // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -283,6 +383,8 @@ int main(int argc, char *argv[]) DynamicList<point> localCoarseCf(nCoarseFaces); DynamicList<point> localCoarseSf(nCoarseFaces); + DynamicList<label> localAgg(nCoarseFaces); + forAll (viewFactorsPatches, i) { const label patchID = viewFactorsPatches[i]; @@ -296,11 +398,18 @@ int main(int argc, char *argv[]) const pointField& coarseCf = coarseMesh.Cf().boundaryField()[patchID]; const pointField& coarseSf = coarseMesh.Sf().boundaryField()[patchID]; + labelHashSet includePatches; + includePatches.insert(patchID); + forAll(coarseCf, faceI) { point cf = coarseCf[faceI]; + const label coarseFaceI = coarsePatchFace[faceI]; const labelList& fineFaces = coarseToFine[coarseFaceI]; + const label agglomI = + agglom[fineFaces[0]] + coarsePatches[patchID].start(); + // Construct single face uindirectPrimitivePatch upp ( @@ -308,6 +417,7 @@ int main(int argc, char *argv[]) pp.points() ); + List<point> availablePoints ( upp.faceCentres().size() @@ -342,6 +452,7 @@ int main(int argc, char *argv[]) point sf = coarseSf[faceI]; localCoarseCf.append(cf); localCoarseSf.append(sf); + localAgg.append(agglomI); } } @@ -350,9 +461,12 @@ int main(int argc, char *argv[]) List<pointField> remoteCoarseCf(Pstream::nProcs()); List<pointField> remoteCoarseSf(Pstream::nProcs()); + List<labelField> remoteCoarseAgg(Pstream::nProcs()); remoteCoarseCf[Pstream::myProcNo()] = localCoarseCf; remoteCoarseSf[Pstream::myProcNo()] = localCoarseSf; + remoteCoarseAgg[Pstream::myProcNo()] = localAgg; + // Collect remote Cf and Sf on fine mesh // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -370,8 +484,12 @@ int main(int argc, char *argv[]) Pstream::scatterList(remoteCoarseCf); Pstream::gatherList(remoteCoarseSf); Pstream::scatterList(remoteCoarseSf); + Pstream::gatherList(remoteCoarseAgg); + Pstream::scatterList(remoteCoarseAgg); + globalIndex globalNumbering(nCoarseFaces); + // Set up searching engine for obstacles // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include "searchingEngine.H" @@ -383,8 +501,6 @@ int main(int argc, char *argv[]) DynamicList<label> rayEndFace(rayStartFace.size()); - globalIndex globalNumbering(nCoarseFaces); - // Return rayStartFace in local index andrayEndFace in global index // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index fb36589061da30f47554bd93d38876b8076d5199..a01705595849555fb88428ec101d8e796c1f4ba5 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -435,7 +435,7 @@ int main(int argc, char *argv[]) scalar smallDim = 1e-6 * bb.mag(); Info<< "Checking for points less than 1e-6 of bounding box (" - << bb.span() << " meter) apart." + << bb.span() << " metre) apart." << endl; // Sort points diff --git a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C index b63686881ae08d6baab542a9d1d77df7591299bf..585072d7c02e8ece5a1debfe5121fe96bcd3a67d 100644 --- a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C +++ b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) const fileName outFileName = args[3]; Info<< "Reading surface from " << surfFileName << " ..." << endl; - Info<< "Merging points within " << mergeTol << " meter." << endl; + Info<< "Merging points within " << mergeTol << " metre." << endl; triSurface surf1(surfFileName); diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 2264c4ee03850cf37610384befd7b4238ba99bd2..a276a9716725b88a466290744756dd6390d9d675 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -224,6 +224,13 @@ case ThirdParty: set mpfr_version=mpfr-3.1.0 set mpc_version=mpc-0.9 breaksw + case Gcc48: + case Gcc48++0x: + set gcc_version=gcc-4.8.0 + set gmp_version=gmp-5.0.4 + set mpfr_version=mpfr-3.1.0 + set mpc_version=mpc-0.9 + breaksw case Gcc47: case Gcc47++0x: set gcc_version=gcc-4.7.2 @@ -242,8 +249,7 @@ case ThirdParty: # using clang - not gcc setenv WM_CC 'clang' setenv WM_CXX 'clang++' - set clang_version=llvm-3.1 - #set clang_version=llvm-svn + set clang_version=llvm-3.2 breaksw default: echo diff --git a/etc/config/settings.sh b/etc/config/settings.sh index 5a77479b568f7e653a9fb4b0e81293f1357d6748..0a46c308a9cbab995f1d5ca63130e4dc3391d703 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -246,6 +246,12 @@ OpenFOAM | ThirdParty) mpfr_version=mpfr-3.1.0 mpc_version=mpc-0.9 ;; + Gcc48 | Gcc48++0x) + gcc_version=gcc-4.8.0 + gmp_version=gmp-5.0.4 + mpfr_version=mpfr-3.1.0 + mpc_version=mpc-0.9 + ;; Gcc47 | Gcc47++0x) gcc_version=gcc-4.7.2 gmp_version=gmp-5.0.4 @@ -262,8 +268,7 @@ OpenFOAM | ThirdParty) # using clang - not gcc export WM_CC='clang' export WM_CXX='clang++' - clang_version=llvm-3.1 - #clang_version=llvm-svn + clang_version=llvm-3.2 ;; *) echo 1>&2 diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C index bd5c4cc598f7aa60223351ae2c7ea64050fa6b2a..d18a0e29342d0b46926698453f11ef0db1dcb218 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C @@ -105,6 +105,7 @@ void Foam::IOdictionary::readFile(const bool masterOnly) myComm.above(), 0, Pstream::msgType(), + Pstream::worldComm, IOstream::ASCII ); IOdictionary::readData(fromAbove); @@ -124,6 +125,7 @@ void Foam::IOdictionary::readFile(const bool masterOnly) myComm.below()[belowI], 0, Pstream::msgType(), + Pstream::worldComm, IOstream::ASCII ); IOdictionary::writeData(toBelow); diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C index 91827479a44471338cd9ccdf439b621f5fec91af..bc950e518f2f61f552c2c2d98e53cf4b85db3faf 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C +++ b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C @@ -243,6 +243,7 @@ bool Foam::regIOobject::read() myComm.above(), 0, Pstream::msgType(), + Pstream::worldComm, IOstream::ASCII ); ok = readData(fromAbove); @@ -257,6 +258,7 @@ bool Foam::regIOobject::read() myComm.below()[belowI], 0, Pstream::msgType(), + Pstream::worldComm, IOstream::ASCII ); writeData(toBelow); diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 8545c2aa9e3d85082938034eb8c6bbab82fc960e..334eba8e418962b2c39e6d4b114b09ce21736e7a 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.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 @@ -677,7 +677,6 @@ template<class Type> template<class Form, class Cmpt, int nCmpt> void Foam::Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs) { - typedef VectorSpace<Form,Cmpt,nCmpt> VSType; TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs) } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C index 6bea99a1bc998c4598358bb620f4b3c87b9e66c9..74707a9a93e8dfade08fbfcf13982c1e7b1b0165 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C @@ -122,7 +122,8 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated procPatch_.neighbProcNo(), reinterpret_cast<char*>(receiveBuf_.begin()), receiveBuf_.byteSize(), - procPatch_.tag() + procPatch_.tag(), + procPatch_.comm() ); } OPstream::write @@ -131,7 +132,8 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated procPatch_.neighbProcNo(), reinterpret_cast<const char*>(pf.begin()), pf.byteSize(), - procPatch_.tag() + procPatch_.tag(), + procPatch_.comm() ); } } @@ -156,7 +158,8 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated procPatch_.neighbProcNo(), reinterpret_cast<char*>(receiveBuf_.begin()), receiveBuf_.byteSize(), - procPatch_.tag() + procPatch_.tag(), + procPatch_.comm() ); } diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 4db10a9941050ada7b88564e57c24f62a3ccc814..b75a8864ada42c32cd5fe2bbf3185460377848ca 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -373,7 +373,8 @@ Foam::argList::argList int& argc, char**& argv, bool checkArgs, - bool checkOpts + bool checkOpts, + const bool initialise ) : args_(argc), @@ -405,12 +406,12 @@ Foam::argList::argList // Check arguments and options, we already have argv[0] int nArgs = 1; - string argListString = args_[0]; + argListStr_ = args_[0]; for (int argI = 1; argI < args_.size(); ++argI) { - argListString += ' '; - argListString += args_[argI]; + argListStr_ += ' '; + argListStr_ += args_[argI]; if (args_[argI][0] == '-') { @@ -438,8 +439,8 @@ Foam::argList::argList FatalError.exit(); } - argListString += ' '; - argListString += args_[argI]; + argListStr_ += ' '; + argListStr_ += args_[argI]; options_.insert(optionName, args_[argI]); } else @@ -459,6 +460,39 @@ Foam::argList::argList args_.setSize(nArgs); + parse(checkArgs, checkOpts, initialise); +} + + +Foam::argList::argList +( + const argList& args, + const HashTable<string>& options, + bool checkArgs, + bool checkOpts, + bool initialise +) +: + args_(args.args_), + options_(options), + executable_(args.executable_), + rootPath_(args.rootPath_), + globalCase_(args.globalCase_), + case_(args.case_), + argListStr_(args.argListStr_), + parRunControl_(args.parRunControl_) +{ + parse(checkArgs, checkOpts, initialise); +} + + +void Foam::argList::parse +( + bool checkArgs, + bool checkOpts, + bool initialise +) +{ // Help/documentation options: // -help print the usage // -doc display application documentation in browser @@ -495,42 +529,44 @@ Foam::argList::argList } - string dateString = clock::date(); - string timeString = clock::clockTime(); - - // Print the banner once only for parallel runs - if (Pstream::master() && bannerEnabled) + if (initialise) { - IOobject::writeBanner(Info, true) - << "Build : " << Foam::FOAMbuild << nl - << "Exec : " << argListString.c_str() << nl - << "Date : " << dateString.c_str() << nl - << "Time : " << timeString.c_str() << nl - << "Host : " << hostName() << nl - << "PID : " << pid() << endl; - } + string dateString = clock::date(); + string timeString = clock::clockTime(); - jobInfo.add("startDate", dateString); - jobInfo.add("startTime", timeString); - jobInfo.add("userName", userName()); - jobInfo.add("foamVersion", word(FOAMversion)); - jobInfo.add("code", executable_); - jobInfo.add("argList", argListString); - jobInfo.add("currentDir", cwd()); - jobInfo.add("PPID", ppid()); - jobInfo.add("PGID", pgid()); - - // add build information - only use the first word - { - std::string build(Foam::FOAMbuild); - std::string::size_type found = build.find(' '); - if (found != std::string::npos) + // Print the banner once only for parallel runs + if (Pstream::master() && bannerEnabled) { - build.resize(found); + IOobject::writeBanner(Info, true) + << "Build : " << Foam::FOAMbuild << nl + << "Exec : " << argListStr_.c_str() << nl + << "Date : " << dateString.c_str() << nl + << "Time : " << timeString.c_str() << nl + << "Host : " << hostName() << nl + << "PID : " << pid() << endl; } - jobInfo.add("foamBuild", build); - } + jobInfo.add("startDate", dateString); + jobInfo.add("startTime", timeString); + jobInfo.add("userName", userName()); + jobInfo.add("foamVersion", word(FOAMversion)); + jobInfo.add("code", executable_); + jobInfo.add("argList", argListStr_); + jobInfo.add("currentDir", cwd()); + jobInfo.add("PPID", ppid()); + jobInfo.add("PGID", pgid()); + + // add build information - only use the first word + { + std::string build(Foam::FOAMbuild); + std::string::size_type found = build.find(' '); + if (found != std::string::npos) + { + build.resize(found); + } + jobInfo.add("foamBuild", build); + } + } // Case is a single processor run unless it is running parallel int nProcs = 1; @@ -781,52 +817,56 @@ Foam::argList::argList } } - jobInfo.add("root", rootPath_); - jobInfo.add("case", globalCase_); - jobInfo.add("nProcs", nProcs); - if (slaveProcs.size()) - { - jobInfo.add("slaves", slaveProcs); - } - if (roots.size()) + if (initialise) { - jobInfo.add("roots", roots); - } - jobInfo.write(); - - // Switch on signal trapping. We have to wait until after Pstream::init - // since this sets up its own ones. - sigFpe_.set(bannerEnabled); - sigInt_.set(bannerEnabled); - sigQuit_.set(bannerEnabled); - sigSegv_.set(bannerEnabled); + jobInfo.add("root", rootPath_); + jobInfo.add("case", globalCase_); + jobInfo.add("nProcs", nProcs); + if (slaveProcs.size()) + { + jobInfo.add("slaves", slaveProcs); + } + if (roots.size()) + { + jobInfo.add("roots", roots); + } + jobInfo.write(); - if (bannerEnabled) - { - Info<< "fileModificationChecking : " - << "Monitoring run-time modified files using " - << regIOobject::fileCheckTypesNames - [ - regIOobject::fileModificationChecking - ] - << endl; + // Switch on signal trapping. We have to wait until after Pstream::init + // since this sets up its own ones. + sigFpe_.set(bannerEnabled); + sigInt_.set(bannerEnabled); + sigQuit_.set(bannerEnabled); + sigSegv_.set(bannerEnabled); - Info<< "allowSystemOperations : "; - if (dynamicCode::allowSystemOperations) + if (bannerEnabled) { - Info<< "Allowing user-supplied system call operations" << endl; + Info<< "fileModificationChecking : " + << "Monitoring run-time modified files using " + << regIOobject::fileCheckTypesNames + [ + regIOobject::fileModificationChecking + ] + << endl; + + Info<< "allowSystemOperations : "; + if (dynamicCode::allowSystemOperations) + { + Info<< "Allowing user-supplied system call operations" << endl; + } + else + { + Info<< "Disallowing user-supplied system call operations" + << endl; + } } - else + + if (Pstream::master() && bannerEnabled) { - Info<< "Disallowing user-supplied system call operations" << endl; + Info<< endl; + IOobject::writeDivider(Info); } } - - if (Pstream::master() && bannerEnabled) - { - Info<< endl; - IOobject::writeDivider(Info); - } } diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index 4cc354d2cbe0ffd66d0beba7a4d5ac930cef072e..c7e07026bdc860a0a20b1e8cdf1eceb956dee860 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.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 @@ -41,7 +41,7 @@ Description \par Default command-line options \param -case \<dir\> \n - select an case directory instead of the current working directory + select a case directory instead of the current working directory \param -parallel \n specify case as a parallel job \param -doc \n @@ -69,6 +69,7 @@ Note SourceFiles argList.C + argListI.H \*---------------------------------------------------------------------------*/ @@ -111,6 +112,7 @@ class argList fileName rootPath_; fileName globalCase_; fileName case_; + string argListStr_; ParRunControl parRunControl_; @@ -186,17 +188,37 @@ public: ( int& argc, char**& argv, - bool checkArgs=true, - bool checkOpts=true + bool checkArgs = true, + bool checkOpts = true, + bool initialise = true ); + //- Construct copy with new options + argList + ( + const argList& args, + const HashTable<string>& options, + bool checkArgs = true, + bool checkOpts = true, + bool initialise = true + ); - //- Destructor - virtual ~argList(); + + //- Destructor + virtual ~argList(); // Member functions + //- Parse + void parse + ( + bool checkArgs, + bool checkOpts, + bool initialise + ); + + // Access //- Name of executable without the path @@ -211,12 +233,18 @@ public: //- Return case name inline const fileName& globalCaseName() const; + //- Return parRunControl + inline const ParRunControl& parRunControl() const; + //- Return the path to the caseName inline fileName path() const; //- Return arguments inline const stringList& args() const; + //- Return non-const access to arguments + inline stringList& args(); + //- Return the argument corresponding to index. inline const string& arg(const label index) const; @@ -240,6 +268,9 @@ public: //- Return options inline const Foam::HashTable<string>& options() const; + //- Return non-const access to options + inline Foam::HashTable<string>& options(); + //- Return the argument string associated with the named option inline const string& option(const word& opt) const; @@ -295,6 +326,7 @@ public: // \sa option() inline const string& operator[](const word& opt) const; + // Edit //- Add to a bool option to validOptions with usage information diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H index e35663540be56c5bbddf4ae97cafe5c116a302cd..47ad29a58eb208a5c21b44b6e2ade8336b5e2fd4 100644 --- a/src/OpenFOAM/global/argList/argListI.H +++ b/src/OpenFOAM/global/argList/argListI.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,6 +51,12 @@ inline const Foam::fileName& Foam::argList::globalCaseName() const } +inline const Foam::ParRunControl& Foam::argList::parRunControl() const +{ + return parRunControl_; +} + + inline Foam::fileName Foam::argList::path() const { return rootPath()/caseName(); @@ -63,6 +69,12 @@ inline const Foam::stringList& Foam::argList::args() const } +inline Foam::stringList& Foam::argList::args() +{ + return args_; +} + + inline const Foam::string& Foam::argList::arg(const label index) const { return args_[index]; @@ -81,6 +93,12 @@ inline const Foam::HashTable<Foam::string>& Foam::argList::options() const } +inline Foam::HashTable<Foam::string>& Foam::argList::options() +{ + return options_; +} + + inline const Foam::string& Foam::argList::option(const word& opt) const { return options_[opt]; diff --git a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C index 426182f1760e81b808fde6a232004f3181636634..68069c88cfd89cc306ecd90d551ecaefcbaaaa15 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C @@ -122,7 +122,7 @@ void Foam::lduPrimitiveMesh::checkUpperTriangular } -Foam::label Foam::lduPrimitiveMesh::size +Foam::label Foam::lduPrimitiveMesh::totalSize ( const PtrList<lduPrimitiveMesh>& meshes ) @@ -294,7 +294,7 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh labelListListList& boundaryFaceMap ) : - lduAddressing(myMesh.lduAddr().size() + size(otherMeshes)), + lduAddressing(myMesh.lduAddr().size() + totalSize(otherMeshes)), lowerAddr_(0), upperAddr_(0), interfaces_(0), diff --git a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H index 36b7e93d3cf1609d54949bb57d7d563a2606982c..66c26dc37ed5707167beb305f7a86f13360fc204 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H +++ b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H @@ -76,7 +76,7 @@ class lduPrimitiveMesh // Private Member Functions //- Get size of all meshes - static label size(const PtrList<lduPrimitiveMesh>&); + static label totalSize(const PtrList<lduPrimitiveMesh>&); static labelList upperTriOrder ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index 992a5b0c24e7ab6848b62178f4991aceb40d0e59..da777d683c53287bc9ee0942c9c989919d8bd7ad 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -134,6 +134,12 @@ public: return procPolyPatch_.tag(); } + //- Return communicator used for communication + virtual label comm() const + { + return procPolyPatch_.comm(); + } + //- Return the constraint type this pointPatch implements. virtual const word& constraintType() const { diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index 3bd72a7cf260ddfd4d16ff20ce4aa7eda5dc7bc2..c5a6226dc89f895cc1811ca42b87057db27f68a1 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -246,14 +246,6 @@ public: } } - - //- Return communicator used for communication - label comm() const - { - //return comm_; - return boundaryMesh().mesh().comm(); - } - //- Return processor number int myProcNo() const { @@ -266,30 +258,6 @@ public: return neighbProcNo_; } - - // For testing - -// //- Return communicator used for communication -// label& comm() -// { -// return comm_; -// } - - //- Return processor number - int& myProcNo() - { - return myProcNo_; - } - - //- Return neigbour processor number - int& neighbProcNo() - { - return neighbProcNo_; - } - - - - //- Does the processor own the patch ? virtual bool owner() const { @@ -332,6 +300,12 @@ public: return Pstream::msgType(); } + //- Return communicator used for communication + virtual label comm() const + { + return boundaryMesh().mesh().comm(); + } + //- Transform a patch-based position from other side to this side virtual void transformPosition(pointField& l) const {} diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C index 986922f61d8c83c2ff8d15bc9cba785c427ca4bf..00aabb3bd61b8e2ec2a6a59868de6bbd44a4e434 100644 --- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C +++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C @@ -1542,7 +1542,7 @@ void Foam::faceCoupleInfo::perfectPointMatch ) << "Did not match all of the master faces to the slave faces" << endl << "This usually means that the slave patch and master patch" - << " do not align to within " << absTol << " meter." + << " do not align to within " << absTol << " metre." << abort(FatalError); } diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C index a1cfc83aebe47fd7c87ece182fc09465df179594..3241a79c2de88e7ec9299f491fa1ae6435f5c597 100644 --- a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C +++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C @@ -485,7 +485,7 @@ Foam::polyMeshFilter::polyMeshFilter(const fvMesh& mesh) faceFilterFactor_() { Info<< "Merging:" << nl - << " edges with length less than " << minLen_ << " meters" << nl + << " edges with length less than " << minLen_ << " metres" << nl << " edges split by a point with edges in line to within " << radToDeg(::acos(maxCos_)) << " degrees" << nl << " Minimum edge length reduction factor = " diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index ddf9564230faca1a7903b9f1929ae5d1dc3075b2..35a308ff000e995d632460df6f2b26885522fcba 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -181,6 +181,7 @@ $(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVe $(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C +$(derivedFvPatchFields)/uniformFixedGradient/uniformFixedGradientFvPatchFields.C $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C $(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C @@ -321,8 +322,6 @@ $(ddtSchemes)/CoEulerDdtScheme/CoEulerDdtSchemes.C $(ddtSchemes)/SLTSDdtScheme/SLTSDdtSchemes.C $(ddtSchemes)/localEulerDdtScheme/localEulerDdtSchemes.C $(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C -$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C -$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C $(ddtSchemes)/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C $(ddtSchemes)/boundedDdtScheme/boundedDdtSchemes.C @@ -404,5 +403,4 @@ $(SRF)/SRFModel/rpm/rpm.C $(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C $(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C - LIB = $(FOAM_LIBBIN)/libfiniteVolume diff --git a/src/finiteVolume/cfdTools/general/include/alphaControls.H b/src/finiteVolume/cfdTools/general/include/alphaControls.H new file mode 100644 index 0000000000000000000000000000000000000000..c172904f4f0fc6e88bb5dc788ed98c4f9a46210e --- /dev/null +++ b/src/finiteVolume/cfdTools/general/include/alphaControls.H @@ -0,0 +1,12 @@ +const dictionary& alphaControls = mesh.solverDict(alpha1.name()); +label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); +label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); +Switch MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false)); + +if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) +{ + FatalErrorIn(args.executable()) + << "Sub-cycling alpha is only allowed for PISO operation, " + "i.e. when the number of outer-correctors = 1" + << exit(FatalError); +} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C index 2cea02cd9cd1d3fba125fff69cbf3227c9e6e69b..3550e414cf4b3203274f194e7325ed8f24e845c3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.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 @@ -95,8 +95,6 @@ mappedFixedPushedInternalValueFvPatchField template<class Type> void Foam::mappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs() { - typedef GeometricField<Type, fvPatchField, volMesh> FieldType; - if (this->updated()) { return; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..877e413dbed58111a2d8f9fa247def60ea3c4f12 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "uniformFixedGradientFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + fixedGradientFvPatchField<Type>(p, iF), + uniformGradient_() +{} + + +template<class Type> +uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const Field<Type>& fld +) +: + fixedGradientFvPatchField<Type>(p, iF, fld), + uniformGradient_() +{} + + +template<class Type> +uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField +( + const uniformFixedGradientFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedGradientFvPatchField<Type>(ptf, p, iF, mapper), + uniformGradient_(ptf.uniformGradient_().clone().ptr()) +{ + // For safety re-evaluate + const scalar t = this->db().time().timeOutputValue(); + this->gradient() = uniformGradient_->value(t); +} + + +template<class Type> +uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + fixedGradientFvPatchField<Type>(p, iF), + uniformGradient_(DataEntry<Type>::New("uniformGradient", dict)) +{ + if (dict.found("gradient")) + { + this->gradient() = Field<Type>("gradient", dict, p.size()); + } + else + { + const scalar t = this->db().time().timeOutputValue(); + this->gradient() = uniformGradient_->value(t); + } +} + + +template<class Type> +uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField +( + const uniformFixedGradientFvPatchField<Type>& ptf +) +: + fixedGradientFvPatchField<Type>(ptf), + uniformGradient_ + ( + ptf.uniformGradient_.valid() + ? ptf.uniformGradient_().clone().ptr() + : NULL + ) +{} + + +template<class Type> +uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField +( + const uniformFixedGradientFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + fixedGradientFvPatchField<Type>(ptf, iF), + uniformGradient_ + ( + ptf.uniformGradient_.valid() + ? ptf.uniformGradient_().clone().ptr() + : NULL + ) +{ + // For safety re-evaluate + const scalar t = this->db().time().timeOutputValue(); + + if (ptf.uniformGradient_.valid()) + { + this->gradient() = uniformGradient_->value(t); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void uniformFixedGradientFvPatchField<Type>::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const scalar t = this->db().time().timeOutputValue(); + this->gradient() = uniformGradient_->value(t); + + fixedGradientFvPatchField<Type>::updateCoeffs(); +} + + +template<class Type> +void uniformFixedGradientFvPatchField<Type>::write(Ostream& os) const +{ + fixedGradientFvPatchField<Type>::write(os); + uniformGradient_->writeData(os); + this->writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..5659297fecc0c37610440c7336b1e79fb302da59 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::uniformFixedGradientFvPatchField + +Group + grpGenericBoundaryConditions + +Description + This boundary condition provides a uniform fixed gradient condition. + + \heading Patch usage + + \table + Property | Description | Required | Default value + uniformGradient | uniform gradient | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type uniformFixedGradient; + uniformGradient constant 0.2; + } + \endverbatim + +Note + The uniformGradient entry is a DataEntry type, able to describe time + varying functions. The example above gives the usage for supplying a + constant value. + +SeeAlso + Foam::DataEntry + Foam::fixedGradientFvPatchField + +SourceFiles + uniformFixedGradientFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformFixedGradientFvPatchField_H +#define uniformFixedGradientFvPatchField_H + +#include "fixedGradientFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class uniformFixedGradientFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class uniformFixedGradientFvPatchField +: + public fixedGradientFvPatchField<Type> +{ + // Private data + + //- Gradient + autoPtr<DataEntry<Type> > uniformGradient_; + + +public: + + //- Runtime type information + TypeName("uniformFixedGradient"); + + + // Constructors + + //- Construct from patch and internal field + uniformFixedGradientFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch and internal field and patch field + uniformFixedGradientFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const Field<Type>& fld + ); + + //- Construct from patch, internal field and dictionary + uniformFixedGradientFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given uniformFixedGradientFvPatchField + // onto a new patch + uniformFixedGradientFvPatchField + ( + const uniformFixedGradientFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + uniformFixedGradientFvPatchField + ( + const uniformFixedGradientFvPatchField<Type>& + ); + + //- Construct and return a clone + virtual tmp<fvPatchField<Type> > clone() const + { + return tmp<fvPatchField<Type> > + ( + new uniformFixedGradientFvPatchField<Type>(*this) + ); + } + + //- Construct as copy setting internal field reference + uniformFixedGradientFvPatchField + ( + const uniformFixedGradientFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<Type> > clone + ( + const DimensionedField<Type, volMesh>& iF + ) const + { + return tmp<fvPatchField<Type> > + ( + new uniformFixedGradientFvPatchField<Type>(*this, iF) + ); + } + + + // Member functions + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "uniformFixedGradientFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C similarity index 76% rename from src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C rename to src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C index 1504b8ba3b39dc7b74f5c070ceb99c20824cbc88..a0b72644ac73045e06c772d4f05770714166b278 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.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) 2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,22 +23,21 @@ License \*---------------------------------------------------------------------------*/ -#include "boundedBackwardDdtScheme.H" -#include "fvMesh.H" +#include "uniformFixedGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -namespace fv -{ -defineTypeNameAndDebug(boundedBackwardDdtScheme, 0); +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(uniformFixedGradient); -ddtScheme<scalar>::addIstreamConstructorToTable<boundedBackwardDdtScheme> - addboundedBackwardDdtSchemeIstreamConstructorToTable_; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} -} +} // End namespace Foam // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..83560205a2d2f2c0bc5cde4b785cc28ba2d59c3c --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformFixedGradientFvPatchFields_H +#define uniformFixedGradientFvPatchFields_H + +#include "uniformFixedGradientFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(uniformFixedGradient); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..9eaa07e2a69e7b2a5310a0b2ab9317cc237b2cf4 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformFixedGradientFvPatchFieldsFwd_H +#define uniformFixedGradientFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class uniformFixedGradientFvPatchField; + +makePatchTypeFieldTypedefs(uniform); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C deleted file mode 100644 index b46ca8e0f9959d36fd1661d1004340e7887583fa..0000000000000000000000000000000000000000 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C +++ /dev/null @@ -1,708 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "boundedBackwardDdtScheme.H" -#include "surfaceInterpolate.H" -#include "fvcDiv.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -scalar boundedBackwardDdtScheme::deltaT_() const -{ - return mesh().time().deltaTValue(); -} - - -scalar boundedBackwardDdtScheme::deltaT0_() const -{ - return mesh().time().deltaT0Value(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -tmp<volScalarField> -boundedBackwardDdtScheme::fvcDdt -( - const dimensionedScalar& dt -) -{ - // No change compared to backward - - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+dt.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(); - - scalar coefft = 1 + deltaT/(deltaT + deltaT0); - scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0)); - scalar coefft0 = coefft + coefft00; - - if (mesh().moving()) - { - tmp<volScalarField> tdtdt - ( - new volScalarField - ( - ddtIOobject, - mesh(), - dimensionedScalar - ( - "0", - dt.dimensions()/dimTime, - 0.0 - ) - ) - ); - - tdtdt().internalField() = rDeltaT.value()*dt.value()* - ( - coefft - (coefft0*mesh().V0() - coefft00*mesh().V00())/mesh().V() - ); - - return tdtdt; - } - else - { - return tmp<volScalarField> - ( - new volScalarField - ( - ddtIOobject, - mesh(), - dimensionedScalar - ( - "0", - dt.dimensions()/dimTime, - 0.0 - ), - calculatedFvPatchScalarField::typeName - ) - ); - } -} - - -tmp<volScalarField> -boundedBackwardDdtScheme::fvcDdt -( - const volScalarField& vf -) -{ - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+vf.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const volScalarField phict - ( - mag - ( - vf.oldTime().oldTime() - - vf.oldTime().oldTime().oldTime() - )/ - ( - mag - ( - vf.oldTime() - - vf.oldTime().oldTime() - ) - + dimensionedScalar("small", vf.dimensions(), VSMALL) - ) - ); - - const volScalarField limiter(pos(phict) - pos(phict - scalar(1))); - const volScalarField coefft(scalar(1) + limiter*deltaT/(deltaT + deltaT0)); - const volScalarField coefft00 - ( - limiter*sqr(deltaT)/(deltaT0*(deltaT + deltaT0)) - ); - const volScalarField coefft0(coefft + coefft00); - - if (mesh().moving()) - { - return tmp<volScalarField> - ( - new volScalarField - ( - ddtIOobject, - mesh(), - rDeltaT.dimensions()*vf.dimensions(), - rDeltaT.value()* - ( - coefft*vf.internalField() - - ( - coefft0.internalField() - *vf.oldTime().internalField()*mesh().V0() - - coefft00.internalField() - *vf.oldTime().oldTime().internalField() - *mesh().V00() - )/mesh().V() - ), - rDeltaT.value()* - ( - coefft.boundaryField()*vf.boundaryField() - - ( - coefft0.boundaryField()* - vf.oldTime().boundaryField() - - coefft00.boundaryField()* - vf.oldTime().oldTime().boundaryField() - ) - ) - ) - ); - } - else - { - return tmp<volScalarField> - ( - new volScalarField - ( - ddtIOobject, - rDeltaT* - ( - coefft*vf - - coefft0*vf.oldTime() - + coefft00*vf.oldTime().oldTime() - ) - ) - ); - } -} - - -tmp<volScalarField> -boundedBackwardDdtScheme::fvcDdt -( - const dimensionedScalar& rho, - const volScalarField& vf -) -{ - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+rho.name()+','+vf.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const volScalarField phict - ( - mag - ( - vf.oldTime().oldTime() - - vf.oldTime().oldTime().oldTime() - )/ - ( - mag - ( - vf.oldTime() - - vf.oldTime().oldTime() - ) - + dimensionedScalar("small", vf.dimensions(), VSMALL) - ) - ); - - const volScalarField limiter(pos(phict) - pos(phict - scalar(1))); - const volScalarField coefft(scalar(1) + limiter*deltaT/(deltaT + deltaT0)); - const volScalarField coefft00 - ( - limiter*sqr(deltaT)/(deltaT0*(deltaT + deltaT0)) - ); - const volScalarField coefft0(coefft + coefft00); - - if (mesh().moving()) - { - return tmp<volScalarField> - ( - new volScalarField - ( - ddtIOobject, - mesh(), - rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(), - rDeltaT.value()*rho.value()* - ( - coefft*vf.internalField() - - ( - coefft0.internalField()* - vf.oldTime().internalField()*mesh().V0() - - coefft00.internalField()* - vf.oldTime().oldTime().internalField() - *mesh().V00() - )/mesh().V() - ), - rDeltaT.value()*rho.value()* - ( - coefft.boundaryField()*vf.boundaryField() - - ( - coefft0.boundaryField()* - vf.oldTime().boundaryField() - - coefft00.boundaryField()* - vf.oldTime().oldTime().boundaryField() - ) - ) - ) - ); - } - else - { - return tmp<volScalarField> - ( - new volScalarField - ( - ddtIOobject, - rDeltaT*rho* - ( - coefft*vf - - coefft0*vf.oldTime() - + coefft00*vf.oldTime().oldTime() - ) - ) - ); - } -} - - -tmp<volScalarField> -boundedBackwardDdtScheme::fvcDdt -( - const volScalarField& rho, - const volScalarField& vf -) -{ - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+rho.name()+','+vf.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const volScalarField phict - ( - mag - ( - rho.oldTime().oldTime()*vf.oldTime().oldTime() - - rho.oldTime().oldTime().oldTime()*vf.oldTime().oldTime().oldTime() - )/ - ( - mag - ( - rho.oldTime()*vf.oldTime() - - rho.oldTime().oldTime()*vf.oldTime().oldTime() - ) - + dimensionedScalar("small", rho.dimensions()*vf.dimensions(), VSMALL) - ) - ); - - const volScalarField limiter(pos(phict) - pos(phict - scalar(1))); - const volScalarField coefft(scalar(1) + limiter*deltaT/(deltaT + deltaT0)); - const volScalarField coefft00 - ( - limiter*sqr(deltaT)/(deltaT0*(deltaT + deltaT0)) - ); - const volScalarField coefft0(coefft + coefft00); - - if (mesh().moving()) - { - return tmp<volScalarField> - ( - new volScalarField - ( - ddtIOobject, - mesh(), - rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(), - rDeltaT.value()* - ( - coefft*rho.internalField()*vf.internalField() - - ( - coefft0.internalField()* - rho.oldTime().internalField()* - vf.oldTime().internalField()*mesh().V0() - - coefft00.internalField()* - rho.oldTime().oldTime().internalField() - *vf.oldTime().oldTime().internalField()*mesh().V00() - )/mesh().V() - ), - rDeltaT.value()* - ( - coefft.boundaryField()*vf.boundaryField() - - ( - coefft0.boundaryField()* - rho.oldTime().boundaryField()* - vf.oldTime().boundaryField() - - coefft00.boundaryField()* - rho.oldTime().oldTime().boundaryField()* - vf.oldTime().oldTime().boundaryField() - ) - ) - ) - ); - } - else - { - return tmp<volScalarField> - ( - new volScalarField - ( - ddtIOobject, - rDeltaT* - ( - coefft*rho*vf - - coefft0*rho.oldTime()*vf.oldTime() - + coefft00*rho.oldTime().oldTime()*vf.oldTime().oldTime() - ) - ) - ); - } -} - - -tmp<fvScalarMatrix> -boundedBackwardDdtScheme::fvmDdt -( - const volScalarField& vf -) -{ - tmp<fvScalarMatrix> tfvm - ( - new fvScalarMatrix - ( - vf, - vf.dimensions()*dimVol/dimTime - ) - ); - - fvScalarMatrix& fvm = tfvm(); - - scalar rDeltaT = 1.0/deltaT_(); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const scalarField phict - ( - mag - ( - vf.oldTime().oldTime().internalField() - - vf.oldTime().oldTime().oldTime().internalField() - )/ - ( - mag - ( - vf.oldTime().internalField() - - vf.oldTime().oldTime().internalField() - ) - + VSMALL - ) - ); - - const scalarField limiter(pos(phict) - pos(phict - 1.0)); - const scalarField coefft(1.0 + limiter*deltaT/(deltaT + deltaT0)); - const scalarField coefft00 - ( - limiter*deltaT*deltaT/(deltaT0*(deltaT + deltaT0)) - ); - const scalarField coefft0(coefft + coefft00); - - fvm.diag() = (coefft*rDeltaT)*mesh().V(); - - if (mesh().moving()) - { - fvm.source() = rDeltaT* - ( - coefft0*vf.oldTime().internalField()*mesh().V0() - - coefft00*vf.oldTime().oldTime().internalField() - *mesh().V00() - ); - } - else - { - fvm.source() = rDeltaT*mesh().V()* - ( - coefft0*vf.oldTime().internalField() - - coefft00*vf.oldTime().oldTime().internalField() - ); - } - - return tfvm; -} - - -tmp<fvScalarMatrix> -boundedBackwardDdtScheme::fvmDdt -( - const dimensionedScalar& rho, - const volScalarField& vf -) -{ - tmp<fvScalarMatrix> tfvm - ( - new fvScalarMatrix - ( - vf, - rho.dimensions()*vf.dimensions()*dimVol/dimTime - ) - ); - fvScalarMatrix& fvm = tfvm(); - - scalar rDeltaT = 1.0/deltaT_(); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const scalarField phict - ( - mag - ( - vf.oldTime().oldTime().internalField() - - vf.oldTime().oldTime().oldTime().internalField() - )/ - ( - mag - ( - vf.oldTime().internalField() - - vf.oldTime().oldTime().internalField() - ) - + VSMALL - ) - ); - - const scalarField limiter(pos(phict) - pos(phict - 1.0)); - const scalarField coefft(1.0 + limiter*deltaT/(deltaT + deltaT0)); - const scalarField coefft00 - ( - limiter*deltaT*deltaT/(deltaT0*(deltaT + deltaT0)) - ); - const scalarField coefft0(coefft + coefft00); - - fvm.diag() = (coefft*rDeltaT*rho.value())*mesh().V(); - - if (mesh().moving()) - { - fvm.source() = rDeltaT*rho.value()* - ( - coefft0*vf.oldTime().internalField()*mesh().V0() - - coefft00*vf.oldTime().oldTime().internalField() - *mesh().V00() - ); - } - else - { - fvm.source() = rDeltaT*mesh().V()*rho.value()* - ( - coefft0*vf.oldTime().internalField() - - coefft00*vf.oldTime().oldTime().internalField() - ); - } - - return tfvm; -} - - -tmp<fvScalarMatrix> -boundedBackwardDdtScheme::fvmDdt -( - const volScalarField& rho, - const volScalarField& vf -) -{ - tmp<fvScalarMatrix> tfvm - ( - new fvScalarMatrix - ( - vf, - rho.dimensions()*vf.dimensions()*dimVol/dimTime - ) - ); - fvScalarMatrix& fvm = tfvm(); - - scalar rDeltaT = 1.0/deltaT_(); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const scalarField phict - ( - mag - ( - rho.oldTime().oldTime().internalField()* - vf.oldTime().oldTime().internalField() - - rho.oldTime().oldTime().oldTime().internalField()* - vf.oldTime().oldTime().oldTime().internalField() - )/ - ( - mag - ( - rho.oldTime().internalField()* - vf.oldTime().internalField() - - rho.oldTime().oldTime().internalField()* - vf.oldTime().oldTime().internalField() - ) - + VSMALL - ) - ); - - const scalarField limiter(pos(phict) - pos(phict - 1.0)); - const scalarField coefft(1.0 + limiter*deltaT/(deltaT + deltaT0)); - const scalarField coefft00 - ( - limiter*deltaT*deltaT/(deltaT0*(deltaT + deltaT0)) - ); - const scalarField coefft0(coefft + coefft00); - - fvm.diag() = (coefft*rDeltaT)*rho.internalField()*mesh().V(); - - if (mesh().moving()) - { - fvm.source() = rDeltaT* - ( - coefft0*rho.oldTime().internalField() - *vf.oldTime().internalField()*mesh().V0() - - coefft00*rho.oldTime().oldTime().internalField() - *vf.oldTime().oldTime().internalField()*mesh().V00() - ); - } - else - { - fvm.source() = rDeltaT*mesh().V()* - ( - coefft0*rho.oldTime().internalField() - *vf.oldTime().internalField() - - coefft00*rho.oldTime().oldTime().internalField() - *vf.oldTime().oldTime().internalField() - ); - } - - return tfvm; -} - - -tmp<surfaceScalarField> boundedBackwardDdtScheme::fvcDdtPhiCorr -( - const volScalarField& rA, - const volScalarField& U, - const surfaceScalarField& phi -) -{ - notImplemented - ( - "boundedBackwardDdtScheme::fvcDdtPhiCorr" - ); - - return surfaceScalarField::null(); -} - - -tmp<surfaceScalarField> boundedBackwardDdtScheme::fvcDdtPhiCorr -( - const volScalarField& rA, - const volScalarField& rho, - const volScalarField& U, - const surfaceScalarField& phi -) -{ - notImplemented - ( - "boundedBackwardDdtScheme::fvcDdtPhiCorr" - ); - - return surfaceScalarField::null(); -} - - -tmp<surfaceScalarField> boundedBackwardDdtScheme::meshPhi -( - const volScalarField& vf -) -{ - notImplemented - ( - "boundedBackwardDdtScheme::meshPhi(const volScalarField& vf)" - ); - - return surfaceScalarField::null(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H deleted file mode 100644 index 900e2a7993295db1780dd4caf107d7699e69eaf2..0000000000000000000000000000000000000000 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H +++ /dev/null @@ -1,193 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. - -Class - Foam::fv::boundedBackwardDdtScheme - -Description - Second-order bounded-backward-differencing ddt using the current and - two previous time-step values. - -SourceFiles - boundedBackwardDdtScheme.C - -\*---------------------------------------------------------------------------*/ - -#ifndef boundedBackwardDdtScheme_H -#define boundedBackwardDdtScheme_H - -#include "ddtScheme.H" -#include "fvMatrices.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -/*---------------------------------------------------------------------------*\ - Class boundedBackwardDdtScheme Declaration -\*---------------------------------------------------------------------------*/ - -class boundedBackwardDdtScheme -: - public fv::ddtScheme<scalar> -{ - // Private Member Functions - - //- Return the current time-step - scalar deltaT_() const; - - //- Return the previous time-step - scalar deltaT0_() const; - - //- Return the previous time-step or GREAT if the old timestep field - // wasn't available in which case Euler ddt is used - template<class GeoField> - scalar deltaT0_(const GeoField& vf) const - { - if (vf.oldTime().timeIndex() == vf.oldTime().oldTime().timeIndex()) - { - return GREAT; - } - else - { - return deltaT0_(); - } - } - - - //- Disallow default bitwise copy construct - boundedBackwardDdtScheme(const boundedBackwardDdtScheme&); - - //- Disallow default bitwise assignment - void operator=(const boundedBackwardDdtScheme&); - - -public: - - //- Runtime type information - TypeName("boundedBackward"); - - - // Constructors - - //- Construct from mesh - boundedBackwardDdtScheme(const fvMesh& mesh) - : - ddtScheme<scalar>(mesh) - {} - - //- Construct from mesh and Istream - boundedBackwardDdtScheme(const fvMesh& mesh, Istream& is) - : - ddtScheme<scalar>(mesh, is) - {} - - - // Member Functions - - //- Return mesh reference - const fvMesh& mesh() const - { - return fv::ddtScheme<scalar>::mesh(); - } - - tmp<volScalarField> fvcDdt - ( - const dimensionedScalar& - ); - - tmp<volScalarField> fvcDdt - ( - const volScalarField& - ); - - tmp<volScalarField> fvcDdt - ( - const dimensionedScalar&, - const volScalarField& - ); - - tmp<volScalarField> fvcDdt - ( - const volScalarField&, - const volScalarField& - ); - - tmp<fvScalarMatrix> fvmDdt - ( - const volScalarField& - ); - - tmp<fvScalarMatrix> fvmDdt - ( - const dimensionedScalar&, - const volScalarField& - ); - - tmp<fvScalarMatrix> fvmDdt - ( - const volScalarField&, - const volScalarField& - ); - - tmp<surfaceScalarField> fvcDdtPhiCorr - ( - const volScalarField& rA, - const volScalarField& U, - const surfaceScalarField& phi - ); - - tmp<surfaceScalarField> fvcDdtPhiCorr - ( - const volScalarField& rA, - const volScalarField& rho, - const volScalarField& U, - const surfaceScalarField& phi - ); - - tmp<surfaceScalarField> meshPhi - ( - const volScalarField& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C index 62ca855e785d375bf752f19119b18d667c554117..ff5994e670ce942784ddbdb283ebc4247896a603 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C @@ -48,6 +48,25 @@ void Foam::MULES::explicitSolve } +void Foam::MULES::correct +( + volScalarField& psi, + surfaceScalarField& phiPsiCorr, + const scalar psiMax, + const scalar psiMin +) +{ + correct + ( + geometricOneField(), + psi, + phiPsiCorr, + zeroField(), zeroField(), + psiMax, psiMin + ); +} + + void Foam::MULES::limitSum(UPtrList<scalarField>& phiPsiCorrs) { forAll(phiPsiCorrs[0], facei) diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H index 2307c289e4007bddb4436326d04db4049d453d32..c1d824b9503a16fce8f27befc168e3a40b754e66 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H @@ -92,6 +92,38 @@ void explicitSolve const scalar psiMin ); + +template<class RhoType, class SpType, class SuType> +void correct +( + const RhoType& rho, + volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su +); + +template<class RhoType, class SpType, class SuType> +void correct +( + const RhoType& rho, + volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin +); + +void correct +( + volScalarField& psi, + surfaceScalarField& phiCorr, + const scalar psiMax, + const scalar psiMin +); + + template<class RhoType, class SpType, class SuType> void limiter ( @@ -122,6 +154,35 @@ void limit const bool returnCorr ); + +template<class RhoType, class SpType, class SuType> +void limiterCorr +( + scalarField& allLambda, + const RhoType& rho, + const volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +); + +template<class RhoType, class SpType, class SuType> +void limitCorr +( + const RhoType& rho, + const volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +); + + void limitSum(UPtrList<scalarField>& phiPsiCorrs); template<class SurfaceScalarFieldList> diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C index a3cb9f17e9d40e52a7b5c850975eb00dbcb27eed..e0718f923a91b2d3f26fd7db813447c8f9822f8d 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C @@ -96,6 +96,74 @@ void Foam::MULES::explicitSolve } +template<class RhoType, class SpType, class SuType> +void Foam::MULES::correct +( + const RhoType& rho, + volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su +) +{ + Info<< "MULES: Correcting " << psi.name() << endl; + + const fvMesh& mesh = psi.mesh(); + + const scalar deltaT = mesh.time().deltaTValue(); + + scalarField psiIf(psi.size(), 0); + fvc::surfaceIntegrate(psiIf, phiCorr); + + if (mesh.moving()) + { + psi.internalField() = + ( + rho.field()*psi.internalField()/deltaT + + Su.field() + - psiIf + )/(rho.field()/deltaT - Sp.field()); + } + else + { + psi.internalField() = + ( + rho.field()*psi.internalField()/deltaT + + Su.field() + - psiIf + )/(rho.field()/deltaT - Sp.field()); + } + + psi.correctBoundaryConditions(); +} + + +template<class RhoType, class SpType, class SuType> +void Foam::MULES::correct +( + const RhoType& rho, + volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin +) +{ + const fvMesh& mesh = psi.mesh(); + + const dictionary& MULEScontrols = mesh.solverDict(psi.name()); + + label nLimiterIter + ( + readLabel(MULEScontrols.lookup("nLimiterIter")) + ); + + limitCorr(rho, psi, phiCorr, Sp, Su, psiMax, psiMin, nLimiterIter); + correct(rho, psi, phiCorr, Sp, Su); +} + + template<class RhoType, class SpType, class SuType> void Foam::MULES::limiter ( @@ -511,6 +579,364 @@ void Foam::MULES::limit } +template<class RhoType, class SpType, class SuType> +void Foam::MULES::limiterCorr +( + scalarField& allLambda, + const RhoType& rho, + const volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +) +{ + const scalarField& psiIf = psi; + const volScalarField::GeometricBoundaryField& psiBf = psi.boundaryField(); + + const fvMesh& mesh = psi.mesh(); + + const labelUList& owner = mesh.owner(); + const labelUList& neighb = mesh.neighbour(); + tmp<volScalarField::DimensionedInternalField> tVsc = mesh.Vsc(); + const scalarField& V = tVsc(); + const scalar deltaT = mesh.time().deltaTValue(); + + const scalarField& phiCorrIf = phiCorr; + const surfaceScalarField::GeometricBoundaryField& phiCorrBf = + phiCorr.boundaryField(); + + slicedSurfaceScalarField lambda + ( + IOobject + ( + "lambda", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + dimless, + allLambda, + false // Use slices for the couples + ); + + scalarField& lambdaIf = lambda; + surfaceScalarField::GeometricBoundaryField& lambdaBf = + lambda.boundaryField(); + + scalarField psiMaxn(psiIf.size(), psiMin); + scalarField psiMinn(psiIf.size(), psiMax); + + scalarField sumPhip(psiIf.size(), VSMALL); + scalarField mSumPhim(psiIf.size(), VSMALL); + + forAll(phiCorrIf, facei) + { + label own = owner[facei]; + label nei = neighb[facei]; + + psiMaxn[own] = max(psiMaxn[own], psiIf[nei]); + psiMinn[own] = min(psiMinn[own], psiIf[nei]); + + psiMaxn[nei] = max(psiMaxn[nei], psiIf[own]); + psiMinn[nei] = min(psiMinn[nei], psiIf[own]); + + scalar phiCorrf = phiCorrIf[facei]; + + if (phiCorrf > 0.0) + { + sumPhip[own] += phiCorrf; + mSumPhim[nei] += phiCorrf; + } + else + { + mSumPhim[own] -= phiCorrf; + sumPhip[nei] -= phiCorrf; + } + } + + forAll(phiCorrBf, patchi) + { + const fvPatchScalarField& psiPf = psiBf[patchi]; + const scalarField& phiCorrPf = phiCorrBf[patchi]; + + const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + + if (psiPf.coupled()) + { + const scalarField psiPNf(psiPf.patchNeighbourField()); + + forAll(phiCorrPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiPNf[pFacei]); + psiMinn[pfCelli] = min(psiMinn[pfCelli], psiPNf[pFacei]); + } + } + else + { + forAll(phiCorrPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiPf[pFacei]); + psiMinn[pfCelli] = min(psiMinn[pfCelli], psiPf[pFacei]); + } + } + + forAll(phiCorrPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + scalar phiCorrf = phiCorrPf[pFacei]; + + if (phiCorrf > 0.0) + { + sumPhip[pfCelli] += phiCorrf; + } + else + { + mSumPhim[pfCelli] -= phiCorrf; + } + } + } + + psiMaxn = min(psiMaxn, psiMax); + psiMinn = max(psiMinn, psiMin); + + // scalar smooth = 0.5; + // psiMaxn = min((1.0 - smooth)*psiIf + smooth*psiMaxn, psiMax); + // psiMinn = max((1.0 - smooth)*psiIf + smooth*psiMinn, psiMin); + + psiMaxn = + V + *( + (rho.field()/deltaT - Sp.field())*psiMaxn + - Su.field() + - rho.field()*psi.internalField()/deltaT + ); + + psiMinn = + V + *( + Su.field() + - (rho.field()/deltaT - Sp.field())*psiMinn + + rho.field()*psi.internalField()/deltaT + ); + + scalarField sumlPhip(psiIf.size()); + scalarField mSumlPhim(psiIf.size()); + + for (int j=0; j<nLimiterIter; j++) + { + sumlPhip = 0.0; + mSumlPhim = 0.0; + + forAll(lambdaIf, facei) + { + label own = owner[facei]; + label nei = neighb[facei]; + + scalar lambdaPhiCorrf = lambdaIf[facei]*phiCorrIf[facei]; + + if (lambdaPhiCorrf > 0.0) + { + sumlPhip[own] += lambdaPhiCorrf; + mSumlPhim[nei] += lambdaPhiCorrf; + } + else + { + mSumlPhim[own] -= lambdaPhiCorrf; + sumlPhip[nei] -= lambdaPhiCorrf; + } + } + + forAll(lambdaBf, patchi) + { + scalarField& lambdaPf = lambdaBf[patchi]; + const scalarField& phiCorrfPf = phiCorrBf[patchi]; + + const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + + forAll(lambdaPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + scalar lambdaPhiCorrf = lambdaPf[pFacei]*phiCorrfPf[pFacei]; + + if (lambdaPhiCorrf > 0.0) + { + sumlPhip[pfCelli] += lambdaPhiCorrf; + } + else + { + mSumlPhim[pfCelli] -= lambdaPhiCorrf; + } + } + } + + forAll(sumlPhip, celli) + { + sumlPhip[celli] = + max(min + ( + (sumlPhip[celli] + psiMaxn[celli])/mSumPhim[celli], + 1.0), 0.0 + ); + + mSumlPhim[celli] = + max(min + ( + (mSumlPhim[celli] + psiMinn[celli])/sumPhip[celli], + 1.0), 0.0 + ); + } + + const scalarField& lambdam = sumlPhip; + const scalarField& lambdap = mSumlPhim; + + forAll(lambdaIf, facei) + { + if (phiCorrIf[facei] > 0.0) + { + lambdaIf[facei] = min + ( + lambdaIf[facei], + min(lambdap[owner[facei]], lambdam[neighb[facei]]) + ); + } + else + { + lambdaIf[facei] = min + ( + lambdaIf[facei], + min(lambdam[owner[facei]], lambdap[neighb[facei]]) + ); + } + } + + + forAll(lambdaBf, patchi) + { + fvsPatchScalarField& lambdaPf = lambdaBf[patchi]; + const scalarField& phiCorrfPf = phiCorrBf[patchi]; + const fvPatchScalarField& psiPf = psiBf[patchi]; + + if (isA<wedgeFvPatch>(mesh.boundary()[patchi])) + { + lambdaPf = 0; + } + else if (psiPf.coupled()) + { + const labelList& pFaceCells = + mesh.boundary()[patchi].faceCells(); + + forAll(lambdaPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + if (phiCorrfPf[pFacei] > 0.0) + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdap[pfCelli]); + } + else + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdam[pfCelli]); + } + } + } + else + { + const labelList& pFaceCells = + mesh.boundary()[patchi].faceCells(); + const scalarField& phiCorrPf = phiCorrBf[patchi]; + + forAll(lambdaPf, pFacei) + { + // Limit outlet faces only + if (phiCorrPf[pFacei] > 0) + { + label pfCelli = pFaceCells[pFacei]; + + if (phiCorrfPf[pFacei] > 0.0) + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdap[pfCelli]); + } + else + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdam[pfCelli]); + } + } + } + } + } + + syncTools::syncFaceList(mesh, allLambda, minEqOp<scalar>()); + } +} + + +template<class RhoType, class SpType, class SuType> +void Foam::MULES::limitCorr +( + const RhoType& rho, + const volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +) +{ + const fvMesh& mesh = psi.mesh(); + + scalarField allLambda(mesh.nFaces(), 1.0); + + slicedSurfaceScalarField lambda + ( + IOobject + ( + "lambda", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + dimless, + allLambda, + false // Use slices for the couples + ); + + limiterCorr + ( + allLambda, + rho, + psi, + phiCorr, + Sp, + Su, + psiMax, + psiMin, + nLimiterIter + ); + + phiCorr *= lambda; +} + + template<class SurfaceScalarFieldList> void Foam::MULES::limitSum(SurfaceScalarFieldList& phiPsiCorrs) { diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C index 25df8d29d16f6030a1f019b9c07369c553af97d3..46bcbc8953d52a00bb6a7f50dafb2814cd69eab8 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C @@ -119,7 +119,8 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration new scalarField(meshLevels_[nCreatedLevels].size()) ); - restrictField(*aggVPtr, *VPtr, nCreatedLevels); + // Restrict but no parallel agglomeration (not supported) + restrictField(*aggVPtr, *VPtr, nCreatedLevels, false); if (nCreatedLevels) { @@ -157,7 +158,8 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration new scalarField(meshLevels_[nCreatedLevels].size()) ); - restrictField(*aggSbPtr, *SbPtr, nCreatedLevels); + // Restrict but no parallel agglomeration (not supported) + restrictField(*aggSbPtr, *SbPtr, nCreatedLevels, false); delete SbPtr; SbPtr = aggSbPtr; diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C index 48d73efb2e316a6d00bbc44893a7a6aa0206c460..9a7462127cded0319c428f707a19272ccf94e150 100644 --- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C +++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.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 @@ -43,8 +43,10 @@ bool Foam::pairPatchAgglomeration::continueAgglomerating ) { // Check the need for further agglomeration on all processors - bool contAgg = nCoarseFaces >= nFacesInCoarsestLevel_; - reduce(contAgg, andOp<bool>()); + label localnCoarseFaces = nCoarseFaces; +// reduce(localnCoarseFaces, sumOp<label>()); + bool contAgg = localnCoarseFaces >= nFacesInCoarsestLevel_; + //reduce(contAgg, andOp<bool>()); return contAgg; } @@ -263,6 +265,11 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch ) << "min(fineToCoarse) == -1" << exit(FatalError); } + if (fineToCoarse.size() == 0) + { + return true; + } + if (fineToCoarse.size() != patch.size()) { FatalErrorIn @@ -282,6 +289,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch const label nCoarseI = max(fineToCoarse)+1; List<face> patchFaces(nCoarseI); + // Patch faces per agglomeration labelListList coarseToFine(invertOneToMany(nCoarseI, fineToCoarse)); @@ -335,6 +343,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch patch.points() ) ); + return true; } @@ -343,59 +352,73 @@ void Foam::pairPatchAgglomeration:: agglomerate() { label nPairLevels = 0; label nCreatedLevels = 1; //0 level is the base patch + label nCoarseFaces = 0; + label nCoarseFacesOld = 0; while (nCreatedLevels < maxLevels_) { - label nCoarseCells = -1; - const bPatch& patch = patchLevels_[nCreatedLevels - 1]; tmp<labelField> finalAgglomPtr(new labelField(patch.size())); bool agglomOK = false; - while (!agglomOK && patch.size()) + while (!agglomOK) { finalAgglomPtr = agglomerateOneLevel ( - nCoarseCells, + nCoarseFaces, patch ); - agglomOK = agglomeratePatch - ( - patch, - finalAgglomPtr, - nCreatedLevels - ); - } + if (nCoarseFaces > 0) + { + agglomOK = agglomeratePatch + ( + patch, + finalAgglomPtr, + nCreatedLevels + ); - nFaces_[nCreatedLevels] = nCoarseCells; - restrictAddressing_.set(nCreatedLevels, finalAgglomPtr); - mapBaseToTopAgglom(nCreatedLevels); + restrictAddressing_.set(nCreatedLevels, finalAgglomPtr); + mapBaseToTopAgglom(nCreatedLevels); + setEdgeWeights(nCreatedLevels); - if (!continueAgglomerating(nCoarseCells)) - { - break; + if (nPairLevels % mergeLevels_) + { + combineLevels(nCreatedLevels); + } + else + { + nCreatedLevels++; + } + + nPairLevels++; + } + else + { + agglomOK = true; + } + reduce(nCoarseFaces, sumOp<label>()); } - setEdgeWeights(nCreatedLevels); + nFaces_[nCreatedLevels] = nCoarseFaces; - if (nPairLevels % mergeLevels_) - { - combineLevels(nCreatedLevels); - } - else + if + ( + !continueAgglomerating(nCoarseFaces) + || (nCoarseFacesOld == nCoarseFaces) + ) { - nCreatedLevels++; + break; } - nPairLevels++; + nCoarseFacesOld = nCoarseFaces; } } Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel ( - label& nCoarseCells, + label& nCoarseFaces, const bPatch& patch ) { @@ -406,7 +429,7 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel const labelListList& faceFaces = patch.faceFaces(); - nCoarseCells = 0; + nCoarseFaces = 0; forAll(faceFaces, facei) { @@ -440,9 +463,9 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel if (matchFaceNo >= 0) { // Make a new group - coarseCellMap[matchFaceNo] = nCoarseCells; - coarseCellMap[matchFaceNeibNo] = nCoarseCells; - nCoarseCells++; + coarseCellMap[matchFaceNo] = nCoarseFaces; + coarseCellMap[matchFaceNeibNo] = nCoarseFaces; + nCoarseFaces++; } else { @@ -475,8 +498,8 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel else { // if not create single-cell "clusters" for each - coarseCellMap[facei] = nCoarseCells; - nCoarseCells ++; + coarseCellMap[facei] = nCoarseFaces; + nCoarseFaces ++; } } } diff --git a/src/lagrangian/distributionModels/uniform/uniform.C b/src/lagrangian/distributionModels/uniform/uniform.C index 4d1504b646821fcaaaa134d74b001197fa58efe7..83284905887d3fbe4527788f0ccb1c1a00fc796c 100644 --- a/src/lagrangian/distributionModels/uniform/uniform.C +++ b/src/lagrangian/distributionModels/uniform/uniform.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 @@ -47,8 +47,7 @@ Foam::distributionModels::uniform::uniform : distributionModel(typeName, dict, rndGen), minValue_(readScalar(distributionModelDict_.lookup("minValue"))), - maxValue_(readScalar(distributionModelDict_.lookup("maxValue"))), - range_(maxValue_ - minValue_) + maxValue_(readScalar(distributionModelDict_.lookup("maxValue"))) { check(); } diff --git a/src/lagrangian/distributionModels/uniform/uniform.H b/src/lagrangian/distributionModels/uniform/uniform.H index 5a8f6650fdba08fb2cb416918a55a7a90e55ab8d..cd4a6733a0465db228871bd336d2e332cf7cd29d 100644 --- a/src/lagrangian/distributionModels/uniform/uniform.H +++ b/src/lagrangian/distributionModels/uniform/uniform.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,9 +60,6 @@ class uniform //- Distribution maximum scalar maxValue_; - //- Distribution range - scalar range_; - public: diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index ae4c1f9d66075f32b3590f0feebcd52a15b09ef5..9165621d6c9826698e074934e1a5831f6055c35b 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -25,7 +25,7 @@ $(KINEMATICCOLLIDINGPARCEL)/makeBasicKinematicCollidingParcelSubmodels.C /* thermo parcel sub-models */ -THERMOPARCEL=$(DERIVEDPARCELS)/fluidThermoParcel +THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel $(THERMOPARCEL)/defineBasicThermoParcel.C $(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 03765b5c5720eefd46be227fb87b188d6382c18a..66e54468e5cf9eb3239598adcde3e8b3300f4710 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -31,6 +31,7 @@ License #include "InjectionModelList.H" #include "DispersionModel.H" #include "PatchInteractionModel.H" +#include "StochasticCollisionModel.H" #include "SurfaceFilmModel.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -56,6 +57,15 @@ void Foam::KinematicCloud<CloudType>::setModels() ).ptr() ); + stochasticCollisionModel_.reset + ( + StochasticCollisionModel<KinematicCloud<CloudType> >::New + ( + subModelProperties_, + *this + ).ptr() + ); + surfaceFilmModel_.reset ( SurfaceFilmModel<KinematicCloud<CloudType> >::New @@ -181,7 +191,6 @@ void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td) if (preInjectionSize != this->size()) { updateCellOccupancy(); - preInjectionSize = this->size(); } @@ -191,6 +200,8 @@ void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td) // Assume that motion will update the cellOccupancy as necessary // before it is required. td.cloud().motion(td); + + stochasticCollision().update(solution_.trackTime()); } else { @@ -249,6 +260,7 @@ void Foam::KinematicCloud<CloudType>::cloudReset(KinematicCloud<CloudType>& c) dispersionModel_.reset(c.dispersionModel_.ptr()); patchInteractionModel_.reset(c.patchInteractionModel_.ptr()); + stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr()); surfaceFilmModel_.reset(c.surfaceFilmModel_.ptr()); UIntegrator_.reset(c.UIntegrator_.ptr()); @@ -338,6 +350,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud ), dispersionModel_(NULL), patchInteractionModel_(NULL), + stochasticCollisionModel_(NULL), surfaceFilmModel_(NULL), UIntegrator_(NULL), UTrans_ @@ -418,6 +431,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud injectors_(c.injectors_), dispersionModel_(c.dispersionModel_->clone()), patchInteractionModel_(c.patchInteractionModel_->clone()), + stochasticCollisionModel_(c.stochasticCollisionModel_->clone()), surfaceFilmModel_(c.surfaceFilmModel_->clone()), UIntegrator_(c.UIntegrator_->clone()), UTrans_ @@ -507,6 +521,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud injectors_(*this), dispersionModel_(NULL), patchInteractionModel_(NULL), + stochasticCollisionModel_(NULL), surfaceFilmModel_(NULL), UIntegrator_(NULL), UTrans_(NULL), diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 7cf68d8d5be1d80a0730b5c2a44a4d475fd61826..cae86032ca836ece080f114433b96ba526a185aa 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -39,6 +39,7 @@ Description - dispersion model - injection model - patch interaction model + - stochastic collision model - surface film model SourceFiles @@ -84,6 +85,9 @@ class PatchInteractionModel; template<class CloudType> class SurfaceFilmModel; +template<class CloudType> +class StochasticCollisionModel; + /*---------------------------------------------------------------------------*\ Class KinematicCloud Declaration @@ -203,6 +207,10 @@ protected: autoPtr<PatchInteractionModel<KinematicCloud<CloudType> > > patchInteractionModel_; + //- Stochastic collision model + autoPtr<StochasticCollisionModel<KinematicCloud<CloudType> > > + stochasticCollisionModel_; + //- Surface film model autoPtr<SurfaceFilmModel<KinematicCloud<CloudType> > > surfaceFilmModel_; @@ -416,6 +424,15 @@ public: inline PatchInteractionModel<KinematicCloud<CloudType> >& patchInteraction(); + //- Return const-access to the stochastic collision model + inline const + StochasticCollisionModel<KinematicCloud<CloudType> >& + stochasticCollision() const; + + //- Return reference to the stochastic collision model + inline StochasticCollisionModel<KinematicCloud<CloudType> >& + stochasticCollision(); + //- Return const-access to the surface film model inline const SurfaceFilmModel<KinematicCloud<CloudType> >& surfaceFilm() const; @@ -482,6 +499,9 @@ public: // Fields + //- Volume swept rate of parcels per cell + inline const tmp<volScalarField> vDotSweep() const; + //- Return the particle volume fraction field // Note: for particles belonging to this cloud only inline const tmp<volScalarField> theta() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 7e50b0b67c26427ea6393b612ced236c8979b09d..bef2f78a60937c00bd3626d32c63183d30275223 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -204,6 +204,22 @@ Foam::KinematicCloud<CloudType>::patchInteraction() } +template<class CloudType> +inline const Foam::StochasticCollisionModel<Foam::KinematicCloud<CloudType> >& +Foam::KinematicCloud<CloudType>::stochasticCollision() const +{ + return stochasticCollisionModel_(); +} + + +template<class CloudType> +inline Foam::StochasticCollisionModel<Foam::KinematicCloud<CloudType> >& +Foam::KinematicCloud<CloudType>::stochasticCollision() +{ + return stochasticCollisionModel_(); +} + + template<class CloudType> inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType> >& Foam::KinematicCloud<CloudType>::surfaceFilm() const @@ -571,6 +587,45 @@ Foam::KinematicCloud<CloudType>::SU(volVectorField& U) const } +template<class CloudType> +inline const Foam::tmp<Foam::volScalarField> +Foam::KinematicCloud<CloudType>::vDotSweep() const +{ + tmp<volScalarField> tvDotSweep + ( + new volScalarField + ( + IOobject + ( + this->name() + ":vDotSweep", + this->db().time().timeName(), + this->db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless/dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + volScalarField& vDotSweep = tvDotSweep(); + forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + { + const parcelType& p = iter(); + const label cellI = p.cell(); + + vDotSweep[cellI] += p.nParticle()*p.areaP()*mag(p.U() - U_[cellI]); + } + + vDotSweep.internalField() /= mesh_.V(); + vDotSweep.correctBoundaryConditions(); + + return tvDotSweep; +} + + template<class CloudType> inline const Foam::tmp<Foam::volScalarField> Foam::KinematicCloud<CloudType>::theta() const diff --git a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H index d7a0fcf0d03056df7411dac483549f62240cbca0..84a98dd6b7bde4a4fe82d481b210d4da9471d4b8 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.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 @@ -100,6 +100,9 @@ public: // Fields + //- Volume swept rate of parcels per cell + virtual const tmp<volScalarField> vDotSweep() const = 0; + //- Return the particle volume fraction field // Note: for particles belonging to this cloud only virtual const tmp<volScalarField> theta() const = 0; diff --git a/src/lagrangian/intermediate/clouds/derived/fluidThermoCloud/fluidThermoCloud.H b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H similarity index 87% rename from src/lagrangian/intermediate/clouds/derived/fluidThermoCloud/fluidThermoCloud.H rename to src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H index 5f024b0ee0099523706cab737302f39d344bd82a..00ee07d17e0ed857a2820453926c99a754a875ff 100644 --- a/src/lagrangian/intermediate/clouds/derived/fluidThermoCloud/fluidThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.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 @@ -22,18 +22,18 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::fluidThermoCloud + Foam::basicThermoCloud Description Cloud class to introduce thermodynamic parcels \*---------------------------------------------------------------------------*/ -#ifndef fluidThermoCloud_H -#define fluidThermoCloud_H +#ifndef basicThermoCloud_H +#define basicThermoCloud_H #include "ThermoCloud.H" -#include "fluidThermoParcel.H" +#include "basicThermoParcel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,10 +45,10 @@ namespace Foam < Cloud < - fluidThermoParcel + basicThermoParcel > > - > fluidThermoCloud; + > basicThermoCloud; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C index 186fbff0cf85f9599774c24430fc5122fbd3a642..97c531b21f0cf18f41a5e25fd6a341dfc06397db 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.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 @@ -138,6 +138,8 @@ bool Foam::CollidingParcel<ParcelType>::move } p.age() += dt; + + td.cloud().functions().postMove(p, cellI, dt, td.keepParticle); } break; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index ee860ad478dc325305b57ba1d41997a831391526..3460fe401b8866c22120e400df45c3015b9a303e 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.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 @@ -520,8 +520,7 @@ public: // Helper functions - //- Return the index of the face to be used in the interpolation - // routine + //- Return the index of the face used in the interpolation routine inline label faceInterpolation() const; //- Cell owner mass diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 9350e1251ed9208395e9f7c5f4e83a8a55da31ca..aab07b4d7ddddcc284e4a9edc1b7cb2d3cf15ea5 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -498,7 +498,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV, scalar& Sh, scalar& N, @@ -512,6 +512,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation ( !td.cloud().devolatilisation().active() || T < td.cloud().constProps().Tvap() + || canCombust == -1 ) { return; @@ -588,7 +589,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions const scalar d, const scalar T, const scalar mass, - const bool canCombust, + const label canCombust, const scalar N, const scalarField& YMix, const scalarField& YGas, @@ -603,7 +604,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions ) const { // Check that model is active - if (!td.cloud().surfaceReaction().active() || !canCombust) + if (!td.cloud().surfaceReaction().active() || (canCombust != 1)) { return; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index db20b8d9c744607339a264404195c73b58e0a081..ff13d240b9aacee8c20d35d96b59d70f6769f1ab 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.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 @@ -183,9 +183,13 @@ protected: //- Mass fractions of solids [] scalarField YSolid_; - //- Flag to say that the particle is allowed to combust - // Only true after volatile content falls below threshold value - bool canCombust_; + //- Flag to identify if the particle can devolatilise and combust + // Combustion possible only after volatile content falls below + // threshold value. States include: + // 0 = can devolatilise, cannot combust but can change + // 1 = can devolatilise, can combust + // -1 = cannot devolatilise or combust, and cannot change + label canCombust_; // Protected Member Functions @@ -205,7 +209,7 @@ protected: const scalarField& YGasEff,// gas component mass fractions const scalarField& YLiquidEff,// liquid component mass fractions const scalarField& YSolidEff,// solid component mass fractions - bool& canCombust, // 'can combust' flag + label& canCombust, // 'can combust' flag scalarField& dMassDV, // mass transfer - local to particle scalar& Sh, // explicit particle enthalpy source scalar& N, // flux of species emitted from particle @@ -223,7 +227,7 @@ protected: const scalar d, // diameter const scalar T, // temperature const scalar mass, // mass - const bool canCombust, // 'can combust' flag + const label canCombust, // 'can combust' flag const scalar N, // flux of species emitted from particle const scalarField& YMix, // mixture mass fractions const scalarField& YGas, // gas-phase mass fractions @@ -362,7 +366,7 @@ public: inline const scalarField& YSolid() const; //- Return const access to the canCombust flag - inline bool canCombust() const; + inline label canCombust() const; // Edit @@ -377,7 +381,7 @@ public: inline scalarField& YSolid(); //- Return access to the canCombust flag - inline bool& canCombust(); + inline label& canCombust(); // Main calculation loop diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index e610de174e8e23230b9bcb50f4996a6d2a61da42..4a4a97eddfacaaa7333ffe1f79fdfb1daf099576 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -94,7 +94,7 @@ inline Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel YGas_(0), YLiquid_(0), YSolid_(0), - canCombust_(false) + canCombust_(0) {} @@ -142,7 +142,7 @@ inline Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel YGas_(YGas0), YLiquid_(YLiquid0), YSolid_(YSolid0), - canCombust_(false) + canCombust_(0) {} @@ -192,7 +192,8 @@ YSolid() const template<class ParcelType> -inline bool Foam::ReactingMultiphaseParcel<ParcelType>::canCombust() const +inline Foam::label +Foam::ReactingMultiphaseParcel<ParcelType>::canCombust() const { return canCombust_; } @@ -220,7 +221,7 @@ inline Foam::scalarField& Foam::ReactingMultiphaseParcel<ParcelType>::YSolid() template<class ParcelType> -inline bool& Foam::ReactingMultiphaseParcel<ParcelType>::canCombust() +inline Foam::label& Foam::ReactingMultiphaseParcel<ParcelType>::canCombust() { return canCombust_; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index fa1e6e0428f3810844da7e53c1642a0a998c92d6..9495376322a0c49b3c3e663025359e7ed871abca 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.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 @@ -47,7 +47,7 @@ Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel YGas_(0), YLiquid_(0), YSolid_(0), - canCombust_(false) + canCombust_(0) { if (readFields) { diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 4906280cf9f8c3a3ecae5f2a79e34e7edcc4a295..efb73ecae86f9f0e186f01c2229be8c1d63b3057 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -32,6 +32,169 @@ using namespace Foam::constant::mathematical; // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // +template<class ParcelType> +template<class TrackData> +void Foam::ReactingParcel<ParcelType>::calcPhaseChange +( + TrackData& td, + const scalar dt, + const label cellI, + const scalar Re, + const scalar Pr, + const scalar Ts, + const scalar nus, + const scalar d, + const scalar T, + const scalar mass, + const label idPhase, + const scalar YPhase, + const scalarField& YComponents, + scalarField& dMassPC, + scalar& Sh, + scalar& N, + scalar& NCpW, + scalarField& Cs +) +{ + if + ( + !td.cloud().phaseChange().active() + || T < td.cloud().constProps().Tvap() + || YPhase < SMALL + ) + { + return; + } + + typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + const CompositionModel<reactingCloudType>& composition = + td.cloud().composition(); + + const scalar TMax = td.cloud().phaseChange().TMax(pc_, this->Tc_); + const scalar Tdash = min(T, TMax); + const scalar Tsdash = min(Ts, TMax); + + // Calculate mass transfer due to phase change + td.cloud().phaseChange().calculate + ( + dt, + cellI, + Re, + Pr, + d, + nus, + Tdash, + Tsdash, + pc_, + this->Tc_, + YComponents, + dMassPC + ); + + // Limit phase change mass by availability of each specie + dMassPC = min(mass*YPhase*YComponents, dMassPC); + + const scalar dMassTot = sum(dMassPC); + + // Add to cumulative phase change mass + td.cloud().phaseChange().addToPhaseChangeMass(this->nParticle_*dMassTot); + + forAll(dMassPC, i) + { + const label idc = composition.localToGlobalCarrierId(idPhase, i); + const label idl = composition.globalIds(idPhase)[i]; + + const scalar dh = td.cloud().phaseChange().dh(idc, idl, pc_, Tdash); + Sh -= dMassPC[i]*dh/dt; + } + + + // Update molar emissions + if (td.cloud().heatTransfer().BirdCorrection()) + { + // Average molecular weight of carrier mix - assumes perfect gas + const scalar Wc = this->rhoc_*specie::RR*this->Tc_/this->pc_; + + + forAll(dMassPC, i) + { + const label idc = composition.localToGlobalCarrierId(idPhase, i); + const label idl = composition.globalIds(idPhase)[i]; + + const scalar Cp = composition.carrier().Cp(idc, pc_, Tsdash); + const scalar W = composition.carrier().W(idc); + const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W); + + const scalar Dab = + composition.liquids().properties()[idl].D(pc_, Tsdash, Wc); + + // Molar flux of species coming from the particle (kmol/m^2/s) + N += Ni; + + // Sum of Ni*Cpi*Wi of emission species + NCpW += Ni*Cp*W; + + // Concentrations of emission species + Cs[idc] += Ni*d/(2.0*Dab); + } + } +} + + +template<class ParcelType> +Foam::scalar Foam::ReactingParcel<ParcelType>::updateMassFraction +( + const scalar mass0, + const scalarField& dMass, + scalarField& Y +) const +{ + scalar mass1 = mass0 - sum(dMass); + + // only update the mass fractions if the new particle mass is finite + if (mass1 > ROOTVSMALL) + { + forAll(Y, i) + { + Y[i] = (Y[i]*mass0 - dMass[i])/mass1; + } + } + + return mass1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class ParcelType> +Foam::ReactingParcel<ParcelType>::ReactingParcel +( + const ReactingParcel<ParcelType>& p +) +: + ParcelType(p), + mass0_(p.mass0_), + Y_(p.Y_), + pc_(p.pc_) +{} + + +template<class ParcelType> +Foam::ReactingParcel<ParcelType>::ReactingParcel +( + const ReactingParcel<ParcelType>& p, + const polyMesh& mesh +) +: + ParcelType(p, mesh), + mass0_(p.mass0_), + Y_(p.Y_), + pc_(p.pc_) +{} + + +// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // + template<class ParcelType> template<class TrackData> void Foam::ReactingParcel<ParcelType>::setCellValues @@ -165,7 +328,7 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues const SLGThermo& thermo = td.cloud().thermo(); // Far field carrier molar fractions - scalarField Xinf(td.cloud().thermo().carrier().species().size()); + scalarField Xinf(thermo.carrier().species().size()); forAll(Xinf, i) { @@ -234,29 +397,6 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues } -template<class ParcelType> -Foam::scalar Foam::ReactingParcel<ParcelType>::updateMassFraction -( - const scalar mass0, - const scalarField& dMass, - scalarField& Y -) const -{ - scalar mass1 = mass0 - sum(dMass); - - // only update the mass fractions if the new particle mass is finite - if (mass1 > ROOTVSMALL) - { - forAll(Y, i) - { - Y[i] = (Y[i]*mass0 - dMass[i])/mass1; - } - } - - return mass1; -} - - template<class ParcelType> template<class TrackData> void Foam::ReactingParcel<ParcelType>::calc @@ -472,144 +612,6 @@ void Foam::ReactingParcel<ParcelType>::calc } -template<class ParcelType> -template<class TrackData> -void Foam::ReactingParcel<ParcelType>::calcPhaseChange -( - TrackData& td, - const scalar dt, - const label cellI, - const scalar Re, - const scalar Pr, - const scalar Ts, - const scalar nus, - const scalar d, - const scalar T, - const scalar mass, - const label idPhase, - const scalar YPhase, - const scalarField& YComponents, - scalarField& dMassPC, - scalar& Sh, - scalar& N, - scalar& NCpW, - scalarField& Cs -) -{ - if - ( - !td.cloud().phaseChange().active() - || T < td.cloud().constProps().Tvap() - || YPhase < SMALL - ) - { - return; - } - - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; - const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); - - const scalar TMax = td.cloud().phaseChange().TMax(pc_, this->Tc_); - const scalar Tdash = min(T, TMax); - const scalar Tsdash = min(Ts, TMax); - - // Calculate mass transfer due to phase change - td.cloud().phaseChange().calculate - ( - dt, - cellI, - Re, - Pr, - d, - nus, - Tdash, - Tsdash, - pc_, - this->Tc_, - YComponents, - dMassPC - ); - - // Limit phase change mass by availability of each specie - dMassPC = min(mass*YPhase*YComponents, dMassPC); - - const scalar dMassTot = sum(dMassPC); - - // Add to cumulative phase change mass - td.cloud().phaseChange().addToPhaseChangeMass(this->nParticle_*dMassTot); - - forAll(dMassPC, i) - { - const label idc = composition.localToGlobalCarrierId(idPhase, i); - const label idl = composition.globalIds(idPhase)[i]; - - const scalar dh = td.cloud().phaseChange().dh(idc, idl, pc_, Tdash); - Sh -= dMassPC[i]*dh/dt; - } - - - // Update molar emissions - if (td.cloud().heatTransfer().BirdCorrection()) - { - // Average molecular weight of carrier mix - assumes perfect gas - const scalar Wc = this->rhoc_*specie::RR*this->Tc_/this->pc_; - - - forAll(dMassPC, i) - { - const label idc = composition.localToGlobalCarrierId(idPhase, i); - const label idl = composition.globalIds(idPhase)[i]; - - const scalar Cp = composition.carrier().Cp(idc, pc_, Tsdash); - const scalar W = composition.carrier().W(idc); - const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W); - - const scalar Dab = - composition.liquids().properties()[idl].D(pc_, Tsdash, Wc); - - // Molar flux of species coming from the particle (kmol/m^2/s) - N += Ni; - - // Sum of Ni*Cpi*Wi of emission species - NCpW += Ni*Cp*W; - - // Concentrations of emission species - Cs[idc] += Ni*d/(2.0*Dab); - } - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class ParcelType> -Foam::ReactingParcel<ParcelType>::ReactingParcel -( - const ReactingParcel<ParcelType>& p -) -: - ParcelType(p), - mass0_(p.mass0_), - Y_(p.Y_), - pc_(p.pc_) -{} - - -template<class ParcelType> -Foam::ReactingParcel<ParcelType>::ReactingParcel -( - const ReactingParcel<ParcelType>& p, - const polyMesh& mesh -) -: - ParcelType(p, mesh), - mass0_(p.mass0_), - Y_(p.Y_), - pc_(p.pc_) -{} - - // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "ReactingParcelIO.C" diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 0bb8f3704e8c177315a74968be3aa449cd58ba7f..7b4fea251a17cf4358f892c167c17f585ad8b1d3 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.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 diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C index 5ed566d4b9e7081ea0a866d31fb38d074e653971..b07c64638e7559f7e63089629c3c9c7feffeca2a 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.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 @@ -33,6 +33,7 @@ License #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" #include "makeParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,7 @@ namespace Foam makeParcelInjectionModels(basicKinematicCollidingCloud); makeParcelCollisionModels(basicKinematicCollidingCloud); makeParcelPatchInteractionModels(basicKinematicCollidingCloud); + makeParcelStochasticCollisionModels(basicKinematicCollidingCloud); makeParcelSurfaceFilmModels(basicKinematicCollidingCloud); } diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C index 8ad62161721a1db9af3c51bab20a6f60bce410f8..1aaa9590fc3320dbaf88553736d785e80d9c00da 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.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 @@ -32,6 +32,7 @@ License #include "makeParcelDispersionModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" #include "makeParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,6 +46,7 @@ namespace Foam makeParcelDispersionModels(basicKinematicCloud); makeParcelInjectionModels(basicKinematicCloud); makeParcelPatchInteractionModels(basicKinematicCloud); + makeParcelStochasticCollisionModels(basicKinematicCloud); makeParcelSurfaceFilmModels(basicKinematicCloud); } diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C index b14f905032a781fc8c99b7d8e56fb1529b07d535..bafe2cdd26aaaf6b8ec2bf395b35615fcdcd9749 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.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 @@ -32,6 +32,8 @@ License #include "makeParcelDispersionModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelPatchInteractionModels.H" +#include "makeReactingMultiphaseParcelStochasticCollisionModels.H" // MP variant +#include "makeReactingParcelSurfaceFilmModels.H" // Reacting variant // Thermodynamic #include "makeParcelHeatTransferModels.H" @@ -39,7 +41,6 @@ License // Reacting #include "makeReactingMultiphaseParcelCompositionModels.H" // MP Variant #include "makeReactingParcelPhaseChangeModels.H" -#include "makeReactingParcelSurfaceFilmModels.H" // Reacting multiphase #include "makeReactingMultiphaseParcelDevolatilisationModels.H" @@ -56,6 +57,11 @@ namespace Foam makeParcelDispersionModels(basicReactingMultiphaseCloud); makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseCloud); makeParcelPatchInteractionModels(basicReactingMultiphaseCloud); + makeReactingMultiphaseParcelStochasticCollisionModels + ( + basicReactingMultiphaseCloud + ); + makeReactingParcelSurfaceFilmModels(basicReactingMultiphaseCloud); // Thermo sub-models makeParcelHeatTransferModels(basicReactingMultiphaseCloud); @@ -72,10 +78,6 @@ namespace Foam ( basicReactingMultiphaseCloud ); - makeReactingParcelSurfaceFilmModels - ( - basicReactingMultiphaseCloud - ); makeReactingMultiphaseParcelSurfaceReactionModels ( basicReactingMultiphaseCloud diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C index bd425895b6c9004648efd85d1382d5a9077dc520..e9eb87a2cd06c54853cf897fb59286f8140bd1c0 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.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 @@ -32,6 +32,8 @@ License #include "makeParcelDispersionModels.H" #include "makeReactingParcelInjectionModels.H" // Reacting variant #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" +#include "makeReactingParcelSurfaceFilmModels.H" // Reacting variant // Thermodynamic #include "makeParcelHeatTransferModels.H" @@ -39,7 +41,6 @@ License // Reacting #include "makeReactingParcelCompositionModels.H" #include "makeReactingParcelPhaseChangeModels.H" -#include "makeReactingParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +53,8 @@ namespace Foam makeParcelDispersionModels(basicReactingCloud); makeReactingParcelInjectionModels(basicReactingCloud); makeParcelPatchInteractionModels(basicReactingCloud); + makeParcelStochasticCollisionModels(basicReactingCloud); + makeReactingParcelSurfaceFilmModels(basicReactingCloud); // Thermo sub-models makeParcelHeatTransferModels(basicReactingCloud); @@ -59,7 +62,6 @@ namespace Foam // Reacting sub-models makeReactingParcelCompositionModels(basicReactingCloud); makeReactingParcelPhaseChangeModels(basicReactingCloud); - makeReactingParcelSurfaceFilmModels(basicReactingCloud); } diff --git a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/fluidThermoParcel.H b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H similarity index 84% rename from src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/fluidThermoParcel.H rename to src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H index 12e863b7b8b5e11d06d3e6b133ba4fc2f0ba6d03..c7778ac1cfe8d76e2f4ab676c41820703b2966e6 100644 --- a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/fluidThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.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 @@ -22,18 +22,18 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::fluidThermoParcel + Foam::basicThermoParcel Description Definition of basic thermo parcel SourceFiles - fluidThermoParcel.C + basicThermoParcel.C \*---------------------------------------------------------------------------*/ -#ifndef fluidThermoParcel_H -#define fluidThermoParcel_H +#ifndef basicThermoParcel_H +#define basicThermoParcel_H #include "contiguous.H" #include "particle.H" @@ -44,10 +44,10 @@ SourceFiles namespace Foam { - typedef ThermoParcel<KinematicParcel<particle> > fluidThermoParcel; + typedef ThermoParcel<KinematicParcel<particle> > basicThermoParcel; template<> - inline bool contiguous<fluidThermoParcel>() + inline bool contiguous<basicThermoParcel>() { return true; } diff --git a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/defineBasicThermoParcel.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C similarity index 85% rename from src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/defineBasicThermoParcel.C rename to src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C index 45381d280d61d77d663070328da308794e0f1ea0..7c300a22b5d6f5d5defa0e4e0d1fad8ebda85647 100644 --- a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/defineBasicThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.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 @@ -23,15 +23,15 @@ License \*---------------------------------------------------------------------------*/ -#include "fluidThermoParcel.H" +#include "basicThermoParcel.H" #include "Cloud.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - defineTemplateTypeNameAndDebug(fluidThermoParcel, 0); - defineTemplateTypeNameAndDebug(Cloud<fluidThermoParcel>, 0); + defineTemplateTypeNameAndDebug(basicThermoParcel, 0); + defineTemplateTypeNameAndDebug(Cloud<basicThermoParcel>, 0); } // ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/makeBasicThermoParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C similarity index 72% rename from src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/makeBasicThermoParcelSubmodels.C rename to src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C index 1a685395aeb5769042fd7a53ecf7a7a62380f867..ba6d30bb91ca1c09292c0343abfa4e894cba528d 100644 --- a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/makeBasicThermoParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.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 @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "fluidThermoCloud.H" +#include "basicThermoCloud.H" #include "makeParcelCloudFunctionObjects.H" @@ -32,26 +32,28 @@ License #include "makeParcelDispersionModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" +#include "makeThermoParcelSurfaceFilmModels.H" // thermo variant // Thermodynamic #include "makeParcelHeatTransferModels.H" -#include "makeThermoParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - makeParcelCloudFunctionObjects(fluidThermoCloud); + makeParcelCloudFunctionObjects(basicThermoCloud); // Kinematic sub-models - makeThermoParcelForces(fluidThermoCloud); - makeParcelDispersionModels(fluidThermoCloud); - makeParcelInjectionModels(fluidThermoCloud); - makeParcelPatchInteractionModels(fluidThermoCloud); + makeThermoParcelForces(basicThermoCloud); + makeParcelDispersionModels(basicThermoCloud); + makeParcelInjectionModels(basicThermoCloud); + makeParcelPatchInteractionModels(basicThermoCloud); + makeParcelStochasticCollisionModels(basicThermoCloud); + makeParcelSurfaceFilmModels(basicThermoCloud); // Thermo sub-models - makeParcelHeatTransferModels(fluidThermoCloud); - makeParcelSurfaceFilmModels(fluidThermoCloud); + makeParcelHeatTransferModels(basicThermoCloud); } diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelStochasticCollisionModels.H b/src/lagrangian/intermediate/parcels/include/makeParcelStochasticCollisionModels.H new file mode 100644 index 0000000000000000000000000000000000000000..e949d6e0ad57afaedb2de797d1d63487257e70f0 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeParcelStochasticCollisionModels.H @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeParcelStochasticCollisionModels_H +#define makeParcelStochasticCollisionModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NoStochasticCollision.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeParcelStochasticCollisionModels(CloudType) \ + \ + makeStochasticCollisionModel(CloudType); \ + makeStochasticCollisionModelType(NoStochasticCollision, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelStochasticCollisionModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelStochasticCollisionModels.H new file mode 100644 index 0000000000000000000000000000000000000000..ea8436b119d0c55cc3e26f23569bcd8afdb012ea --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelStochasticCollisionModels.H @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeReactingMultiphaseParcelStochasticCollisionModels_H +#define makeReactingMultiphaseParcelStochasticCollisionModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NoStochasticCollision.H" +#include "SuppressionCollision.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeReactingMultiphaseParcelStochasticCollisionModels(CloudType) \ + \ + makeStochasticCollisionModel(CloudType); \ + makeStochasticCollisionModelType(NoStochasticCollision, CloudType); \ + makeStochasticCollisionModelType(SuppressionCollision, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C similarity index 77% rename from src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C index 024ccd313fdaf56e757076d04a61c46bd97c86bd..563c0caaef69eb33063e7b143de1d0d93a44e856 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.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 @@ -25,6 +25,15 @@ License #include "NoStochasticCollision.H" +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template<class CloudType> +void Foam::NoStochasticCollision<CloudType>::collide(const scalar) +{ + // do nothing +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class CloudType> @@ -64,37 +73,4 @@ bool Foam::NoStochasticCollision<CloudType>::active() const } -template<class CloudType> -bool Foam::NoStochasticCollision<CloudType>::update -( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const -{ - return false; -} - - // ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H similarity index 77% rename from src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H index 0e93cbc031db9fa1b27197a35f8cbf573fcad5f9..81338611e340330ca23965dfe9c2b28619ca8d0a 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class NoStochasticCollision Declaration + Class NoStochasticCollision Declaration \*---------------------------------------------------------------------------*/ template<class CloudType> @@ -47,6 +47,14 @@ class NoStochasticCollision : public StochasticCollisionModel<CloudType> { +protected: + + // Protected Member Functions + + //- Update the model + virtual void collide(const scalar dt); + + public: //- Runtime type information @@ -79,34 +87,6 @@ public: //- Flag to indicate whether model activates collision model virtual bool active() const; - - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; }; diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C similarity index 63% rename from src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C index fa22d59f0b3f9df69ed1fae4d3a9a2e23e6892a8..f177613232cffc94e15233d736309dded3403feb 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.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 @@ -25,6 +25,18 @@ License #include "StochasticCollisionModel.H" +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template<class CloudType> +void Foam::StochasticCollisionModel<CloudType>::collide(const scalar dt) +{ + notImplemented + ( + "void Foam::NoStochasticCollision<CloudType>::collide(const scalar)" + ); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class CloudType> @@ -69,66 +81,12 @@ Foam::StochasticCollisionModel<CloudType>::~StochasticCollisionModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -bool Foam::StochasticCollisionModel<CloudType>::update -( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const +void Foam::StochasticCollisionModel<CloudType>::update(const scalar dt) { - notImplemented - ( - "bool Foam::StochasticCollisionModel<CloudType>::update" - "(" - "const scalar, " - "cachedRandom&, " - "vector&, " - "scalar&, " - "scalar&, " - "scalar&, " - "vector&, " - "scalar&, " - "scalar&, " - "scalarField&, " - "const scalar, " - "const label, " - "const scalar, " - "vector&, " - "scalar&, " - "scalar&, " - "scalar&, " - "vector&, " - "scalar&, " - "scalar&, " - "scalarField&, " - "const scalar, " - "const label, " - "const scalar" - ") const" - ); - - return false; + if (this->active()) + { + this->collide(dt); + } } @@ -137,4 +95,3 @@ bool Foam::StochasticCollisionModel<CloudType>::update #include "StochasticCollisionModelNew.C" // ************************************************************************* // - diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H similarity index 78% rename from src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H index 87ebafab24e6c3b30ef01e0f707967cd4802c4cc..0ca8935b18300796693425399b5e77aff75188dc 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,6 +55,12 @@ class StochasticCollisionModel : public SubModelBase<CloudType> { +protected: + + //- Main collision routine + virtual void collide(const scalar dt); + + public: //- Runtime type information @@ -114,33 +120,8 @@ public: // Member Functions - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; + //- Update the model + void update(const scalar dt); }; @@ -152,27 +133,27 @@ public: #define makeStochasticCollisionModel(CloudType) \ \ - typedef CloudType::sprayCloudType sprayCloudType; \ + typedef CloudType::kinematicCloudType kinematicCloudType; \ defineNamedTemplateTypeNameAndDebug \ ( \ - StochasticCollisionModel<sprayCloudType>, \ + StochasticCollisionModel<kinematicCloudType>, \ 0 \ ); \ defineTemplateRunTimeSelectionTable \ ( \ - StochasticCollisionModel<sprayCloudType>, \ + StochasticCollisionModel<kinematicCloudType>, \ dictionary \ ); #define makeStochasticCollisionModelType(SS, CloudType) \ \ - typedef CloudType::sprayCloudType sprayCloudType; \ - defineNamedTemplateTypeNameAndDebug(SS<sprayCloudType>, 0); \ + typedef CloudType::kinematicCloudType kinematicCloudType; \ + defineNamedTemplateTypeNameAndDebug(SS<kinematicCloudType>, 0); \ \ - StochasticCollisionModel<sprayCloudType>:: \ - adddictionaryConstructorToTable<SS<sprayCloudType> > \ - add##SS##CloudType##sprayCloudType##ConstructorToTable_; + StochasticCollisionModel<kinematicCloudType>:: \ + adddictionaryConstructorToTable<SS<kinematicCloudType> > \ + add##SS##CloudType##kinematicCloudType##ConstructorToTable_; diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C similarity index 88% rename from src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C index 1cfc31a16f95f15b4755533348ecbf96d44c855a..5c2a4b80f099ca3b9d4e0fc86c6087b05f716f60 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.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 @@ -37,7 +37,7 @@ Foam::StochasticCollisionModel<CloudType>::New { word modelType(dict.lookup("stochasticCollisionModel")); - Info<< "Selecting StochasticCollisionModel " << modelType << endl; + Info<< "Selecting stochastic collision model " << modelType << endl; typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(modelType); @@ -51,9 +51,9 @@ Foam::StochasticCollisionModel<CloudType>::New "const dictionary&, " "CloudType&" ")" - ) << "Unknown StochasticCollisionModelType type " + ) << "Unknown model type type " << modelType << ", constructor not in hash table" << nl << nl - << " Valid StochasticCollisionModel types are:" << nl + << " Valid model types are:" << nl << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C index 0de07723819a21e16cc3959e41b81da81853886c..a98e959392d06a4c296691054d6bb65026a93fcc 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.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 @@ -109,7 +109,7 @@ void Foam::ConstantRateDevolatilisation<CloudType>::calculate const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const { @@ -130,7 +130,10 @@ void Foam::ConstantRateDevolatilisation<CloudType>::calculate dMassDV[id] = min(dt*A0*massVolatile0, massVolatile); } - canCombust = done; + if (done && canCombust != -1) + { + canCombust = 1; + } } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H index 7faffb990da36a57c34473bd7faaf626bc6ad8c1..4b61de316d6add07753afe6a82ee60278b7bf995 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.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 @@ -111,7 +111,7 @@ public: const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const; }; diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.C index 6b4325db4fa36966a3f1181dd5138941bbaf1dc9..48a0a4ee5fb0dfb116433d00199583466b98e5d8 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.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 @@ -82,7 +82,7 @@ void Foam::DevolatilisationModel<CloudType>::calculate const scalarField&, const scalarField&, const scalarField&, - bool&, + label&, scalarField& ) const { @@ -98,7 +98,7 @@ void Foam::DevolatilisationModel<CloudType>::calculate "const scalarField&, " "const scalarField&, " "const scalarField&, " - "bool&, " + "label&, " "scalarField&" ") const" ); diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.H index 7cff8d426a3ab795a56bab9831837bd32bbfea5a..f467aa7470ab4ab54ce668536c9e34724e13f8db 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.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 @@ -133,7 +133,7 @@ public: const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const; diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C index fe4b856cfbcf36dba3d44ff1a9bed0eedf61bc57..d3a8ca8aed6d12e1203266485afd219c32f3ab22 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.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 @@ -112,7 +112,7 @@ void Foam::SingleKineticRateDevolatilisation<CloudType>::calculate const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const { @@ -137,7 +137,10 @@ void Foam::SingleKineticRateDevolatilisation<CloudType>::calculate dMassDV[id] = min(dt*kappa*massVolatile, massVolatile); } - canCombust = done; + if (done && canCombust != -1) + { + canCombust = 1; + } } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H index d9c3064ce9a09205245489eb494a8c038d4de820..6b4802c8f655cc05bae95dc56587b33631656eee 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.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 @@ -236,7 +236,7 @@ public: const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const; }; diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C new file mode 100644 index 0000000000000000000000000000000000000000..b486fa02b7fec4b07bef3292e7d96384616973d2 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "SuppressionCollision.H" +#include "kinematicCloud.H" + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template<class CloudType> +void Foam::SuppressionCollision<CloudType>::collide(const scalar dt) +{ + const kinematicCloud& sc = + this->owner().mesh().template + lookupObject<kinematicCloud>(suppressionCloud_); + + volScalarField vDotSweep(sc.vDotSweep()); + + dimensionedScalar Dt("dt", dimTime, dt); + volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*Dt)); + + forAllIter(typename CloudType, this->owner(), iter) + { + typename CloudType::parcelType& p = iter(); + label cellI = p.cell(); + + scalar xx = this->owner().rndGen().template sample01<scalar>(); + + if (xx < P[cellI]) + { + p.canCombust() = -1; + p.typeId() = max(p.typeId(), suppressedParcelType_); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::SuppressionCollision<CloudType>::SuppressionCollision +( + const dictionary& dict, + CloudType& owner +) +: + StochasticCollisionModel<CloudType>(dict, owner, typeName), + suppressionCloud_(this->coeffDict().lookup("suppressionCloud")), + suppressedParcelType_ + ( + this->coeffDict().lookupOrDefault("suppressedParcelType", -1) + ) +{} + + +template<class CloudType> +Foam::SuppressionCollision<CloudType>::SuppressionCollision +( + const SuppressionCollision<CloudType>& cm +) +: + StochasticCollisionModel<CloudType>(cm), + suppressionCloud_(cm.suppressionCloud_), + suppressedParcelType_(cm.suppressedParcelType_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::SuppressionCollision<CloudType>::~SuppressionCollision() +{} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.H new file mode 100644 index 0000000000000000000000000000000000000000..5d02ad48430d61c917773423658cf729c27f2071 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::SuppressionCollision + +Description + Inter-cloud collision model, whereby the \c canReact flag can be used + to inhibit devolatilisation and surface reactions + +\*---------------------------------------------------------------------------*/ + +#ifndef SuppressionCollision_H +#define SuppressionCollision_H + +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class SuppressionCollision Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class SuppressionCollision +: + public StochasticCollisionModel<CloudType> +{ +protected: + + // Protected data + + //- Name of cloud used for suppression + const word suppressionCloud_; + + //- Suppressed parcel type - optional + const label suppressedParcelType_; + + + // Protected Member Functions + + //- Update the model + virtual void collide(const scalar dt); + + +public: + + //- Runtime type information + TypeName("suppressionCollision"); + + + // Constructors + + //- Construct from dictionary + SuppressionCollision(const dictionary& dict, CloudType& owner); + + //- Construct copy + SuppressionCollision(const SuppressionCollision<CloudType>& cm); + + //- Construct and return a clone + virtual autoPtr<StochasticCollisionModel<CloudType> > clone() const + { + return autoPtr<StochasticCollisionModel<CloudType> > + ( + new SuppressionCollision<CloudType>(*this) + ); + } + + + //- Destructor + virtual ~SuppressionCollision(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "SuppressionCollision.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C index bf418468bd9d7ec3190c6f2e69683a50d09a323d..4bc55c989ec65a574d5f325127949e5c71dcf6b5 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.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 @@ -26,7 +26,6 @@ License #include "SprayCloud.H" #include "AtomizationModel.H" #include "BreakupModel.H" -#include "StochasticCollisionModel.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -50,15 +49,6 @@ void Foam::SprayCloud<CloudType>::setModels() *this ).ptr() ); - - stochasticCollisionModel_.reset - ( - StochasticCollisionModel<SprayCloud<CloudType> >::New - ( - this->subModelProperties(), - *this - ).ptr() - ); } @@ -72,7 +62,6 @@ void Foam::SprayCloud<CloudType>::cloudReset atomizationModel_.reset(c.atomizationModel_.ptr()); breakupModel_.reset(c.breakupModel_.ptr()); - stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr()); } @@ -94,8 +83,7 @@ Foam::SprayCloud<CloudType>::SprayCloud cloudCopyPtr_(NULL), averageParcelMass_(0.0), atomizationModel_(NULL), - breakupModel_(NULL), - stochasticCollisionModel_(NULL) + breakupModel_(NULL) { if (this->solution().active()) { @@ -130,8 +118,7 @@ Foam::SprayCloud<CloudType>::SprayCloud cloudCopyPtr_(NULL), averageParcelMass_(c.averageParcelMass_), atomizationModel_(c.atomizationModel_->clone()), - breakupModel_(c.breakupModel_->clone()), - stochasticCollisionModel_(c.stochasticCollisionModel_->clone()) + breakupModel_(c.breakupModel_->clone()) {} @@ -148,8 +135,7 @@ Foam::SprayCloud<CloudType>::SprayCloud cloudCopyPtr_(NULL), averageParcelMass_(0.0), atomizationModel_(NULL), - breakupModel_(NULL), - stochasticCollisionModel_(NULL) + breakupModel_(NULL) {} @@ -179,6 +165,8 @@ void Foam::SprayCloud<CloudType>::setParcelThermoProperties // override rho and Cp from constantProperties parcel.Cp() = liqMix.Cp(parcel.pc(), parcel.T(), X); parcel.rho() = liqMix.rho(parcel.pc(), parcel.T(), X); + parcel.sigma() = liqMix.sigma(parcel.pc(), parcel.T(), X); + parcel.mu() = liqMix.mu(parcel.pc(), parcel.T(), X); } @@ -237,128 +225,6 @@ void Foam::SprayCloud<CloudType>::evolve() } -template<class CloudType> -template<class TrackData> -void Foam::SprayCloud<CloudType>::motion(TrackData& td) -{ - const scalar dt = this->solution().trackTime(); - - td.part() = TrackData::tpLinearTrack; - CloudType::move(td, dt); - - this->updateCellOccupancy(); - - if (stochasticCollision().active()) - { - const liquidMixtureProperties& liqMix = this->composition().liquids(); - - label i = 0; - forAllIter(typename SprayCloud<CloudType>, *this, iter) - { - label j = 0; - forAllIter(typename SprayCloud<CloudType>, *this, jter) - { - if (j > i) - { - parcelType& p = iter(); - scalar Vi = this->mesh().V()[p.cell()]; - scalarField X1(liqMix.X(p.Y())); - scalar sigma1 = liqMix.sigma(p.pc(), p.T(), X1); - scalar mp = p.mass()*p.nParticle(); - - parcelType& q = jter(); - scalar Vj = this->mesh().V()[q.cell()]; - scalarField X2(liqMix.X(q.Y())); - scalar sigma2 = liqMix.sigma(q.pc(), q.T(), X2); - scalar mq = q.mass()*q.nParticle(); - - bool updateProperties = stochasticCollision().update - ( - dt, - this->rndGen(), - p.position(), - mp, - p.d(), - p.nParticle(), - p.U(), - p.rho(), - p.T(), - p.Y(), - sigma1, - p.cell(), - Vi, - q.position(), - mq, - q.d(), - q.nParticle(), - q.U(), - q.rho(), - q.T(), - q.Y(), - sigma2, - q.cell(), - Vj - ); - - // for coalescence we need to update the density and - // the diameter cause of the temp/conc/mass-change - if (updateProperties) - { - if (mp > VSMALL) - { - scalarField Xp(liqMix.X(p.Y())); - p.rho() = liqMix.rho(p.pc(), p.T(), Xp); - p.Cp() = liqMix.Cp(p.pc(), p.T(), Xp); - p.d() = - cbrt - ( - 6.0*mp - /( - p.nParticle() - *p.rho() - *constant::mathematical::pi - ) - ); - } - - if (mq > VSMALL) - { - scalarField Xq(liqMix.X(q.Y())); - q.rho() = liqMix.rho(q.pc(), q.T(), Xq); - q.Cp() = liqMix.Cp(q.pc(), q.T(), Xq); - q.d() = - cbrt - ( - 6.0*mq - /( - q.nParticle() - *q.rho() - *constant::mathematical::pi - ) - ); - } - } - } - j++; - } - i++; - } - - // remove coalesced parcels that fall below minimum mass threshold - forAllIter(typename SprayCloud<CloudType>, *this, iter) - { - parcelType& p = iter(); - scalar mass = p.nParticle()*p.mass(); - - if (mass < td.cloud().constProps().minParticleMass()) - { - this->deleteParticle(p); - } - } - } -} - - template<class CloudType> void Foam::SprayCloud<CloudType>::info() { diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H index f8ffbbc7df91059bf456883efcb674dd0d677b19..2055c375e8242e91d06defe94e8b03068117c07f 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,10 @@ Class Description Templated base class for spray cloud + - sub-models: + - atomization model + - break-up model + \*---------------------------------------------------------------------------*/ #ifndef SprayCloud_H @@ -46,9 +50,6 @@ class AtomizationModel; template<class CloudType> class BreakupModel; -template<class CloudType> -class StochasticCollisionModel; - /*---------------------------------------------------------------------------*\ Class SprayCloud Declaration \*---------------------------------------------------------------------------*/ @@ -106,10 +107,6 @@ protected: //- Break-up model autoPtr<BreakupModel<SprayCloud<CloudType> > > breakupModel_; - //- Collision model - autoPtr<StochasticCollisionModel<SprayCloud<CloudType> > > - stochasticCollisionModel_; - // Protected Member Functions @@ -202,14 +199,6 @@ public: //- Return reference to the breakup model inline BreakupModel<SprayCloud<CloudType> >& breakup(); - //- Return const-access to the breakup model - inline const StochasticCollisionModel<SprayCloud<CloudType> >& - stochasticCollision() const; - - //- Return reference to the breakup model - inline StochasticCollisionModel<SprayCloud<CloudType> >& - stochasticCollision(); - // Cloud evolution functions @@ -236,10 +225,6 @@ public: //- Evolve the spray (inject, move) void evolve(); - //- Particle motion - - template<class TrackData> - void motion(TrackData& td); // I-O @@ -249,7 +234,6 @@ public: }; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H index fc0746267063e40de6d37b19f64ffcab8876fdba..834dbbddd415a61e7702b618063a6667b47b01c7 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,22 +65,6 @@ Foam::SprayCloud<CloudType>::breakup() } -template<class CloudType> -inline const Foam::StochasticCollisionModel<Foam::SprayCloud<CloudType> >& -Foam::SprayCloud<CloudType>::stochasticCollision() const -{ - return stochasticCollisionModel_; -} - - -template<class CloudType> -inline Foam::StochasticCollisionModel<Foam::SprayCloud<CloudType> >& -Foam::SprayCloud<CloudType>::stochasticCollision() -{ - return stochasticCollisionModel_(); -} - - template<class CloudType> inline Foam::scalar Foam::SprayCloud<CloudType>::averageParcelMass() const { diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C index b93d687c209ef7775a97448267f9bf09792bdd01..d0d3814bc72abcb09bf328ca15a0f20194ed955e 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C @@ -82,6 +82,7 @@ void Foam::SprayParcel<ParcelType>::calc scalar T0 = this->T(); this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T0, X); + sigma_ = td.cloud().composition().liquids().sigma(this->pc_, T0, X); scalar rho0 = td.cloud().composition().liquids().rho(this->pc_, T0, X); this->rho() = rho0; @@ -89,13 +90,14 @@ void Foam::SprayParcel<ParcelType>::calc if (td.keepParticle) { - // update Cp, diameter and density due to change in temperature + // update Cp, sigma, diameter and density due to change in temperature // and/or composition scalar T1 = this->T(); const scalarField& Y1(this->Y()); scalarField X1(td.cloud().composition().liquids().X(Y1)); this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T1, X1); + sigma_ = td.cloud().composition().liquids().sigma(this->pc_, T1, X); scalar rho1 = td.cloud().composition().liquids().rho(this->pc_, T1, X1); this->rho() = rho1; @@ -139,15 +141,6 @@ void Foam::SprayParcel<ParcelType>::calcAtomization const AtomizationModel<sprayCloudType>& atomization = td.cloud().atomization(); - - // cell state info is updated in ReactingParcel calc - const scalarField& Y(this->Y()); - scalarField X(composition.liquids().X(Y)); - - scalar rho = composition.liquids().rho(this->pc(), this->T(), X); - scalar mu = composition.liquids().mu(this->pc(), this->T(), X); - scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X); - // Average molecular weight of carrier mix - assumes perfect gas scalar Wc = this->rhoc_*specie::RR*this->Tc()/this->pc(); scalar R = specie::RR/Wc; @@ -174,7 +167,7 @@ void Foam::SprayParcel<ParcelType>::calcAtomization scalar chi = 0.0; if (atomization.calcChi()) { - chi = this->chi(td, X); + chi = this->chi(td, composition.liquids().X(this->Y())); } atomization.update @@ -183,9 +176,9 @@ void Foam::SprayParcel<ParcelType>::calcAtomization this->d(), this->liquidCore(), this->tc(), - rho, - mu, - sigma, + this->rho(), + mu_, + sigma_, volFlowRate, rhoAv, Urel, @@ -207,10 +200,6 @@ void Foam::SprayParcel<ParcelType>::calcBreakup const label cellI ) { - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; - const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); - typedef typename TrackData::cloudType cloudType; typedef typename cloudType::parcelType parcelType; typedef typename cloudType::forceType forceType; @@ -223,14 +212,6 @@ void Foam::SprayParcel<ParcelType>::calcBreakup solveTABEq(td, dt); } - // cell state info is updated in ReactingParcel calc - const scalarField& Y(this->Y()); - scalarField X(composition.liquids().X(Y)); - - scalar rho = composition.liquids().rho(this->pc(), this->T(), X); - scalar mu = composition.liquids().mu(this->pc(), this->T(), X); - scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X); - // Average molecular weight of carrier mix - assumes perfect gas scalar Wc = this->rhoc()*specie::RR*this->Tc()/this->pc(); scalar R = specie::RR/Wc; @@ -266,9 +247,9 @@ void Foam::SprayParcel<ParcelType>::calcBreakup this->y(), this->yDot(), this->d0(), - rho, - mu, - sigma, + this->rho(), + mu_, + sigma_, this->U(), rhoAv, muAv, @@ -287,7 +268,7 @@ void Foam::SprayParcel<ParcelType>::calcBreakup SprayParcel<ParcelType>* child = new SprayParcel<ParcelType>(*this); child->mass0() = massChild; child->d() = dChild; - child->nParticle() = massChild/rho*this->volume(dChild); + child->nParticle() = massChild/this->rho()*this->volume(dChild); const forceSuSp Fcp = forces.calcCoupled(*child, dt, massChild, Re, muAv); @@ -447,6 +428,8 @@ Foam::SprayParcel<ParcelType>::SprayParcel(const SprayParcel<ParcelType>& p) ParcelType(p), d0_(p.d0_), position0_(p.position0_), + sigma_(p.sigma_), + mu_(p.mu_), liquidCore_(p.liquidCore_), KHindex_(p.KHindex_), y_(p.y_), @@ -469,6 +452,8 @@ Foam::SprayParcel<ParcelType>::SprayParcel ParcelType(p, mesh), d0_(p.d0_), position0_(p.position0_), + sigma_(p.sigma_), + mu_(p.mu_), liquidCore_(p.liquidCore_), KHindex_(p.KHindex_), y_(p.y_), diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H index 19529b7d0b92d4ef5ac5b2c4754b762f207007c2..1ac1663d288770c7615279ab5b199504bb6b0c93 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,6 +59,74 @@ class SprayParcel public ParcelType { +public: + + //- Class to hold reacting particle constant properties + class constantProperties + : + public ParcelType::constantProperties + { + // Private data + + //- Particle initial surface tension [N/m] + scalar sigma0_; + + //- Particle initial dynamic viscosity [Pa.s] + scalar mu0_; + + + public: + + // Constructors + + //- Null constructor + constantProperties(); + + //- Copy constructor + constantProperties(const constantProperties& cp); + + //- Constructor from dictionary + constantProperties + ( + const dictionary& parentDict, + const bool readFields = true + ); + + //- Construct from components + constantProperties + ( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar TMax, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr, + const scalar pMin, + const Switch& constantVolume, + const scalar Tvap, + const scalar Tbp, + const scalar sigma0, + const scalar mu0 + ); + + + // Access + + //- Return const access to the initial surface tension + inline scalar sigma0() const; + + //- Return const access to the initial dynamic viscosity + inline scalar mu0() const; + }; + + protected: // Protected data @@ -71,6 +139,12 @@ protected: //- Injection position vector position0_; + //- Liquid surface tension [N/m] + scalar sigma_; + + //- Liquid dynamic viscosity [Pa.s] + scalar mu_; + //- Part of liquid core ( >0.5=liquid, <0.5=droplet ) scalar liquidCore_; @@ -219,6 +293,12 @@ public: //- Return const access to initial droplet position inline const vector& position0() const; + //- Return const access to the liquid surface tension + inline scalar sigma() const; + + //- Return const access to the liquid dynamic viscosity + inline scalar mu() const; + //- Return const access to liquid core inline scalar liquidCore() const; @@ -255,6 +335,12 @@ public: //- Return access to initial droplet position inline vector& position0(); + //- Return access to the liquid surface tension + inline scalar& sigma(); + + //- Return access to the liquid dynamic viscosity + inline scalar& mu(); + //- Return access to liquid core inline scalar& liquidCore(); diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H index 0ec6aad0e44df9da728f1f6961298c359e3dd543..66e5dc616faa7a6130c1e3e01ce14d565a511f55 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,94 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +template<class ParcelType> +inline Foam::SprayParcel<ParcelType>::constantProperties::constantProperties() +: + ParcelType::constantProperties(), + sigma0_(0.0), + mu0_(0.0) +{} + + +template<class ParcelType> +inline Foam::SprayParcel<ParcelType>::constantProperties::constantProperties +( + const constantProperties& cp +) +: + ParcelType::constantProperties(cp), + sigma0_(cp.sigma0_), + mu0_(cp.mu0_) +{} + + +template<class ParcelType> +inline Foam::SprayParcel<ParcelType>::constantProperties::constantProperties +( + const dictionary& parentDict, + const bool readFields +) +: + ParcelType::constantProperties(parentDict, readFields), + sigma0_(0.0), + mu0_(0.0) +{ + if (readFields) + { + this->dict().lookup("sigma0") >> sigma0_; + } +} + + +template<class ParcelType> +inline Foam::SprayParcel<ParcelType>::constantProperties::constantProperties +( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar TMax, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr, + const scalar pMin, + const Switch& constantVolume, + const scalar Tvap, + const scalar Tbp, + const scalar sigma0, + const scalar mu0 +) +: + ParcelType::constantProperties + ( + parcelTypeId, + rhoMin, + rho0, + minParticleMass, + youngsModulus, + poissonsRatio, + T0, + TMin, + TMax, + Cp0, + epsilon0, + f0, + Pr, + pMin, + constantVolume, + Tvap, + Tbp + ), + sigma0_(sigma0), + mu0_(mu0) +{} + + template<class ParcelType> inline Foam::SprayParcel<ParcelType>::SprayParcel ( @@ -38,6 +126,8 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel ParcelType(mesh, position, cellI, tetFaceI, tetPtI), d0_(this->d()), position0_(position), + sigma_(0.0), + mu_(0.0), liquidCore_(0.0), KHindex_(0.0), y_(0.0), @@ -99,6 +189,8 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel ), d0_(d0), position0_(position), + sigma_(constProps.sigma0()), + mu_(constProps.mu0()), liquidCore_(liquidCore), KHindex_(KHindex), y_(y), @@ -127,6 +219,20 @@ inline const Foam::vector& Foam::SprayParcel<ParcelType>::position0() const } +template<class ParcelType> +inline Foam::scalar Foam::SprayParcel<ParcelType>::sigma() const +{ + return sigma_; +} + + +template<class ParcelType> +inline Foam::scalar Foam::SprayParcel<ParcelType>::mu() const +{ + return mu_; +} + + template<class ParcelType> inline Foam::scalar Foam::SprayParcel<ParcelType>::liquidCore() const { @@ -204,6 +310,20 @@ inline Foam::vector& Foam::SprayParcel<ParcelType>::position0() } +template<class ParcelType> +inline Foam::scalar& Foam::SprayParcel<ParcelType>::sigma() +{ + return sigma_; +} + + +template<class ParcelType> +inline Foam::scalar& Foam::SprayParcel<ParcelType>::mu() +{ + return mu_; +} + + template<class ParcelType> inline Foam::scalar& Foam::SprayParcel<ParcelType>::liquidCore() { diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C index f4d443f92a7bc27a2f3bf70d87b7678f1725c8f8..6708e73e7b3d35cec6c7887f2d48b8e1f5cd5a8d 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C @@ -33,6 +33,8 @@ Foam::string Foam::SprayParcel<ParcelType>::propHeader = ParcelType::propHeader + " d0" + " position0" + + " sigma" + + " mu" + " liquidCore" + " KHindex" + " y" @@ -57,6 +59,8 @@ Foam::SprayParcel<ParcelType>::SprayParcel ParcelType(mesh, is, readFields), d0_(0.0), position0_(vector::zero), + sigma_(0.0), + mu_(0.0), liquidCore_(0.0), KHindex_(0.0), y_(0.0), @@ -74,6 +78,8 @@ Foam::SprayParcel<ParcelType>::SprayParcel { d0_ = readScalar(is); is >> position0_; + sigma_ = readScalar(is); + mu_ = readScalar(is); liquidCore_ = readScalar(is); KHindex_ = readScalar(is); y_ = readScalar(is); @@ -91,6 +97,8 @@ Foam::SprayParcel<ParcelType>::SprayParcel reinterpret_cast<char*>(&d0_), sizeof(d0_) + sizeof(position0_) + + sizeof(sigma_) + + sizeof(mu_) + sizeof(liquidCore_) + sizeof(KHindex_) + sizeof(y_) @@ -154,6 +162,12 @@ void Foam::SprayParcel<ParcelType>::readFields ); c.checkFieldIOobject(c, position0); + IOField<scalar> sigma(c.fieldIOobject("sigma", IOobject::MUST_READ)); + c.checkFieldIOobject(c, sigma); + + IOField<scalar> mu(c.fieldIOobject("mu", IOobject::MUST_READ)); + c.checkFieldIOobject(c, mu); + IOField<scalar> liquidCore(c.fieldIOobject ( "liquidCore", IOobject::MUST_READ) @@ -190,6 +204,8 @@ void Foam::SprayParcel<ParcelType>::readFields SprayParcel<ParcelType>& p = iter(); p.d0_ = d0[i]; p.position0_ = position0[i]; + p.sigma_ = sigma[i]; + p.mu_ = mu[i]; p.liquidCore_ = liquidCore[i]; p.KHindex_ = KHindex[i]; p.y_ = y[i]; @@ -230,6 +246,8 @@ void Foam::SprayParcel<ParcelType>::writeFields c.fieldIOobject("position0", IOobject::NO_READ), np ); + IOField<scalar> sigma(c.fieldIOobject("sigma", IOobject::NO_READ), np); + IOField<scalar> mu(c.fieldIOobject("mu", IOobject::NO_READ), np); IOField<scalar> liquidCore ( c.fieldIOobject("liquidCore", IOobject::NO_READ), @@ -254,6 +272,8 @@ void Foam::SprayParcel<ParcelType>::writeFields const SprayParcel<ParcelType>& p = iter(); d0[i] = p.d0_; position0[i] = p.position0_; + sigma[i] = p.sigma_; + mu[i] = p.mu_; liquidCore[i] = p.liquidCore_; KHindex[i] = p.KHindex_; y[i] = p.y_; @@ -268,6 +288,8 @@ void Foam::SprayParcel<ParcelType>::writeFields d0.write(); position0.write(); + sigma.write(); + mu.write(); liquidCore.write(); KHindex.write(); y.write(); @@ -294,6 +316,8 @@ Foam::Ostream& Foam::operator<< os << static_cast<const ParcelType&>(p) << token::SPACE << p.d0() << token::SPACE << p.position0() + << token::SPACE << p.sigma() + << token::SPACE << p.mu() << token::SPACE << p.liquidCore() << token::SPACE << p.KHindex() << token::SPACE << p.y() @@ -312,6 +336,8 @@ Foam::Ostream& Foam::operator<< reinterpret_cast<const char*>(&p.d0_), sizeof(p.d0()) + sizeof(p.position0()) + + sizeof(p.sigma()) + + sizeof(p.mu()) + sizeof(p.liquidCore()) + sizeof(p.KHindex()) + sizeof(p.y()) diff --git a/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C b/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C index 01a480bab24d869687bf2d86c161b96918f2530e..3af2751d2f8bb8eecd904aab13022787c0321cf7 100644 --- a/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C +++ b/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.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 @@ -32,6 +32,7 @@ License #include "makeParcelDispersionModels.H" #include "makeSprayParcelInjectionModels.H" // Spray variant #include "makeParcelPatchInteractionModels.H" +#include "makeSprayParcelStochasticCollisionModels.H" // Spray variant // Thermodynamic #include "makeParcelHeatTransferModels.H" @@ -44,7 +45,6 @@ License // Spray #include "makeSprayParcelAtomizationModels.H" #include "makeSprayParcelBreakupModels.H" -#include "makeSprayParcelCollisionModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,6 +57,7 @@ namespace Foam makeParcelDispersionModels(basicSprayCloud); makeSprayParcelInjectionModels(basicSprayCloud); makeParcelPatchInteractionModels(basicSprayCloud); + makeSprayParcelStochasticCollisionModels(basicSprayCloud); // Thermo sub-models makeParcelHeatTransferModels(basicSprayCloud); @@ -69,7 +70,6 @@ namespace Foam // Spray sub-models makeSprayParcelAtomizationModels(basicSprayCloud); makeSprayParcelBreakupModels(basicSprayCloud); - makeSprayParcelCollisionModels(basicSprayCloud); }; diff --git a/src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H b/src/lagrangian/spray/parcels/include/makeSprayParcelStochasticCollisionModels.H similarity index 88% rename from src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H rename to src/lagrangian/spray/parcels/include/makeSprayParcelStochasticCollisionModels.H index b5fc1ce39bbc4285c19928b3bfbe0eab7089e84f..2d9fdbf4a300ce62aac6994a912b58d00b252545 100644 --- a/src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H +++ b/src/lagrangian/spray/parcels/include/makeSprayParcelStochasticCollisionModels.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,8 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#ifndef makeSprayParcelCollisionModels_H -#define makeSprayParcelCollisionModels_H +#ifndef makeSprayParcelStochasticCollisionModels_H +#define makeSprayParcelStochasticCollisionModels_H // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -34,7 +34,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define makeSprayParcelCollisionModels(CloudType) \ +#define makeSprayParcelStochasticCollisionModels(CloudType) \ \ makeStochasticCollisionModel(CloudType); \ makeStochasticCollisionModelType(NoStochasticCollision, CloudType); \ diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C index 793eb50a35e7986d7f697e226252d05d45f3f385..258dd588a35ba1751d5a45b4ab4bdf634c4663f9 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C @@ -24,150 +24,120 @@ License \*---------------------------------------------------------------------------*/ #include "ORourkeCollision.H" +#include "mathematicalConstants.H" +#include "SLGThermo.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::ORourkeCollision<CloudType>::ORourkeCollision -( - const dictionary& dict, - CloudType& owner -) -: - StochasticCollisionModel<CloudType>(dict, owner, typeName), - coalescence_(this->coeffDict().lookup("coalescence")) -{} +using namespace Foam::constant::mathematical; +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // template<class CloudType> -Foam::ORourkeCollision<CloudType>::ORourkeCollision -( - const ORourkeCollision<CloudType>& cm -) -: - StochasticCollisionModel<CloudType>(cm), - coalescence_(cm.coalescence_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // +void Foam::ORourkeCollision<CloudType>::collide(const scalar dt) +{ + label i = 0; + forAllIter(typename CloudType, this->owner(), iter1) + { + label j = 0; + forAllIter(typename CloudType, this->owner(), iter2) + { + if (j > i) + { + parcelType& p1 = iter1(); + parcelType& p2 = iter2(); + + scalar m1 = p1.nParticle()*p1.mass(); + scalar m2 = p2.nParticle()*p2.mass(); + + bool massChanged = collideParcels(dt, p1, p2, m1, m2); + + if (massChanged) + { + if (m1 > ROOTVSMALL) + { + const scalarField X(liquids_.X(p1.Y())); + p1.rho() = liquids_.rho(p1.pc(), p1.T(), X); + p1.Cp() = liquids_.Cp(p1.pc(), p1.T(), X); + p1.sigma() = liquids_.sigma(p1.pc(), p1.T(), X); + p1.mu() = liquids_.mu(p1.pc(), p1.T(), X); + p1.d() = cbrt(6.0*m1/(p1.nParticle()*p1.rho()*pi)); + } + + if (m2 > ROOTVSMALL) + { + const scalarField X(liquids_.X(p2.Y())); + p2.rho() = liquids_.rho(p2.pc(), p2.T(), X); + p2.Cp() = liquids_.Cp(p2.pc(), p2.T(), X); + p2.sigma() = liquids_.sigma(p2.pc(), p2.T(), X); + p2.mu() = liquids_.mu(p2.pc(), p2.T(), X); + p2.d() = cbrt(6.0*m2/(p2.nParticle()*p2.rho()*pi)); + } + } + } + j++; + } + i++; + } -template<class CloudType> -Foam::ORourkeCollision<CloudType>::~ORourkeCollision() -{} + // remove coalesced parcels that fall below minimum mass threshold + forAllIter(typename CloudType, this->owner(), iter) + { + parcelType& p = iter(); + scalar mass = p.nParticle()*p.mass(); + if (mass < this->owner().constProps().minParticleMass()) + { + this->owner().deleteParticle(p); + } + } +} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -bool Foam::ORourkeCollision<CloudType>::update +bool Foam::ORourkeCollision<CloudType>::collideParcels ( const scalar dt, - cachedRandom& rndGen, - vector& pos1, + parcelType& p1, + parcelType& p2, scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const + scalar& m2 +) { + const label cell1 = p1.cell(); + const label cell2 = p2.cell(); + // check if parcels belong to same cell - if ((celli != cellj) || (m1 < VSMALL) || (m2 < VSMALL)) + if ((cell1 != cell2) || (m1 < ROOTVSMALL) || (m2 < ROOTVSMALL)) { return false; } bool coalescence = false; - scalar magVrel = mag(U1-U2); + const scalar Vc = this->owner().mesh().V()[cell1]; + const scalar d1 = p1.d(); + const scalar d2 = p2.d(); + + scalar magUrel = mag(p1.U() - p2.U()); scalar sumD = d1 + d2; - scalar nu0 = 0.25*constant::mathematical::pi*sumD*sumD*magVrel*dt/volj; - scalar nMin = min(N1, N2); + scalar nu0 = 0.25*constant::mathematical::pi*sqr(sumD)*magUrel*dt/Vc; + scalar nMin = min(p1.nParticle(), p2.nParticle()); scalar nu = nMin*nu0; scalar collProb = exp(-nu); - scalar xx = rndGen.sample01<scalar>(); + scalar xx = this->owner().rndGen().template sample01<scalar>(); // collision occurs if (xx > collProb) { if (d1 > d2) { - coalescence = collideSorted - ( - dt, - rndGen, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj - ); + coalescence = collideSorted(dt, p1, p2, m1, m2); } else { - coalescence = collideSorted - ( - dt, - rndGen, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli - ); + coalescence = collideSorted(dt, p2, p1, m2, m1); } } + return coalescence; } @@ -176,85 +146,81 @@ template<class CloudType> bool Foam::ORourkeCollision<CloudType>::collideSorted ( const scalar dt, - cachedRandom& rndGen, - vector& pos1, + parcelType& p1, + parcelType& p2, scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const + scalar& m2 +) { bool coalescence = false; - vector vRel = U1 - U2; - scalar magVRel = mag(vRel); + const scalar sigma1 = p1.sigma(); + const scalar sigma2 = p2.sigma(); - scalar mdMin = m2/N2; + const scalar d1 = p1.d(); + const scalar d2 = p2.d(); - scalar mTot = m1 + m2; + const scalar T1 = p1.T(); + const scalar T2 = p2.T(); + + const scalar rho1 = p1.rho(); + const scalar rho2 = p2.rho(); - scalar gamma = d1/max(d2, 1.0e-12); - scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma; + const vector& U1 = p1.U(); + const vector& U2 = p2.U(); - vector momMax = m1*U1; - vector momMin = m2*U2; + const label& nP1 = p1.nParticle(); + const label& nP2 = p2.nParticle(); - // use mass-averaged temperature to calculate We number - scalar Tm = (T1*m1 + T2*m2)/mTot; - // interpolate the averaged surface tension - scalar sigma = sigma1 + (sigma2 - sigma1)*(Tm - T1)/(T2 - T1); + vector URel = U1 - U2; + scalar magURel = mag(URel); + + scalar mTot = m1 + m2; + + scalar gamma = d1/max(ROOTVSMALL, d2); + scalar f = pow3(gamma) + 2.7*gamma - 2.4*sqr(gamma); + + // mass-averaged temperature + scalar Tave = (T1*m1 + T2*m2)/mTot; + + // interpolate to find average surface tension + scalar sigmaAve = sigma1 + (sigma2 - sigma1)*(Tave - T1)/(T2 - T1); - sigma = max(1.0e-6, sigma); scalar Vtot = m1/rho1 + m2/rho2; - scalar rho = mTot/Vtot; + scalar rhoAve = mTot/Vtot; - scalar dMean = sqrt(d1*d2); - scalar WeColl = max(1.0e-12, 0.5*rho*magVRel*magVRel*dMean/sigma); + scalar dAve = sqrt(d1*d2); + scalar WeColl = 0.5*rhoAve*sqr(magURel)*dAve/max(ROOTVSMALL, sigmaAve); - scalar coalesceProb = min(1.0, 2.4*f/WeColl); + scalar coalesceProb = min(1.0, 2.4*f/max(ROOTVSMALL, WeColl)); - scalar prob = rndGen.sample01<scalar>(); + scalar prob = this->owner().rndGen().template sample01<scalar>(); // Coalescence if (prob < coalesceProb && coalescence_) { coalescence = true; - // How 'many' of the droplets coalesce - scalar nProb = prob*N2/N1; - // Conservation of mass, momentum and energy - scalar m2Org = m2; - scalar dm = N1*nProb*mdMin; - m2 -= dm; - scalar V2 = constant::mathematical::pi*pow3(d2)/6.0; - N2 = m2/(rho2*V2); + // number of the droplets that coalesce + scalar nProb = prob*nP2/nP1; + // conservation of mass, momentum and energy scalar m1Org = m1; + scalar m2Org = m2; + + scalar dm = nP1*nProb*m2/scalar(nP2); + m1 += dm; - T1 = (Tm*mTot - m2*T2)/m1; + m2 -= dm; + + p1.T() = (Tave*mTot - m2*T2)/m1; + + p1.U() = (m1*U1 + (1.0 - m2/m2Org)*m2*U2)/m1; - U1 =(momMax + (1.0 - m2/m2Org)*momMin)/m1; + p1.Y() = (m1Org*p1.Y() + dm*p2.Y())/m1; - // update the liquid mass fractions - Y1 = (m1Org*Y1 + dm*Y2)/m1; + p2.nParticle() = m2/(rho2*p2.volume()); } // Grazing collision (no coalescence) else @@ -271,28 +237,65 @@ bool Foam::ORourkeCollision<CloudType>::collideSorted // and these parcels should have coalesced gf = max(0.0, gf); - // gf -> 1 => v1p -> p1().U() ... - // gf -> 0 => v1p -> momentum/(m1+m2) + // gf -> 1 => v1p -> U1 ... + // gf -> 0 => v1p -> momentum/mTot vector mr = m1*U1 + m2*U2; - vector v1p = (mr + m2*gf*vRel)/(m1+m2); - vector v2p = (mr - m1*gf*vRel)/(m1+m2); + vector v1p = (mr + m2*gf*URel)/mTot; + vector v2p = (mr - m1*gf*URel)/mTot; - if (N1 < N2) + if (nP1 < nP2) { - U1 = v1p; - U2 = (N1*v2p + (N2-N1)*U2)/N2; + p1.U() = v1p; + p2.U() = (nP1*v2p + (nP2 - nP1)*U2)/nP2; } else { - U1 = (N2*v1p + (N1-N2)*U1)/N1; - U2 = v2p; + p1.U() = (nP2*v1p + (nP1 - nP2)*U1)/nP1; + p2.U() = v2p; } - } return coalescence; } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ORourkeCollision<CloudType>::ORourkeCollision +( + const dictionary& dict, + CloudType& owner, + const word& modelName +) +: + StochasticCollisionModel<CloudType>(dict, owner, modelName), + liquids_ + ( + owner.db().template lookupObject<SLGThermo>("SLGThermo").liquids() + ), + coalescence_(this->coeffDict().lookup("coalescence")) +{} + + +template<class CloudType> +Foam::ORourkeCollision<CloudType>::ORourkeCollision +( + const ORourkeCollision<CloudType>& cm +) +: + StochasticCollisionModel<CloudType>(cm), + liquids_(cm.liquids_), + coalescence_(cm.coalescence_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ORourkeCollision<CloudType>::~ORourkeCollision() +{} + + // ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H index 1a98c9e5f9b4650bc01c124f05a3d2bc069e1043..0e3381a9af40fb7443604f9acf641c5690afc665 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,13 +34,14 @@ Description #define ORourkeCollision_H #include "StochasticCollisionModel.H" +#include "liquidMixtureProperties.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class ORourkeCollision Declaration + Class ORourkeCollision Declaration \*---------------------------------------------------------------------------*/ template<class CloudType> @@ -48,10 +49,44 @@ class ORourkeCollision : public StochasticCollisionModel<CloudType> { -private: +protected: + + // Protected Data + + //- Convenience typedef to the cloud's parcel type + typedef typename CloudType::parcelType parcelType; + + const liquidMixtureProperties& liquids_; + + //- Coalescence activation switch + Switch coalescence_; + + + // Protected Member Functions + + //- Main collision routine + virtual void collide(const scalar dt); + + //- Collide parcels and return true if mass has changed + virtual bool collideParcels + ( + const scalar dt, + parcelType& p1, + parcelType& p2, + scalar& m1, + scalar& m2 + ); + + // 1 is the larger drop and 2 is the smaller + virtual bool collideSorted + ( + const scalar dt, + parcelType& p1, + parcelType& p2, + scalar& m1, + scalar& m2 + ); - dictionary coeffsDict_; - Switch coalescence_; public: @@ -62,7 +97,12 @@ public: // Constructors //- Construct from dictionary - ORourkeCollision(const dictionary& dict, CloudType& cloud); + ORourkeCollision + ( + const dictionary& dict, + CloudType& cloud, + const word& modelName = typeName + ); //- Construct copy ORourkeCollision(const ORourkeCollision<CloudType>& cm); @@ -79,67 +119,6 @@ public: //- Destructor virtual ~ORourkeCollision(); - - - // Member Functions - - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; - - - // 1 is the larger drop and 2 is the smaller - bool collideSorted - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; }; diff --git a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C index fa09dfc2ca9f162b01680ad292e91df74e70409c..4abc032432b2683f26988af4f2f3ce40f85e84c3 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C +++ b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C @@ -25,187 +25,96 @@ License #include "TrajectoryCollision.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::TrajectoryCollision<CloudType>::TrajectoryCollision -( - const dictionary& dict, - CloudType& owner -) -: - StochasticCollisionModel<CloudType>(dict, owner, typeName), - cSpace_(readScalar(this->coeffDict().lookup("cSpace"))), - cTime_(readScalar(this->coeffDict().lookup("cTime"))), - coalescence_(this->coeffDict().lookup("coalescence")) -{} - - -template<class CloudType> -Foam::TrajectoryCollision<CloudType>::TrajectoryCollision -( - const TrajectoryCollision<CloudType>& cm -) -: - StochasticCollisionModel<CloudType>(cm), - cSpace_(cm.cSpace_), - cTime_(cm.cTime_), - coalescence_(cm.coalescence_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // template<class CloudType> -Foam::TrajectoryCollision<CloudType>::~TrajectoryCollision() -{} - +void Foam::TrajectoryCollision<CloudType>::collide(const scalar dt) +{ + ORourkeCollision<CloudType>::collide(dt); +} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -bool Foam::TrajectoryCollision<CloudType>::update +bool Foam::TrajectoryCollision<CloudType>::collideParcels ( const scalar dt, - cachedRandom& rndGen, - vector& pos1, + parcelType& p1, + parcelType& p2, scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const + scalar& m2 +) { bool coalescence = false; - vector vRel = U1 - U2; + const vector& pos1 = p1.position(); + const vector& pos2 = p2.position(); + + const vector& U1 = p1.U(); + const vector& U2 = p2.U(); - vector p = pos2 - pos1; - scalar dist = mag(p); + vector URel = U1 - U2; - scalar vAlign = vRel & (p/(dist + SMALL)); + vector d = pos2 - pos1; + scalar magd = mag(d); + + scalar vAlign = URel & (d/(magd + ROOTVSMALL)); if (vAlign > 0) { + const scalar d1 = p1.d(); + const scalar d2 = p2.d(); + scalar sumD = d1 + d2; - if (vAlign*dt > dist - 0.5*sumD) + if (vAlign*dt > magd - 0.5*sumD) { - scalar v1Mag = mag(U1); - scalar v2Mag = mag(U2); - vector nv1 = U1/v1Mag; - vector nv2 = U2/v2Mag; + scalar magU1 = mag(U1) + ROOTVSMALL; + scalar magU2 = mag(U2) + ROOTVSMALL; + vector n1 = U1/magU1; + vector n2 = U2/magU2; - scalar v1v2 = nv1 & nv2; - scalar v1p = nv1 & p; - scalar v2p = nv2 & p; + scalar n1n2 = n1 & n2; + scalar n1d = n1 & d; + scalar n2d = n2 & d; - scalar det = 1.0 - v1v2*v1v2; + scalar det = 1.0 - sqr(n1n2); - scalar alpha = 1.0e+20; - scalar beta = 1.0e+20; + scalar alpha = GREAT; + scalar beta = GREAT; if (mag(det) > 1.0e-4) { - beta = -(v2p - v1v2*v1p)/det; - alpha = v1p + v1v2*beta; + beta = -(n2d - n1n2*n1d)/det; + alpha = n1d + n1n2*beta; } - alpha /= v1Mag*dt; - beta /= v2Mag*dt; + alpha /= magU1*dt; + beta /= magU2*dt; // is collision possible within this timestep - if ((alpha>0) && (alpha<1.0) && (beta>0) && (beta<1.0)) + if ((alpha > 0) && (alpha < 1.0) && (beta > 0) && (beta < 1.0)) { vector p1c = pos1 + alpha*U1*dt; vector p2c = pos2 + beta*U2*dt; - scalar closestDist = mag(p1c-p2c); + scalar closestDist = mag(p1c - p2c); scalar collProb = pow(0.5*sumD/max(0.5*sumD, closestDist), cSpace_) - * exp(-cTime_*mag(alpha-beta)); + *exp(-cTime_*mag(alpha - beta)); - scalar xx = rndGen.sample01<scalar>(); + scalar xx = this->owner().rndGen().template sample01<scalar>(); - // collision occur - if ((xx < collProb) && (m1 > VSMALL) && (m2 > VSMALL)) + // collision occurs + if (xx > collProb) { if (d1 > d2) { - coalescence = collideSorted - ( - dt, - rndGen, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj - ); + coalescence = this->collideSorted(dt, p1, p2, m1, m2); } else { - coalescence = collideSorted - ( - dt, - rndGen, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli - ); + coalescence = this->collideSorted(dt, p2, p1, m2, m1); } } } @@ -216,128 +125,38 @@ bool Foam::TrajectoryCollision<CloudType>::update } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + template<class CloudType> -bool Foam::TrajectoryCollision<CloudType>::collideSorted +Foam::TrajectoryCollision<CloudType>::TrajectoryCollision ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const -{ - bool coalescence = false; - - vector vRel = U1 - U2; - - scalar mdMin = m2/N2; - - scalar mTot = m1 + m2; - - scalar gamma = d1/max(d2, 1.0e-12); - scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma; - - vector momMax = m1*U1; - vector momMin = m2*U2; - - // use mass-averaged temperature to calculate We number - scalar Tm = (T1*m1 + T2*m2)/mTot; - - // and mass averaged fractions ... - //scalarField Yav((m1*Y1 + m2*Y2)/mTot; - - // interpolate the averaged surface tension - scalar sigma = sigma1 + (sigma2 - sigma1)*(Tm - T1)/(T2 - T1); - - sigma = max(1.0e-6, sigma); - scalar Vtot = m1/rho1 + m2/rho2; - scalar rho = mTot/Vtot; - - scalar dMean = sqrt(d1*d2); - scalar WeColl = max(1.0e-12, 0.5*rho*magSqr(vRel)*dMean/sigma); - - scalar coalesceProb = min(1.0, 2.4*f/WeColl); - - scalar prob = rndGen.sample01<scalar>(); - - // Coalescence - if ( prob < coalesceProb && coalescence_) - { - coalescence = true; - // How 'many' of the droplets coalesce - scalar nProb = prob*N2/N1; - - // Conservation of mass, momentum and energy - scalar m2Org = m2; - scalar dm = N1*nProb*mdMin; - m2 -= dm; - scalar V2 = constant::mathematical::pi*pow3(d2)/6.0; - N2 = m2/(rho2*V2); - - scalar m1Org = m1; - m1 += dm; - T1 = (Tm*mTot - m2*T2)/m1; - - U1 =(momMax + (1.0 - m2/m2Org)*momMin)/m1; - - // update the liquid mass fractions - Y1 = (m1Org*Y1 + dm*Y2)/m1; - } - // Grazing collision (no coalescence) - else - { - scalar gf = sqrt(prob) - sqrt(coalesceProb); - scalar denom = 1.0 - sqrt(coalesceProb); - if (denom < 1.0e-5) - { - denom = 1.0; - } - gf /= denom; + const dictionary& dict, + CloudType& owner +) +: + ORourkeCollision<CloudType>(dict, owner, typeName), + cSpace_(readScalar(this->coeffDict().lookup("cSpace"))), + cTime_(readScalar(this->coeffDict().lookup("cTime"))) +{} - // if gf negative, this means that coalescence is turned off - // and these parcels should have coalesced - gf = max(0.0, gf); - // gf -> 1 => v1p -> p1().U() ... - // gf -> 0 => v1p -> momentum/(m1 + m2) +template<class CloudType> +Foam::TrajectoryCollision<CloudType>::TrajectoryCollision +( + const TrajectoryCollision<CloudType>& cm +) +: + ORourkeCollision<CloudType>(cm), + cSpace_(cm.cSpace_), + cTime_(cm.cTime_) +{} - vector mr = m1*U1 + m2*U2; - vector v1p = (mr + m2*gf*vRel)/(m1 + m2); - vector v2p = (mr - m1*gf*vRel)/(m1 + m2); - if (N1 < N2) - { - U1 = v1p; - U2 = (N1*v2p + (N2 - N1)*U2)/N2; - } - else - { - U1 = (N2*v1p + (N1 - N2)*U1)/N1; - U2 = v2p; - } - } +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - return coalescence; -} +template<class CloudType> +Foam::TrajectoryCollision<CloudType>::~TrajectoryCollision() +{} // ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H index 979d84b49004f08556385258c39a9b3a3b1cc07e..ebd23198a06b5d7969c55afbb144c35889b272bc 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H +++ b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,35 +25,57 @@ Class Foam::TrajectoryCollision Description - Trajectory collision model by N. Nordin. + Trajectory collision model by N. Nordin, based on O'Rourke's collision + model \*---------------------------------------------------------------------------*/ #ifndef TrajectoryCollision_H #define TrajectoryCollision_H -#include "StochasticCollisionModel.H" +#include "ORourkeCollision.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class TrajectoryCollision Declaration + Class TrajectoryCollision Declaration \*---------------------------------------------------------------------------*/ template<class CloudType> class TrajectoryCollision : - public StochasticCollisionModel<CloudType> + public ORourkeCollision<CloudType> { -private: +protected: - // Private data + // Protected Data + //- Convenience typedef to the cloud's parcel type + typedef typename CloudType::parcelType parcelType; + + //- Space coefficient scalar cSpace_; + + //- Time coefficient scalar cTime_; - Switch coalescence_; + + + // Protected Member Functions + + //- Main collision routine + virtual void collide(const scalar dt); + + //- Collide parcels and return true if mass has changed + virtual bool collideParcels + ( + const scalar dt, + parcelType& p1, + parcelType& p2, + scalar& m1, + scalar& m2 + ); public: @@ -82,66 +104,6 @@ public: //- Destructor virtual ~TrajectoryCollision(); - - - // Member Functions - - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; - - // 1 is the larger drop and 2 is the smaller - bool collideSorted - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; }; diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 0178c1387537fa855195bb85a802a52784b57099..4c262bd132049c99532332526fc94d9e4c059e80 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -918,7 +918,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface << " coordinate:" << localPoints[pointI] << " did not find any surface within:" << minSnapDist[pointI] - << " meter." << endl; + << " metre." << endl; } } diff --git a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C index 9c8f08630f189deeda3eacee7cc520896c58f7c0..f3d969e69113b09948af15f631a9c8f1672ad404 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C +++ b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C @@ -133,7 +133,7 @@ void Foam::refinementFeatures::read { Info<< " level " << levels_[featI][j] << " for all cells within " << distances_[featI][j] - << " meter." << endl; + << " metre." << endl; } } } diff --git a/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C index a7a44f3fbfb388de08469b2a80f6616d4b31c685..8de805a692817c3ffff4f47b449190fd9a407ef6 100644 --- a/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C @@ -119,7 +119,7 @@ void Foam::shellSurfaces::setAndCheckLevels { Info<< " level " << levels_[shellI][j] << " for all cells within " << distances_[shellI][j] - << " meter." << endl; + << " metre." << endl; } } else diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H index 0188d28dca533568885987e9b2535457a2131444..e3a6619ce9a377d53ed71395ef94cb88ea36a875 100644 --- a/src/mesh/blockMesh/blockMesh/blockMesh.H +++ b/src/mesh/blockMesh/blockMesh/blockMesh.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ class blockMesh //- The list of curved edges curvedEdgeList edges_; - //- The scaling factor to convert to meters + //- The scaling factor to convert to metres scalar scaleFactor_; //- The blocks themselves (the topology) as a polyMesh @@ -171,7 +171,7 @@ public: return edges_; } - //- The scaling factor used to convert to meters + //- The scaling factor used to convert to metres scalar scaleFactor() const; //- The points for the entire mesh diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index f37d7ae2bdc2f6240f9149b2864ccce8c6b815e7..8bc8b86d2ec8c601338af8226ccb3d2dcf1b6b8b 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -190,12 +190,13 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights wghtSum.setSize(wght.size()); forAll(wght, faceI) { - scalar s = sum(wght[faceI]); + scalarList& w = wght[faceI]; + scalar s = sum(w); scalar t = s/patchAreas[faceI]; - forAll(addr[faceI], i) + forAll(w, i) { - wght[faceI][i] /= s; + w[i] /= s; } wghtSum[faceI] = t; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C index 9c145081342bd8b36d0e3cf4a5a9d9b26ce89d03..b5ab236b92976c10123e30428dd7eef618904fc4 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C @@ -268,7 +268,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces ) const { const labelList& nbrFaces = patch.faceFaces()[faceI]; - const pointField& tgtPoints = patch.points(); + const pointField& points = patch.points(); // filter out faces already visited from src face neighbours forAll(nbrFaces, i) @@ -298,14 +298,13 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces if (valid) { - const face& myn = patch[faceI]; - const face& nbrn = patch[nbrFaceI]; - const vector& nbrNormal = nbrn.normal(tgtPoints); - const vector& mynNormal = myn.normal(tgtPoints); + const face& f = patch[faceI]; + const face& nbrF = patch[nbrFaceI]; + const vector& n = f.normal(points); + const vector& nbrN = nbrF.normal(points); + scalar cosI = mag(nbrN & n); - scalar cosI = nbrNormal & mynNormal; - - if (cosI > Foam::cos(degToRad(89.0))) + if (cosI < Foam::cos(degToRad(89.0))) { faceIDs.append(nbrFaceI); } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C index 820d3f22fcbf69142e69732d49503bdf75a2b854..ab47c3afb4d4cfab76f6e9233c12e3d5f9483016 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -67,7 +67,7 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace visitedFaces.append(tgtFaceI); scalar area = interArea(srcFaceI, tgtFaceI); - // store when intersection area > 0 + // store when intersection fractional area > tolerance if (area/this->srcMagSf_[srcFaceI] > faceAreaIntersect::tolerance()) { srcAddr[srcFaceI].append(tgtFaceI); @@ -227,12 +227,9 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea const face& tgt = this->tgtPatch_[tgtFaceI]; // quick reject if either face has zero area - // Note: do not used stored face areas for target patch + // Note: do not use stored face areas for target patch const scalar tgtMag = tgt.mag(tgtPoints); - if - ( - (this->srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgtMag < ROOTVSMALL) - ) + if ((this->srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgtMag < ROOTVSMALL)) { return 0.0; } diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H index c169a98ca16106a7515fed0212aeab7b218b4347..1344cda2d9ed5fc4da35dcea0e3ca7a57e1284e2 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.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 @@ -65,7 +65,7 @@ private: // Private Member Data - //- gap size in meter + //- gap size in metre const scalar gap_; //- Underlying geometry (size 1) diff --git a/src/meshTools/sets/topoSets/topoSet.C b/src/meshTools/sets/topoSets/topoSet.C index 561d9fbe46c3958de7ef911258ce58f0fd7b30bf..37fe9a0595883afdd500942c603056dcc7f39812 100644 --- a/src/meshTools/sets/topoSets/topoSet.C +++ b/src/meshTools/sets/topoSets/topoSet.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 @@ -269,7 +269,7 @@ void Foam::topoSet::writeDebug boundBox bb(pointField(coords, toc()), true); os << "Set bounding box: min = " - << bb.min() << " max = " << bb.max() << " meters. " << endl << endl; + << bb.min() << " max = " << bb.max() << " metres. " << endl << endl; label n = 0; diff --git a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C index c284e2c0426ad64411726c2f67e8a6dcf7be2240..a4a7941055f00c0979cdac95bdfc29cbafa73a06 100644 --- a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C +++ b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.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 @@ -297,4 +297,3 @@ void Foam::calcTypes::addSubtract::calc // ************************************************************************* // - diff --git a/src/postProcessing/foamCalcFunctions/basic/addSubtract/writeAddSubtractField.C b/src/postProcessing/foamCalcFunctions/basic/addSubtract/writeAddSubtractField.C index e069cd1fc08abf8856c3cc038d76eaad704c816d..8304569ae4a65ed496f242a024158e7eccafe244 100644 --- a/src/postProcessing/foamCalcFunctions/basic/addSubtract/writeAddSubtractField.C +++ b/src/postProcessing/foamCalcFunctions/basic/addSubtract/writeAddSubtractField.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 @@ -72,7 +72,9 @@ void Foam::calcTypes::addSubtract::writeAddSubtractField mesh, IOobject::NO_READ ), - calcMode_ == ADD ? baseField + addField : baseField - addField + calcMode_ == ADD + ? (baseField + addField)() + : (baseField - addField)() ); newField.write(); } diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C index 9f3674700cd958090647ac3be3c7cfe7847304c0..2a43bb7ba2f2a54d8cd9f4df5e64934c60bd310a 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C @@ -38,6 +38,16 @@ namespace Foam // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +bool Foam::directMethod::intersect +( + const label srcCellI, + const label tgtCellI +) const +{ + return tgt_.pointInCell(src_.cellCentres()[srcCellI], tgtCellI); +} + + bool Foam::directMethod::findInitialSeeds ( const labelList& srcCellIDs, diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H index 1c9f489a83c3fc8f19fb6db0757bb0c00d361c31..2effe6d2b0baf7faa420fc2bbf913e82d89285fa 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H @@ -56,9 +56,16 @@ protected: // Protected Member Functions + //- Return the true if cells intersect + virtual bool intersect + ( + const label srcCellI, + const label tgtCellI + ) const; + //- Find indices of overlapping cells in src and tgt meshes - returns // true if found a matching pair - bool findInitialSeeds + virtual bool findInitialSeeds ( const labelList& srcCellIDs, const boolList& mapFlag, @@ -68,7 +75,7 @@ protected: ) const; //- Calculate the mesh-to-mesh addressing and weights - void calculateAddressing + virtual void calculateAddressing ( labelListList& srcToTgtCellAddr, scalarListList& srcToTgtCellWght, @@ -82,7 +89,7 @@ protected: ); //- Append to list of src mesh seed indices - void appendToDirectSeeds + virtual void appendToDirectSeeds ( boolList& mapFlag, labelList& srcTgtSeed, diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H index 813c46683ff5671e27ac3fd0bd3f6e44914e70a1..5ba76a30703e4557b5fc134394ed0b5d6e031442 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H @@ -58,7 +58,7 @@ protected: //- Find indices of overlapping cells in src and tgt meshes - returns // true if found a matching pair - bool findInitialSeeds + virtual bool findInitialSeeds ( const labelList& srcCellIDs, const boolList& mapFlag, @@ -68,7 +68,7 @@ protected: ) const; //- Calculate the mesh-to-mesh addressing and weights - void calculateAddressing + virtual void calculateAddressing ( labelListList& srcToTgtCellAddr, scalarListList& srcToTgtCellWght, @@ -82,7 +82,7 @@ protected: ); //- Find the nearest cell on mesh2 for cell1 on mesh1 - void findNearestCell + virtual void findNearestCell ( const polyMesh& mesh1, const polyMesh& mesh2, @@ -91,7 +91,7 @@ protected: ) const; //- Set the next cells for the marching front algorithm - void setNextNearestCells + virtual void setNextNearestCells ( label& startSeedI, label& srcCellI, @@ -101,7 +101,7 @@ protected: ) const; //- Find a source cell mapped to target cell tgtCellI - label findMappedSrcCell + virtual label findMappedSrcCell ( const label tgtCellI, const List<DynamicList<label> >& tgtToSrc diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H index 3338fa5349569629ec72684a0304702c7323661e..cf3e693f8bdad435548948db64e2128097d893b8 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H @@ -72,13 +72,21 @@ protected: labelList maskCells() const; //- Return the true if cells intersect - bool intersect(const label srcCellI, const label tgtCellI) const; + virtual bool intersect + ( + const label srcCellI, + const label tgtCellI + ) const; //- Return the intersection volume between two cells - scalar interVol(const label srcCellI, const label tgtCellI) const; + virtual scalar interVol + ( + const label srcCellI, + const label tgtCellI + ) const; //- Append target cell neihgbour cells to cellIDs list - void appendNbrCells + virtual void appendNbrCells ( const label tgtCellI, const polyMesh& mesh, @@ -86,7 +94,7 @@ protected: DynamicList<label>& nbrTgtCellIDs ) const; - bool initialise + virtual bool initialise ( labelListList& srcToTgtAddr, scalarListList& srcToTgtWght, diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C index 27f0bd592c34f61382989fa2fd517f7b77f61f08..48ac3f4aabd0c788960c5e86e8f5e78609f18ae4 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C @@ -93,7 +93,6 @@ Foam::labelList Foam::meshToMeshNew::maskCells void Foam::meshToMeshNew::normaliseWeights ( const word& descriptor, - const scalarField& cellVolumes, const labelListList& addr, scalarListList& wght ) const @@ -102,27 +101,18 @@ void Foam::meshToMeshNew::normaliseWeights if (nCell > 0) { - scalar minW = GREAT; - scalar maxW = -GREAT; - forAll(wght, cellI) { scalarList& w = wght[cellI]; scalar s = sum(w); - scalar Vc = cellVolumes[cellI]; forAll(w, i) { - w[i] /= Vc; + // note: normalise by s instead of cell volume since + // 1-to-1 methods duplicate contributions in parallel + w[i] /= s; } - - minW = min(minW, s/Vc); - maxW = max(maxW, s/Vc); } - - Info<< " " << descriptor << " weights min/max = " - << returnReduce(minW, minOp<scalar>()) << ", " - << returnReduce(maxW, maxOp<scalar>()) << endl; } } @@ -303,7 +293,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "source", - srcRegion_.cellVolumes(), srcToTgtCellAddr_, srcToTgtCellWght_ ); @@ -311,7 +300,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "target", - tgtRegion_.cellVolumes(), tgtToSrcCellAddr_, tgtToSrcCellWght_ ); @@ -337,7 +325,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "source", - srcRegion_.cellVolumes(), srcToTgtCellAddr_, srcToTgtCellWght_ ); @@ -345,7 +332,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "target", - tgtRegion_.cellVolumes(), tgtToSrcCellAddr_, tgtToSrcCellWght_ ); @@ -461,6 +447,7 @@ Foam::meshToMeshNew::meshToMeshNew srcPatchID_(), tgtPatchID_(), patchAMIs_(), + cuttingPatches_(), srcToTgtCellAddr_(), tgtToSrcCellAddr_(), srcToTgtCellWght_(), @@ -476,34 +463,42 @@ Foam::meshToMeshNew::meshToMeshNew const polyBoundaryMesh& srcBM = src.boundaryMesh(); const polyBoundaryMesh& tgtBM = tgt.boundaryMesh(); - if (srcBM.size() != tgtBM.size()) - { - FatalErrorIn - ( - "Foam::meshToMeshNew::meshToMeshNew" - "(" - "const polyMesh&, " - "const polyMesh&, " - "const interpolationMethod&" - ")" - ) << "Source and target meshes are dissimiar:" << nl - << " Source patches: " << srcBM.size() << nl - << " Target patches: " << tgtBM.size() << exit(FatalError); - } - - DynamicList<label> patchID(src.boundaryMesh().size()); - + DynamicList<label> srcPatchID(src.boundaryMesh().size()); + DynamicList<label> tgtPatchID(tgt.boundaryMesh().size()); forAll(srcBM, patchI) { const polyPatch& pp = srcBM[patchI]; if (!polyPatch::constraintType(pp.type())) { - patchID.append(pp.index()); + srcPatchID.append(pp.index()); + + label tgtPatchI = tgt.boundaryMesh().findPatchID(pp.name()); + + if (tgtPatchI != -1) + { + tgtPatchID.append(tgtPatchI); + } + else + { + FatalErrorIn + ( + "Foam::meshToMeshNew::meshToMeshNew" + "(" + "const polyMesh&, " + "const polyMesh&, " + "const interpolationMethod&, " + "bool" + ")" + ) << "Source patch " << pp.name() + << " not found in target mesh. " + << "Available target patches are " << tgtBM.names() + << exit(FatalError); + } } } - srcPatchID_.transfer(patchID); - tgtPatchID_ = srcPatchID_; + srcPatchID_.transfer(srcPatchID); + tgtPatchID_.transfer(tgtPatchID); } // calculate volume addressing and weights @@ -519,7 +514,8 @@ Foam::meshToMeshNew::meshToMeshNew const polyMesh& src, const polyMesh& tgt, const interpolationMethod& method, - const HashTable<word>& patchMap + const HashTable<word>& patchMap, + const wordList& cuttingPatches ) : srcRegion_(src), @@ -527,6 +523,7 @@ Foam::meshToMeshNew::meshToMeshNew srcPatchID_(), tgtPatchID_(), patchAMIs_(), + cuttingPatches_(), srcToTgtCellAddr_(), tgtToSrcCellAddr_(), srcToTgtCellWght_(), @@ -559,6 +556,14 @@ Foam::meshToMeshNew::meshToMeshNew // calculate patch addressing and weights (void)patchAMIs(); + + // set IDs of cutting patches on target mesh + cuttingPatches_.setSize(cuttingPatches.size()); + forAll(cuttingPatches_, i) + { + const word& patchName = cuttingPatches[i]; + cuttingPatches_[i] = tgt.boundaryMesh().findPatchID(patchName); + } } diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H index ab05a058ae98b7b1efab12e8cf215625bfed3c75..3437bf48efa4cfa1262376695e12269be42f51e2 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H @@ -94,6 +94,9 @@ private: //- List of AMIs between source and target patches mutable PtrList<AMIPatchToPatchInterpolation> patchAMIs_; + //- Cutting patches whose values are set using a zero-gradient condition + List<label> cuttingPatches_; + //- Source to target cell addressing labelListList srcToTgtCellAddr_; @@ -136,7 +139,6 @@ private: void normaliseWeights ( const word& descriptor, - const scalarField& cellVolumes, const labelListList& addr, scalarListList& wght ) const; @@ -242,7 +244,8 @@ public: const polyMesh& src, const polyMesh& tgt, const interpolationMethod& method, - const HashTable<word>& patchMap + const HashTable<word>& patchMap, + const wordList& cuttingPatches ); diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C index dde5218fd485f78e852cde335dafb752eba8082a..4e5fd14435966a90fae081712eebddddc02841ea 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C @@ -336,9 +336,6 @@ void Foam::meshToMeshNew::mapSrcToTgt GeometricField<Type, fvPatchField, volMesh>& result ) const { - // clear any previously stored values - - mapSrcToTgt(field, cop, result.internalField()); const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs(); @@ -360,6 +357,13 @@ void Foam::meshToMeshNew::mapSrcToTgt tgtField ); } + + forAll(cuttingPatches_, i) + { + label patchI = cuttingPatches_[i]; + fvPatchField<Type>& pf = result.boundaryField()[patchI]; + pf == pf.patchInternalField(); + } } @@ -466,6 +470,13 @@ void Foam::meshToMeshNew::mapTgtToSrc srcField ); } + + forAll(cuttingPatches_, i) + { + label patchI = cuttingPatches_[i]; + fvPatchField<Type>& pf = result.boundaryField()[patchI]; + pf == pf.patchInternalField(); + } } diff --git a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.C b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.C index 730dbe5ec475eb2cf514fa199f01637531d8fd0a..0f2213b686b665a9e8ae8e09331e1c3129f895c8 100644 --- a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.C +++ b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.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 @@ -52,7 +52,7 @@ Foam::viscosityModels::BirdCarreau::calcNu() const return nuInf_ + (nu0_ - nuInf_) - *pow(scalar(1) + sqr(k_*strainRate()), (n_ - 1.0)/2.0); + *pow(scalar(1) + pow(k_*strainRate(), a_), (n_ - 1.0)/a_); } @@ -72,6 +72,14 @@ Foam::viscosityModels::BirdCarreau::BirdCarreau nuInf_(BirdCarreauCoeffs_.lookup("nuInf")), k_(BirdCarreauCoeffs_.lookup("k")), n_(BirdCarreauCoeffs_.lookup("n")), + a_ + ( + BirdCarreauCoeffs_.lookupOrDefault + ( + "a", + dimensionedScalar("a", dimless, 2) + ) + ), nu_ ( IOobject @@ -102,6 +110,11 @@ bool Foam::viscosityModels::BirdCarreau::read BirdCarreauCoeffs_.lookup("nuInf") >> nuInf_; BirdCarreauCoeffs_.lookup("k") >> k_; BirdCarreauCoeffs_.lookup("n") >> n_; + a_ = BirdCarreauCoeffs_.lookupOrDefault + ( + "a", + dimensionedScalar("a", dimless, 2) + ); return true; } diff --git a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.H b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.H index 14589cae12a1efe6bb971fff3c1070aef8028da7..e235041087b3129b6e2504efa5c9312324804d98 100644 --- a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.H +++ b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,9 @@ Class Description An incompressible Bird-Carreau non-Newtonian viscosity model. + The Bird-Carreau-Yasuda form is also supported if the optional "a" + coefficient is specified. "a" defaults to 2 for the Bird-Carreau model. + SourceFiles BirdCarreau.C @@ -62,6 +65,7 @@ class BirdCarreau dimensionedScalar nuInf_; dimensionedScalar k_; dimensionedScalar n_; + dimensionedScalar a_; volScalarField nu_; diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index 63a1340ee92ddf3fa3dab052365f2e35bcfa3ee4..cfa20630aed40bb294fb050a4e4091bb61b41b39 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.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 @@ -159,7 +159,7 @@ Foam::interfaceProperties::interfaceProperties ( readScalar ( - alpha1.mesh().solutionDict().subDict("PIMPLE").lookup("cAlpha") + alpha1.mesh().solverDict(alpha1.name()).lookup("cAlpha") ) ), sigma_(dict.lookup("sigma")), diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 05370cbc441a7134731e0905c6aaa8b20168e332..e39162f58569b1d5762e884a24322672e01891e1 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -51,6 +51,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(true), thickness_(p.size()), Qs_(p.size()), + solidDict_(), solidPtr_(NULL) {} @@ -70,6 +71,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} @@ -88,6 +90,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(readBool(dict.lookup("baffleActivated"))), thickness_(scalarField("thickness", dict, p.size())), Qs_(scalarField("Qs", dict, p.size())), + solidDict_(dict), solidPtr_(new solidType(dict)) { if (!isA<mappedPatchBase>(this->patch().patch())) @@ -141,6 +144,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} @@ -158,12 +162,28 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class solidType> +const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solidPtr() const +{ + if (!solidPtr_.empty()) + { + return solidPtr_(); + } + else + { + solidPtr_.reset(new solidType(solidDict_)); + return solidPtr_(); + } +} + + template<class solidType> void thermalBaffle1DFvPatchScalarField<solidType>::autoMap ( @@ -171,6 +191,8 @@ void thermalBaffle1DFvPatchScalarField<solidType>::autoMap ) { mixedFvPatchScalarField::autoMap(m); + thickness_.autoMap(m); + Qs_.autoMap(m); } template<class solidType> @@ -181,6 +203,12 @@ void thermalBaffle1DFvPatchScalarField<solidType>::rmap ) { mixedFvPatchScalarField::rmap(ptf, addr); + + const thermalBaffle1DFvPatchScalarField& tiptf = + refCast<const thermalBaffle1DFvPatchScalarField>(ptf); + + thickness_.rmap(tiptf.thickness_, addr); + Qs_.rmap(tiptf.Qs_, addr); } @@ -264,7 +292,7 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs() forAll(KDeltaw, i) { KDeltaw[i] = - solidPtr_().kappa(0.0, (Tp[i] + nbrTw[i])/2.0)/thickness_[i]; + solidPtr().kappa(0.0, (Tp[i] + nbrTw[i])/2.0)/thickness_[i]; } const scalarField q @@ -338,8 +366,7 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs() } template<class solidType> -void thermalBaffle1DFvPatchScalarField<solidType>:: -write(Ostream& os) const +void thermalBaffle1DFvPatchScalarField<solidType>:: write(Ostream& os) const { mixedFvPatchScalarField::write(os); os.writeKeyword("TName") @@ -348,7 +375,7 @@ write(Ostream& os) const os.writeKeyword("baffleActivated") << baffleActivated_ << token::END_STATEMENT << nl; Qs_.writeEntry("Qs", os); - solidPtr_->write(os); + solidPtr().write(os); } diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H index c2b209cb16421226b0907bbf8b881445a907dca3..399e80062a0c9de9daa571abc0fc30e7cf33e24c 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H @@ -70,8 +70,17 @@ class thermalBaffle1DFvPatchScalarField //- Superficial heat source [W/m2] scalarField Qs_; - // Solid thermo - autoPtr<solidType> solidPtr_; + //- Solid dictionary + dictionary solidDict_; + + //- Solid thermo + mutable autoPtr<solidType> solidPtr_; + + + // Private members + + //- Return non const solid thermo autoMap + const solidType& solidPtr() const; public: @@ -144,6 +153,7 @@ public: // Member functions + // Mapping functions //- Map (and resize as needed) from self given a mapping object @@ -160,6 +170,8 @@ public: ); + + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H index a0c703dd1cc555d600b628b6744749e3c805d010..533b063750c6bdce678f5645363c0421b149bf50 100644 --- a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H +++ b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H @@ -49,7 +49,7 @@ Description d/dt(fmm) + div(U*fmm) = - (1/T)*(M && M - flm) + (1/T)*(M && M - fmm) where diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties index 91b20eee70e0e31a2b2c602b95ecd7581809aa31..1de9320ac1ad84e40ae98d77419d38d6289d429e 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties @@ -89,6 +89,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties index 91b20eee70e0e31a2b2c602b95ecd7581809aa31..1de9320ac1ad84e40ae98d77419d38d6289d429e 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties @@ -89,6 +89,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties index 91b20eee70e0e31a2b2c602b95ecd7581809aa31..1de9320ac1ad84e40ae98d77419d38d6289d429e 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties @@ -89,6 +89,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index aa8b02241a5b7ed42e112ad151f2340bb5ea59db..6b759cd17e3e038b3f29bdac510f4dc3b72e4621 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -144,6 +144,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties index bc122d0a3791682a799e6ab51be69453dafc5428..77742fd0180b23d33f2337fd6a4d93a8d5711ddb 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties @@ -117,6 +117,8 @@ subModels devolatilisationModel constantRateDevolatilisation; + stochasticCollisionModel none; + surfaceReactionModel COxidationKineticDiffusionLimitedRate; surfaceFilmModel none; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties index 0517933f4d4b7470debddaedb58196a8662a04ad..1177f8fc321c5ec9277ae8a9816a8150dedf3f33 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties @@ -104,6 +104,8 @@ subModels heatTransferModel RanzMarshall; + stochasticCollisionModel none; + surfaceFilmModel none; radiation on; diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties index 36014706556c8524d4ff3e3ab9b26cfb0c95518d..20eed6f6e0e785cd4e37eeb988c69c98396ada00 100644 --- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties +++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties @@ -70,6 +70,8 @@ subModels heatTransferModel none; + stochasticCollisionModel none; + surfaceFilmModel none; collisionModel pairCollision; diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties index fbd8c9f174c499ac0d2829f7e958bc6ae1702691..b24dcb63b23eba2f077124ac95e021fd7d0744a8 100644 --- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties +++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties @@ -80,6 +80,8 @@ subModels heatTransferModel none; + stochasticCollisionModel none; + surfaceFilmModel none; collisionModel pairCollision; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties index 68e6be961fcf77de5a29026e74b7ae2c5f7d9773..45ae8875b737fc122940315d9d3ff594744a9512 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties @@ -101,6 +101,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties index a4d326c0411c0f9831860b14739a1294fa5cac6d..fb559463aade92aabea4545fd8a48dde00ba5646 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties @@ -123,6 +123,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties index b59b42445e9092a2997977b7433fd3d158f968d4..c25468b554f13ea9ffe18c18a972fb1a5538385a 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties @@ -101,6 +101,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties index cb6c2dd3becd14a73d94c1392f5671307b8e7898..5a1582cead67ec7a347edce8a3fc920e365ef92b 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties @@ -110,6 +110,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties index 56b0a2d3e7c473f1316a983cbfa0e1aed79c467d..478bbe13595bf8beb9ee5c04f6b1970a70f44ce7 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties @@ -118,6 +118,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index b4d1d9abdf50879e95417c9dbe5aac5e873ca786..47cd1a3bb693eec15eb18a46377e26275325fa76 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -139,6 +139,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index aa8b02241a5b7ed42e112ad151f2340bb5ea59db..6b759cd17e3e038b3f29bdac510f4dc3b72e4621 100644 --- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -144,6 +144,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties index 0ce1e3bbc8a22230ffde01e1393f55c4e6c05deb..dc08a39d09b9ecbab2837cc9282400335c5b5ef0 100644 --- a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties @@ -161,14 +161,14 @@ subModels phaseChangeModel liquidEvaporationBoil; + stochasticCollisionModel none; + surfaceFilmModel none; atomizationModel none; breakupModel ReitzDiwakar; // ReitzKHRT; - stochasticCollisionModel none; - radiation off; standardWallInteractionCoeffs diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution index a2906e9722b1ed3183c4eb5484fd25c103863e38..e0cc208e4ef5f8e59ae5a5ce3a4871e631eb1303 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution @@ -17,6 +17,12 @@ FoamFile solvers { + alpha1 + { + nAlphaCorr 1; + nAlphaSubCycles 2; + } + p { solver GAMG; @@ -90,11 +96,9 @@ solvers PIMPLE { - nOuterCorrectors 3; - nCorrectors 1; + nOuterCorrectors 1; + nCorrectors 3; nNonOrthogonalCorrectors 0; - nAlphaCorr 1; - nAlphaSubCycles 2; } relaxationFactors diff --git a/tutorials/multiphase/interFoam/laminar/capillaryRise/system/fvSolution b/tutorials/multiphase/interFoam/laminar/capillaryRise/system/fvSolution index 569a58a3403abae5f9073d2d6bc8a4f507530857..6bea5720564eeb6cd3d9694e2caf5caa5f566c0a 100644 --- a/tutorials/multiphase/interFoam/laminar/capillaryRise/system/fvSolution +++ b/tutorials/multiphase/interFoam/laminar/capillaryRise/system/fvSolution @@ -17,6 +17,13 @@ FoamFile solvers { + alpha1 + { + nAlphaCorr 1; + nAlphaSubCycles 2; + cAlpha 1; + } + pcorr { solver PCG; @@ -54,9 +61,6 @@ PIMPLE momentumPredictor no; nCorrectors 3; nNonOrthogonalCorrectors 0; - nAlphaCorr 1; - nAlphaSubCycles 2; - cAlpha 1; } diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution b/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution index 569a58a3403abae5f9073d2d6bc8a4f507530857..6bea5720564eeb6cd3d9694e2caf5caa5f566c0a 100644 --- a/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution +++ b/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution @@ -17,6 +17,13 @@ FoamFile solvers { + alpha1 + { + nAlphaCorr 1; + nAlphaSubCycles 2; + cAlpha 1; + } + pcorr { solver PCG; @@ -54,9 +61,6 @@ PIMPLE momentumPredictor no; nCorrectors 3; nNonOrthogonalCorrectors 0; - nAlphaCorr 1; - nAlphaSubCycles 2; - cAlpha 1; } diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution index d4ae062a470951edde85acbefaecfd94e98dacbc..235c7014d026ce19570cd1470824b2fdf1bdfcb6 100644 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/system/fvSolution @@ -19,6 +19,10 @@ solvers { "alpha." { + nAlphaCorr 1; + nAlphaSubCycles 2; + cAlpha 1; + solver smoothSolver; smoother GaussSeidel; tolerance 1e-06; @@ -64,9 +68,6 @@ PIMPLE momentumPredictor no; nCorrectors 3; nNonOrthogonalCorrectors 0; - nAlphaCorr 1; - nAlphaSubCycles 2; - cAlpha 1; } diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict index f190eaf2ff82595058739bfa82a38aed4bc8ba1f..d1a8467089474642d52441dad9ba86ce154c204c 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict @@ -14,37 +14,37 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application interPhaseChangeFoam; +application interPhaseChangeFoam; -startFrom latestTime; +startFrom latestTime; -startTime 0; +startTime 0; -stopAt endTime; +stopAt endTime; -endTime 0.05; +endTime 0.05; -deltaT 1e-8; +deltaT 1e-8; -writeControl adjustableRunTime; +writeControl adjustableRunTime; -writeInterval 0.001; +writeInterval 0.001; -purgeWrite 0; +purgeWrite 0; -writeFormat ascii; +writeFormat ascii; -writePrecision 6; +writePrecision 6; -writeCompression uncompressed; +writeCompression uncompressed; -timeFormat general; +timeFormat general; -runTimeModifiable yes; +runTimeModifiable yes; -adjustTimeStep on; +adjustTimeStep on; -maxCo 1.0; +maxCo 5; // ************************************************************************* // diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes index 9143f603f4b73ec4b100fd003d242e65af899c57..8ddd1fe903d3c4bd9293c1afe4e9dbafb8a8ffd5 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes @@ -32,6 +32,7 @@ divSchemes div(phi,k) Gauss linearUpwind grad(k); div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; + UD Gauss upwind; div((muEff*dev(T(grad(U))))) Gauss linear; } @@ -47,10 +48,7 @@ laplacianSchemes snGradSchemes { - default none; - snGrad(pd) limited corrected 0.5; - snGrad(rho) limited corrected 0.5; - snGrad(alpha1) limited corrected 0.5; + default limited corrected 0.5; } fluxRequired diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution index bfbd5df2715b0f33a0bb2b07e93fcc83523c550a..a1f8f8ffd5e3c2376a31e3a25f9f49fe036cfd3d 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution @@ -18,22 +18,24 @@ solvers { alpha1 { - maxUnboundedness 1e-5; - CoCoeff 2; - maxIter 5; - nLimiterIter 2; + cAlpha 0; + nAlphaCorr 2; + nAlphaSubCycles 1; - solver PBiCG; - preconditioner DILU; - tolerance 1e-12; - relTol 0.1; + MULESCorr yes; + nLimiterIter 5; + + solver PBiCG; + preconditioner DILU; + tolerance 1e-8; + relTol 0; }; - U + "U.*" { solver PBiCG; preconditioner DILU; - tolerance 1e-06; + tolerance 1e-6; relTol 0; }; @@ -96,10 +98,6 @@ PIMPLE nOuterCorrectors 1; nCorrectors 3; nNonOrthogonalCorrectors 0; - - cAlpha 0; - nAlphaCorr 1; - nAlphaSubCycles 1; } diff --git a/wmake/rules/linux64Gcc48/c b/wmake/rules/linux64Gcc48/c new file mode 100644 index 0000000000000000000000000000000000000000..f4114be3143d1210ffea500a2b361008910abed0 --- /dev/null +++ b/wmake/rules/linux64Gcc48/c @@ -0,0 +1,16 @@ +.SUFFIXES: .c .h + +cWARN = -Wall + +cc = gcc -m64 + +include $(RULES)/c$(WM_COMPILE_OPTION) + +cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC + +ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ + +LINK_LIBS = $(cDBUG) + +LINKLIBSO = $(cc) -shared +LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linux64Gcc48/c++ b/wmake/rules/linux64Gcc48/c++ new file mode 100644 index 0000000000000000000000000000000000000000..98b25ed1fea2a1baa0ad749c09a76bd877ea4a6d --- /dev/null +++ b/wmake/rules/linux64Gcc48/c++ @@ -0,0 +1,21 @@ +.SUFFIXES: .C .cxx .cc .cpp + +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast + +CC = g++ -m64 + +include $(RULES)/c++$(WM_COMPILE_OPTION) + +ptFLAGS = -DNoRepository -ftemplate-depth-100 + +c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC + +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@ +cxxtoo = $(Ctoo) +cctoo = $(Ctoo) +cpptoo = $(Ctoo) + +LINK_LIBS = $(c++DBUG) + +LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed diff --git a/wmake/rules/linux64Gcc48/c++Debug b/wmake/rules/linux64Gcc48/c++Debug new file mode 100644 index 0000000000000000000000000000000000000000..19bdb9c3346fc7a69380dfedd6e7911fe220a965 --- /dev/null +++ b/wmake/rules/linux64Gcc48/c++Debug @@ -0,0 +1,2 @@ +c++DBUG = -ggdb3 -DFULLDEBUG +c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/linux64Gcc48/c++Opt b/wmake/rules/linux64Gcc48/c++Opt new file mode 100644 index 0000000000000000000000000000000000000000..2aedabd6280a3476bc58db13139a0a3aa579502b --- /dev/null +++ b/wmake/rules/linux64Gcc48/c++Opt @@ -0,0 +1,2 @@ +c++DBUG = +c++OPT = -O3 diff --git a/wmake/rules/linux64Gcc48/c++Prof b/wmake/rules/linux64Gcc48/c++Prof new file mode 100644 index 0000000000000000000000000000000000000000..3bda4dad55e898a8198f6e8bfe21e8d829d7230a --- /dev/null +++ b/wmake/rules/linux64Gcc48/c++Prof @@ -0,0 +1,2 @@ +c++DBUG = -pg +c++OPT = -O2 diff --git a/wmake/rules/linux64Gcc48/cDebug b/wmake/rules/linux64Gcc48/cDebug new file mode 100644 index 0000000000000000000000000000000000000000..72b638f458220e329d52b59e3566a3c807101f9d --- /dev/null +++ b/wmake/rules/linux64Gcc48/cDebug @@ -0,0 +1,2 @@ +cDBUG = -ggdb -DFULLDEBUG +cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/linux64Gcc48/cOpt b/wmake/rules/linux64Gcc48/cOpt new file mode 100644 index 0000000000000000000000000000000000000000..17318709f1fa39e6bf89cbe87778bc6fa459de17 --- /dev/null +++ b/wmake/rules/linux64Gcc48/cOpt @@ -0,0 +1,2 @@ +cDBUG = +cOPT = -O3 diff --git a/wmake/rules/linux64Gcc48/cProf b/wmake/rules/linux64Gcc48/cProf new file mode 100644 index 0000000000000000000000000000000000000000..ca3ac9bf5f0cd61fe99e0f05fa1bd4bdf9fa6cf7 --- /dev/null +++ b/wmake/rules/linux64Gcc48/cProf @@ -0,0 +1,2 @@ +cDBUG = -pg +cOPT = -O2 diff --git a/wmake/rules/linux64Gcc48/general b/wmake/rules/linux64Gcc48/general new file mode 100644 index 0000000000000000000000000000000000000000..4a42b11b1ee6aebe596e3cd2e2633d9c70cb5e9a --- /dev/null +++ b/wmake/rules/linux64Gcc48/general @@ -0,0 +1,8 @@ +CPP = cpp -traditional-cpp + +PROJECT_LIBS = -l$(WM_PROJECT) -ldl + +include $(GENERAL_RULES)/standard + +include $(RULES)/c +include $(RULES)/c++ diff --git a/wmake/rules/linux64Gcc48/mplibHPMPI b/wmake/rules/linux64Gcc48/mplibHPMPI new file mode 100644 index 0000000000000000000000000000000000000000..574492a236a32f7d87d00bf0e3507a5ac8e54f55 --- /dev/null +++ b/wmake/rules/linux64Gcc48/mplibHPMPI @@ -0,0 +1,3 @@ +PFLAGS = +PINC = -I$(MPI_ARCH_PATH)/include -D_MPICC_H +PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_amd64 -lmpi diff --git a/wmake/rules/linux64Gcc48/mplibINTELMPI b/wmake/rules/linux64Gcc48/mplibINTELMPI new file mode 100644 index 0000000000000000000000000000000000000000..cf80ec2eaf68d1c2f6adf208964b6490c4c8fd36 --- /dev/null +++ b/wmake/rules/linux64Gcc48/mplibINTELMPI @@ -0,0 +1,3 @@ +PFLAGS = -DMPICH_SKIP_MPICXX +PINC = -I$(MPI_ARCH_PATH)/include64 +PLIBS = -L$(MPI_ARCH_PATH)/lib64 -lmpi diff --git a/wmake/rules/linuxGcc48/c b/wmake/rules/linuxGcc48/c new file mode 100644 index 0000000000000000000000000000000000000000..d914fcd37d084b82a1833722d6ad7a0db3dd1c93 --- /dev/null +++ b/wmake/rules/linuxGcc48/c @@ -0,0 +1,16 @@ +.SUFFIXES: .c .h + +cWARN = -Wall + +cc = gcc -m32 + +include $(RULES)/c$(WM_COMPILE_OPTION) + +cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC + +ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ + +LINK_LIBS = $(cDBUG) + +LINKLIBSO = $(cc) -shared +LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linuxGcc48/c++ b/wmake/rules/linuxGcc48/c++ new file mode 100644 index 0000000000000000000000000000000000000000..357f4106e10d7d1108a6713802e6f0d01cd8be9a --- /dev/null +++ b/wmake/rules/linuxGcc48/c++ @@ -0,0 +1,21 @@ +.SUFFIXES: .C .cxx .cc .cpp + +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast + +CC = g++ -m32 + +include $(RULES)/c++$(WM_COMPILE_OPTION) + +ptFLAGS = -DNoRepository -ftemplate-depth-100 + +c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC + +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@ +cxxtoo = $(Ctoo) +cctoo = $(Ctoo) +cpptoo = $(Ctoo) + +LINK_LIBS = $(c++DBUG) + +LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed diff --git a/wmake/rules/linuxGcc48/c++Debug b/wmake/rules/linuxGcc48/c++Debug new file mode 100644 index 0000000000000000000000000000000000000000..19bdb9c3346fc7a69380dfedd6e7911fe220a965 --- /dev/null +++ b/wmake/rules/linuxGcc48/c++Debug @@ -0,0 +1,2 @@ +c++DBUG = -ggdb3 -DFULLDEBUG +c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/linuxGcc48/c++Opt b/wmake/rules/linuxGcc48/c++Opt new file mode 100644 index 0000000000000000000000000000000000000000..2aedabd6280a3476bc58db13139a0a3aa579502b --- /dev/null +++ b/wmake/rules/linuxGcc48/c++Opt @@ -0,0 +1,2 @@ +c++DBUG = +c++OPT = -O3 diff --git a/wmake/rules/linuxGcc48/c++Prof b/wmake/rules/linuxGcc48/c++Prof new file mode 100644 index 0000000000000000000000000000000000000000..3bda4dad55e898a8198f6e8bfe21e8d829d7230a --- /dev/null +++ b/wmake/rules/linuxGcc48/c++Prof @@ -0,0 +1,2 @@ +c++DBUG = -pg +c++OPT = -O2 diff --git a/wmake/rules/linuxGcc48/cDebug b/wmake/rules/linuxGcc48/cDebug new file mode 100644 index 0000000000000000000000000000000000000000..72b638f458220e329d52b59e3566a3c807101f9d --- /dev/null +++ b/wmake/rules/linuxGcc48/cDebug @@ -0,0 +1,2 @@ +cDBUG = -ggdb -DFULLDEBUG +cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/linuxGcc48/cOpt b/wmake/rules/linuxGcc48/cOpt new file mode 100644 index 0000000000000000000000000000000000000000..17318709f1fa39e6bf89cbe87778bc6fa459de17 --- /dev/null +++ b/wmake/rules/linuxGcc48/cOpt @@ -0,0 +1,2 @@ +cDBUG = +cOPT = -O3 diff --git a/wmake/rules/linuxGcc48/cProf b/wmake/rules/linuxGcc48/cProf new file mode 100644 index 0000000000000000000000000000000000000000..ca3ac9bf5f0cd61fe99e0f05fa1bd4bdf9fa6cf7 --- /dev/null +++ b/wmake/rules/linuxGcc48/cProf @@ -0,0 +1,2 @@ +cDBUG = -pg +cOPT = -O2 diff --git a/wmake/rules/linuxGcc48/general b/wmake/rules/linuxGcc48/general new file mode 100644 index 0000000000000000000000000000000000000000..4b051e6b9840df29cac2e8ced14c7d18b0b337d5 --- /dev/null +++ b/wmake/rules/linuxGcc48/general @@ -0,0 +1,9 @@ +CPP = cpp -traditional-cpp +LD = ld -melf_i386 + +PROJECT_LIBS = -l$(WM_PROJECT) -ldl + +include $(GENERAL_RULES)/standard + +include $(RULES)/c +include $(RULES)/c++ diff --git a/wmake/rules/linuxGcc48/mplibHPMPI b/wmake/rules/linuxGcc48/mplibHPMPI new file mode 100644 index 0000000000000000000000000000000000000000..8aff40632bd23af9607d63c4eb675a8de0cd287c --- /dev/null +++ b/wmake/rules/linuxGcc48/mplibHPMPI @@ -0,0 +1,3 @@ +PFLAGS = +PINC = -I$(MPI_ARCH_PATH)/include -D_MPICC_H +PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_ia32 -lmpi