diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H index 8dbb489c8d2d0fad19b6e8035a64b71be2767152..fa56de00bb40474dc995a83b92f6a8e2a7997894 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"))); if (nAlphaSubCycles > 1) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H index 1c42c7b91a64104651b4b2948ed7ee8b4bc823be..9c8c2d4f18c2bbdf4267a19af53d7d2ecb690f37 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H @@ -132,6 +132,17 @@ phasei++; } + phasei = 0; + forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) + { + phaseModel& phase = iter(); + + mrfZones.relativeFlux(phase.phi().oldTime()); + mrfZones.relativeFlux(phase.phi()); + + phasei++; + } + surfaceScalarField Dp ( IOobject @@ -185,7 +196,6 @@ phase.phi() = phiHbyAs[phasei] + rAlphaAUfs[phasei]*mSfGradp/phase.rho(); - mrfZones.relativeFlux(phase.phi().oldTime()); phi += alphafs[phasei]*phase.phi(); phasei++; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwclean b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwclean index 63db39ff0566cf06b8259c8c5040c97d50c172e5..cc138bc068e6882e24eb995668e00a0fc18d3e58 100755 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwclean +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwclean @@ -6,6 +6,5 @@ wclean libso phaseModel wclean libso interfacialModels wclean libso kineticTheoryModels wclean -wclean MRFtwoPhaseEulerFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake index faf438d0bddd640f77b0ad233a16266f3d8bf80e..29294d166a947be8f5f391168d9e4f67faeb8718 100755 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake @@ -6,6 +6,5 @@ wmake libso phaseModel wmake libso interfacialModels wmake libso kineticTheoryModels wmake -wmake MRFtwoPhaseEulerFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/MRFTwoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/MRFTwoPhaseEulerFoam.C deleted file mode 100644 index 357c7e413ab889f1a6845ceeaec7fdf46f655c93..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/MRFTwoPhaseEulerFoam.C +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 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 - twoPhaseEulerFoam - -Description - Solver for a system of 2 incompressible fluid phases with one phase - dispersed, e.g. gas bubbles in a liquid or solid particles in a gas. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "nearWallDist.H" -#include "wallFvPatch.H" -#include "Switch.H" - -#include "IFstream.H" -#include "OFstream.H" - -#include "dragModel.H" -#include "phaseModel.H" -#include "kineticTheoryModel.H" - -#include "pimpleControl.H" -#include "MRFZones.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "setRootCase.H" - - #include "createTime.H" - #include "createMesh.H" - #include "readGravitationalAcceleration.H" - #include "createFields.H" - #include "readPPProperties.H" - #include "initContinuityErrs.H" - #include "createMRFZones.H" - #include "readTimeControls.H" - #include "CourantNo.H" - #include "setInitialDeltaT.H" - - pimpleControl pimple(mesh); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (runTime.run()) - { - #include "readTwoPhaseEulerFoamControls.H" - #include "CourantNos.H" - #include "setDeltaT.H" - - runTime++; - Info<< "Time = " << runTime.timeName() << nl << endl; - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { - #include "alphaEqn.H" - #include "liftDragCoeffs.H" - #include "UEqns.H" - - // --- Pressure corrector loop - while (pimple.correct()) - { - #include "pEqn.H" - - if (correctAlpha && !pimple.finalIter()) - { - #include "alphaEqn.H" - } - } - - #include "DDtU.H" - - if (pimple.turbCorr()) - { - #include "kEpsilon.H" - } - } - - #include "write.H" - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/Make/files b/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/Make/files deleted file mode 100644 index 45960722aefce40efa346d1723b98b35c5651da0..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -MRFTwoPhaseEulerFoam.C - -EXE = $(FOAM_APPBIN)/MRFTwoPhaseEulerFoam diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/Make/options deleted file mode 100644 index b9b19059da672e0822af3f61d0314ab3988ebd39..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/Make/options +++ /dev/null @@ -1,17 +0,0 @@ -EXE_INC = \ - -I.. \ - -I../../bubbleFoam \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ - -IturbulenceModel \ - -I../kineticTheoryModels/lnInclude \ - -I../interfacialModels/lnInclude \ - -I../phaseModel/lnInclude \ - -EXE_LIBS = \ - -lEulerianInterfacialModels \ - -lfiniteVolume \ - -lmeshTools \ - -lincompressibleTransportModels \ - -lphaseModel \ - -lkineticTheoryModel diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/pEqn.H deleted file mode 100644 index 079ecfefe455bd7b073508100b3c33a784519a64..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/pEqn.H +++ /dev/null @@ -1,123 +0,0 @@ -{ - surfaceScalarField alpha1f(fvc::interpolate(alpha1)); - surfaceScalarField alpha2f(scalar(1) - alpha1f); - - volScalarField rAU1(1.0/U1Eqn.A()); - volScalarField rAU2(1.0/U2Eqn.A()); - - rAU1f = fvc::interpolate(rAU1); - surfaceScalarField rAU2f(fvc::interpolate(rAU2)); - - volVectorField HbyA1("HbyA1", U1); - HbyA1 = rAU1*U1Eqn.H(); - - volVectorField HbyA2("HbyA2", U2); - HbyA2 = rAU2*U2Eqn.H(); - - mrfZones.absoluteFlux(phi1.oldTime()); - mrfZones.absoluteFlux(phi1); - - mrfZones.absoluteFlux(phi2.oldTime()); - mrfZones.absoluteFlux(phi2); - - surfaceScalarField phiDrag1 - ( - fvc::interpolate(alpha2/rho1*K*rAU1)*phi2 + rAU1f*(g & mesh.Sf()) - ); - - if (g0.value() > 0.0) - { - phiDrag1 -= ppMagf*fvc::snGrad(alpha1)*mesh.magSf(); - } - - if (kineticTheory.on()) - { - phiDrag1 -= rAU1f*fvc::snGrad(kineticTheory.pa()/rho1)*mesh.magSf(); - } - - - surfaceScalarField phiDrag2 - ( - fvc::interpolate(alpha1/rho2*K*rAU2)*phi1 + rAU2f*(g & mesh.Sf()) - ); - - // Fix for gravity on outlet boundary. - forAll(p.boundaryField(), patchi) - { - if (isA<zeroGradientFvPatchScalarField>(p.boundaryField()[patchi])) - { - phiDrag1.boundaryField()[patchi] = 0.0; - phiDrag2.boundaryField()[patchi] = 0.0; - } - } - - surfaceScalarField phiHbyA1 - ( - "phiHbyA1", - (fvc::interpolate(HbyA1) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU1, U1, phi1) - + phiDrag1 - ); - mrfZones.relativeFlux(phiHbyA1); - - surfaceScalarField phiHbyA2 - ( - "phiHbyA2", - (fvc::interpolate(HbyA2) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU2, U2, phi2) - + phiDrag2 - ); - mrfZones.relativeFlux(phiHbyA2); - - surfaceScalarField phiHbyA("phiHbyA", alpha1f*phiHbyA1 + alpha2f*phiHbyA2); - - surfaceScalarField Dp - ( - "Dp", - alpha1f*rAU1f/rho1 + alpha2f*rAU2f/rho2 - ); - - while (pimple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvm::laplacian(Dp, p) == fvc::div(phiHbyA) - ); - - pEqn.setReference(pRefCell, pRefValue); - - pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - - if (pimple.finalNonOrthogonalIter()) - { - surfaceScalarField SfGradp(pEqn.flux()/Dp); - - phi1.boundaryField() == - (fvc::interpolate(U1) & mesh.Sf())().boundaryField(); - mrfZones.relativeFlux(phi1); - phi1 = phiHbyA1 - rAU1f*SfGradp/rho1; - mrfZones.relativeFlux(phi1.oldTime()); - - phi2.boundaryField() == - (fvc::interpolate(U2) & mesh.Sf())().boundaryField(); - mrfZones.relativeFlux(phi2); - phi2 = phiHbyA2 - rAU2f*SfGradp/rho2; - mrfZones.relativeFlux(phi2.oldTime()); - - phi = alpha1f*phi1 + alpha2f*phi2; - - p.relax(); - SfGradp = pEqn.flux()/Dp; - - U1 = HbyA1 + fvc::reconstruct(phiDrag1 - rAU1f*SfGradp/rho1); - U1.correctBoundaryConditions(); - - U2 = HbyA2 + fvc::reconstruct(phiDrag2 - rAU2f*SfGradp/rho2); - U2.correctBoundaryConditions(); - - U = alpha1*U1 + alpha2*U2; - } - } -} - -#include "continuityErrs.H" diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H b/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H index 8d09ccd3ef0c74db4cc9ef096eca61d0747ddb77..0c0cc1543a7a5aad203013d0ed97b15505121f36 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H @@ -53,7 +53,7 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); //+ alpha2/rho1*K*U2 // Explicit drag transfered to p-equation - alpha2/rho1*(liftCoeff - Cvm*rho2*DDtU2) ); - + mrfZones.addCoriolis(U1Eqn); U1Eqn.relax(); } @@ -93,7 +93,7 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); //+ alpha1/rho2*K*U1 // Explicit drag transfered to p-equation + alpha1/rho2*(liftCoeff + Cvm*rho2*DDtU1) ); - + mrfZones.addCoriolis(U2Eqn); U2Eqn.relax(); } } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H index 52f09e4793943737b24ed0f70805bdcce5ce5adc..34fdc24afc532d56c0fd0ddf0c08479237d2cdb9 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H @@ -1,6 +1,9 @@ { - word scheme("div(phi,alpha1)"); - word schemer("div(phir,alpha1)"); + label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); + label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); + + word alphaScheme("div(phi,alpha1)"); + word alpharScheme("div(phir,alpha1)"); surfaceScalarField phic("phic", phi); surfaceScalarField phir("phir", phi1 - phi2); @@ -15,14 +18,39 @@ for (int acorr=0; acorr<nAlphaCorr; acorr++) { - fvScalarMatrix alpha1Eqn + for ( - fvm::ddt(alpha1) - + fvm::div(phic, alpha1, scheme) - + fvm::div(-fvc::flux(-phir, alpha2, schemer), alpha1, schemer) - ); + subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles); + !(++alphaSubCycle).end(); + ) + { + surfaceScalarField phiAlpha + ( + fvc::flux + ( + phic, + alpha1, + alphaScheme + ) + + fvc::flux + ( + -fvc::flux(-phir, alpha2, alpharScheme), + alpha1, + alpharScheme + ) + ); + + MULES::explicitSolve + ( + alpha1, + phi, + phiAlpha, + (g0.value() > 0 ? alphaMax : 1), + 0 + ); + } - if (g0.value() > 0.0) + if (g0.value() > 0) { ppMagf = rAU1f*fvc::interpolate ( @@ -30,18 +58,22 @@ *g0*min(exp(preAlphaExp*(alpha1 - alphaMax)), expMax) ); - alpha1Eqn -= fvm::laplacian + fvScalarMatrix alpha1Eqn ( - (fvc::interpolate(alpha1) + scalar(0.0001))*ppMagf, - alpha1, - "laplacian(alpha1PpMag,alpha1)" + fvm::ddt(alpha1) - fvc::ddt(alpha1) + - fvm::laplacian + ( + (fvc::interpolate(alpha1) + scalar(0.0001))*ppMagf, + alpha1, + "laplacian(alpha1PpMag,alpha1)" + ) ); - } - alpha1Eqn.relax(); - alpha1Eqn.solve(); + alpha1Eqn.relax(); + alpha1Eqn.solve(); - #include "packingLimiter.H" + #include "packingLimiter.H" + } alpha2 = scalar(1) - alpha1; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H index b71c7849e5b456591f19ef931ae4f102b58fc54d..314d9b55ea6d8a8edc0b90eb1ea11a2fad806df2 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H @@ -93,16 +93,22 @@ dimensionedScalar Cvm ( + "Cvm", + dimless, transportProperties.lookup("Cvm") ); dimensionedScalar Cl ( + "Cl", + dimless, transportProperties.lookup("Cl") ); dimensionedScalar Ct ( + "Ct", + dimless, transportProperties.lookup("Ct") ); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H similarity index 100% rename from applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/createMRFZones.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/newVirualMass/DDtU.H b/applications/solvers/multiphase/twoPhaseEulerFoam/newVirualMass/DDtU.H new file mode 100644 index 0000000000000000000000000000000000000000..9ce45379797d70162ebfa36c3361813bd6882375 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/newVirualMass/DDtU.H @@ -0,0 +1,11 @@ +{ + DDtU1 = + fvc::ddt(U1) + + fvc::div(phi, U1) + - fvc::div(phi)*U1; + + DDtU2 = + fvc::ddt(U2) + + fvc::div(phi, U2) + - fvc::div(phi)*U2; +} diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/UEqns.H b/applications/solvers/multiphase/twoPhaseEulerFoam/newVirualMass/UEqns.H similarity index 72% rename from applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/UEqns.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/newVirualMass/UEqns.H index 0c0cc1543a7a5aad203013d0ed97b15505121f36..cae326e44a2d13a03349bef25abf4a3202b9b2c8 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/MRFtwoPhaseEulerFoam/UEqns.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/newVirualMass/UEqns.H @@ -2,6 +2,16 @@ fvVectorMatrix U1Eqn(U1, U1.dimensions()*dimVol/dimTime); fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); { + volScalarField Cvma + ( + Cvm + /( + 1 + + mag(fvc::grad(alpha1)) + *dimensionedScalar("l", dimLength, 1e-2) + ) + ); + { volTensorField gradU1T(T(fvc::grad(U1))); @@ -34,11 +44,15 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); U1Eqn = ( - (scalar(1) + Cvm*rho2*alpha2/rho1)* + fvm::ddt(U1) + + fvm::div(phi1, U1) + - fvm::Sp(fvc::div(phi1), U1) + + + Cvma*alpha2*rho/rho1* ( fvm::ddt(U1) - + fvm::div(phi1, U1, "div(phi1,U1)") - - fvm::Sp(fvc::div(phi1), U1) + + fvm::div(phi, U1) + - fvm::Sp(fvc::div(phi), U1) ) - fvm::laplacian(nuEff1, U1) @@ -51,9 +65,11 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); // g // Buoyancy term transfered to p-equation - fvm::Sp(alpha2/rho1*K, U1) //+ alpha2/rho1*K*U2 // Explicit drag transfered to p-equation - - alpha2/rho1*(liftCoeff - Cvm*rho2*DDtU2) + // - fvm::Sp(K/rho1, U1) + ////+ K/rho1*U // Explicit drag transfered to p-equation + - alpha2/rho1*liftCoeff + Cvma*alpha2*rho*DDtU2/rho1 ); - mrfZones.addCoriolis(U1Eqn); + U1Eqn.relax(); } @@ -73,11 +89,15 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); U2Eqn = ( - (scalar(1) + Cvm*rho2*alpha1/rho2)* + fvm::ddt(U2) + + fvm::div(phi2, U2) + - fvm::Sp(fvc::div(phi2), U2) + + + Cvma*alpha1*rho/rho2* ( fvm::ddt(U2) - + fvm::div(phi2, U2, "div(phi2,U2)") - - fvm::Sp(fvc::div(phi2), U2) + + fvm::div(phi, U2) + - fvm::Sp(fvc::div(phi), U2) ) - fvm::laplacian(nuEff2, U2) @@ -85,15 +105,16 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); + fvm::div(phiR2, U2, "div(phi2,U2)") - fvm::Sp(fvc::div(phiR2), U2) - + (fvc::grad(alpha2)/(fvc::average(alpha2) + scalar(0.001)) & Rc2) == // g // Buoyancy term transfered to p-equation - fvm::Sp(alpha1/rho2*K, U2) //+ alpha1/rho2*K*U1 // Explicit drag transfered to p-equation - + alpha1/rho2*(liftCoeff + Cvm*rho2*DDtU1) + // - fvm::Sp(K/rho2, U2) + ////+ K/rho2*U // Explicit drag transfered to p-equation + + alpha1/rho2*liftCoeff + Cvma*alpha1*rho*DDtU1/rho2 ); - mrfZones.addCoriolis(U2Eqn); + U2Eqn.relax(); } } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H index 91f8302d7ff1a3c27bf971068c89815a8a94db7e..348cc847d71411e7e4c2c4ada254244c01ef59c6 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H @@ -14,6 +14,12 @@ volVectorField HbyA2("HbyA2", U2); HbyA2 = rAU2*U2Eqn.H(); + mrfZones.absoluteFlux(phi1.oldTime()); + mrfZones.absoluteFlux(phi1); + + mrfZones.absoluteFlux(phi2.oldTime()); + mrfZones.absoluteFlux(phi2); + surfaceScalarField phiDrag1 ( fvc::interpolate(alpha2/rho1*K*rAU1)*phi2 + rAU1f*(g & mesh.Sf()) @@ -29,6 +35,7 @@ phiDrag1 -= rAU1f*fvc::snGrad(kineticTheory.pa()/rho1)*mesh.magSf(); } + surfaceScalarField phiDrag2 ( fvc::interpolate(alpha1/rho2*K*rAU2)*phi1 + rAU2f*(g & mesh.Sf()) @@ -51,6 +58,7 @@ + fvc::ddtPhiCorr(rAU1, U1, phi1) + phiDrag1 ); + mrfZones.relativeFlux(phiHbyA1); surfaceScalarField phiHbyA2 ( @@ -59,6 +67,12 @@ + fvc::ddtPhiCorr(rAU2, U2, phi2) + phiDrag2 ); + mrfZones.relativeFlux(phiHbyA2); + + mrfZones.relativeFlux(phi1.oldTime()); + mrfZones.relativeFlux(phi1); + mrfZones.relativeFlux(phi2.oldTime()); + mrfZones.relativeFlux(phi2); surfaceScalarField phiHbyA("phiHbyA", alpha1f*phiHbyA1 + alpha2f*phiHbyA2); @@ -83,14 +97,8 @@ { surfaceScalarField SfGradp(pEqn.flux()/Dp); - phi1.boundaryField() == - (fvc::interpolate(U1) & mesh.Sf())().boundaryField(); phi1 = phiHbyA1 - rAU1f*SfGradp/rho1; - - phi2.boundaryField() == - (fvc::interpolate(U2) & mesh.Sf())().boundaryField(); phi2 = phiHbyA2 - rAU2f*SfGradp/rho2; - phi = alpha1f*phi1 + alpha2f*phi2; p.relax(); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C index d81ad8e703143ef3916e25ea55f5bfb7a69a6b2b..aebc7ba6cb01645ed9f638c4cb80501bfe8b0f3b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C @@ -43,14 +43,20 @@ Foam::phaseModel::phaseModel name_(phaseName), d_ ( + "d", + dimLength, dict_.lookup("d") ), nu_ ( + "nu", + dimensionSet(0, 2, -1, 0, 0), dict_.lookup("nu") ), rho_ ( + "rho", + dimDensity, dict_.lookup("rho") ), U_ diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H b/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H index a345c4e53bc97e5b3ad14ddaf653805a78a75571..4e6847debe35e252aa3b696c93bb43d5f79d1213 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H @@ -1,5 +1,3 @@ #include "readTimeControls.H" - int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr"))); - Switch correctAlpha(pimple.dict().lookup("correctAlpha")); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C index 19810a15f19c7db8839497c21dd12b054655af28..d9da532aef570a4e206b7680531c72e7fff571f8 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,8 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "MULES.H" +#include "subCycle.H" #include "nearWallDist.H" #include "wallFvPatch.H" #include "Switch.H" @@ -43,6 +45,7 @@ Description #include "kineticTheoryModel.H" #include "pimpleControl.H" +#include "MRFZones.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,6 +59,7 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "readPPProperties.H" #include "initContinuityErrs.H" + #include "createMRFZones.H" #include "readTimeControls.H" #include "CourantNo.H" #include "setInitialDeltaT.H" diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.C index 13aefeac1060812e0264e8b87e2c7606bf254e96..7da1a844b7ff94e7cb859879bf93406d59409ab0 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,6 +67,7 @@ void Foam::createShellMesh::syncEdges const labelList& patchEdges, const labelList& coupledEdges, const PackedBoolList& sameEdgeOrientation, + const bool syncNonCollocated, PackedBoolList& isChangedEdge, DynamicList<label>& changedEdges, @@ -111,7 +112,11 @@ void Foam::createShellMesh::syncEdges ( cppEdgeData, globalData.globalEdgeSlaves(), - globalData.globalEdgeTransformedSlaves(), + ( + syncNonCollocated + ? globalData.globalEdgeTransformedSlaves() // transformed elems + : labelListList(globalData.globalEdgeSlaves().size()) //no transformed + ), map, minEqOp<labelPair>() ); @@ -150,6 +155,7 @@ void Foam::createShellMesh::calcPointRegions const globalMeshData& globalData, const primitiveFacePatch& patch, const PackedBoolList& nonManifoldEdge, + const bool syncNonCollocated, faceList& pointGlobalRegions, faceList& pointLocalRegions, @@ -243,6 +249,7 @@ void Foam::createShellMesh::calcPointRegions patchEdges, coupledEdges, sameEdgeOrientation, + syncNonCollocated, isChangedEdge, changedEdges, @@ -356,6 +363,7 @@ void Foam::createShellMesh::calcPointRegions patchEdges, coupledEdges, sameEdgeOrientation, + syncNonCollocated, isChangedEdge, changedEdges, @@ -509,6 +517,7 @@ void Foam::createShellMesh::setRefinement } } + // Introduce original points // ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -525,12 +534,13 @@ void Foam::createShellMesh::setRefinement ); pointToPointMap.append(pointI); -// Pout<< "Added bottom point " << pointToPointMap[pointI] -// << " at " << patch_.localPoints()[pointI] -// << " from point " << pointI -// << endl; + //Pout<< "Added bottom point " << addedPointI + // << " at " << patch_.localPoints()[pointI] + // << " from point " << pointI + // << endl; } + // Introduce new points (one for every region) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -541,7 +551,6 @@ void Foam::createShellMesh::setRefinement point pt = patch_.localPoints()[pointI]; point disp = firstLayerDisp[regionI]; - for (label layerI = 0; layerI < nLayers; layerI++) { pt += disp; @@ -675,7 +684,7 @@ void Foam::createShellMesh::setRefinement { FatalErrorIn("createShellMesh::setRefinement(..)") << "external/feature edge:" << edgeI - << " has " << eFaces.size() << " connected extruded faces" + << " has " << eFaces.size() << " connected extruded faces " << " but only " << ePatches.size() << " boundary faces defined." << exit(FatalError); } diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.H b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.H index 7517a956df1dc16d241bb26cdc221a8c0281371f..df1e000be8c90a46ee3391b4a601d669215ef5dc 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.H +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh/createShellMesh.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,6 +88,8 @@ class createShellMesh const labelList&, const labelList&, const PackedBoolList& sameEdgeOrientation, + const bool syncNonCollocated, + PackedBoolList& isChangedEdge, DynamicList<label>& changedEdges, labelPairList& allEdgeData @@ -160,6 +162,8 @@ public: // same on all faces connected to a point if they can be // reached through a face-edge-face walk without crossing // the nonManifoldEdge. + // syncNonCollocated = true: edges connected through cyclic become + // single region. false: kept separate. // pointGlobalRegions : non-compact. Guaranteed to be the same // across processors. // pointLocalRegions : compact. @@ -169,6 +173,7 @@ public: const globalMeshData& globalData, const primitiveFacePatch& patch, const PackedBoolList& nonManifoldEdge, + const bool syncNonCollocated, faceList& pointGlobalRegions, faceList& pointLocalRegions, labelList& localToGlobalRegion diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index b32c249e7c201c96e633d75e0163ef32b905e3d9..ff4780b65b68dc76ae6b10382bb352938bd1564b 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,6 +102,13 @@ becomes BBB=mapped between original mesh and new extrusion CCC=polypatch + +Notes: + - when extruding cyclics with only one cell inbetween it does not + detect this as a cyclic since the face is the same face. It will + only work if the coupled edge extrudes a different face so if there + are more than 1 cell inbetween. + \*---------------------------------------------------------------------------*/ #include "argList.H" @@ -1032,6 +1039,42 @@ label findUncoveredPatchFace } +// Same as findUncoveredPatchFace, except explicitly checks for cyclic faces +label findUncoveredCyclicPatchFace +( + const fvMesh& mesh, + const UIndirectList<label>& extrudeMeshFaces,// mesh faces that are extruded + const label meshEdgeI // mesh edge +) +{ + // Make set of extruded faces. + labelHashSet extrudeFaceSet(extrudeMeshFaces.size()); + forAll(extrudeMeshFaces, i) + { + extrudeFaceSet.insert(extrudeMeshFaces[i]); + } + + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + const labelList& eFaces = mesh.edgeFaces()[meshEdgeI]; + forAll(eFaces, i) + { + label faceI = eFaces[i]; + label patchI = pbm.whichPatch(faceI); + + if + ( + patchI != -1 + && isA<cyclicPolyPatch>(pbm[patchI]) + && !extrudeFaceSet.found(faceI) + ) + { + return faceI; + } + } + return -1; +} + + // Calculate per edge min and max zone void calcEdgeMinMaxZone ( @@ -1288,12 +1331,13 @@ void addCouplingPatches } -// Sets sidePatch[edgeI] to interprocessor patch. Adds any -// interprocessor patches if necessary. -void addProcPatches +// Sets sidePatch[edgeI] to interprocessor or cyclic patch. Adds any +// coupled patches if necessary. +void addCoupledPatches ( const fvMesh& mesh, const primitiveFacePatch& extrudePatch, + const labelList& extrudeMeshFaces, const labelList& extrudeMeshEdges, const mapDistribute& extrudeEdgeFacesMap, const labelListList& extrudeEdgeGlobalFaces, @@ -1342,7 +1386,7 @@ void addProcPatches labelMin // null value ); - Pout<< "Adding inter-processor patches:" << nl << nl + Pout<< "Adding processor or cyclic patches:" << nl << nl << "patchID\tpatch" << nl << "-------\t-----" << endl; @@ -1367,35 +1411,84 @@ void addProcPatches nbrProcI = maxProcID[edgeI]; } - word name = - "procBoundary" - + Foam::name(Pstream::myProcNo()) - + "to" - + Foam::name(nbrProcI); - - sidePatchID[edgeI] = findPatchID(newPatches, name); - if (sidePatchID[edgeI] == -1) + if (nbrProcI == Pstream::myProcNo()) { - dictionary patchDict; - patchDict.add("myProcNo", Pstream::myProcNo()); - patchDict.add("neighbProcNo", nbrProcI); + // Cyclic patch since both procs the same. This cyclic should + // already exist in newPatches so no adding necessary. - sidePatchID[edgeI] = addPatch<processorPolyPatch> + label faceI = findUncoveredCyclicPatchFace ( - mesh.boundaryMesh(), - name, - patchDict, - newPatches + mesh, + UIndirectList<label>(extrudeMeshFaces, eFaces), + extrudeMeshEdges[edgeI] ); - Pout<< sidePatchID[edgeI] << '\t' << name - << nl; + if (faceI != -1) + { + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + label newPatchI = findPatchID + ( + newPatches, + patches[patches.whichPatch(faceI)].name() + ); + + sidePatchID[edgeI] = newPatchI; + } + else + { + FatalErrorIn + ( + "void addCoupledPatches" + "(" + "const fvMesh&, " + "const primitiveFacePatch&, " + "const labelList&, " + "const labelList&, " + "const mapDistribute&, " + "const labelListList&, " + "labelList&, " + "DynamicList<polyPatch*>&" + ")" + ) << "Unable to determine coupled patch addressing" + << abort(FatalError); + } + } + else + { + // Rrocessor patch + + word name = + "procBoundary" + + Foam::name(Pstream::myProcNo()) + + "to" + + Foam::name(nbrProcI); + + sidePatchID[edgeI] = findPatchID(newPatches, name); + + if (sidePatchID[edgeI] == -1) + { + dictionary patchDict; + patchDict.add("myProcNo", Pstream::myProcNo()); + patchDict.add("neighbProcNo", nbrProcI); + + sidePatchID[edgeI] = addPatch<processorPolyPatch> + ( + mesh.boundaryMesh(), + name, + patchDict, + newPatches + ); + + Pout<< sidePatchID[edgeI] << '\t' << name + << nl; + } } } } Pout<< "Added " << newPatches.size()-nOldPatches - << " inter-processor patches." << nl + << " coupled patches." << nl << endl; } @@ -2251,12 +2344,13 @@ int main(int argc, char *argv[]) // Sets sidePatchID[edgeI] to interprocessor patch. Adds any - // interprocessor patches if necessary. + // interprocessor or cyclic patches if necessary. labelList sidePatchID; - addProcPatches + addCoupledPatches ( mesh, extrudePatch, + extrudeMeshFaces, extrudeMeshEdges, extrudeEdgeFacesMap, extrudeEdgeGlobalFaces, @@ -2409,6 +2503,7 @@ int main(int argc, char *argv[]) mesh.globalData(), extrudePatch, nonManifoldEdge, + false, // keep cyclic separated regions apart pointGlobalRegions, pointLocalRegions, @@ -2431,7 +2526,6 @@ int main(int argc, char *argv[]) pointField localRegionNormals(localToGlobalRegion.size()); { pointField localSum(localToGlobalRegion.size(), vector::zero); - labelList localNum(localToGlobalRegion.size(), 0); forAll(pointLocalRegions, faceI) { @@ -2440,32 +2534,25 @@ int main(int argc, char *argv[]) { label localRegionI = pRegions[fp]; localSum[localRegionI] += extrudePatch.faceNormals()[faceI]; - localNum[localRegionI]++; } } Map<point> globalSum(2*localToGlobalRegion.size()); - Map<label> globalNum(2*localToGlobalRegion.size()); forAll(localSum, localRegionI) { label globalRegionI = localToGlobalRegion[localRegionI]; globalSum.insert(globalRegionI, localSum[localRegionI]); - globalNum.insert(globalRegionI, localNum[localRegionI]); } // Reduce Pstream::mapCombineGather(globalSum, plusEqOp<point>()); Pstream::mapCombineScatter(globalSum); - Pstream::mapCombineGather(globalNum, plusEqOp<label>()); - Pstream::mapCombineScatter(globalNum); forAll(localToGlobalRegion, localRegionI) { label globalRegionI = localToGlobalRegion[localRegionI]; - localRegionNormals[localRegionI] = - globalSum[globalRegionI] - / globalNum[globalRegionI]; + localRegionNormals[localRegionI] = globalSum[globalRegionI]; } localRegionNormals /= mag(localRegionNormals); } diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 5b8a4b73bbe85c562c9e50527fd1b113a8796c3b..4c2180f21d489ff5b916f8bce73628f23443558c 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -85,7 +85,7 @@ FoamFile // { // set p0; // option any; // cell with any point in pointSet -// //option all; // cell with all points in pointSet +// //option edge; // cell with an edge with both points in pointSet // } // // // Select based on cellShape @@ -198,6 +198,7 @@ FoamFile // set p0; // option any; // Faces using any point in pointSet // //option all // Faces with all points in pointSet +// //option edge // Faces with two consecutive points in pointSet // } // // // Select by explicitly providing face labels diff --git a/bin/foamCleanPath b/bin/foamCleanPath index 6bae9ca55e9e4866c3272f3350575bea78ae779a..85b93f8f57e51b5fa1c400a6e91a8c5ca66fe59d 100755 --- a/bin/foamCleanPath +++ b/bin/foamCleanPath @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -50,7 +50,7 @@ options: Prints its argument (which should be a ':' separated list) cleansed from - duplicate elements - elements whose start matches one of the wildcard(s) - - inaccessible directories (with the -strip (at your option) + - inaccessible directories (with the -strip option) Exit status 0 on success @@ -86,7 +86,7 @@ done dirList="$1" shift -[ -n "$1" ] || exit 2 # quick exit on empty 'dirList' +[ -n "$dirList" ] || exit 2 # quick exit on empty 'dirList' ##DEBUG echo "input>$dirList<" 1>&2 diff --git a/src/OpenFOAM/algorithms/subCycle/subCycle.H b/src/OpenFOAM/algorithms/subCycle/subCycle.H index 7ead8235051bb033ffe23888798dfb20bcf0603a..a4a1ea1844c506b86ebeeba260e9895005405d70 100644 --- a/src/OpenFOAM/algorithms/subCycle/subCycle.H +++ b/src/OpenFOAM/algorithms/subCycle/subCycle.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,13 +40,11 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class subCycle Declaration + Class subCycleField Declaration \*---------------------------------------------------------------------------*/ template<class GeometricField> -class subCycle -: - public subCycleTime +class subCycleField { // Private data @@ -57,6 +55,41 @@ class subCycle GeometricField gf0_; +public: + + // Constructors + + //- Construct field and number of sub-cycles + subCycleField(GeometricField& gf) + : + gf_(gf), + gf0_(gf.oldTime()) + {} + + + //- Destructor + ~subCycleField() + { + // Correct the time index of the field to correspond to the global time + gf_.timeIndex() = gf_.time().timeIndex(); + + // Reset the old-time field value + gf_.oldTime() = gf0_; + gf_.oldTime().timeIndex() = gf0_.timeIndex(); + } +}; + + +/*---------------------------------------------------------------------------*\ + Class subCycle Declaration +\*---------------------------------------------------------------------------*/ + +template<class GeometricField> +class subCycle +: + public subCycleField<GeometricField>, + public subCycleTime +{ // Private Member Functions //- Disallow default bitwise copy construct @@ -73,9 +106,9 @@ public: //- Construct field and number of sub-cycles subCycle(GeometricField& gf, const label nSubCycles) : - subCycleTime(const_cast<Time&>(gf.time()), nSubCycles), - gf_(gf), - gf0_(gf.oldTime()) + + subCycleField<GeometricField>(gf), + subCycleTime(const_cast<Time&>(gf.time()), nSubCycles) {} @@ -84,13 +117,6 @@ public: { // End the subCycleTime, which restores the time state endSubCycle(); - - // Correct the time index of the field to correspond to the global time - gf_.timeIndex() = gf_.time().timeIndex(); - - // Reset the old-time field value - gf_.oldTime() = gf0_; - gf_.oldTime().timeIndex() = gf_.time().timeIndex(); } }; diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index d1b4926e763910f2f24449d1d4ba6606734354cf..3ccbdd4043253af2c64bb1e7370d63c012d030a1 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -2403,7 +2403,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints ( masterGlobalPoint, pointSlaves, - labelListList(cpp.nPoints()), // no transforms + labelListList(0), // no transforms pointSlavesMap, maxEqOp<label>() ); @@ -2684,7 +2684,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints ( globalMaster, pointSlaves, - labelListList(cpp.nPoints()), // no transforms + labelListList(0), // no transforms pointSlavesMap, maxEqOp<label>() ); diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C index 22428ace15f8e088d9d64368ee8bedfe32f8e034..b5d18c2cd8b1e5e452034fc24760bb93ffd65cea 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,10 +50,17 @@ void Foam::globalMeshData::syncData Type& elem = elems[i]; const labelList& slavePoints = slaves[i]; - const labelList& transformSlavePoints = transformedSlaves[i]; - - if (slavePoints.size()+transformSlavePoints.size() > 0) + label nTransformSlavePoints = + ( + transformedSlaves.size() == 0 + ? 0 + : transformedSlaves[i].size() + ); + + if (slavePoints.size()+nTransformSlavePoints > 0) { + const labelList& transformSlavePoints = transformedSlaves[i]; + // Combine master with untransformed slave data forAll(slavePoints, j) { @@ -109,10 +116,17 @@ void Foam::globalMeshData::syncData Type& elem = elems[i]; const labelList& slavePoints = slaves[i]; - const labelList& transformSlavePoints = transformedSlaves[i]; - - if (slavePoints.size()+transformSlavePoints.size() > 0) + label nTransformSlavePoints = + ( + transformedSlaves.size() == 0 + ? 0 + : transformedSlaves[i].size() + ); + + if (slavePoints.size()+nTransformSlavePoints > 0) { + const labelList& transformSlavePoints = transformedSlaves[i]; + // Combine master with untransformed slave data forAll(slavePoints, j) { diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H index bc1791a94653f4f6e39941556817d8b2a31633df..5a6787be8390b813894fdd12dce48f652cd1a339 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H @@ -704,8 +704,6 @@ tetSliceWithPlane // Tet cut into two prisms. Determine the positive one. label pos0 = -1; label pos1 = -1; - label neg0 = -1; - label neg1 = -1; forAll(d, i) { if (d[i] > 0) @@ -719,17 +717,6 @@ tetSliceWithPlane pos1 = i; } } - else - { - if (neg0 == -1) - { - neg0 = i; - } - else - { - neg1 = i; - } - } } //Pout<< "Split 2pos tet " << tet << " d:" << d diff --git a/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.C b/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.C index 3086c3555d9e10557f58dc14a98913619aa7235d..5be68757dc75e5ebce5840befccd76e29eb56d41 100644 --- a/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.C +++ b/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,10 +44,57 @@ Foam::fileFormats::OBJedgeFormat::OBJedgeFormat // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::fileFormats::OBJedgeFormat::read +void Foam::fileFormats::OBJedgeFormat::readVertices ( - const fileName& filename + const string& line, + string::size_type& endNum, + DynamicList<label>& dynVertices ) +{ + dynVertices.clear(); + while (true) + { + string::size_type startNum = + line.find_first_not_of(' ', endNum); + + if (startNum == string::npos) + { + break; + } + + endNum = line.find(' ', startNum); + + string vertexSpec; + if (endNum != string::npos) + { + vertexSpec = line.substr(startNum, endNum-startNum); + } + else + { + vertexSpec = line.substr(startNum, line.size() - startNum); + } + + string::size_type slashPos = vertexSpec.find('/'); + + label vertI = 0; + if (slashPos != string::npos) + { + IStringStream intStream(vertexSpec.substr(0, slashPos)); + + intStream >> vertI; + } + else + { + IStringStream intStream(vertexSpec); + + intStream >> vertI; + } + dynVertices.append(vertI - 1); + } +} + + +bool Foam::fileFormats::OBJedgeFormat::read(const fileName& filename) { clear(); @@ -66,6 +113,8 @@ bool Foam::fileFormats::OBJedgeFormat::read DynamicList<edge> dynEdges; DynamicList<label> dynUsedPoints; + DynamicList<label> dynVertices; + while (is.good()) { string line = this->getLineNoComment(is); @@ -97,50 +146,18 @@ bool Foam::fileFormats::OBJedgeFormat::read // Assume 'l' is followed by space. string::size_type endNum = 1; - int nVerts = 0; - for (int count = 0; count < 2; ++count) - { - string::size_type startNum = - line.find_first_not_of(' ', endNum); - - if (startNum == string::npos) - { - break; - } - - endNum = line.find(' ', startNum); - - string vertexSpec; - if (endNum != string::npos) - { - vertexSpec = line.substr(startNum, endNum-startNum); - } - else - { - vertexSpec = line.substr(startNum, line.size() - startNum); - } - - string::size_type slashPos = vertexSpec.find('/'); - - label vertI = 0; - if (slashPos != string::npos) - { - IStringStream intStream(vertexSpec.substr(0, slashPos)); - - intStream >> vertI; - } - else - { - IStringStream intStream(vertexSpec); - - intStream >> vertI; - } - - edgeRead[nVerts++] = (vertI - 1); // change to zero-offset - } + readVertices + ( + line, + endNum, + dynVertices + ); + - if (nVerts >= 2) + for (label i = 1; i < dynVertices.size(); i++) { + edge edgeRead(dynVertices[i-1], dynVertices[i]); + dynUsedPoints[edgeRead[0]] = edgeRead[0]; dynUsedPoints[edgeRead[1]] = edgeRead[1]; diff --git a/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.H b/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.H index 6ba025aa501b9d0094b84a5108bc7e278a98a352..11affeddb0e0b5e8077ef21cb7fa8e0e2b5be24c 100644 --- a/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.H +++ b/src/edgeMesh/edgeFormats/obj/OBJedgeFormat.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,6 +59,13 @@ class OBJedgeFormat { // Private Member Functions + void readVertices + ( + const string& line, + string::size_type& endNum, + DynamicList<label>& dynVertices + ); + //- Disallow default bitwise copy construct OBJedgeFormat(const OBJedgeFormat&); diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C index 80e12aae664ad5ce08d0b2373d4781dd150ff24c..8177c02efa1ca16544834f8eb5b555c94887d4a9 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C +++ b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -347,9 +347,6 @@ void Foam::rotorDiskSource::constructGeometry() { const vectorField& C = mesh_.C(); - const vector rDir = coordSys_.e1(); - const vector zDir = coordSys_.e3(); - forAll(cells_, i) { const label cellI = cells_[i]; diff --git a/src/fileFormats/vtk/vtkUnstructuredReader.C b/src/fileFormats/vtk/vtkUnstructuredReader.C index 26ecf9a0ade0477ec85bbab79cbe91d3a21cd72f..3d80e1ccec6ac05ce02e083b9a386b2f41dc0c94 100644 --- a/src/fileFormats/vtk/vtkUnstructuredReader.C +++ b/src/fileFormats/vtk/vtkUnstructuredReader.C @@ -578,6 +578,12 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile) Info<< "dataType : " << dataType_ << endl; } + if (dataType_ == "BINARY") + { + FatalIOErrorIn("vtkUnstructuredReader::read(ISstream&)", inFile) + << "Binary reading not supported " << exit(FatalIOError); + } + parseMode readMode = NOMODE; label wantedSize = -1; diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 8f951b6c524752853ce2921963ca278b8fd42b58..460b9650704eb369c554153fd2e78dceb823f806 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -421,6 +421,7 @@ void Foam::Cloud<ParticleType>::autoMap if (trackStartCell < 0) { trackStartCell = 0; + p.cell() = 0; } vector pos = p.position(); diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index 2ec24517e3c48bcc939743f883c6eee9ff71aef3..c295a18e248d7ee7f901807672b97adc156dcfe0 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/basic/particle/particleI.H b/src/lagrangian/basic/particle/particleI.H index 2f6d975120e3ef78a888b05afa124115a9064396..e3c9a6e049be5accb7c230a0828984596c183909 100644 --- a/src/lagrangian/basic/particle/particleI.H +++ b/src/lagrangian/basic/particle/particleI.H @@ -748,7 +748,7 @@ inline void Foam::particle::initCellFacePt() // number, but hasn't been able to find a cell to // occupy. - if(!mesh_.pointInCellBB(position_, oldCellI, 0.1)) + if (!mesh_.pointInCellBB(position_, oldCellI, 0.1)) { // If the position is not inside the (slightly // extended) bound-box of the cell that it thought diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 5c97c41d5c9e2573c791eec60632c7de755ae5ff..d7134f5cd370c780767ae55fd113b24995fef91a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -674,6 +674,17 @@ void Foam::KinematicCloud<CloudType>::motion(TrackData& td) } +template<class CloudType> +void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper) +{ + typedef typename particle::TrackingData<KinematicCloud<CloudType> > tdType; + + tdType td(*this); + + Cloud<parcelType>::template autoMap<tdType>(td, mapper); +} + + template<class CloudType> void Foam::KinematicCloud<CloudType>::info() { diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 7225347e605f989d4ebd5448cf2affeb587edd08..91a261f4df7b6403611b419891c28861ce8bb3ea 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -556,6 +556,13 @@ public: void motion(TrackData& td); + // Mapping + + //- Remap the cells of particles corresponding to the + // mesh topology change with a default tracking data object + virtual void autoMap(const mapPolyMesh&); + + // I-O //- Print cloud information diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index 3de4ae546de335b8687cf422551f0cf843596cce..4a83808fa2f2e73f9113dcc9e376a79c119b3f24 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -342,6 +342,17 @@ void Foam::ReactingCloud<CloudType>::evolve() +template<class CloudType> +void Foam::ReactingCloud<CloudType>::autoMap(const mapPolyMesh& mapper) +{ + typedef typename particle::TrackingData<ReactingCloud<CloudType> > tdType; + + tdType td(*this); + + Cloud<parcelType>::template autoMap<tdType>(td, mapper); +} + + template<class CloudType> void Foam::ReactingCloud<CloudType>::info() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index 7f58d83bd67f7a2ae90e2294e06eee076ae8f9f7..a16f1255af7d94800ba51903a97f7242f198bf6f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -299,6 +299,13 @@ public: void evolve(); + // Mapping + + //- Remap the cells of particles corresponding to the + // mesh topology change with a default tracking data object + virtual void autoMap(const mapPolyMesh&); + + // I-O //- Print cloud information diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 9088b97717a6ab784d5d074d6bff7fd259b26eb4..8cab7d3f8500cf9797aa9fd13942d5bc28f84c32 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -252,6 +252,21 @@ void Foam::ReactingMultiphaseCloud<CloudType>::evolve() } +template<class CloudType> +void Foam::ReactingMultiphaseCloud<CloudType>::autoMap +( + const mapPolyMesh& mapper +) +{ + typedef typename particle::TrackingData<ReactingMultiphaseCloud<CloudType> > + tdType; + + tdType td(*this); + + Cloud<parcelType>::template autoMap<tdType>(td, mapper); +} + + template<class CloudType> void Foam::ReactingMultiphaseCloud<CloudType>::info() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index 5f92be1ea8fa2e070919122695356a9b5b2e0f6d..bb72273e3f5bf265466de17f3e4aaf0dc8591652 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -273,6 +273,13 @@ public: void evolve(); + // Mapping + + //- Remap the cells of particles corresponding to the + // mesh topology change with a default tracking data object + virtual void autoMap(const mapPolyMesh&); + + // I-O //- Print cloud information diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 9530707bb4abb15598dc2477ece3b828a00c51ee..1844a6b21e7c8833351aa3df5fa066205366361c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -333,6 +333,17 @@ void Foam::ThermoCloud<CloudType>::evolve() } +template<class CloudType> +void Foam::ThermoCloud<CloudType>::autoMap(const mapPolyMesh& mapper) +{ + typedef typename particle::TrackingData<ThermoCloud<CloudType> > tdType; + + tdType td(*this); + + Cloud<parcelType>::template autoMap<tdType>(td, mapper); +} + + template<class CloudType> void Foam::ThermoCloud<CloudType>::info() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index c3c552472fadc99cd6e39ef52669a82660694ce3..4acd25162143807abd25e4964a8c8d32f0777b56 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -318,7 +318,14 @@ public: void evolve(); - // Check + // Mapping + + //- Remap the cells of particles corresponding to the + // mesh topology change with a default tracking data object + virtual void autoMap(const mapPolyMesh&); + + + // I-O //- Print cloud information void info(); diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H index 572be515a63fe96a7ebd9f9f3f9c84fdefa8429d..9e19beae3498a11eba4646ae707fbfe1b6083001 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H @@ -31,6 +31,7 @@ License #include "FacePostProcessing.H" #include "ParticleErosion.H" #include "ParticleTracks.H" +#include "ParticleTrap.H" #include "PatchPostProcessing.H" #include "VoidFraction.H" @@ -43,6 +44,7 @@ License makeCloudFunctionObjectType(FacePostProcessing, CloudType); \ makeCloudFunctionObjectType(ParticleErosion, CloudType); \ makeCloudFunctionObjectType(ParticleTracks, CloudType); \ + makeCloudFunctionObjectType(ParticleTrap, CloudType); \ makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ makeCloudFunctionObjectType(VoidFraction, CloudType); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C new file mode 100644 index 0000000000000000000000000000000000000000..f1b19bde59132264d37d9527387e16944a35de6c --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "ParticleTrap.H" +#include "fvcGrad.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ParticleTrap<CloudType>::ParticleTrap +( + const dictionary& dict, + CloudType& owner +) +: + CloudFunctionObject<CloudType>(dict, owner, typeName), + alphaName_ + ( + this->coeffDict().template lookupOrDefault<word>("alphaName", "alpha") + ), + alphaPtr_(NULL), + gradAlphaPtr_(NULL), + threshold_(readScalar(this->coeffDict().lookup("threshold"))) +{} + + +template<class CloudType> +Foam::ParticleTrap<CloudType>::ParticleTrap +( + const ParticleTrap<CloudType>& pt +) +: + CloudFunctionObject<CloudType>(pt), + alphaName_(pt.alphaName_), + alphaPtr_(pt.alphaPtr_), + gradAlphaPtr_(NULL), + threshold_(pt.threshold_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ParticleTrap<CloudType>::~ParticleTrap() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +void Foam::ParticleTrap<CloudType>::preEvolve() +{ + if (alphaPtr_ == NULL) + { + const fvMesh& mesh = this->owner().mesh(); + const volScalarField& alpha = + mesh.lookupObject<volScalarField>(alphaName_); + + alphaPtr_ = α + } + + if (gradAlphaPtr_.valid()) + { + gradAlphaPtr_() == fvc::grad(*alphaPtr_); + } + else + { + gradAlphaPtr_.reset(new volVectorField(fvc::grad(*alphaPtr_))); + } +} + + +template<class CloudType> +void Foam::ParticleTrap<CloudType>::postEvolve() +{ + gradAlphaPtr_.clear(); +} + + +template<class CloudType> +void Foam::ParticleTrap<CloudType>::postMove +( + parcelType& p, + const label cellI, + const scalar +) +{ + if (alphaPtr_->internalField()[cellI] < threshold_) + { + const vector& gradAlpha = gradAlphaPtr_()[cellI]; + vector nHat = gradAlpha/mag(gradAlpha); + scalar nHatU = nHat & p.U(); + + if (nHatU < 0) + { + p.U() -= 2*nHat*nHatU; + } + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H new file mode 100644 index 0000000000000000000000000000000000000000..39321af3c0886a409936aaa6d0556eaf93d0d4e9 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::ParticleTrap + +Description + Traps particles within a given phase fraction for multi-phase cases + + Model is activated using: + + particleTrap + { + alphaName alpha; // name volume fraction field + threshold 0.95; // alpha value below which model is active + } + + +SourceFiles + ParticleTrap.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ParticleTrap_H +#define ParticleTrap_H + +#include "CloudFunctionObject.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ParticleTrap Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class ParticleTrap +: + public CloudFunctionObject<CloudType> +{ + // Private Data + + // Typedefs + + //- Convenience typedef for parcel type + typedef typename CloudType::parcelType parcelType; + + + //- Name of vol fraction field + const word alphaName_; + + //- Pointer to the volume fraction field + const volScalarField* alphaPtr_; + + //- Gradient of the volume fraction field + autoPtr<volVectorField> gradAlphaPtr_; + + //- Threshold beyond which model is active + scalar threshold_; + + +public: + + //- Runtime type information + TypeName("particleTrap"); + + + // Constructors + + //- Construct from dictionary + ParticleTrap(const dictionary& dict, CloudType& owner); + + //- Construct copy + ParticleTrap(const ParticleTrap<CloudType>& pe); + + //- Construct and return a clone + virtual autoPtr<CloudFunctionObject<CloudType> > clone() const + { + return autoPtr<CloudFunctionObject<CloudType> > + ( + new ParticleTrap<CloudType>(*this) + ); + } + + + //- Destructor + virtual ~ParticleTrap(); + + + // Member Functions + + // Evaluation + + //- Pre-evolve hook + virtual void preEvolve(); + + //- Post-evolve hook + virtual void postEvolve(); + + //- Post-move hook + virtual void postMove + ( + typename CloudType::parcelType& p, + const label cellI, + const scalar dt + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ParticleTrap.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/mdTools/averageMDFields.H b/src/lagrangian/molecularDynamics/old/mdTools/averageMDFields.H deleted file mode 100644 index a19febe07b637ad81759ec08044641b6cb002772..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/averageMDFields.H +++ /dev/null @@ -1,227 +0,0 @@ -if (runTime.outputTime()) -{ - /*-----------------------------------------------------------------------*\ - Number density - \*-----------------------------------------------------------------------*/ - - scalarField totalRhoN_sum(mesh.nCells(), 0.0); - - forAll(allSpeciesRhoN, rN) - { - allSpeciesRhoN[rN].internalField() = - allSpeciesN_RU[rN] - /mesh.cellVolumes() - /nAveragingSteps; - - totalRhoN_sum += allSpeciesRhoN[rN].internalField(); - } - - totalRhoN.internalField() = totalRhoN_sum; - - - /*-----------------------------------------------------------------------*\ - Mass density - \*-----------------------------------------------------------------------*/ - - scalarField totalRhoM_sum(mesh.nCells(), 0.0); - - forAll(allSpeciesRhoM, rM) - { - allSpeciesRhoM[rM].internalField() = - allSpeciesM_RU[rM] - /mesh.cellVolumes() - /nAveragingSteps; - - totalRhoM_sum += allSpeciesRhoM[rM].internalField(); - } - - totalRhoM.internalField() = totalRhoM_sum; - - /*-----------------------------------------------------------------------*\ - Bulk velocity - \*-----------------------------------------------------------------------*/ - - vectorField totalMomentum_sum(mesh.nCells(), vector::zero); - - scalarField totalMass_sum(mesh.nCells(), 0.0); - - forAll(allSpeciesVelocity, v) - { - // A check for 1/0 molecules is required. - - vectorField& singleSpeciesVelocity - ( - allSpeciesVelocity[v].internalField() - ); - - forAll(singleSpeciesVelocity, sSV) - { - if (allSpeciesN_RU[v][sSV]) - { - singleSpeciesVelocity[sSV] = - allSpeciesVelocitySum_RU[v][sSV] - /allSpeciesN_RU[v][sSV]; - - totalMomentum_sum[sSV] += - allSpeciesM_RU[v][sSV] - /allSpeciesN_RU[v][sSV] - *allSpeciesVelocitySum_RU[v][sSV]; - - totalMass_sum[sSV] += allSpeciesM_RU[v][sSV]; - } - else - { - singleSpeciesVelocity[sSV] = vector::zero; - } - } - } - - volVectorField::InternalField& itotalVelocity = - totalVelocity.internalField(); - - forAll(itotalVelocity, tV) - { - if (totalMass_sum[tV] > VSMALL) - { - itotalVelocity[tV] = totalMomentum_sum[tV]/totalMass_sum[tV]; - } - else - { - itotalVelocity[tV] = vector::zero; - } - } - - /*-----------------------------------------------------------------------*\ - Kinetic temperature - \*-----------------------------------------------------------------------*/ - - scalarField totalTemperatureVTerms_sum(mesh.nCells(), 0.0); - - scalarField totalN_sum(mesh.nCells(), 0.0); - - forAll(allSpeciesTemperature, t) - { - // A check for 1/0 molecules is required. - - scalarField& singleSpeciesTemp - ( - allSpeciesTemperature[t].internalField() - ); - - forAll(singleSpeciesTemp, sST) - { - if (allSpeciesN_RU[t][sST]) - { - singleSpeciesTemp[sST] = - allSpeciesM_RU[t][sST] - /allSpeciesN_RU[t][sST] - /(3.0 * moleculeCloud::kb * allSpeciesN_RU[t][sST]) - *( - allSpeciesVelocityMagSquaredSum_RU[t][sST] - - - ( - allSpeciesVelocitySum_RU[t][sST] - & - allSpeciesVelocitySum_RU[t][sST] - ) - /allSpeciesN_RU[t][sST] - ); - - totalTemperatureVTerms_sum[sST] += - allSpeciesM_RU[t][sST] - /allSpeciesN_RU[t][sST] - *( - allSpeciesVelocityMagSquaredSum_RU[t][sST] - - - ( - allSpeciesVelocitySum_RU[t][sST] - & - allSpeciesVelocitySum_RU[t][sST] - ) - /allSpeciesN_RU[t][sST] - ); - - totalN_sum[sST] += allSpeciesN_RU[t][sST]; - } - else - { - singleSpeciesTemp[sST] = 0.0; - } - } - } - - volScalarField::InternalField& itotalTemperature = - totalTemperature.internalField(); - - forAll(itotalTemperature, tT) - { - if (totalN_sum[tT] > 0) - { - itotalTemperature[tT] = - totalTemperatureVTerms_sum[tT] - /(3.0 * moleculeCloud::kb * totalN_sum[tT]); - } - else - { - itotalTemperature[tT] = 0.0; - } - } - - /*-----------------------------------------------------------------------*\ - Mean kinetic energy - \*-----------------------------------------------------------------------*/ - - scalarField totalKE_sum(mesh.nCells(), 0.0); - - forAll(allSpeciesMeanKE, mKE) - { - // A check for 1/0 molecules is required. - - scalarField& singleSpeciesMeanKE - ( - allSpeciesMeanKE[mKE].internalField() - ); - - forAll(singleSpeciesMeanKE, sSMKE) - { - if (allSpeciesN_RU[mKE][sSMKE]) - { - singleSpeciesMeanKE[sSMKE] = - allSpeciesM_RU[mKE][sSMKE] - /allSpeciesN_RU[mKE][sSMKE] - /(2.0*allSpeciesN_RU[mKE][sSMKE]) - *( - allSpeciesVelocityMagSquaredSum_RU[mKE][sSMKE] - ); - - totalKE_sum[sSMKE] += - allSpeciesM_RU[mKE][sSMKE] - /allSpeciesN_RU[mKE][sSMKE] - /2.0 - *( - allSpeciesVelocityMagSquaredSum_RU[mKE][sSMKE] - ); - } - else - { - singleSpeciesMeanKE[sSMKE] = 0.0; - } - } - } - - volScalarField::InternalField& itotalMeanKE = totalMeanKE.internalField(); - - forAll(itotalMeanKE, tMKE) - { - if (totalN_sum[tMKE] > 0) - { - itotalMeanKE[tMKE] = - totalKE_sum[tMKE] - /totalN_sum[tMKE]; - } - else - { - itotalMeanKE[tMKE] = 0.0; - } - } -} diff --git a/src/lagrangian/molecularDynamics/old/mdTools/calculateAutoCorrelationFunctions.H b/src/lagrangian/molecularDynamics/old/mdTools/calculateAutoCorrelationFunctions.H deleted file mode 100644 index 4b46bdd0dfb3a3554ee55a74e3bc3a855fe56c84..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/calculateAutoCorrelationFunctions.H +++ /dev/null @@ -1,77 +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/>. - -\*---------------------------------------------------------------------------*/ - -if (mesh.time().timeIndex() % vacf.sampleSteps() == 0) -{ - Field<vector> uVals(molecules.size()); - - label uV = 0; - - forAllConstIter(IDLList<molecule>, molecules, mol) - { - uVals[uV++] = mol().U(); - } - - vacf.calculateCorrelationFunction(uVals); -} - -if (mesh.time().timeIndex() % pacf.sampleSteps() == 0) -{ - vector p = vector::zero; - - forAllConstIter(IDLList<molecule>, molecules, mol) - { - p.x() += - mol().mass() * mol().U().y() * mol().U().z() - + 0.5*mol().rf().yz(); - - p.y() += - mol().mass() * mol().U().z() * mol().U().x() - + 0.5*mol().rf().zx(); - - p.z() += - mol().mass() * mol().U().x() * mol().U().y() - + 0.5*mol().rf().xy(); - } - - pacf.calculateCorrelationFunction(p); -} - -if (mesh.time().timeIndex() % hfacf.sampleSteps() == 0) -{ - vector s = vector::zero; - - forAllConstIter(IDLList<molecule>, molecules, mol) - { - s += - ( - 0.5*mol().mass()*magSqr(mol().U()) - + mol().potentialEnergy() - )*mol().U() - + 0.5*(mol().rf() & mol().U()); - } - - hfacf.calculateCorrelationFunction(s); -} diff --git a/src/lagrangian/molecularDynamics/old/mdTools/calculateMDFields.H b/src/lagrangian/molecularDynamics/old/mdTools/calculateMDFields.H deleted file mode 100644 index af5c938da43cf3308ea2caf8ded6466cc27d09ad..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/calculateMDFields.H +++ /dev/null @@ -1,23 +0,0 @@ -const List<DynamicList<molecule*> >& cellOccupancy = molecules.cellOccupancy(); - -forAll(cellOccupancy, cell) -{ - const List<molecule*>& molsInCell = cellOccupancy[cell]; - - forAll(molsInCell, mIC) - { - molecule* mol = molsInCell[mIC]; - - const label molId = mol->id(); - - const vector& molU = mol->U(); - - allSpeciesN_RU[molId][cell]++; - - allSpeciesM_RU[molId][cell] += mol->mass(); - - allSpeciesVelocitySum_RU[molId][cell] += molU; - - allSpeciesVelocityMagSquaredSum_RU[molId][cell] += molU & molU; - } -} diff --git a/src/lagrangian/molecularDynamics/old/mdTools/calculateTransportProperties.H b/src/lagrangian/molecularDynamics/old/mdTools/calculateTransportProperties.H deleted file mode 100644 index 72af8f365794d6346ffb0ffed67d0a8b569e7585..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/calculateTransportProperties.H +++ /dev/null @@ -1,81 +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/>. - -\*---------------------------------------------------------------------------*/ - -if (writeVacf) -{ - OFstream vacfFile(runTime.path()/"vacf"); - - if (!vacf.writeAveraged(vacfFile)) - { - FatalErrorIn(args.executable()) - << "Failed writing to " - << vacfFile.name() - << abort(FatalError); - } -} - -Info<< "Diffusion coefficient = " - << vacf.integral() << endl; - -if (writePacf) -{ - OFstream pacfFile(runTime.path()/"pacf"); - - if (!pacf.writeAveraged(pacfFile)) - { - FatalErrorIn(args.executable()) - << "Failed writing to " - << pacfFile.name() - << abort(FatalError); - } -} - -Info<< "Viscosity = " - << pacf.integral()/averageTemperature/moleculeCloud::kb/meshVolume - << endl; - -if (writeHFacf) -{ - OFstream hfacfFile - ( - runTime.path()/ + "hfacf" - ); - - if (!hfacf.writeAveraged(hfacfFile)) - { - FatalErrorIn(args.executable()) - << "Failed writing to " - << hfacfFile.name() - << abort(FatalError); - } -} - -Info<< "Thermal conductivity = " - << hfacf.integral() - /averageTemperature - /averageTemperature - /moleculeCloud::kb - / meshVolume - << endl; diff --git a/src/lagrangian/molecularDynamics/old/mdTools/createAutoCorrelationFunctions.H b/src/lagrangian/molecularDynamics/old/mdTools/createAutoCorrelationFunctions.H deleted file mode 100644 index 55fbe14bbcec6974ffc056d9dca4cd9961779e36..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/createAutoCorrelationFunctions.H +++ /dev/null @@ -1,98 +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/>. - -\*---------------------------------------------------------------------------*/ - -Info << nl << "Creating autocorrelation functions." << endl; - -IOdictionary mdTransportProperitesDict -( - IOobject - ( - "mdTransportProperitesDict", - mesh.time().system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -const dictionary& autocorrelationFunctionDict -( - mdTransportProperitesDict.subDict("autocorrelationFunctions") -); - -//- Velocity autocorrelation function - -Info << tab << "velocty" << endl; - -const dictionary& velocityACFDict -( - autocorrelationFunctionDict.subDict("velocity") -); - -correlationFunction<vector> vacf -( - mesh, - velocityACFDict, - molecules.size() -); - -bool writeVacf(Switch(velocityACFDict.lookup("writeFile"))); - -//- Pressure autocorrelation function - -Info << tab << "pressure" << endl; - -const dictionary& pressureACFDict -( - autocorrelationFunctionDict.subDict("pressure") -); - -correlationFunction<vector> pacf -( - mesh, - pressureACFDict, - 1 -); - -bool writePacf(Switch(pressureACFDict.lookup("writeFile"))); - -//- Heat flux autocorrelation function - -Info << tab << "heat flux" << endl; - -const dictionary& heatFluxACFDict -( - autocorrelationFunctionDict.subDict("heatFlux") -); - -correlationFunction<vector> hfacf -( - mesh, - heatFluxACFDict, - 1 -); - -bool writeHFacf(Switch(heatFluxACFDict.lookup("writeFile"))); diff --git a/src/lagrangian/molecularDynamics/old/mdTools/createMDFields.H b/src/lagrangian/molecularDynamics/old/mdTools/createMDFields.H deleted file mode 100644 index 6d6617d652084e773ca496e7bdcafa61e9cdaec5..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/createMDFields.H +++ /dev/null @@ -1,324 +0,0 @@ -// Fields for data gathering - -List< scalarField > allSpeciesN_RU -( - molecules.potential().nIds(), - scalarField (mesh.nCells(), 0.0) -); - -List< scalarField > allSpeciesM_RU -( - molecules.potential().nIds(), - scalarField (mesh.nCells(), 0.0) -); - -List< vectorField > allSpeciesVelocitySum_RU -( - molecules.potential().nIds(), - vectorField (mesh.nCells(), vector::zero) -); - -List< scalarField > allSpeciesVelocityMagSquaredSum_RU -( - molecules.potential().nIds(), - scalarField (mesh.nCells(), 0.0) -); - -// Geometric Fields for IO - -Info << nl << "Creating fields." << endl; - -/*---------------------------------------------------------------------------*\ - Number density -\*---------------------------------------------------------------------------*/ - -PtrList<volScalarField> allSpeciesRhoN -( - molecules.potential().nIds() -); - -forAll(allSpeciesRhoN, rN) -{ - Info<< " Creating number density field for " - << molecules.potential().idList()[rN] << endl; - - allSpeciesRhoN.set - ( - rN, - new volScalarField - ( - IOobject - ( - "rhoN_" + molecules.potential().idList()[rN], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimless/dimVolume, - "zeroGradient" - ) - ); - allSpeciesRhoN[rN].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesRhoN[rN].correctBoundaryConditions(); -} - -Info << " Creating total number density field" << endl; - -volScalarField totalRhoN -( - IOobject - ( - "rhoN_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimless/dimVolume, - "zeroGradient" -); -totalRhoN.internalField() = scalarField (mesh.nCells(), 0.0); -totalRhoN.correctBoundaryConditions(); - -/*---------------------------------------------------------------------------*\ - Mass density -\*---------------------------------------------------------------------------*/ - -PtrList<volScalarField> allSpeciesRhoM -( - molecules.potential().nIds() -); - -forAll(allSpeciesRhoM, rM) -{ - Info<< " Creating mass density field for " - << molecules.potential().idList()[rM] << endl; - - allSpeciesRhoM.set - ( - rM, - new volScalarField - ( - IOobject - ( - "rhoM_" + molecules.potential().idList()[rM], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimMass/dimVolume, - "zeroGradient" - ) - ); - allSpeciesRhoM[rM].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesRhoM[rM].correctBoundaryConditions(); -} - -Info << " Creating total mass density field" << endl; - -volScalarField totalRhoM -( - IOobject - ( - "rhoM_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimMass/dimVolume, - "zeroGradient" -); -totalRhoM.internalField() = scalarField (mesh.nCells(), 0.0); -totalRhoM.correctBoundaryConditions(); - -/*---------------------------------------------------------------------------*\ - Bulk velocity -\*---------------------------------------------------------------------------*/ - -PtrList<volVectorField> allSpeciesVelocity -( - molecules.potential().nIds() -); - -forAll(allSpeciesVelocity, v) -{ - Info<< " Creating velocity field for " - << molecules.potential().idList()[v] << endl; - - allSpeciesVelocity.set - ( - v, - new volVectorField - ( - IOobject - ( - "velocity_" + molecules.potential().idList()[v], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimVelocity, - "zeroGradient" - ) - ); - allSpeciesVelocity[v].internalField() = - vectorField (mesh.nCells(), vector::zero); - allSpeciesVelocity[v].correctBoundaryConditions(); -} - -Info << " Creating total velocity field" << endl; - -// volVectorField totalVelocity -// ( -// IOobject -// ( -// "velocity_total", -// runTime.timeName(), -// mesh, -// IOobject::NO_READ, -// IOobject::AUTO_WRITE -// ), -// mesh, -// dimVelocity, -// "zeroGradient" -// ); -// totalVelocity.internalField() = vectorField (mesh.nCells(), vector::zero); -// totalVelocity.correctBoundaryConditions(); - - -volVectorField totalVelocity - -( - IOobject - ( - - "velocity_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - - ), - mesh, - dimensionedVector("zero", dimVelocity, vector::zero) -); - -/*---------------------------------------------------------------------------*\ - Kinetic temperature -\*---------------------------------------------------------------------------*/ - -PtrList<volScalarField> allSpeciesTemperature -( - molecules.potential().nIds() -); - -forAll(allSpeciesTemperature, t) -{ - Info<< " Creating temperature field for " - << molecules.potential().idList()[t] << endl; - - allSpeciesTemperature.set - ( - t, - new volScalarField - ( - IOobject - ( - "temperature_" + molecules.potential().idList()[t], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimTemperature, - "zeroGradient" - ) - ); - allSpeciesTemperature[t].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesTemperature[t].correctBoundaryConditions(); -} - -Info << " Creating total temperature field" << endl; - -volScalarField totalTemperature -( - IOobject - ( - "temperature_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimTemperature, - "zeroGradient" -); -totalTemperature.internalField() = scalarField (mesh.nCells(), 0.0); -totalTemperature.correctBoundaryConditions(); - -/*---------------------------------------------------------------------------*\ - Mean kinetic energy -\*---------------------------------------------------------------------------*/ - - -PtrList<volScalarField> allSpeciesMeanKE -( - molecules.potential().nIds() -); - -forAll(allSpeciesMeanKE, mKE) -{ - Info<< " Creating mean kinetic energy field for " - << molecules.potential().idList()[mKE] << endl; - - allSpeciesMeanKE.set - ( - mKE, - new volScalarField - ( - IOobject - ( - "meanKE_" + molecules.potential().idList()[mKE], - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionSet(1, 2, -2, 0, 0, 0, 0), - "zeroGradient" - ) - ); - allSpeciesMeanKE[mKE].internalField() = scalarField (mesh.nCells(), 0.0); - allSpeciesMeanKE[mKE].correctBoundaryConditions(); -} - -Info << " Creating total mean kinetic energy field" << endl; - -volScalarField totalMeanKE -( - IOobject - ( - "meanKE_total", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionSet(1, 2, -2, 0, 0, 0, 0), - "zeroGradient" -); -totalMeanKE.internalField() = scalarField (mesh.nCells(), 0.0); -totalMeanKE.correctBoundaryConditions(); diff --git a/src/lagrangian/molecularDynamics/old/mdTools/createRefUnits.H b/src/lagrangian/molecularDynamics/old/mdTools/createRefUnits.H deleted file mode 100644 index c1e558b2213748d246588a244958642a6d972215..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/createRefUnits.H +++ /dev/null @@ -1,22 +0,0 @@ -reducedUnits refUnits; - -IOobject reducedUnitsDictIOobject -( - "reducedUnitsDict", - runTime.system(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE -); - -if (reducedUnitsDictIOobject.headerOk()) -{ - Info<< nl - << "Reading reference quantities from reducedUnitsDict file." << endl; - - IOdictionary reducedUnitsDict(reducedUnitsDictIOobject); - - refUnits.setRefValues(reducedUnitsDict); -} - -Info << refUnits << endl; diff --git a/src/lagrangian/molecularDynamics/old/mdTools/md.H b/src/lagrangian/molecularDynamics/old/mdTools/md.H deleted file mode 100644 index 9a079764ae823abdac17a56236003610c44863df..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/md.H +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef md_H -#define md_H - #include "potential.H" - #include "moleculeCloud.H" - #include "correlationFunction.H" - #include "distribution.H" - #include "reducedUnits.H" -#endif - diff --git a/src/lagrangian/molecularDynamics/old/mdTools/meanMomentumEnergyAndNMols.H b/src/lagrangian/molecularDynamics/old/mdTools/meanMomentumEnergyAndNMols.H deleted file mode 100644 index ae117cafc5709dea2c18d46f8f94edb110d0637d..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/meanMomentumEnergyAndNMols.H +++ /dev/null @@ -1,180 +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/>. - -Global - meanMomentumEnergyAndNMols.H - -Description - Calculates and prints the mean momentum and energy in the system - and the number of molecules. - -\*---------------------------------------------------------------------------*/ - - -vector singleStepTotalLinearMomentum(vector::zero); - -vector singleStepTotalAngularMomentum(vector::zero); - -scalar singleStepMaxVelocityMag = 0.0; - -scalar singleStepTotalMass = 0.0; - -scalar singleStepTotalLinearKE = 0.0; - -scalar singleStepTotalAngularKE = 0.0; - -scalar singleStepTotalPE = 0.0; - -scalar singleStepTotalrDotf = 0.0; - -//vector singleStepCentreOfMass(vector::zero); - -label singleStepNMols = molecules.size(); - -label singleStepDOFs = 0; - -{ - forAllConstIter(IDLList<molecule>, molecules, mol) - { - const label molId = mol().id(); - - scalar molMass(molecules.constProps(molId).mass()); - - singleStepTotalMass += molMass; - - //singleStepCentreOfMass += mol().position()*molMass; - } - - // if (singleStepNMols) - // { - // singleStepCentreOfMass /= singleStepTotalMass; - // } - - forAllConstIter(IDLList<molecule>, molecules, mol) - { - const label molId = mol().id(); - - const molecule::constantProperties cP(molecules.constProps(molId)); - - scalar molMass(cP.mass()); - - const diagTensor& molMoI(cP.momentOfInertia()); - - const vector& molV(mol().v()); - - const vector& molOmega(inv(molMoI) & mol().pi()); - - vector molPiGlobal = mol().Q() & mol().pi(); - - singleStepTotalLinearMomentum += molV * molMass; - - singleStepTotalAngularMomentum += molPiGlobal; - //+((mol().position() - singleStepCentreOfMass) ^ (molV * molMass)); - - if (mag(molV) > singleStepMaxVelocityMag) - { - singleStepMaxVelocityMag = mag(molV); - } - - singleStepTotalLinearKE += 0.5*molMass*magSqr(molV); - - singleStepTotalAngularKE += 0.5*(molOmega & molMoI & molOmega); - - singleStepTotalPE += mol().potentialEnergy(); - - singleStepTotalrDotf += tr(mol().rf()); - - singleStepDOFs += cP.degreesOfFreedom(); - } -} - -if (Pstream::parRun()) -{ - reduce(singleStepTotalLinearMomentum, sumOp<vector>()); - - reduce(singleStepTotalAngularMomentum, sumOp<vector>()); - - reduce(singleStepMaxVelocityMag, maxOp<scalar>()); - - reduce(singleStepTotalMass, sumOp<scalar>()); - - reduce(singleStepTotalLinearKE, sumOp<scalar>()); - - reduce(singleStepTotalAngularKE, sumOp<scalar>()); - - reduce(singleStepTotalPE, sumOp<scalar>()); - - reduce(singleStepTotalrDotf, sumOp<scalar>()); - - reduce(singleStepNMols, sumOp<label>()); - - reduce(singleStepDOFs, sumOp<label>()); -} - -if (singleStepNMols) -{ - Info<< "Number of molecules in system = " - << singleStepNMols << nl - << "Overall number density = " - << singleStepNMols/meshVolume << nl - << "Overall mass density = " - << singleStepTotalMass/meshVolume << nl - << "Average linear momentum per molecule = " - << singleStepTotalLinearMomentum/singleStepNMols << ' ' - << mag(singleStepTotalLinearMomentum)/singleStepNMols << nl - << "Average angular momentum per molecule = " - << singleStepTotalAngularMomentum << ' ' - << mag(singleStepTotalAngularMomentum)/singleStepNMols << nl - << "Maximum |velocity| = " - << singleStepMaxVelocityMag << nl - << "Average linear KE per molecule = " - << singleStepTotalLinearKE/singleStepNMols << nl - << "Average angular KE per molecule = " - << singleStepTotalAngularKE/singleStepNMols << nl - << "Average PE per molecule = " - << singleStepTotalPE/singleStepNMols << nl - << "Average TE per molecule = " - << - ( - singleStepTotalLinearKE - + singleStepTotalAngularKE - + singleStepTotalPE - ) - /singleStepNMols - << endl; - - // Info<< singleStepNMols << " " - // << singleStepTotalMomentum/singleStepTotalMass << " " - // << singleStepMaxVelocityMag << " " - // << singleStepTotalKE/singleStepNMols << " " - // << singleStepTotalPE/singleStepNMols << " " - // << (singleStepTotalKE + singleStepTotalPE) - // /singleStepNMols << endl; -} -else -{ - Info<< "No molecules in system" << endl; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/mdTools/resetMDFields.H b/src/lagrangian/molecularDynamics/old/mdTools/resetMDFields.H deleted file mode 100644 index af0197b5fe4dc0fc2e75858e9f49ba86f3b0a273..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/resetMDFields.H +++ /dev/null @@ -1,26 +0,0 @@ -if (runTime.outputTime()) -{ - allSpeciesN_RU = List< scalarField > - ( - molecules.potential().nIds(), - scalarField(mesh.nCells(), 0.0) - ); - - allSpeciesM_RU = List< scalarField > - ( - molecules.potential().nIds(), - scalarField(mesh.nCells(), 0.0) - ); - - allSpeciesVelocitySum_RU = List< vectorField > - ( - molecules.potential().nIds(), - vectorField(mesh.nCells(), vector::zero) - ); - - allSpeciesVelocityMagSquaredSum_RU = List< scalarField > - ( - molecules.potential().nIds(), - scalarField(mesh.nCells(), 0.0) - ); -} diff --git a/src/lagrangian/molecularDynamics/old/mdTools/temperatureAndPressure.H b/src/lagrangian/molecularDynamics/old/mdTools/temperatureAndPressure.H deleted file mode 100644 index df182244d21dd7d05b11d519b236e9694ccb0d26..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/mdTools/temperatureAndPressure.H +++ /dev/null @@ -1,111 +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/>. - -Global - temperatureAndPressure.H - -Description - Accumulates values for temperature and pressure measurement, and - calculates and outputs the average values at output times. - Requires temperatureAndPressureVariables.H to be declared before the - timeloop. - -\*---------------------------------------------------------------------------*/ - -accumulatedTotalLinearMomentum += singleStepTotalLinearMomentum; - -accumulatedTotalMass += singleStepTotalMass; - -accumulatedTotalLinearKE += singleStepTotalLinearKE; - -accumulatedTotalAngularKE += singleStepTotalAngularKE; - -accumulatedTotalPE += singleStepTotalPE; - -accumulatedTotalrDotfSum += singleStepTotalrDotf; - -accumulatedNMols += singleStepNMols; - -accumulatedDOFs += singleStepDOFs; - -if (runTime.outputTime()) -{ - if (accumulatedNMols) - { - Info<< "calculating averages" << endl; - - averageTemperature = - ( - 2.0/(physicoChemical::k.value()*accumulatedDOFs) - * - ( - accumulatedTotalLinearKE + accumulatedTotalAngularKE - - - 0.5*magSqr(accumulatedTotalLinearMomentum)/accumulatedTotalMass - ) - ); - - averagePressure = - ( - ( - (accumulatedNMols/nAveragingSteps) - *physicoChemical::k.value()*averageTemperature - + accumulatedTotalrDotfSum/(6.0*nAveragingSteps) - ) - / - meshVolume - ); - - Info<< "----------------------------------------" << nl - << "Averaged properties" << nl - << "Average |velocity| = " - << mag(accumulatedTotalLinearMomentum)/accumulatedTotalMass << nl - << "Average temperature = " << averageTemperature << nl - << "Average pressure = " << averagePressure << nl - << "----------------------------------------" << endl; - } - else - { - Info<< "Not averaging temperature and pressure: " - << "no molecules in system" << endl; - } - - accumulatedTotalLinearMomentum = vector::zero; - - accumulatedTotalMass = 0.0; - - accumulatedTotalLinearKE = 0.0; - - accumulatedTotalAngularKE = 0.0; - - accumulatedTotalPE = 0.0; - - accumulatedTotalrDotfSum = 0.0; - - accumulatedNMols = 0; - - accumulatedDOFs = 0; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/Make/files b/src/lagrangian/molecularDynamics/old/molecularMeasurements/Make/files deleted file mode 100644 index 8450dc836082269edd9242bbdae0195cfe7a9861..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -distribution/distribution.C - -LIB = $(FOAM_LIBBIN)/libmolecularMeasurements diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/Make/options b/src/lagrangian/molecularDynamics/old/molecularMeasurements/Make/options deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulator.C b/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulator.C deleted file mode 100644 index 2163688da9b1b0fdf01213862f9c35cb8607d238..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulator.C +++ /dev/null @@ -1,236 +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 "bufferedAccumulator.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template<class Type> -const char* const - Foam::bufferedAccumulator<Type>::typeName("bufferedAccumulator"); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -void Foam::bufferedAccumulator<Type>::accumulateAndResetBuffer(const label b) -{ - accumulationBuffer() += (*this)[b]; - - averagesTaken_++; - - (*this)[b] = Field<Type>(bufferLength(), pTraits<Type>::zero); - - bufferOffsets_[b] = 0; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::bufferedAccumulator<Type>::bufferedAccumulator() -: - List< Field<Type> >(), - averagesTaken_(), - bufferOffsets_() -{} - - -template<class Type> -Foam::bufferedAccumulator<Type>::bufferedAccumulator -( - const label nBuffers, - const label bufferLength, - const label bufferingInterval -) -: - List< Field<Type> >(), - averagesTaken_(), - bufferOffsets_() -{ - setSizes - ( - nBuffers, - bufferLength, - bufferingInterval - ); -} - - -template<class Type> -Foam::bufferedAccumulator<Type>::bufferedAccumulator -( - const bufferedAccumulator<Type>& bA -) -: - List< Field<Type> >(static_cast< List< Field<Type> > >(bA)), - averagesTaken_(bA.averagesTaken()), - bufferOffsets_(bA.bufferOffsets()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::bufferedAccumulator<Type>::~bufferedAccumulator() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::bufferedAccumulator<Type>::setSizes -( - const label nBuffers, - const label bufferLength, - const label bufferingInterval -) -{ - (*this).setSize(nBuffers + 1); - - forAll((*this), b) - { - (*this)[b] = Field<Type>(bufferLength, pTraits<Type>::zero); - } - - averagesTaken_ = 0; - - bufferOffsets_.setSize(nBuffers); - - forAll(bufferOffsets_, bO) - { - bufferOffsets_[bO] = -bufferingInterval * bO - 1; - } -} - - -template<class Type> -Foam::label Foam::bufferedAccumulator<Type>::addToBuffers -( - const List<Type>& valuesToAdd -) -{ - label bufferToRefill = -1; - - for (label b = 0; b < nBuffers(); b++) - { - Field<Type>& buf((*this)[b]); - - label& bO = bufferOffsets_[b]; - - if (bO >= 0) - { - buf[bO] = valuesToAdd[b]; - } - - bO++; - - if (bO == bufferLength()) - { - accumulateAndResetBuffer(b); - } - - if (bO == 0) - { - if (bufferToRefill != -1) - { - FatalErrorIn("bufferedAccumulator<Type>::addToBuffers ") - << "More than one bufferedAccumulator accumulation " - << "buffer filled at once, this is considered an error." - << abort(FatalError); - } - - bufferToRefill = b; - } - } - - return bufferToRefill; -} - - -template<class Type> -Foam::Field<Type> Foam::bufferedAccumulator<Type>::averaged() const -{ - if (averagesTaken_) - { - Field<Type> bA = accumulationBuffer()/averagesTaken_; - - return bA; - } - else - { - WarningIn - ( - "bufferedAccumulator<Type>::averagedbufferedAccumulator() const" - ) << "Averaged correlation function requested but averagesTaken = " - << averagesTaken_ - << ". Returning empty field." - << endl; - - return Field<Type>(bufferLength(), pTraits<Type>::zero); - } -} - - -template<class Type> -void Foam::bufferedAccumulator<Type>::resetAveraging() -{ - accumulationBuffer() = Field<Type>(bufferLength(), pTraits<Type>::zero); - - averagesTaken_ = 0; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template<class Type> -void Foam::bufferedAccumulator<Type>::operator= -( - const bufferedAccumulator<Type>& rhs -) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "bufferedAccumulator<Type>::operator=(const bufferedAccumulator&)" - ) << "Attempted assignment to self" - << abort(FatalError); - } - - List< Field<Type> >::operator=(rhs); - - averagesTaken_ = rhs.averagesTaken(); - - bufferOffsets_ = rhs.bufferOffsets(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -# include "bufferedAccumulatorIO.C" - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulator.H b/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulator.H deleted file mode 100644 index 8d462902f48ce69cf294d90391b37e1407f4e720..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulator.H +++ /dev/null @@ -1,176 +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::bufferedAccumulator - -Description - -SourceFiles - bufferedAccumulatorI.H - bufferedAccumulator.C - bufferedAccumulatorIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef bufferedAccumulator_H -#define bufferedAccumulator_H - -#include "Field.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -template<class Type> -class bufferedAccumulator; - -template<class Type> -Ostream& operator<< -( - Ostream&, - const bufferedAccumulator<Type>& -); - -/*---------------------------------------------------------------------------*\ - Class bufferedAccumulator Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class bufferedAccumulator -: - public List< Field<Type> > -{ - // Private data - - label averagesTaken_; - - List<label> bufferOffsets_; - - - // Private Member Functions - - inline Field<Type>& accumulationBuffer(); - - inline const Field<Type>& accumulationBuffer() const; - - void accumulateAndResetBuffer(const label b); - - -public: - - //- Component type - typedef typename pTraits<Type>::cmptType cmptType; - - - // Static data members - - static const char* const typeName; - - - // Constructors - - //- Construct null - bufferedAccumulator(); - - //- Construct from components - bufferedAccumulator - ( - const label nBuffers, - const label bufferLength, - const label bufferingInterval - ); - - //- Construct as copy - bufferedAccumulator(const bufferedAccumulator<Type>&); - - - //- Destructor - ~bufferedAccumulator(); - - - // Member Functions - - label addToBuffers(const List<Type>& valuesToAdd); - - Field<Type> averaged() const; - - void resetAveraging(); - - - // Access - - inline label averagesTaken() const; - - inline label nBuffers() const; - - inline label bufferLength() const; - - inline const List<label>& bufferOffsets() const; - - - // Edit - - void setSizes - ( - const label nBuffers, - const label bufferLength, - const label bufferingInterval - ); - - - // Member Operators - - void operator=(const bufferedAccumulator<Type>&); - - - // IOstream Operators - - friend Ostream& operator<< <Type> - ( - Ostream&, - const bufferedAccumulator<Type>& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "bufferedAccumulatorI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "bufferedAccumulator.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorI.H b/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorI.H deleted file mode 100644 index 303b2e5ec02bfb53a90acf21d9d3b88a56a29972..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorI.H +++ /dev/null @@ -1,79 +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/>. - -\*---------------------------------------------------------------------------*/ - -namespace Foam -{ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -inline Field<Type>& bufferedAccumulator<Type>::accumulationBuffer() -{ - return (*this)[nBuffers()]; -} - - -template<class Type> -inline const Field<Type>& bufferedAccumulator<Type>::accumulationBuffer() const -{ - return (*this)[nBuffers()]; -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -inline label bufferedAccumulator<Type>::averagesTaken() const -{ - return averagesTaken_; -} - - -template<class Type> -inline label bufferedAccumulator<Type>::nBuffers() const -{ - return bufferOffsets_.size(); -} - - -template<class Type> -inline label bufferedAccumulator<Type>::bufferLength() const -{ - return (*this)[0].size(); -} - - -template<class Type> -inline const List<label>& bufferedAccumulator<Type>::bufferOffsets() const -{ - return bufferOffsets_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunction.C b/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunction.C deleted file mode 100644 index 0928783a53db991adf8852d96ad48c0362dd3d76..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunction.C +++ /dev/null @@ -1,223 +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 "correlationFunction.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template<class Type> -const char* const - Foam::correlationFunction<Type>::typeName("correlationFunction"); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -void Foam::correlationFunction<Type>::setTimesAndSizes -( - const label tZeroBufferSize -) -{ - sampleSteps_ = ceil(sampleInterval_/mesh_.time().deltaTValue()); - - sampleInterval_ = sampleSteps_*mesh_.time().deltaTValue(); - - label bufferLength(ceil(duration_/sampleInterval_)); - - duration_ = bufferLength*sampleInterval_; - - label bufferingInterval(ceil(averagingInterval_/sampleInterval_)); - - averagingInterval_ = bufferingInterval*sampleInterval_; - - label nBuffers(ceil(duration_/averagingInterval_)); - - this->setSizes - ( - nBuffers, - bufferLength, - bufferingInterval - ); - - tZeroBuffers_ = - Field< Field<Type> > - ( - nBuffers, - Field<Type> - ( - tZeroBufferSize, - pTraits<Type>::zero - ) - ); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::correlationFunction<Type>::correlationFunction -( - const polyMesh& mesh, - const dictionary& cfDict, - const label tZeroBufferSize -) -: - bufferedAccumulator<scalar>(), - mesh_(mesh) -{ - duration_ = readScalar(cfDict.lookup("duration")); - - sampleInterval_ = readScalar(cfDict.lookup("sampleInterval")); - - averagingInterval_ = readScalar(cfDict.lookup("averagingInterval")); - - setTimesAndSizes(tZeroBufferSize); -} - - -template<class Type> -Foam::correlationFunction<Type>::correlationFunction -( - const polyMesh& mesh, - const label tZeroBufferSize, - const scalar duration, - const scalar sampleInterval, - const scalar averagingInterval -) -: - bufferedAccumulator<scalar>(), - mesh_(mesh), - duration_(duration), - sampleInterval_(sampleInterval), - averagingInterval_(averagingInterval) -{ - setTimesAndSizes(tZeroBufferSize); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::correlationFunction<Type>::~correlationFunction() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::correlationFunction<Type>::calculateCorrelationFunction -( - const Field<Type>& currentValues -) -{ - if (measurandFieldSize() != currentValues.size()) - { - FatalErrorIn("correlationFunction<Type>::calculateCorrelationFunction") - << "Trying to supply a Field of length" - << currentValues.size() - << " to calculate the correlation function. " - << "Expecting a Field of length " - << measurandFieldSize() << nl - << abort(FatalError); - } - - List<scalar> cFSums(nBuffers(),0.0); - - forAll(tZeroBuffers_, tZB) - { - scalar& cFSum = cFSums[tZB]; - - const Field<Type>& tZeroBuffer = tZeroBuffers_[tZB]; - - forAll(currentValues, cV) - { - const Type& tZeroBufferValue = tZeroBuffer[cV]; - - const Type& currentValue = currentValues[cV]; - - forAll(currentValue, component) - { - cFSum += - ( - tZeroBufferValue[component]*currentValue[component] - ); - } - } - - cFSum /= (measurandFieldSize()*currentValues[0].size()); - } - - label bufferToRefill = addToBuffers(cFSums); - - if (bufferToRefill != -1) - { - tZeroBuffers_[bufferToRefill] = currentValues; - } -} - - -template<class Type> -void Foam::correlationFunction<Type>::calculateCorrelationFunction -( - const Type& currentValue -) -{ - if (measurandFieldSize() != 1) - { - FatalErrorIn("correlationFunction<Type>::calculateCorrelationFunction") - << "Trying to supply a single value to calculate the correlation " - << "function. Expecting a Field of length " - << measurandFieldSize() - << abort(FatalError); - } - - calculateCorrelationFunction(Field<Type>(1, currentValue)); -} - - -template<class Type> -Foam::scalar Foam::correlationFunction<Type>::integral() const -{ - Field<scalar> averageCF(averaged()); - - scalar cFIntegral = 0.0; - - for (label v = 0; v < averageCF.size() - 1; v++) - { - cFIntegral += - 0.5 - *sampleInterval_ - *(averageCF[v+1] + averageCF[v]); - } - - return cFIntegral; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -# include "correlationFunctionIO.C" - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunction.H b/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunction.H deleted file mode 100644 index 0c02e412df859d307e452e02b8ee85cda17e93d2..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunction.H +++ /dev/null @@ -1,181 +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::correlationFunction - -Description - -SourceFiles - correlationFunctionI.H - correlationFunction.C - correlationFunctionIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef correlationFunction_H -#define correlationFunction_H - -#include "bufferedAccumulator.H" -#include "dictionary.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -template<class Type> -class correlationFunction; - -template<class Type> -Ostream& operator<< -( - Ostream&, - const correlationFunction<Type>& -); - -/*---------------------------------------------------------------------------*\ - Class correlationFunction Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class correlationFunction -: - public bufferedAccumulator<scalar> -{ - // Private data - - const polyMesh& mesh_; - - Field< Field<Type> > tZeroBuffers_; - - scalar duration_; - scalar sampleInterval_; - scalar averagingInterval_; - - label sampleSteps_; - - - // Private Member Functions - - void setTimesAndSizes(const label); - - //- Disallow default bitwise copy construct - correlationFunction(const correlationFunction<Type>&); - - //- Disallow default bitwise assignment - void operator=(const correlationFunction<Type>&); - - -public: - - //- Component type - typedef typename pTraits<Type>::cmptType cmptType; - - - // Static data members - - static const char* const typeName; - - - // Constructors - - //- Construct from dictionary - correlationFunction - ( - const polyMesh&, - const dictionary&, - const label tZeroBufferSize - ); - - //- Construct from components - correlationFunction - ( - const polyMesh&, - const label tZeroBufferSize, - const scalar duration, - const scalar sampleInterval, - const scalar averagingInterval - - ); - - - //- Destructor - ~correlationFunction(); - - - // Member Functions - - void calculateCorrelationFunction(const Field<Type>&); - - void calculateCorrelationFunction(const Type&); - - scalar integral() const; - - bool writeAveraged(Ostream&) const; - - - // Access - - inline const Field< Field<Type> >& tZeroBuffers() const; - - inline scalar duration() const; - - inline scalar sampleInterval() const; - - inline scalar averagingInterval() const; - - inline label sampleSteps() const; - - inline label measurandFieldSize() const; - - - // IOstream Operators - - friend Ostream& operator<< <Type> - ( - Ostream&, - const correlationFunction<Type>& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "correlationFunctionI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "correlationFunction.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunctionI.H b/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunctionI.H deleted file mode 100644 index c3296a928ac06a6daab2f6bdd89ee2c30425917a..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunctionI.H +++ /dev/null @@ -1,69 +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/>. - -\*---------------------------------------------------------------------------*/ - -template<class Type> -inline const Foam::Field< Foam::Field<Type> >& -Foam::correlationFunction<Type>::tZeroBuffers() const -{ - return tZeroBuffers_; -} - - -template<class Type> -inline Foam::scalar Foam::correlationFunction<Type>::duration() const -{ - return duration_; -} - - -template<class Type> -inline Foam::scalar Foam::correlationFunction<Type>::sampleInterval() const -{ - return sampleInterval_; -} - - -template<class Type> -inline Foam::scalar Foam::correlationFunction<Type>::averagingInterval() const -{ - return averagingInterval_; -} - - -template<class Type> -inline Foam::label Foam::correlationFunction<Type>::sampleSteps() const -{ - return sampleSteps_; -} - - -template<class Type> -inline Foam::label Foam::correlationFunction<Type>::measurandFieldSize() const -{ - return tZeroBuffers_[0].size(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunctionIO.C b/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunctionIO.C deleted file mode 100644 index 63d7b68c88c7038e788b2a7ca0938d10ab93f0bf..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/correlationFunction/correlationFunctionIO.C +++ /dev/null @@ -1,71 +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 "correlationFunction.H" -#include "IOstreams.H" - -template<class Type> -bool Foam::correlationFunction<Type>::writeAveraged(Ostream& os) const -{ - Field<scalar> averageCF(averaged()); - - forAll(averageCF, v) - { - os << v*sampleInterval() - << token::SPACE - << averageCF[v] - << nl; - } - - return os.good(); -} - - -template<class Type> -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const correlationFunction<Type>& cF -) -{ - os << cF.duration() - << nl << cF.sampleInterval() - << nl << cF.averagingInterval() - << nl << cF.sampleSteps() - << nl << cF.tZeroBuffers() - << nl << static_cast<const bufferedAccumulator<scalar>&>(cF); - - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<" - "(Ostream&, const correlationFunction<Type>&)" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distribution.C b/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distribution.C deleted file mode 100644 index 2089fb0e0764f6736e5b1573c84763c020646ea0..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distribution.C +++ /dev/null @@ -1,478 +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 "distribution.H" -#include "OFstream.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(distribution, 0); -} - -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // - -void Foam::distribution::write -( - const fileName& file, - const List<Pair<scalar> >& pairs -) -{ - OFstream os(file); - - forAll(pairs, i) - { - os << pairs[i].first() << ' ' << pairs[i].second() << nl; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distribution::distribution() -: - Map<label>(), - binWidth_(1) -{} - - -Foam::distribution::distribution(const scalar binWidth) -: - Map<label>(), - binWidth_(binWidth) -{} - - -Foam::distribution::distribution(const distribution& d) -: - Map<label>(static_cast< Map<label> >(d)), - binWidth_(d.binWidth()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distribution::~distribution() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::label Foam::distribution::totalEntries() const -{ - label sumOfEntries = 0; - - forAllConstIter(Map<label>, *this, iter) - { - sumOfEntries += iter(); - - if (sumOfEntries < 0) - { - WarningIn("label distribution::totalEntries()") - << "Accumulated distribution values total has become negative: " - << "sumOfEntries = " << sumOfEntries - << ". This is most likely to be because too many samples " - << "have been added to the bins and the label has 'rolled " - << "round'. Try distribution::approxTotalEntries which " - << "returns a scalar." << endl; - - sumOfEntries = -1; - - break; - } - } - - return sumOfEntries; -} - - -Foam::scalar Foam::distribution::approxTotalEntries() const -{ - scalar sumOfEntries = 0; - - forAllConstIter(Map<label>, *this, iter) - { - sumOfEntries += scalar(iter()); - } - - return sumOfEntries; -} - - -Foam::scalar Foam::distribution::mean() const -{ - scalar runningSum = 0; - - scalar totEnt = approxTotalEntries(); - - List<label> keys = toc(); - - forAll(keys,k) - { - label key = keys[k]; - - runningSum += - (0.5 + scalar(key)) - *binWidth_ - *scalar((*this)[key]) - /totEnt; - } - - return runningSum; -} - - -Foam::scalar Foam::distribution::median() -{ - // From: - // http://mathworld.wolfram.com/StatisticalMedian.html - // The statistical median is the value of the distribution variable - // where the cumulative distribution = 0.5. - - scalar median = 0.0; - - scalar runningSum = 0.0; - - List<Pair<scalar> > normDist(normalised()); - - if (normDist.size()) - { - if (normDist.size() == 1) - { - median = normDist[0].first(); - } - else if - ( - normDist.size() > 1 - && normDist[0].second()*binWidth_ > 0.5 - ) - { - scalar xk = normDist[1].first(); - scalar xkm1 = normDist[0].first(); - scalar Sk = - (normDist[0].second() + normDist[1].second())*binWidth_; - scalar Skm1 = normDist[0].second()*binWidth_; - - median = (0.5 - Skm1)*(xk - xkm1)/(Sk - Skm1) + xkm1; - } - else - { - label lastNonZeroIndex = 0; - - forAll(normDist,nD) - { - if (runningSum + (normDist[nD].second()*binWidth_) > 0.5) - { - scalar xk = normDist[nD].first(); - scalar xkm1 = normDist[lastNonZeroIndex].first(); - scalar Sk = runningSum + (normDist[nD].second()*binWidth_); - scalar Skm1 = runningSum; - - median = (0.5 - Skm1)*(xk - xkm1)/(Sk - Skm1) + xkm1; - - break; - } - else if (normDist[nD].second() > 0.0) - { - runningSum += normDist[nD].second()*binWidth_; - - lastNonZeroIndex = nD; - } - } - } - } - - return median; -} - - -void Foam::distribution::add(const scalar valueToAdd) -{ - iterator iter(this->begin()); - - label n = label(valueToAdd/binWidth_) - label(neg(valueToAdd/binWidth_)); - - iter = find(n); - - if (iter == this->end()) - { - this->insert(n,1); - } - else - { - (*this)[n]++; - } - - if ((*this)[n] < 0) - { - FatalErrorIn("distribution::add(const scalar valueToAdd)") - << "Accumulated distribution value has become negative: " - << "bin = " << (0.5 + scalar(n)) * binWidth_ - << ", value = " << (*this)[n] - << ". This is most likely to be because too many samples " - << "have been added to a bin and the label has 'rolled round'" - << abort(FatalError); - } -} - - -void Foam::distribution::add(const label valueToAdd) -{ - add(scalar(valueToAdd)); -} - - -void Foam::distribution::insertMissingKeys() -{ - iterator iter(this->begin()); - - List<label> keys = toc(); - - sort(keys); - - if (keys.size()) - { - for (label k = keys[0]; k < keys.last(); k++) - { - iter = find(k); - - if (iter == this->end()) - { - this->insert(k,0); - } - } - } -} - - -Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalised() -{ - scalar totEnt = approxTotalEntries(); - - insertMissingKeys(); - - List<label> keys = toc(); - - sort(keys); - - List<Pair<scalar> > normDist(size()); - - forAll(keys,k) - { - label key = keys[k]; - - normDist[k].first() = (0.5 + scalar(key))*binWidth_; - - normDist[k].second() = scalar((*this)[key])/totEnt/binWidth_; - } - - if (debug) - { - Info<< "totEnt: " << totEnt << endl; - } - - return normDist; -} - - -Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalisedMinusMean() -{ - return normalisedShifted(mean()); -} - - -Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalisedShifted -( - scalar shiftValue -) -{ - List<Pair<scalar> > oldDist(normalised()); - - List<Pair<scalar> > newDist(oldDist.size()); - - forAll(oldDist,u) - { - oldDist[u].first() -= shiftValue; - } - - scalar lowestOldBin = oldDist[0].first()/binWidth_ - 0.5; - - label lowestNewKey = label - ( - lowestOldBin + 0.5*sign(lowestOldBin) - ); - - scalar interpolationStartDirection = - sign(scalar(lowestNewKey) - lowestOldBin); - - label newKey = lowestNewKey; - - if (debug) - { - Info<< shiftValue - << nl << lowestOldBin - << nl << lowestNewKey - << nl << interpolationStartDirection - << endl; - - scalar checkNormalisation = 0; - - forAll(oldDist, oD) - { - checkNormalisation += oldDist[oD].second()*binWidth_; - } - - Info<< "Initial normalisation = " << checkNormalisation << endl; - } - - forAll(oldDist,u) - { - newDist[u].first() = (0.5 + scalar(newKey)) * binWidth_; - - if (interpolationStartDirection < 0) - { - if (u == 0) - { - newDist[u].second() = - (0.5 + scalar(newKey))*oldDist[u].second() - - oldDist[u].second() - *(oldDist[u].first() - binWidth_)/ binWidth_; - } - else - { - newDist[u].second() = - (0.5 + scalar(newKey)) - *(oldDist[u].second() - oldDist[u-1].second()) - + - ( - oldDist[u-1].second()*oldDist[u].first() - - oldDist[u].second()*oldDist[u-1].first() - ) - /binWidth_; - } - } - else - { - if (u == oldDist.size() - 1) - { - newDist[u].second() = - (0.5 + scalar(newKey))*-oldDist[u].second() - + oldDist[u].second()*(oldDist[u].first() + binWidth_) - /binWidth_; - } - else - { - newDist[u].second() = - (0.5 + scalar(newKey)) - *(oldDist[u+1].second() - oldDist[u].second()) - + - ( - oldDist[u].second()*oldDist[u+1].first() - - oldDist[u+1].second()*oldDist[u].first() - ) - /binWidth_; - } - } - - newKey++; - } - - if (debug) - { - scalar checkNormalisation = 0; - - forAll(newDist, nD) - { - checkNormalisation += newDist[nD].second()*binWidth_; - } - - Info<< "Shifted normalisation = " << checkNormalisation << endl; - } - - return newDist; -} - - -Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::raw() -{ - insertMissingKeys(); - - List<label> keys = toc(); - - sort(keys); - - List<Pair<scalar> > rawDist(size()); - - forAll(keys,k) - { - label key = keys[k]; - - rawDist[k].first() = (0.5 + scalar(key))*binWidth_; - - rawDist[k].second() = scalar((*this)[key]); - } - - return rawDist; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void Foam::distribution::operator=(const distribution& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn("distribution::operator=(const distribution&)") - << "Attempted assignment to self" - << abort(FatalError); - } - - Map<label>::operator=(rhs); - - binWidth_ = rhs.binWidth(); -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const distribution& d) -{ - os << d.binWidth_ - << static_cast<const Map<label>&>(d); - - // Check state of Ostream - os.check - ( - "Ostream& operator<<(Ostream&, " - "const distribution&)" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distribution.H b/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distribution.H deleted file mode 100644 index 7897c034ec3461ed0ceb2278ecd84c12e7ed33f9..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distribution.H +++ /dev/null @@ -1,148 +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::distribution - -Description - Accumulating histogram of values. Specified bin resolution - automatic generation of bins. - -SourceFiles - distributionI.H - distribution.C - -\*---------------------------------------------------------------------------*/ - -#ifndef distribution_H -#define distribution_H - -#include "Map.H" -#include "Pair.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class distribution Declaration -\*---------------------------------------------------------------------------*/ - -class distribution -: - public Map<label> -{ - // Private data - - scalar binWidth_; - - -public: - - //- Runtime type information - - TypeName("distribution"); - - // Static functions - - //- write to file - - static void write - ( - const fileName& file, - const List<Pair<scalar> >& pairs - ); - - - // Constructors - - //- Construct null - distribution(); - - //- Construct from binWidth - distribution(const scalar binWidth); - - //- Construct as copy - distribution(const distribution&); - - - //- Destructor - virtual ~distribution(); - - - // Member Functions - - label totalEntries() const; - - scalar approxTotalEntries() const; - - scalar mean() const; - - scalar median(); - - //- Add a value to the appropriate bin of the distribution. - void add(const scalar valueToAdd); - - void add(const label valueToAdd); - - void insertMissingKeys(); - - List<Pair<scalar> > normalised(); - - List<Pair<scalar> > normalisedMinusMean(); - - List<Pair<scalar> > normalisedShifted(scalar shiftValue); - - List<Pair<scalar> > raw(); - - - // Access - - inline scalar binWidth() const; - - - // Member Operators - - void operator=(const distribution&); - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const distribution&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "distributionI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnits.C b/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnits.C deleted file mode 100644 index 61c768c9fe766559478e0670ac87ee1dd61de892..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnits.C +++ /dev/null @@ -1,164 +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 "reducedUnits.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -const Foam::scalar Foam::reducedUnits::kb = 1.3806504e-23; - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::reducedUnits::calcRefValues() -{ - if - ( - refTime_ < VSMALL - || refLength_ < VSMALL - || refMass_ < VSMALL - ) - { - FatalErrorIn("Foam::reducedUnits::calcRefValues() ") - << "One of more referencence values too small for floating point " - << "calculation: " - << "refTime_ = " << refTime_ - << ", refLength = " << refTemp_ - << ", refMass = " << refMass_ - << nl << abort(FatalError); - } - - refEnergy_ = refLength_*refLength_*refMass_/(refTime_*refTime_); - - refTemp_ = refEnergy_ / kb; - - refForce_ = refEnergy_/refLength_; - - refVelocity_ = Foam::sqrt(refEnergy_/refMass_); - - refVolume_ = Foam::pow(refLength_,3.0); - - refPressure_ = refEnergy_/refVolume_; - - refMassDensity_ = refMass_/refVolume_; - - refNumberDensity_ = 1.0/refVolume_; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::reducedUnits::reducedUnits() -: - refLength_(1e-9), - refTime_(1e-12), - refMass_(1.660538782e-27) -{ - calcRefValues(); -} - - -Foam::reducedUnits::reducedUnits -( - scalar refLength, - scalar refTime, - scalar refMass -) -: - refLength_(refLength), - refTime_(refTime), - refMass_(refMass) -{ - calcRefValues(); -} - - -Foam::reducedUnits::reducedUnits(const IOdictionary& reducedUnitsDict) -: - refLength_(), - refTime_(), - refMass_() -{ - setRefValues(reducedUnitsDict); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::reducedUnits::~reducedUnits() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::reducedUnits::setRefValues -( - scalar refLength, - scalar refTime, - scalar refMass -) -{ - refLength_ = refLength; - - refTime_ = refTime; - - refMass_ = refMass; - - calcRefValues(); -} - - -void Foam::reducedUnits::setRefValues -( - const IOdictionary& reducedUnitsDict -) -{ - refLength_ = readScalar(reducedUnitsDict.lookup("refLength")); - - refTime_ = readScalar(reducedUnitsDict.lookup("refTime")); - - refMass_ = readScalar(reducedUnitsDict.lookup("refMass")); - - calcRefValues(); -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void Foam::reducedUnits::operator=(const reducedUnits& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "Foam::reducedUnits::operator=(const Foam::reducedUnits&)" - ) << "Attempted assignment to self" - << abort(FatalError); - } -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnits.H b/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnits.H deleted file mode 100644 index 8319bf50bc46ba14df732c80283ae47b14bbe34b..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnits.H +++ /dev/null @@ -1,182 +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::reducedUnits - -Description - -SourceFiles - reducedUnitsI.H - reducedUnits.C - reducedUnitsIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef reducedUnits_H -#define reducedUnits_H - -#include "scalar.H" -#include "IOdictionary.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class reducedUnits Declaration -\*---------------------------------------------------------------------------*/ - -class reducedUnits -{ - // Private data - - // Reduced units - - // Fundamental values - - scalar refLength_; - - scalar refTime_; - - scalar refMass_; - - // Derived values - - scalar refEnergy_; - - scalar refTemp_; - - scalar refForce_; - - scalar refVelocity_; - - scalar refVolume_; - - scalar refPressure_; - - scalar refMassDensity_; - - scalar refNumberDensity_; - - - // Private Member Functions - - void calcRefValues(); - - //- Disallow default bitwise copy construct - reducedUnits(const reducedUnits&); - - //- Disallow default bitwise assignment - void operator=(const reducedUnits&); - - -public: - - // Static data members - - //- Static data someStaticData - static const scalar kb; - - - // Constructors - - //- Construct with no argument, uses default values: - // length = 1nm - // mass = 1.660538782e-27kg (unified atomic mass unit) - // temperature = 1K (therefore, energy = 1*kb) - reducedUnits(); - - //- Construct from components - reducedUnits - ( - scalar refLength, - scalar refTime, - scalar refMass - ); - - //- Construct from dictionary - reducedUnits(const IOdictionary& reducedUnitsDict); - - - //- Destructor - ~reducedUnits(); - - - // Member Functions - - void setRefValues - ( - scalar refLength, - scalar refTime, - scalar refMass - ); - - void setRefValues(const IOdictionary& reducedUnitsDict); - - - // Access - - inline scalar refLength() const; - - inline scalar refTime() const; - - inline scalar refMass() const; - - inline scalar refTemp() const; - - inline scalar refEnergy() const; - - inline scalar refForce() const; - - inline scalar refVelocity() const; - - inline scalar refVolume() const; - - inline scalar refPressure() const; - - inline scalar refMassDensity() const; - - inline scalar refNumberDensity() const; - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const reducedUnits&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "reducedUnitsI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnitsI.H b/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnitsI.H deleted file mode 100644 index 6144b7568cff7115c7d688356945155e6b9aeae4..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnitsI.H +++ /dev/null @@ -1,94 +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/>. - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline Foam::scalar Foam::reducedUnits::refLength() const -{ - return refLength_; -} - - -inline Foam::scalar Foam::reducedUnits::refTime() const -{ - return refTime_; -} - - -inline Foam::scalar Foam::reducedUnits::refMass() const -{ - return refMass_; -} - - -inline Foam::scalar Foam::reducedUnits::refTemp() const -{ - return refTemp_; -} - - -inline Foam::scalar Foam::reducedUnits::refEnergy() const -{ - return refEnergy_; -} - - -inline Foam::scalar Foam::reducedUnits::refForce() const -{ - return refForce_; -} - - -inline Foam::scalar Foam::reducedUnits::refVelocity() const -{ - return refVelocity_; -} - - -inline Foam::scalar Foam::reducedUnits::refVolume() const -{ - return refVolume_; -} - - -inline Foam::scalar Foam::reducedUnits::refPressure() const -{ - return refPressure_; -} - - -inline Foam::scalar Foam::reducedUnits::refMassDensity() const -{ - return refMassDensity_; -} - - -inline Foam::scalar Foam::reducedUnits::refNumberDensity() const -{ - return refNumberDensity_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnitsIO.C b/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnitsIO.C deleted file mode 100644 index 7ee1f39bd088000edf3ef0fe27f2e3d6bfb58f0c..0000000000000000000000000000000000000000 --- a/src/lagrangian/molecularDynamics/old/reducedUnits/reducedUnitsIO.C +++ /dev/null @@ -1,60 +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 "reducedUnits.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const reducedUnits& rU) -{ - os << nl << "Defined: " << nl - << tab << "refLength = " << rU.refLength() << " m" << nl - << tab << "refTime = " << rU.refTime() << " s" << nl - << tab << "refMass = " << rU.refMass() << " kg" << nl - << tab << "Boltzmann constant, kb = " << reducedUnits::kb << " J/K" - << nl << "Calculated: " << nl - << tab << "refEnergy = " << rU.refEnergy() << " J" << nl - << tab << "refTemp = " << rU.refTemp() << " K" << nl - << tab << "refForce = " << rU.refForce() << " N" << nl - << tab << "refVelocity = " << rU.refVelocity() << " m/s" << nl - << tab << "refVolume = " << rU.refVolume() << " m^3" << nl - << tab << "refPressure = " << rU.refPressure() << " N/m^2" << nl - << tab << "refMassDensity = " << rU.refMassDensity() << " kg/m^3" << nl - << tab << "refNumberDensity = " << rU.refNumberDensity() << " m^-3" - << endl; - - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " - "const Foam::reducedUnits&)" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 2b37a3137a8272268231dea6c08e59bf14339094..1739f7c90714229d69b1521d83da21eb87f31ffc 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -32,6 +32,32 @@ License namespace Foam { + //- Helper class for list + template<class T> + class ListPlusEqOp + { + public: + void operator()(List<T>& x, const List<T> y) const + { + if (y.size()) + { + if (x.size()) + { + label sz = x.size(); + x.setSize(sz + y.size()); + forAll(y, i) + { + x[sz++] = y[i]; + } + } + else + { + x = y; + } + } + } + }; + //- Combine operator for interpolateToSource/Target template<class Type, class BinaryOp> class combineBinaryOp @@ -1044,7 +1070,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing // reset starting seed label startSeedI = 0; - label nNonOverlap = 0; + DynamicList<label> nonOverlapFaces; do { nbrFaces.clear(); @@ -1085,7 +1111,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing if (!faceProcessed) { - nNonOverlap++; + nonOverlapFaces.append(srcFaceI); } // choose new src face from current src face neighbour @@ -1105,10 +1131,13 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing } } while (nFacesRemaining > 0); - if (nNonOverlap != 0) + if (nonOverlapFaces.size() != 0) { - Pout<< "AMI: " << nNonOverlap << " non-overlap faces identified" + Pout<< "AMI: " << nonOverlapFaces.size() + << " non-overlap faces identified" << endl; + + srcNonOverlap_.transfer(nonOverlapFaces); } // transfer data to persistent storage @@ -1461,6 +1490,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation singlePatchProc_(-999), srcAddress_(), srcWeights_(), + srcNonOverlap_(), tgtAddress_(), tgtWeights_(), treePtr_(NULL), @@ -1493,6 +1523,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation singlePatchProc_(-999), srcAddress_(), srcWeights_(), + srcNonOverlap_(), tgtAddress_(), tgtWeights_(), treePtr_(NULL), @@ -1580,6 +1611,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation singlePatchProc_(fineAMI.singlePatchProc_), srcAddress_(), srcWeights_(), + srcNonOverlap_(), tgtAddress_(), tgtWeights_(), treePtr_(NULL), diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index 7f0237dac4ee98f9676d72a2a73c2dfdfd5274b4..a342d65e3aeb0098d76bbdd7276b08949bf91d82 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,32 +84,6 @@ class AMIInterpolation //- local typedef to octree tree-type typedef treeDataPrimitivePatch<face, SubList, const pointField&> treeType; - //- Helper class for list - template<class T> - class ListPlusEqOp - { - public: - void operator()(List<T>& x, const List<T> y) const - { - if (y.size()) - { - if (x.size()) - { - label sz = x.size(); - x.setSize(sz + y.size()); - forAll(y, i) - { - x[sz++] = y[i]; - } - } - else - { - x = y; - } - } - } - }; - // Private data @@ -132,6 +106,10 @@ class AMIInterpolation //- Weights of target faces per source face scalarListList srcWeights_; + //- Labels of faces that are not overlapped by any target faces + // (should be empty for correct functioning) + labelList srcNonOverlap_; + // Target patch @@ -141,7 +119,7 @@ class AMIInterpolation //- Addresses of source faces per target face labelListList tgtAddress_; - //- Weights of wource faces per target face + //- Weights of source faces per target face scalarListList tgtWeights_; @@ -387,6 +365,11 @@ public: //- Return const access to source patch weights inline const scalarListList& srcWeights() const; + //- Labels of faces that are not overlapped by any target faces + // (should be empty for correct functioning) + inline const labelList& srcNonOverlap() const; + + //- Source map pointer - valid only if singlePatchProc = -1 // This gets source data into a form to be consumed by // tgtAddress, tgtWeights diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H index 0907ee494cd1eaacb3edb3fe67d8b3e2ffc75c5c..3dd21b5aa3a8642c6d98a75b2be2840d06626413 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,6 +55,14 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeights() const } +template<class SourcePatch, class TargetPatch> +inline const Foam::labelList& +Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcNonOverlap() const +{ + return srcNonOverlap_; +} + + template<class SourcePatch, class TargetPatch> inline const Foam::mapDistribute& Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcMap() const diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C index 9701431dc41eb045e4e9f4e73c34376b37f1f8a3..0939a2e3bec5142b84c8b3eb25a2d3788234458d 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,10 +41,11 @@ namespace Foam const char* Foam::NamedEnum < Foam::pointToCell::pointAction, - 1 + 2 >::names[] = { - "any" + "any", + "edge" }; } @@ -52,11 +53,12 @@ namespace Foam Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_ ( pointToCell::typeName, - "\n Usage: pointToCell <pointSet> any\n\n" - " Select all cells with any point in the pointSet\n\n" + "\n Usage: pointToCell <pointSet> any|edge\n\n" + " Select all cells with any point ('any') or any edge ('edge')" + " in the pointSet\n\n" ); -const Foam::NamedEnum<Foam::pointToCell::pointAction, 1> +const Foam::NamedEnum<Foam::pointToCell::pointAction, 2> Foam::pointToCell::pointActionNames_; @@ -82,6 +84,26 @@ void Foam::pointToCell::combine(topoSet& set, const bool add) const } } } + else if (option_ == EDGE) + { + const faceList& faces = mesh_.faces(); + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + forAll(f, fp) + { + if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp))) + { + addOrDelete(set, mesh_.faceOwner()[faceI], add); + if (mesh_.isInternalFace(faceI)) + { + addOrDelete(set, mesh_.faceNeighbour()[faceI], add); + } + } + } + } + } } diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H b/src/meshTools/sets/cellSources/pointToCell/pointToCell.H index 2e8a507640ae01cc54ea01b6369d81e383d8940a..96f02f18bf64c475f8526e82403c45e3b6627ba7 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,8 @@ public: //- Enumeration defining the valid options enum pointAction { - ANY // Cells using any point in set + ANY, // Cells using any point in set + EDGE // Cells using an edge with both points in set //ALL // Possible extension: cells whose all points are in set }; @@ -64,7 +65,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<pointAction, 1> pointActionNames_; + static const NamedEnum<pointAction, 2> pointActionNames_; //- Name of set to use word setName_; diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C index 81e13e4fc459d26bdd85ee0bd8c0edc00c48f114..7d66aaefe2cd999053f8cca4d2d5209c8e6dd9dd 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,11 +41,12 @@ namespace Foam const char* Foam::NamedEnum < Foam::pointToFace::pointAction, - 2 + 3 >::names[] = { "any", - "all" + "all", + "edge" }; } @@ -53,13 +54,14 @@ namespace Foam Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_ ( pointToFace::typeName, - "\n Usage: pointToFace <pointSet> any|all\n\n" + "\n Usage: pointToFace <pointSet> any|all|edge\n\n" " Select faces with\n" " -any point in the pointSet\n" " -all points in the pointSet\n\n" + " -two consecutive points (an edge) in the pointSet\n\n" ); -const Foam::NamedEnum<Foam::pointToFace::pointAction, 2> +const Foam::NamedEnum<Foam::pointToFace::pointAction, 3> Foam::pointToFace::pointActionNames_; @@ -126,6 +128,23 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const } } } + else if (option_ == EDGE) + { + const faceList& faces = mesh_.faces(); + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + forAll(f, fp) + { + if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp))) + { + addOrDelete(set, faceI, add); + break; + } + } + } + } } diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H b/src/meshTools/sets/faceSources/pointToFace/pointToFace.H index 482626f33fc3aa652e893a4a31061648190f2446..e31bc65086f02e96086085e25bfbe57c778d48ca 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,7 +58,8 @@ public: enum pointAction { ANY, - ALL + ALL, + EDGE }; @@ -67,7 +68,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<pointAction, 2> pointActionNames_; + static const NamedEnum<pointAction, 3> pointActionNames_; //- Name of set to use word setName_; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index b2b03af70dc23165f9bdb320fe46f469cc5b693f..5a9e4b1d1e121fefdbd58b8504abb8ab767caca7 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -156,7 +156,9 @@ void Foam::fieldMinMax::writeFileHeader() if (fieldMinMaxFilePtr_.valid()) { fieldMinMaxFilePtr_() - << "# Time" << tab << "field" << tab << "min" << tab << "max" + << "# Time" << token::TAB << "field" << token::TAB + << "min" << token::TAB << "position(min)" << token::TAB + << "max" << token::TAB << "position(max)" << token::TAB << endl; } } @@ -184,50 +186,27 @@ void Foam::fieldMinMax::write() makeFile(); } - forAll(fieldSet_, fieldI) + if (log_) { - calcMinMaxFields<scalar>(fieldSet_[fieldI]); - calcMinMaxFields<vector>(fieldSet_[fieldI]); - calcMinMaxFields<sphericalTensor>(fieldSet_[fieldI]); - calcMinMaxFields<symmTensor>(fieldSet_[fieldI]); - calcMinMaxFields<tensor>(fieldSet_[fieldI]); + Info<< type() << " output:" << nl; } - } -} - - -template<> -void Foam::fieldMinMax::calcMinMaxFields<Foam::scalar> -( - const word& fieldName -) -{ - if (obr_.foundObject<volScalarField>(fieldName)) - { - const volScalarField& field = - obr_.lookupObject<volScalarField>(fieldName); - const scalar minValue = min(field).value(); - const scalar maxValue = max(field).value(); - if (Pstream::master()) + forAll(fieldSet_, fieldI) { - if (write_) - { - fieldMinMaxFilePtr_() - << obr_.time().value() << tab - << fieldName << tab << minValue << tab << maxValue << endl; - } + calcMinMaxFields<scalar>(fieldSet_[fieldI], mdCmpt); + calcMinMaxFields<vector>(fieldSet_[fieldI], mode_); + calcMinMaxFields<sphericalTensor>(fieldSet_[fieldI], mode_); + calcMinMaxFields<symmTensor>(fieldSet_[fieldI], mode_); + calcMinMaxFields<tensor>(fieldSet_[fieldI], mode_); + } - if (log_) - { - Info<< "fieldMinMax output:" << nl - << " min(" << fieldName << ") = " << minValue << nl - << " max(" << fieldName << ") = " << maxValue << nl - << endl; - } + if (log_) + { + Info<< endl; } } } + // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H index 8971a5b1d42d059feff59471e6a371636045279d..3cccb9668d83fb50f1a2b0d3ef61a0fd388615ed 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H @@ -163,7 +163,11 @@ public: //- Calculate the field min/max template<class Type> - void calcMinMaxFields(const word& fieldName); + void calcMinMaxFields + ( + const word& fieldName, + const modeType& mode + ); //- Write the fieldMinMax virtual void write(); @@ -178,11 +182,6 @@ public: }; -// Template specialisation for scalar fields -template<> -void fieldMinMax::calcMinMaxFields<scalar>(const word& fieldName); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 5f74bcc28ad4e9f71e3b83d1fa6f940ad7534982..c2e96743297ceb91b6a6aafa6e97b204e679a45a 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -27,81 +27,140 @@ License #include "volFields.H" #include "dictionary.H" #include "Time.H" +#include "ListOps.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<class Type> -void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) +void Foam::fieldMinMax::calcMinMaxFields +( + const word& fieldName, + const modeType& mode +) { typedef GeometricField<Type, fvPatchField, volMesh> fieldType; if (obr_.foundObject<fieldType>(fieldName)) { + const label procI = Pstream::myProcNo(); + const fieldType& field = obr_.lookupObject<fieldType>(fieldName); - switch (mode_) + switch (mode) { case mdMag: { - const scalar minValue = min(mag(field)).value(); - const scalar maxValue = max(mag(field)).value(); + const scalarField magField(mag(field)); + + labelList minIs(Pstream::nProcs()); + scalarList minVs(Pstream::nProcs()); + List<vector> minCs(Pstream::nProcs()); + minIs[procI] = findMin(magField); + minVs[procI] = magField[minIs[procI]]; + minCs[procI] = field.mesh().C()[minIs[procI]]; + + Pstream::gatherList(minIs); + Pstream::gatherList(minVs); + Pstream::gatherList(minCs); + + labelList maxIs(Pstream::nProcs()); + scalarList maxVs(Pstream::nProcs()); + List<vector> maxCs(Pstream::nProcs()); + maxIs[procI] = findMax(magField); + maxVs[procI] = magField[maxIs[procI]]; + maxCs[procI] = field.mesh().C()[maxIs[procI]]; + + Pstream::gatherList(maxIs); + Pstream::gatherList(maxVs); + Pstream::gatherList(maxCs); + + label minI = findMin(minVs); + scalar minValue = minVs[minI]; + const vector& minC = minCs[minI]; + + label maxI = findMax(maxVs); + scalar maxValue = maxVs[maxI]; + const vector& maxC = maxCs[maxI]; if (Pstream::master()) { if (write_) { fieldMinMaxFilePtr_() - << obr_.time().value() << tab - << fieldName << tab << minValue << tab << maxValue - << endl; + << obr_.time().value() << token::TAB + << fieldName << token::TAB + << minValue << token::TAB << minC << token::TAB + << maxValue << token::TAB << maxC << endl; } if (log_) { - Info<< "fieldMinMax output:" << nl - << " min(mag(" << fieldName << ")) = " - << minValue << nl + Info<< " min(mag(" << fieldName << ")) = " + << minValue << " at position " << minC << nl << " max(mag(" << fieldName << ")) = " - << maxValue << nl - << endl; + << maxValue << " at position " << maxC << nl; } } break; } case mdCmpt: { - const Type minValue = min(field).value(); - const Type maxValue = max(field).value(); + List<Type> minVs(Pstream::nProcs()); + labelList minIs(Pstream::nProcs()); + List<vector> minCs(Pstream::nProcs()); + minIs[procI] = findMin(field); + minVs[procI] = field[minIs[procI]]; + minCs[procI] = field.mesh().C()[minIs[procI]]; + + Pstream::gatherList(minIs); + Pstream::gatherList(minVs); + Pstream::gatherList(minCs); + + List<Type> maxVs(Pstream::nProcs()); + labelList maxIs(Pstream::nProcs()); + List<vector> maxCs(Pstream::nProcs()); + maxIs[procI] = findMax(field); + maxVs[procI] = field[maxIs[procI]]; + maxCs[procI] = field.mesh().C()[maxIs[procI]]; + + Pstream::gatherList(maxIs); + Pstream::gatherList(maxVs); + Pstream::gatherList(maxCs); + + label minI = findMin(minVs); + Type minValue = minVs[minI]; + const vector& minC = minCs[minI]; + + label maxI = findMax(maxVs); + Type maxValue = maxVs[maxI]; + const vector& maxC = maxCs[maxI]; + if (Pstream::master()) { if (write_) { fieldMinMaxFilePtr_() - << obr_.time().value() << tab - << fieldName << tab << minValue << tab << maxValue - << endl; + << obr_.time().value() << token::TAB + << fieldName << token::TAB + << minValue << token::TAB << minC << token::TAB + << maxValue << token::TAB << maxC << endl; } if (log_) { - Info<< "fieldMinMax output:" << nl - << " cmptMin(" << fieldName << ") = " - << minValue << nl - << " cmptMax(" << fieldName << ") = " - << maxValue << nl - << endl; + Info<< " min(" << fieldName << ") = " + << minValue << " at position " << minC << nl + << " max(" << fieldName << ") = " + << maxValue << " at position " << maxC << nl; } } break; } default: { - FatalErrorIn - ( - "Foam::fieldMinMax::calcMinMaxFields" - "(const word& fieldName)" - )<< "Unknown min/max mode: " << modeTypeNames_[mode_] - << exit(FatalError); + FatalErrorIn("Foam::fieldMinMax::calcMinMaxFields(const word&)") + << "Unknown min/max mode: " << modeTypeNames_[mode_] + << exit(FatalError); } } } diff --git a/src/postProcessing/functionObjects/field/fieldValues/controlDict b/src/postProcessing/functionObjects/field/fieldValues/controlDict index 24b3ddbad403d1cd99759e861c89aebaf30af9a8..ff5007f18d43eceacbd876c53aeaa9b10d595138 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/controlDict +++ b/src/postProcessing/functionObjects/field/fieldValues/controlDict @@ -67,17 +67,14 @@ functions sourceName movingWall; //// if sampledSurface: dictionary with a sampledSurface - //// Note: the sampledSurfaces will have cell-values, i.e. - //// non-interpolated. Also will not sample surface fields. + //// Note: will not sample surface fields. //sampledSurfaceDict //{ - // type cuttingPlane; - // planeType pointAndNormal; - // pointAndNormalDict - // { - // basePoint (0 0.099 0); - // normalVector (0 1 0); - // } + // // Sampling on triSurface + // type sampledTriSurfaceMesh; + // surface integrationPlane.stl; + // source cells; // sample cells or boundaryFaces + // interpolate true; //} // Operation: areaAverage/sum/weightedAverage ... diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index 97f244c60b21a0d91d66b1955073434be667720d..6ce7b3350ddb4e5eac90b3bc8338ece4e6504e78 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -53,7 +53,7 @@ namespace Foam const char* Foam::NamedEnum < Foam::fieldValues::faceSource::operationType, - 9 + 11 >::names[] = { "none", @@ -64,7 +64,9 @@ namespace Foam "areaIntegrate", "min", "max", - "CoV" + "CoV", + "areaNormalAverage", + "areaNormalIntegrate" }; } @@ -73,7 +75,7 @@ namespace Foam const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3> Foam::fieldValues::faceSource::sourceTypeNames_; -const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 9> +const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 11> Foam::fieldValues::faceSource::operationTypeNames_; @@ -313,6 +315,35 @@ void Foam::fieldValues::faceSource::writeFileHeader() } +template<> +Foam::vector Foam::fieldValues::faceSource::processValues +( + const Field<vector>& values, + const vectorField& Sf, + const scalarField& weightField +) const +{ + switch (operation_) + { + case opAreaNormalAverage: + { + scalar result = sum(values&Sf)/sum(mag(Sf)); + return vector(result, 0.0, 0.0); + } + case opAreaNormalIntegrate: + { + scalar result = sum(values&Sf); + return vector(result, 0.0, 0.0); + } + default: + { + // Fall through to other operations + return processSameTypeValues(values, Sf, weightField); + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::fieldValues::faceSource::faceSource diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H index b7a292403593051934bf8c6cf0b57bbef556f9de..fd95788894aa3e9d63ebc083045e422f66d6164c 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,7 +65,9 @@ Description - min - max - CoV (Coefficient of variation: standard deviation/mean) - + - areaNormalAverage (vector with first component (average of) inproduct + of value and face area vector) + - areaNormalIntegrate ( ,, ,, (sum of) ,, Notes: - faces on empty patches get ignored @@ -75,7 +77,11 @@ Description negative pressure) - using sampledSurfaces: - they do not do surface fields - - they use cell values - they do not do any interpolation. + - if interpolate=true they use interpolationCellPoint + otherwise they use cell values + - each triangle in sampledSurface is logically only in one cell + so interpolation will be wrong when triangles are larger than + cells. This can only happen for sampling on triSurfaceMesh. - take care when using isoSurfaces - these might have duplicate triangles so integration might be wrong @@ -138,11 +144,13 @@ public: opAreaIntegrate, opMin, opMax, - opCoV + opCoV, + opAreaNormalAverage, + opAreaNormalIntegrate }; //- Operation type names - static const NamedEnum<operationType, 9> operationTypeNames_; + static const NamedEnum<operationType, 11> operationTypeNames_; private: @@ -194,7 +202,6 @@ protected: autoPtr<sampledSurface> surfacePtr_; - // Protected Member Functions //- Initialise, e.g. face addressing @@ -212,12 +219,23 @@ protected: const bool mustGet = false ) const; - //- Apply the 'operation' to the values + //- Apply the 'operation' to the values. Operation has to + // preserve Type. + template<class Type> + Type processSameTypeValues + ( + const Field<Type>& values, + const vectorField& Sf, + const scalarField& weightField + ) const; + + //- Apply the 'operation' to the values. Wrapper around + // processSameTypeValues. See also template specialisation below. template<class Type> Type processValues ( const Field<Type>& values, - const scalarField& magSf, + const vectorField& Sf, const scalarField& weightField ) const; @@ -292,6 +310,17 @@ public: }; +//- Specialisation of processing vectors for opAreaNormalAverage, +// opAreaNormalIntegrate (use inproduct - dimension reducing operation) +template<> +vector faceSource::processValues +( + const Field<vector>& values, + const vectorField& Sf, + const scalarField& weightField +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fieldValues diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index 79c031818fda6824ebf362877ed7bd8bd331bcd4..892593d0360bfe14aafeadc92f2b4820123f653d 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -27,6 +27,7 @@ License #include "surfaceFields.H" #include "volFields.H" #include "sampledSurface.H" +#include "interpolationCellPoint.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -65,13 +66,44 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::getFieldValues } else if (obr_.foundObject<vf>(fieldName)) { + const vf& fld = obr_.lookupObject<vf>(fieldName); + if (surfacePtr_.valid()) { - return surfacePtr_().sample(obr_.lookupObject<vf>(fieldName)); + if (surfacePtr_().interpolate()) + { + const interpolationCellPoint<Type> interp(fld); + tmp<Field<Type> > tintFld(surfacePtr_().interpolate(interp)); + const Field<Type>& intFld = tintFld(); + + // Average + const faceList& faces = surfacePtr_().faces(); + tmp<Field<Type> > tavg + ( + new Field<Type>(faces.size(), pTraits<Type>::zero) + ); + Field<Type>& avg = tavg(); + + forAll(faces, faceI) + { + const face& f = faces[faceI]; + forAll(f, fp) + { + avg[faceI] += intFld[f[fp]]; + } + avg[faceI] /= f.size(); + } + + return tavg; + } + else + { + return surfacePtr_().sample(fld); + } } else { - return filterField(obr_.lookupObject<vf>(fieldName), true); + return filterField(fld, true); } } @@ -94,12 +126,11 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::getFieldValues template<class Type> -Type Foam::fieldValues::faceSource::processValues +Type Foam::fieldValues::faceSource::processSameTypeValues ( const Field<Type>& values, - const scalarField& magSf, + const vectorField& Sf, const scalarField& weightField - ) const { Type result = pTraits<Type>::zero; @@ -122,11 +153,15 @@ Type Foam::fieldValues::faceSource::processValues } case opAreaAverage: { + const scalarField magSf = mag(Sf); + result = sum(values*magSf)/sum(magSf); break; } case opAreaIntegrate: { + const scalarField magSf = mag(Sf); + result = sum(values*magSf); break; } @@ -142,6 +177,8 @@ Type Foam::fieldValues::faceSource::processValues } case opCoV: { + const scalarField magSf = mag(Sf); + Type meanValue = sum(values*magSf)/sum(magSf); const label nComp = pTraits<Type>::nComponents; @@ -169,6 +206,19 @@ Type Foam::fieldValues::faceSource::processValues } +template<class Type> +Type Foam::fieldValues::faceSource::processValues +( + const Field<Type>& values, + const vectorField& Sf, + const scalarField& weightField +) const +{ + return processSameTypeValues(values, Sf, weightField); +} + + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -186,22 +236,22 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) weightField = getFieldValues<scalar>(weightFieldName_, true); } - scalarField magSf; + vectorField Sf; if (surfacePtr_.valid()) { - // Get unoriented magSf - magSf = surfacePtr_().magSf(); + // Get oriented Sf + Sf = surfacePtr_().Sf(); } else { - // Get unoriented magSf - magSf = filterField(mesh().magSf(), false); + // Get oriented Sf + Sf = filterField(mesh().Sf(), false); } // Combine onto master combineFields(values); - combineFields(magSf); + combineFields(Sf); combineFields(weightField); // apply weight field @@ -210,7 +260,7 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) if (Pstream::master()) { - Type result = processValues(values, magSf, weightField); + Type result = processValues(values, Sf, weightField); if (valueOutput_) { diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files index c632fc6222f27b02bfdf0c557a5ff822962d1a45..f6e23536e04cac814f1357c7f2890267b76d82d8 100644 --- a/src/postProcessing/functionObjects/utilities/Make/files +++ b/src/postProcessing/functionObjects/utilities/Make/files @@ -1,15 +1,21 @@ codedFunctionObject/codedFunctionObject.C +dsmcFields/dsmcFields.C +dsmcFields/dsmcFieldsFunctionObject.C + pressureCoefficient/pressureCoefficient.C pressureCoefficient/pressureCoefficientFunctionObject.C staticPressure/staticPressure.C staticPressure/staticPressureFunctionObject.C -dsmcFields/dsmcFields.C -dsmcFields/dsmcFieldsFunctionObject.C - timeActivatedFileUpdate/timeActivatedFileUpdate.C timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C +yPlusLES/yPlusLES.C +yPlusLES/yPlusLESFunctionObject.C + +yPlusRAS/yPlusRAS.C +yPlusRAS/yPlusRASFunctionObject.C + LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects diff --git a/src/postProcessing/functionObjects/utilities/Make/options b/src/postProcessing/functionObjects/utilities/Make/options index 623013bc21e695c7fbe125c2c8c1022853db647e..9acdda40ef3fdbd183628ef0ab4f6acc8a9754d8 100644 --- a/src/postProcessing/functionObjects/utilities/Make/options +++ b/src/postProcessing/functionObjects/utilities/Make/options @@ -3,11 +3,23 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/dsmc/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions \ + -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lsampling \ -llagrangian \ - -ldsmc + -ldsmc \ + -lincompressibleTransportModels \ + -lcompressibleRASModels \ + -lincompressibleRASModels \ + -lcompressibleLESModels \ + -lincompressibleLESModels \ + -lbasicThermophysicalModels diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorIO.C b/src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H similarity index 67% rename from src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorIO.C rename to src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H index 247fe3d37db15d852699271ebbbb9175ca4d977a..55c541ab8f7db1ea59404aa0a4c3602ea997a605 100644 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorIO.C +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,31 +21,29 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -\*---------------------------------------------------------------------------*/ +Typedef + Foam::IOyPlusLES -#include "bufferedAccumulator.H" -#include "IOstreams.H" +Description + Instance of the generic IOOutputFilter for yPlusLES. -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // +\*---------------------------------------------------------------------------*/ -template<class Type> -Foam::Ostream& -Foam::operator<<(Ostream& os, const bufferedAccumulator<Type>& bA) -{ +#ifndef IOyPlusLES_H +#define IOyPlusLES_H - os << bA.averagesTaken_ - << static_cast<const List< Field<Type> >&>(bA) - << bA.bufferOffsets(); +#include "yPlusLES.H" +#include "IOOutputFilter.H" - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " - "const Foam::bufferedAccumulator&)" - ); +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - return os; +namespace Foam +{ + typedef IOOutputFilter<yPlusLES> IOyPlusLES; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C new file mode 100644 index 0000000000000000000000000000000000000000..c93f42c3e894ca1c881ad304c8797b656060f0e4 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C @@ -0,0 +1,334 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "yPlusLES.H" +#include "volFields.H" + +#include "incompressible/LES/LESModel/LESModel.H" +#include "compressible/LES/LESModel/LESModel.H" +#include "wallFvPatch.H" +#include "nearWallDist.H" +//#include "wallDist.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::yPlusLES, 0); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::yPlusLES::makeFile() +{ + // Create the output file if not already created + if (outputFilePtr_.empty()) + { + if (debug) + { + Info<< "Creating output file." << endl; + } + + // File update + if (Pstream::master()) + { + fileName outputDir; + word startTimeName = + obr_.time().timeName(obr_.time().startTime().value()); + + if (Pstream::parRun()) + { + // Put in undecomposed case (Note: gives problems for + // distributed data running) + outputDir = + obr_.time().path()/".."/name_/startTimeName; + } + else + { + outputDir = obr_.time().path()/name_/startTimeName; + } + + // Create directory if does not exist + mkDir(outputDir); + + // Open new file at start up + outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat"))); + + // Add headers to output data + outputFilePtr_() << "# y+ (LES)" << nl + << "# time " << token::TAB << "patch" << token::TAB + << "min" << token::TAB << "max" << token::TAB << "average" + << endl; + } + } +} + + +void Foam::yPlusLES::calcIncompressibleYPlus +( + const fvMesh& mesh, + const volVectorField& U, + volScalarField& yPlus +) +{ + const incompressible::LESModel& model = + mesh.lookupObject<incompressible::LESModel>("LESProperties"); + + volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); + volScalarField nuEff(model.nuEff()); + + const fvPatchList& patches = mesh.boundary(); + + const volScalarField nuLam(model.nu()); + + bool foundPatch = false; + forAll(patches, patchI) + { + const fvPatch& currPatch = patches[patchI]; + + if (isA<wallFvPatch>(currPatch)) + { + foundPatch = true; + yPlus.boundaryField()[patchI] = + d[patchI] + *sqrt + ( + nuEff.boundaryField()[patchI] + *mag(U.boundaryField()[patchI].snGrad()) + ) + /nuLam.boundaryField()[patchI]; + + const scalarField& Yp = yPlus.boundaryField()[patchI]; + + scalar minYp = min(Yp); + scalar maxYp = max(Yp); + scalar avgYp = average(Yp); + + if (log_) + { + Info<< " patch " << currPatch.name() + << " y+ : min = " << min(Yp) << ", max = " << max(Yp) + << ", average = " << average(Yp) << nl; + } + + if (Pstream::master()) + { + outputFilePtr_() << obr_.time().value() << token::TAB + << currPatch.name() << token::TAB + << minYp << token::TAB << maxYp << token::TAB + << avgYp << endl; + } + } + } + + if (log_ && !foundPatch) + { + Info<< " no " << wallFvPatch::typeName << " patches" << endl; + } +} + + +void Foam::yPlusLES::calcCompressibleYPlus +( + const fvMesh& mesh, + const volVectorField& U, + volScalarField& yPlus +) +{ + const compressible::LESModel& model = + mesh.lookupObject<compressible::LESModel>("LESProperties"); + + volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); + volScalarField muEff(model.muEff()); + + const fvPatchList& patches = mesh.boundary(); + + const volScalarField muLam(model.mu()); + + Info<< type() << " output:" << nl; + + bool foundPatch = false; + forAll(patches, patchI) + { + const fvPatch& currPatch = patches[patchI]; + + if (isA<wallFvPatch>(currPatch)) + { + foundPatch = true; + yPlus.boundaryField()[patchI] = + d[patchI] + *sqrt + ( + muEff.boundaryField()[patchI] + *mag(U.boundaryField()[patchI].snGrad()) + ) + /muLam.boundaryField()[patchI]; + + const scalarField& Yp = yPlus.boundaryField()[patchI]; + + scalar minYp = min(Yp); + scalar maxYp = max(Yp); + scalar avgYp = average(Yp); + + if (log_) + { + Info<< " patch " << currPatch.name() + << " y+ : min = " << min(Yp) << ", max = " << max(Yp) + << ", average = " << average(Yp) << nl; + } + + if (Pstream::master()) + { + outputFilePtr_() << obr_.time().value() << token::TAB + << currPatch.name() << token::TAB + << minYp << token::TAB << maxYp << token::TAB + << avgYp << endl; + } + } + } + + if (log_ && !foundPatch) + { + Info<< " no " << wallFvPatch::typeName << " patches" << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::yPlusLES::yPlusLES +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + log_(false), + phiName_("phi"), + UName_("U"), + outputFilePtr_(NULL) +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "yPlusLES::yPlusLES" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + makeFile(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::yPlusLES::~yPlusLES() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::yPlusLES::read(const dictionary& dict) +{ + if (active_) + { + log_ = dict.lookupOrDefault<Switch>("log", false); + phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); + } +} + + +void Foam::yPlusLES::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::yPlusLES::end() +{ + // Do nothing - only valid on write +} + + +void Foam::yPlusLES::write() +{ + if (active_) + { + const surfaceScalarField& phi = + obr_.lookupObject<surfaceScalarField>(phiName_); + + const volVectorField& U = obr_.lookupObject<volVectorField>(UName_); + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField yPlusLES + ( + IOobject + ( + "yPlusLES", + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ), + mesh, + dimensionedScalar("0", dimless, 0.0) + ); + + if (log_) + { + Info<< type() << " output:" << nl; + } + + if (phi.dimensions() == dimMass/dimTime) + { + calcCompressibleYPlus(mesh, U, yPlusLES); + } + else + { + calcIncompressibleYPlus(mesh, U, yPlusLES); + } + + if (log_) + { + Info<< endl; + } + + yPlusLES.write(); + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H new file mode 100644 index 0000000000000000000000000000000000000000..5ab936ab7eefbccba74bd85196390ab088302e0b --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::yPlusLES + +Description + Evaluates and outputs turbulence y+ for LES models. Values written to + time folders as field 'yPlusLES' + +SourceFiles + yPlusLES.C + IOyPlusLES.H + +\*---------------------------------------------------------------------------*/ + +#ifndef yPlusLES_H +#define yPlusLES_H + +#include "volFieldsFwd.H" +#include "pointFieldFwd.H" +#include "Switch.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class yPlusLES Declaration +\*---------------------------------------------------------------------------*/ + +class yPlusLES +{ + // Private data + + //- Name of this set of yPlusLES objects + word name_; + + const objectRegistry& obr_; + + //- on/off switch + bool active_; + + //- Switch to send output to Info as well as to file + Switch log_; + + //- Name of mass/volume flux field (optional, default = phi) + word phiName_; + + //- Name of velocity field + word UName_; + + //- Output file pointer + autoPtr<OFstream> outputFilePtr_; + + + // Private Member Functions + + //- Make the output file + virtual void makeFile(); + + //- Calculate incompressible form of y+ + void calcIncompressibleYPlus + ( + const fvMesh& mesh, + const volVectorField& U, + volScalarField& yPlus + ); + + //- Calculate compressible form of y+ + void calcCompressibleYPlus + ( + const fvMesh& mesh, + const volVectorField& U, + volScalarField& yPlus + ); + + //- Disallow default bitwise copy construct + yPlusLES(const yPlusLES&); + + //- Disallow default bitwise assignment + void operator=(const yPlusLES&); + + +public: + + //- Runtime type information + TypeName("yPlusLES"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + yPlusLES + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~yPlusLES(); + + + // Member Functions + + //- Return name of the set of yPlusLES + virtual const word& name() const + { + return name_; + } + + //- Read the yPlusLES data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the yPlusLES and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distributionI.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C similarity index 76% rename from src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distributionI.H rename to src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C index 81883e5820cae1f2c17aeb59144221aac6cb7b9b..77ea1c21a3cde890d95aa6a2bbda788a7a5a0c22 100644 --- a/src/lagrangian/molecularDynamics/old/molecularMeasurements/distribution/distributionI.H +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,12 +23,20 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +#include "yPlusLESFunctionObject.H" -inline Foam::scalar Foam::distribution::binWidth() const +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam { - return binWidth_; + defineNamedTemplateTypeNameAndDebug(yPlusLESFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + yPlusLESFunctionObject, + dictionary + ); } - // ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/mdTools/temperatureAndPressureVariables.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H similarity index 63% rename from src/lagrangian/molecularDynamics/old/mdTools/temperatureAndPressureVariables.H rename to src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H index d0aa0aabe8983afc3d87b9444b7ce6ec8f519b7a..35a19abb692b673f79dd1bf034ef4582f3c3d3c7 100644 --- a/src/lagrangian/molecularDynamics/old/mdTools/temperatureAndPressureVariables.H +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,42 +21,33 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Global - temperatureAndPressureVariables.H +Typedef + Foam::yPlusLESFunctionObject Description - Provides accumulation variables for temperatureAndPressure.H + FunctionObject wrapper around yPlusLES to allow it to be created + via the functions entry within controlDict. -\*---------------------------------------------------------------------------*/ - -vector accumulatedTotalLinearMomentum(vector::zero); - -scalar accumulatedTotalMass = 0.0; - -scalar accumulatedTotalAngularKE = 0.0; - -scalar accumulatedTotalLinearKE = 0.0; - -scalar accumulatedTotalPE = 0.0; +SourceFiles + yPlusLESFunctionObject.C -scalar accumulatedTotalrDotfSum = 0.0; - -label accumulatedNMols = 0; - -label accumulatedDOFs = 0; - -scalar averageTemperature = 0.0; +\*---------------------------------------------------------------------------*/ -scalar averagePressure = 0.0; +#ifndef yPlusLESFunctionObject_H +#define yPlusLESFunctionObject_H -const scalarField& cellVols = mesh.cellVolumes(); +#include "yPlusLES.H" +#include "OutputFilterFunctionObject.H" -scalar meshVolume = sum(cellVols); +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -if (Pstream::parRun()) +namespace Foam { - reduce(meshVolume, sumOp<scalar>()); + typedef OutputFilterFunctionObject<yPlusLES> yPlusLESFunctionObject; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/IOyPlusRAS.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/IOyPlusRAS.H new file mode 100644 index 0000000000000000000000000000000000000000..959d3fbf4a4cbbf6e7c699621c3030ccea99f2dc --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/IOyPlusRAS.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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/>. + +Typedef + Foam::IOyPlusRAS + +Description + Instance of the generic IOOutputFilter for yPlusRAS. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOyPlusRAS_H +#define IOyPlusRAS_H + +#include "yPlusRAS.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<yPlusRAS> IOyPlusRAS; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C new file mode 100644 index 0000000000000000000000000000000000000000..81bb1df7ec5c15fd0ca5bc2e8fbb5d69b3a3c44a --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C @@ -0,0 +1,319 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "yPlusRAS.H" +#include "volFields.H" + +#include "incompressible/RAS/RASModel/RASModel.H" +#include "nutkWallFunction/nutkWallFunctionFvPatchScalarField.H" + +#include "compressible/RAS/RASModel/RASModel.H" +#include "mutkWallFunction/mutkWallFunctionFvPatchScalarField.H" + +#include "wallDist.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::yPlusRAS, 0); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::yPlusRAS::makeFile() +{ + // Create the output file if not already created + if (outputFilePtr_.empty()) + { + if (debug) + { + Info<< "Creating output file." << endl; + } + + // File update + if (Pstream::master()) + { + fileName outputDir; + word startTimeName = + obr_.time().timeName(obr_.time().startTime().value()); + + if (Pstream::parRun()) + { + // Put in undecomposed case (Note: gives problems for + // distributed data running) + outputDir = + obr_.time().path()/".."/name_/startTimeName; + } + else + { + outputDir = obr_.time().path()/name_/startTimeName; + } + + // Create directory if does not exist + mkDir(outputDir); + + // Open new file at start up + outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat"))); + + // Add headers to output data + outputFilePtr_() << "# y+ (RAS)" << nl + << "# time " << token::TAB << "patch" << token::TAB + << "min" << token::TAB << "max" << token::TAB << "average" + << endl; + } + } +} + + +void Foam::yPlusRAS::calcIncompressibleYPlus +( + const fvMesh& mesh, + volScalarField& yPlus +) +{ + typedef incompressible::RASModels::nutkWallFunctionFvPatchScalarField + wallFunctionPatchField; + + const incompressible::RASModel& model = + mesh.lookupObject<incompressible::RASModel>("RASProperties"); + + const volScalarField nut(model.nut()); + const volScalarField::GeometricBoundaryField& nutPatches = + nut.boundaryField(); + + bool foundPatch = false; + forAll(nutPatches, patchI) + { + if (isA<wallFunctionPatchField>(nutPatches[patchI])) + { + foundPatch = true; + + const wallFunctionPatchField& nutPw = + dynamic_cast<const wallFunctionPatchField&>(nutPatches[patchI]); + + yPlus.boundaryField()[patchI] = nutPw.yPlus(); + const scalarField& Yp = yPlus.boundaryField()[patchI]; + + scalar minYp = min(Yp); + scalar maxYp = max(Yp); + scalar avgYp = average(Yp); + + if (log_) + { + Info<< " patch " << nutPw.patch().name() + << " y+ : min = " << minYp << ", max = " << maxYp + << ", average = " << avgYp << nl; + } + + if (Pstream::master()) + { + outputFilePtr_() << obr_.time().value() << token::TAB + << nutPw.patch().name() << token::TAB + << minYp << token::TAB << maxYp << token::TAB + << avgYp << endl; + } + } + } + + if (log_ && !foundPatch) + { + Info<< " no " << wallFunctionPatchField::typeName << " patches" + << endl; + } +} + + +void Foam::yPlusRAS::calcCompressibleYPlus +( + const fvMesh& mesh, + volScalarField& yPlus +) +{ + typedef compressible::RASModels::mutkWallFunctionFvPatchScalarField + wallFunctionPatchField; + + const compressible::RASModel& model = + mesh.lookupObject<compressible::RASModel>("RASProperties"); + + const volScalarField mut(model.mut()); + const volScalarField::GeometricBoundaryField& mutPatches = + mut.boundaryField(); + + bool foundPatch = false; + forAll(mutPatches, patchI) + { + if (isA<wallFunctionPatchField>(mutPatches[patchI])) + { + foundPatch = true; + + const wallFunctionPatchField& mutPw = + dynamic_cast<const wallFunctionPatchField&>(mutPatches[patchI]); + + yPlus.boundaryField()[patchI] = mutPw.yPlus(); + const scalarField& Yp = yPlus.boundaryField()[patchI]; + + scalar minYp = min(Yp); + scalar maxYp = max(Yp); + scalar avgYp = average(Yp); + + if (log_) + { + Info<< " patch " << mutPw.patch().name() + << " y+ : min = " << minYp << ", max = " << maxYp + << ", average = " << avgYp << nl; + } + + if (Pstream::master()) + { + outputFilePtr_() << obr_.time().value() << token::TAB + << mutPw.patch().name() << token::TAB + << minYp << token::TAB << maxYp << token::TAB + << avgYp << endl; + } + } + } + + if (log_ && !foundPatch) + { + Info<< " no " << wallFunctionPatchField::typeName << " patches" + << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::yPlusRAS::yPlusRAS +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + log_(false), + phiName_("phi"), + outputFilePtr_(NULL) +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "yPlusRAS::yPlusRAS" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + makeFile(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::yPlusRAS::~yPlusRAS() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::yPlusRAS::read(const dictionary& dict) +{ + if (active_) + { + log_ = dict.lookupOrDefault<Switch>("log", false); + phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); + } +} + + +void Foam::yPlusRAS::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::yPlusRAS::end() +{ + // Do nothing - only valid on write +} + + +void Foam::yPlusRAS::write() +{ + if (active_) + { + const surfaceScalarField& phi = + obr_.lookupObject<surfaceScalarField>(phiName_); + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField yPlusRAS + ( + IOobject + ( + "yPlusRAS", + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ), + mesh, + dimensionedScalar("0", dimless, 0.0) + ); + + if (log_) + { + Info<< type() << " output:" << nl; + } + + if (phi.dimensions() == dimMass/dimTime) + { + calcCompressibleYPlus(mesh, yPlusRAS); + } + else + { + calcIncompressibleYPlus(mesh, yPlusRAS); + } + + if (log_) + { + Info<< endl; + } + + yPlusRAS.write(); + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H new file mode 100644 index 0000000000000000000000000000000000000000..2be629342424f959809d755b3b2382859e6d9540 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::yPlusRAS + +Description + Evaluates and outputs turbulence y+ for RAS models. Values written to + time folders as field 'yPlusRAS' + +SourceFiles + yPlusRAS.C + IOyPlusRAS.H + +\*---------------------------------------------------------------------------*/ + +#ifndef yPlusRAS_H +#define yPlusRAS_H + +#include "volFieldsFwd.H" +#include "pointFieldFwd.H" +#include "Switch.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class yPlusRAS Declaration +\*---------------------------------------------------------------------------*/ + +class yPlusRAS +{ + // Private data + + //- Name of this set of yPlusRAS objects + word name_; + + const objectRegistry& obr_; + + //- on/off switch + bool active_; + + //- Switch to send output to Info as well as to file + Switch log_; + + //- Name of mass/volume flux field (optional, default = phi) + word phiName_; + + //- Output file pointer + autoPtr<OFstream> outputFilePtr_; + + + // Private Member Functions + + //- Make the output file + virtual void makeFile(); + + //- Calculate incompressible form of y+ + void calcIncompressibleYPlus(const fvMesh& mesh, volScalarField& yPlus); + + //- Calculate compressible form of y+ + void calcCompressibleYPlus(const fvMesh& mesh, volScalarField& yPlus); + + //- Disallow default bitwise copy construct + yPlusRAS(const yPlusRAS&); + + //- Disallow default bitwise assignment + void operator=(const yPlusRAS&); + + +public: + + //- Runtime type information + TypeName("yPlusRAS"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + yPlusRAS + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~yPlusRAS(); + + + // Member Functions + + //- Return name of the set of yPlusRAS + virtual const word& name() const + { + return name_; + } + + //- Read the yPlusRAS data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the yPlusRAS and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/old/mdTools/temperatureEquilibration.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.C similarity index 76% rename from src/lagrangian/molecularDynamics/old/mdTools/temperatureEquilibration.H rename to src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.C index 78a1e42d9beb3b45ae7cefcab26bfce2f385f50c..77ffceeb84479ab91d0e79e30c8b7857341ec3da 100644 --- a/src/lagrangian/molecularDynamics/old/mdTools/temperatureEquilibration.H +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,22 +21,22 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Global - temperatureEquilibration.H +\*---------------------------------------------------------------------------*/ -Description - Applies temperature control to molecules +#include "yPlusRASFunctionObject.H" -\*---------------------------------------------------------------------------*/ +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -if (runTime.outputTime()) +namespace Foam { - molecules.applyConstraintsAndThermostats + defineNamedTemplateTypeNameAndDebug(yPlusRASFunctionObject, 0); + + addToRunTimeSelectionTable ( - targetTemperature, - averageTemperature + functionObject, + yPlusRASFunctionObject, + dictionary ); } - // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..99d34c6517af2da87e60e8e8327fd12ef83a5d2d --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRASFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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/>. + +Typedef + Foam::yPlusRASFunctionObject + +Description + FunctionObject wrapper around yPlusRAS to allow it to be created + via the functions entry within controlDict. + +SourceFiles + yPlusRASFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef yPlusRASFunctionObject_H +#define yPlusRASFunctionObject_H + +#include "yPlusRAS.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<yPlusRAS> yPlusRASFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.C index 7a626474ba20e3d871c2202b150d65fcc6e2aa89..358e6810ece572ab39c2e5e55fdf161d016bac4d 100644 --- a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,7 @@ tmp<volScalarField> SpalartAllmaras::chi() const tmp<volScalarField> SpalartAllmaras::fv1(const volScalarField& chi) const { - volScalarField chi3(pow3(chi)); + const volScalarField chi3(pow3(chi)); return chi3/(chi3 + pow3(Cv1_)); } @@ -73,7 +73,7 @@ tmp<volScalarField> SpalartAllmaras::fv3 const volScalarField& fv1 ) const { - volScalarField chiByCv2((1/Cv2_)*chi); + const volScalarField chiByCv2((1/Cv2_)*chi); return (scalar(1) + chi*fv1) @@ -96,14 +96,14 @@ tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const Stilda, dimensionedScalar("SMALL", Stilda.dimensions(), SMALL) ) - *sqr(kappa_*d_) + *sqr(kappa_*d_) ), scalar(10.0) ) ); r.boundaryField() == 0.0; - volScalarField g(r + Cw2_*(pow6(r) - r)); + const volScalarField g(r + Cw2_*(pow6(r) - r)); return g*pow((1.0 + pow6(Cw3_))/(pow6(g) + pow6(Cw3_)), 1.0/6.0); } @@ -261,8 +261,7 @@ tmp<volScalarField> SpalartAllmaras::k() const { WarningIn("tmp<volScalarField> SpalartAllmaras::k() const") << "Turbulence kinetic energy not defined for Spalart-Allmaras model. " - << "Returning zero field" - << endl; + << "Returning zero field" << endl; return tmp<volScalarField> ( @@ -294,7 +293,7 @@ tmp<volScalarField> SpalartAllmaras::epsilon() const ( IOobject ( - "epslion", + "epsilon", runTime_.timeName(), mesh_ ), @@ -347,7 +346,7 @@ tmp<volSymmTensorField> SpalartAllmaras::devRhoReff() const tmp<fvVectorMatrix> SpalartAllmaras::divDevRhoReff(volVectorField& U) const { - volScalarField muEff_(muEff()); + const volScalarField muEff_(muEff()); return ( @@ -404,10 +403,10 @@ void SpalartAllmaras::correct() d_.correct(); } - volScalarField chi(this->chi()); - volScalarField fv1(this->fv1(chi)); + const volScalarField chi(this->chi()); + const volScalarField fv1(this->fv1(chi)); - volScalarField Stilda + const volScalarField Stilda ( fv3(chi, fv1)*::sqrt(2.0)*mag(skew(fvc::grad(U_))) + fv2(chi, fv1)*nuTilda_/sqr(kappa_*d_) diff --git a/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C index 213896ff7db5eddbcad8bf00584559fd14b2979c..1804ba5b01007b741f4ad25a14c612032c0940d4 100644 --- a/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -367,6 +367,10 @@ void SpalartAllmaras::correct() if (!turbulence_) { + // Re-calculate viscosity + nut_ = nuTilda_*fv1(this->chi()); + nut_.correctBoundaryConditions(); + return; } @@ -401,6 +405,7 @@ void SpalartAllmaras::correct() bound(nuTilda_, dimensionedScalar("0", nuTilda_.dimensions(), 0.0)); nuTilda_.correctBoundaryConditions(); + // Re-calculate viscosity nut_.internalField() = fv1*nuTilda_.internalField(); nut_.correctBoundaryConditions(); } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones new file mode 100644 index 0000000000000000000000000000000000000000..0034a58c2293992131cec848f2dcb0f8ad50a0d4 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones @@ -0,0 +1,20 @@ +/*--------------------------------*- 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; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +0() + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones new file mode 100644 index 0000000000000000000000000000000000000000..0034a58c2293992131cec848f2dcb0f8ad50a0d4 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones @@ -0,0 +1,20 @@ +/*--------------------------------*- 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; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +0() + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/T1 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/T1 new file mode 100644 index 0000000000000000000000000000000000000000..610cfff17ec8d396b7ce0d1198bae5f83616e7cd --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/T1 @@ -0,0 +1,44 @@ +/*--------------------------------*- 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 volScalarField; + object T1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/T2 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/T2 new file mode 100644 index 0000000000000000000000000000000000000000..c2ea64d776b6233c2bf5f0dbbc2769d6d6eab9e2 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/T2 @@ -0,0 +1,44 @@ +/*--------------------------------*- 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 volScalarField; + object T2; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 500; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/Theta b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/Theta new file mode 100644 index 0000000000000000000000000000000000000000..b18d202df894c0276dd7f546fd3820cd154623e4 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/Theta @@ -0,0 +1,44 @@ +/*--------------------------------*- 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 volScalarField; + object Theta; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/U1 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/U1 new file mode 100644 index 0000000000000000000000000000000000000000..7a88b384782d81444c1dbc8643f955a4720536da --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/U1 @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 volVectorField; + object U1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + rotor + { + type fixedValue; + value uniform (0 0 0); + } + + stator + { + type fixedValue; + value uniform (0 0 0); + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/U2 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/U2 new file mode 100644 index 0000000000000000000000000000000000000000..b93b8d870de47ad7c0f257b0301895c8c8ed05d9 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/U2 @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 volVectorField; + object U2; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + rotor + { + type fixedValue; + value uniform (0 0 0); + } + + stator + { + type fixedValue; + value uniform (0 0 0); + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/alpha1 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/alpha1 new file mode 100644 index 0000000000000000000000000000000000000000..637ebed0e893d74b6cff62103ebf3c627ec682b9 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/alpha1 @@ -0,0 +1,44 @@ +/*--------------------------------*- 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 volScalarField; + object alpha1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.5; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/epsilon b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..3f507afed8ea6ba738e2fc7772a1fe96b57609de --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/epsilon @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 20; + +boundaryField +{ + rotor + { + type zeroGradient; + value uniform 20; + } + + stator + { + type zeroGradient; + value uniform 20; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/k b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/k new file mode 100644 index 0000000000000000000000000000000000000000..b8c3e8cc999284315090f8c666b1cba4efb6fb31 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/k @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform 0.1; + +boundaryField +{ + rotor + { + type zeroGradient; + value uniform 0.1; + } + + stator + { + type zeroGradient; + value uniform 0.1; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/p b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/p new file mode 100644 index 0000000000000000000000000000000000000000..9c4de0da512d78d3fcd7499ef5621c328e3d56e0 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/0/p @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + rotor + { + type multiphaseFixedFluxPressure; + value $internalField; + } + + stator + { + type multiphaseFixedFluxPressure; + value $internalField; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/Allrun b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..a718eaf7e662bad616179bd183caa9fd72de8b79 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/Allrun @@ -0,0 +1,12 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +application=`getApplication` + +runApplication ./makeMesh +runApplication $application + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones new file mode 100644 index 0000000000000000000000000000000000000000..25c3311d0b7ff552c41b5844854959e33685d807 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones @@ -0,0 +1,31 @@ +/*--------------------------------*- 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; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +1 +( + rotor + { + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin origin [0 1 0 0 0 0 0] (0 0 0); + axis axis [0 0 0 0 0 0 0] (0 0 1); + omega omega [0 0 -1 0 0 0 0] 10.472; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/RASProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..a4937b503a46850b2626f0d301e4a07b9f691507 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- 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; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/g b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..508d65849430f8e5abf4b12d7baa53d70521a1c3 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- 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 uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 0); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/interfacialProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/interfacialProperties new file mode 100644 index 0000000000000000000000000000000000000000..41159fe9def1d68030d4d4c65aacca7947e0610b --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/interfacialProperties @@ -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; + location "constant"; + object interfacialProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dragModel1 SchillerNaumann; +dragModel2 SchillerNaumann; + +heatTransferModel1 RanzMarshall; +heatTransferModel2 RanzMarshall; + +dispersedPhase both; +dragPhase blended; + +residualSlip 1e-2; +minInterfaceAlpha 1e-3; + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/kineticTheoryProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/kineticTheoryProperties new file mode 100644 index 0000000000000000000000000000000000000000..53521fbae309deb8893eed645ceaf0776fb9786a --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/kineticTheoryProperties @@ -0,0 +1,52 @@ +/*--------------------------------*- 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; + location "constant"; + object kineticTheoryProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +kineticTheory off; + +equilibrium on; + +e e [ 0 0 0 0 0 0 0 ] 0.9; + +alphaMax alphaMax [ 0 0 0 0 0 0 0 ] 0.6; + +alphaMinFriction alphaMinFriction [ 0 0 0 0 0 0 0 ] 0.5; + +Fr Fr [ 1 -1 -2 0 0 0 0 ] 0.05; + +eta eta [ 0 0 0 0 0 0 0 ] 2; + +p p [ 0 0 0 0 0 0 0 ] 5; + +phi phi [ 0 0 0 0 0 0 0 ] 25; + +viscosityModel Syamlal; + +conductivityModel HrenyaSinclair; + +granularPressureModel Lun; + +frictionalStressModel JohnsonJackson; + +radialModel Gidaspow; + +HrenyaSinclairCoeffs +{ + L L [ 0 1 0 0 0 0 0 ] 0.0005; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 new file mode 100644 index 0000000000000000000000000000000000000000..a93868498ba68d11b25b0875ff69205f62f822ed --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 @@ -0,0 +1,818 @@ +/*--------------------------------*- 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 blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// General macros to create 2D/extruded-2D meshes + +changecom(//)changequote([,]) +define(calc, [esyscmd(perl -e 'print ($1)')]) +define(VCOUNT, 0) +define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) +define(pi, 3.14159265) + +define(hex2D, hex ($1b $2b $3b $4b $1t $2t $3t $4t)) +define(quad2D, ($1b $2b $2t $1t)) +define(frontQuad, ($1t $2t $3t $4t)) +define(backQuad, ($1b $4b $3b $2b)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +// Hub radius +define(r, 0.2) + +// Impeller-tip radius +define(rb, 0.5) + +// Baffle-tip radius +define(Rb, 0.7) + +// Tank radius +define(R, 1) + +// MRF region radius +define(ri, calc(0.5*(rb + Rb))) + +// Thickness of 2D slab +define(z, 0.1) + +// Base z +define(Zb, 0) + +// Top z +define(Zt, calc(Zb + z)) + +// Number of cells radially between hub and impeller tip +define(Nr, 12) + +// Number of cells radially in each of the two regions between +// impeller and baffle tips +define(Ni, 4) + +// Number of cells radially between baffle tip and tank +define(NR, 12) + +// Number of cells azimuthally in each of the 8 blocks +define(Na, 12) + +// Number of cells in the thickness of the slab +define(Nz, 1) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +define(vert, (x$1$2 y$1$2 $3)) +define(evert, (ex$1$2 ey$1$2 $3)) + +define(a0, 0) +define(a1, -45) +define(a2, -90) +define(a3, -135) +define(a4, 180) +define(a5, 135) +define(a6, 90) +define(a7, 45) + +define(ea0, -22.5) +define(ea1, -67.5) +define(ea2, -112.5) +define(ea3, -157.5) +define(ea4, 157.5) +define(ea5, 112.5) +define(ea6, 67.5) +define(ea7, 22.5) + +define(ca0, calc(cos((pi/180)*a0))) +define(ca1, calc(cos((pi/180)*a1))) +define(ca2, calc(cos((pi/180)*a2))) +define(ca3, calc(cos((pi/180)*a3))) +define(ca4, calc(cos((pi/180)*a4))) +define(ca5, calc(cos((pi/180)*a5))) +define(ca6, calc(cos((pi/180)*a6))) +define(ca7, calc(cos((pi/180)*a7))) + +define(sa0, calc(sin((pi/180)*a0))) +define(sa1, calc(sin((pi/180)*a1))) +define(sa2, calc(sin((pi/180)*a2))) +define(sa3, calc(sin((pi/180)*a3))) +define(sa4, calc(sin((pi/180)*a4))) +define(sa5, calc(sin((pi/180)*a5))) +define(sa6, calc(sin((pi/180)*a6))) +define(sa7, calc(sin((pi/180)*a7))) + +define(cea0, calc(cos((pi/180)*ea0))) +define(cea1, calc(cos((pi/180)*ea1))) +define(cea2, calc(cos((pi/180)*ea2))) +define(cea3, calc(cos((pi/180)*ea3))) +define(cea4, calc(cos((pi/180)*ea4))) +define(cea5, calc(cos((pi/180)*ea5))) +define(cea6, calc(cos((pi/180)*ea6))) +define(cea7, calc(cos((pi/180)*ea7))) + +define(sea0, calc(sin((pi/180)*ea0))) +define(sea1, calc(sin((pi/180)*ea1))) +define(sea2, calc(sin((pi/180)*ea2))) +define(sea3, calc(sin((pi/180)*ea3))) +define(sea4, calc(sin((pi/180)*ea4))) +define(sea5, calc(sin((pi/180)*ea5))) +define(sea6, calc(sin((pi/180)*ea6))) +define(sea7, calc(sin((pi/180)*ea7))) + +define(x00, calc(r*ca0)) +define(x01, calc(r*ca1)) +define(x02, calc(r*ca2)) +define(x03, calc(r*ca3)) +define(x04, calc(r*ca4)) +define(x05, calc(r*ca5)) +define(x06, calc(r*ca6)) +define(x07, calc(r*ca7)) + +define(x10, calc(rb*ca0)) +define(x11, calc(rb*ca1)) +define(x12, calc(rb*ca2)) +define(x13, calc(rb*ca3)) +define(x14, calc(rb*ca4)) +define(x15, calc(rb*ca5)) +define(x16, calc(rb*ca6)) +define(x17, calc(rb*ca7)) + +define(x20, calc(ri*ca0)) +define(x21, calc(ri*ca1)) +define(x22, calc(ri*ca2)) +define(x23, calc(ri*ca3)) +define(x24, calc(ri*ca4)) +define(x25, calc(ri*ca5)) +define(x26, calc(ri*ca6)) +define(x27, calc(ri*ca7)) + +define(x30, calc(Rb*ca0)) +define(x31, calc(Rb*ca1)) +define(x32, calc(Rb*ca2)) +define(x33, calc(Rb*ca3)) +define(x34, calc(Rb*ca4)) +define(x35, calc(Rb*ca5)) +define(x36, calc(Rb*ca6)) +define(x37, calc(Rb*ca7)) + +define(x40, calc(R*ca0)) +define(x41, calc(R*ca1)) +define(x42, calc(R*ca2)) +define(x43, calc(R*ca3)) +define(x44, calc(R*ca4)) +define(x45, calc(R*ca5)) +define(x46, calc(R*ca6)) +define(x47, calc(R*ca7)) + +define(y00, calc(r*sa0)) +define(y01, calc(r*sa1)) +define(y02, calc(r*sa2)) +define(y03, calc(r*sa3)) +define(y04, calc(r*sa4)) +define(y05, calc(r*sa5)) +define(y06, calc(r*sa6)) +define(y07, calc(r*sa7)) + +define(y10, calc(rb*sa0)) +define(y11, calc(rb*sa1)) +define(y12, calc(rb*sa2)) +define(y13, calc(rb*sa3)) +define(y14, calc(rb*sa4)) +define(y15, calc(rb*sa5)) +define(y16, calc(rb*sa6)) +define(y17, calc(rb*sa7)) + +define(y20, calc(ri*sa0)) +define(y21, calc(ri*sa1)) +define(y22, calc(ri*sa2)) +define(y23, calc(ri*sa3)) +define(y24, calc(ri*sa4)) +define(y25, calc(ri*sa5)) +define(y26, calc(ri*sa6)) +define(y27, calc(ri*sa7)) + +define(y30, calc(Rb*sa0)) +define(y31, calc(Rb*sa1)) +define(y32, calc(Rb*sa2)) +define(y33, calc(Rb*sa3)) +define(y34, calc(Rb*sa4)) +define(y35, calc(Rb*sa5)) +define(y36, calc(Rb*sa6)) +define(y37, calc(Rb*sa7)) + +define(y40, calc(R*sa0)) +define(y41, calc(R*sa1)) +define(y42, calc(R*sa2)) +define(y43, calc(R*sa3)) +define(y44, calc(R*sa4)) +define(y45, calc(R*sa5)) +define(y46, calc(R*sa6)) +define(y47, calc(R*sa7)) + +define(ex00, calc(r*cea0)) +define(ex01, calc(r*cea1)) +define(ex02, calc(r*cea2)) +define(ex03, calc(r*cea3)) +define(ex04, calc(r*cea4)) +define(ex05, calc(r*cea5)) +define(ex06, calc(r*cea6)) +define(ex07, calc(r*cea7)) + +define(ex10, calc(rb*cea0)) +define(ex11, calc(rb*cea1)) +define(ex12, calc(rb*cea2)) +define(ex13, calc(rb*cea3)) +define(ex14, calc(rb*cea4)) +define(ex15, calc(rb*cea5)) +define(ex16, calc(rb*cea6)) +define(ex17, calc(rb*cea7)) + +define(ex20, calc(ri*cea0)) +define(ex21, calc(ri*cea1)) +define(ex22, calc(ri*cea2)) +define(ex23, calc(ri*cea3)) +define(ex24, calc(ri*cea4)) +define(ex25, calc(ri*cea5)) +define(ex26, calc(ri*cea6)) +define(ex27, calc(ri*cea7)) + +define(ex30, calc(Rb*cea0)) +define(ex31, calc(Rb*cea1)) +define(ex32, calc(Rb*cea2)) +define(ex33, calc(Rb*cea3)) +define(ex34, calc(Rb*cea4)) +define(ex35, calc(Rb*cea5)) +define(ex36, calc(Rb*cea6)) +define(ex37, calc(Rb*cea7)) + +define(ex40, calc(R*cea0)) +define(ex41, calc(R*cea1)) +define(ex42, calc(R*cea2)) +define(ex43, calc(R*cea3)) +define(ex44, calc(R*cea4)) +define(ex45, calc(R*cea5)) +define(ex46, calc(R*cea6)) +define(ex47, calc(R*cea7)) + +define(ey00, calc(r*sea0)) +define(ey01, calc(r*sea1)) +define(ey02, calc(r*sea2)) +define(ey03, calc(r*sea3)) +define(ey04, calc(r*sea4)) +define(ey05, calc(r*sea5)) +define(ey06, calc(r*sea6)) +define(ey07, calc(r*sea7)) + +define(ey10, calc(rb*sea0)) +define(ey11, calc(rb*sea1)) +define(ey12, calc(rb*sea2)) +define(ey13, calc(rb*sea3)) +define(ey14, calc(rb*sea4)) +define(ey15, calc(rb*sea5)) +define(ey16, calc(rb*sea6)) +define(ey17, calc(rb*sea7)) + +define(ey20, calc(ri*sea0)) +define(ey21, calc(ri*sea1)) +define(ey22, calc(ri*sea2)) +define(ey23, calc(ri*sea3)) +define(ey24, calc(ri*sea4)) +define(ey25, calc(ri*sea5)) +define(ey26, calc(ri*sea6)) +define(ey27, calc(ri*sea7)) + +define(ey30, calc(Rb*sea0)) +define(ey31, calc(Rb*sea1)) +define(ey32, calc(Rb*sea2)) +define(ey33, calc(Rb*sea3)) +define(ey34, calc(Rb*sea4)) +define(ey35, calc(Rb*sea5)) +define(ey36, calc(Rb*sea6)) +define(ey37, calc(Rb*sea7)) + +define(ey40, calc(R*sea0)) +define(ey41, calc(R*sea1)) +define(ey42, calc(R*sea2)) +define(ey43, calc(R*sea3)) +define(ey44, calc(R*sea4)) +define(ey45, calc(R*sea5)) +define(ey46, calc(R*sea6)) +define(ey47, calc(R*sea7)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +vertices +( + vert(0, 0, Zb) vlabel(r0b) + vert(0, 0, Zb) vlabel(r0sb) + vert(0, 1, Zb) vlabel(r1b) + vert(0, 2, Zb) vlabel(r2b) + vert(0, 2, Zb) vlabel(r2sb) + vert(0, 3, Zb) vlabel(r3b) + vert(0, 4, Zb) vlabel(r4b) + vert(0, 4, Zb) vlabel(r4sb) + vert(0, 5, Zb) vlabel(r5b) + vert(0, 6, Zb) vlabel(r6b) + vert(0, 6, Zb) vlabel(r6sb) + vert(0, 7, Zb) vlabel(r7b) + + vert(1, 0, Zb) vlabel(rb0b) + vert(1, 1, Zb) vlabel(rb1b) + vert(1, 2, Zb) vlabel(rb2b) + vert(1, 3, Zb) vlabel(rb3b) + vert(1, 4, Zb) vlabel(rb4b) + vert(1, 5, Zb) vlabel(rb5b) + vert(1, 6, Zb) vlabel(rb6b) + vert(1, 7, Zb) vlabel(rb7b) + + vert(2, 0, Zb) vlabel(ri0b) + vert(2, 1, Zb) vlabel(ri1b) + vert(2, 2, Zb) vlabel(ri2b) + vert(2, 3, Zb) vlabel(ri3b) + vert(2, 4, Zb) vlabel(ri4b) + vert(2, 5, Zb) vlabel(ri5b) + vert(2, 6, Zb) vlabel(ri6b) + vert(2, 7, Zb) vlabel(ri7b) + + vert(3, 0, Zb) vlabel(Rb0b) + vert(3, 1, Zb) vlabel(Rb1b) + vert(3, 2, Zb) vlabel(Rb2b) + vert(3, 3, Zb) vlabel(Rb3b) + vert(3, 4, Zb) vlabel(Rb4b) + vert(3, 5, Zb) vlabel(Rb5b) + vert(3, 6, Zb) vlabel(Rb6b) + vert(3, 7, Zb) vlabel(Rb7b) + + vert(4, 0, Zb) vlabel(R0b) + vert(4, 1, Zb) vlabel(R1b) + vert(4, 1, Zb) vlabel(R1sb) + vert(4, 2, Zb) vlabel(R2b) + vert(4, 3, Zb) vlabel(R3b) + vert(4, 3, Zb) vlabel(R3sb) + vert(4, 4, Zb) vlabel(R4b) + vert(4, 5, Zb) vlabel(R5b) + vert(4, 5, Zb) vlabel(R5sb) + vert(4, 6, Zb) vlabel(R6b) + vert(4, 7, Zb) vlabel(R7b) + vert(4, 7, Zb) vlabel(R7sb) + + vert(0, 0, Zt) vlabel(r0t) + vert(0, 0, Zt) vlabel(r0st) + vert(0, 1, Zt) vlabel(r1t) + vert(0, 2, Zt) vlabel(r2t) + vert(0, 2, Zt) vlabel(r2st) + vert(0, 3, Zt) vlabel(r3t) + vert(0, 4, Zt) vlabel(r4t) + vert(0, 4, Zt) vlabel(r4st) + vert(0, 5, Zt) vlabel(r5t) + vert(0, 6, Zt) vlabel(r6t) + vert(0, 6, Zt) vlabel(r6st) + vert(0, 7, Zt) vlabel(r7t) + + vert(1, 0, Zt) vlabel(rb0t) + vert(1, 1, Zt) vlabel(rb1t) + vert(1, 2, Zt) vlabel(rb2t) + vert(1, 3, Zt) vlabel(rb3t) + vert(1, 4, Zt) vlabel(rb4t) + vert(1, 5, Zt) vlabel(rb5t) + vert(1, 6, Zt) vlabel(rb6t) + vert(1, 7, Zt) vlabel(rb7t) + + vert(2, 0, Zt) vlabel(ri0t) + vert(2, 1, Zt) vlabel(ri1t) + vert(2, 2, Zt) vlabel(ri2t) + vert(2, 3, Zt) vlabel(ri3t) + vert(2, 4, Zt) vlabel(ri4t) + vert(2, 5, Zt) vlabel(ri5t) + vert(2, 6, Zt) vlabel(ri6t) + vert(2, 7, Zt) vlabel(ri7t) + + vert(3, 0, Zt) vlabel(Rb0t) + vert(3, 1, Zt) vlabel(Rb1t) + vert(3, 2, Zt) vlabel(Rb2t) + vert(3, 3, Zt) vlabel(Rb3t) + vert(3, 4, Zt) vlabel(Rb4t) + vert(3, 5, Zt) vlabel(Rb5t) + vert(3, 6, Zt) vlabel(Rb6t) + vert(3, 7, Zt) vlabel(Rb7t) + + vert(4, 0, Zt) vlabel(R0t) + vert(4, 1, Zt) vlabel(R1t) + vert(4, 1, Zt) vlabel(R1st) + vert(4, 2, Zt) vlabel(R2t) + vert(4, 3, Zt) vlabel(R3t) + vert(4, 3, Zt) vlabel(R3st) + vert(4, 4, Zt) vlabel(R4t) + vert(4, 5, Zt) vlabel(R5t) + vert(4, 5, Zt) vlabel(R5st) + vert(4, 6, Zt) vlabel(R6t) + vert(4, 7, Zt) vlabel(R7t) + vert(4, 7, Zt) vlabel(R7st) +); + +blocks +( + // block0 + hex2D(r0, r1, rb1, rb0) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(r1, r2s, rb2, rb1) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(r2, r3, rb3, rb2) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(r3, r4s, rb4, rb3) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(r4, r5, rb5, rb4) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(r5, r6s, rb6, rb5) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(r6, r7, rb7, rb6) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(r7, r0s, rb0, rb7) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(rb0, rb1, ri1, ri0) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(rb1, rb2, ri2, ri1) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(rb2, rb3, ri3, ri2) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(rb3, rb4, ri4, ri3) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(rb4, rb5, ri5, ri4) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(rb5, rb6, ri6, ri5) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(rb6, rb7, ri7, ri6) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(rb7, rb0, ri0, ri7) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(ri0, ri1, Rb1, Rb0) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(ri1, ri2, Rb2, Rb1) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(ri2, ri3, Rb3, Rb2) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(ri3, ri4, Rb4, Rb3) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(ri4, ri5, Rb5, Rb4) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(ri5, ri6, Rb6, Rb5) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(ri6, ri7, Rb7, Rb6) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(ri7, ri0, Rb0, Rb7) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(Rb0, Rb1, R1s, R0) + (Na NR Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(Rb1, Rb2, R2, R1) + (Na NR Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(Rb2, Rb3, R3s, R2) + (Na NR Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(Rb3, Rb4, R4, R3) + (Na NR Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(Rb4, Rb5, R5s, R4) + (Na NR Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(Rb5, Rb6, R6, R5) + (Na NR Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(Rb6, Rb7, R7s, R6) + (Na NR Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(Rb7, Rb0, R0, R7) + (Na NR Nz) + simpleGrading (1 1 1) +); + +edges +( + arc r0b r1b evert(0, 0, Zb) + arc r1b r2sb evert(0, 1, Zb) + arc r2b r3b evert(0, 2, Zb) + arc r3b r4sb evert(0, 3, Zb) + arc r4b r5b evert(0, 4, Zb) + arc r5b r6sb evert(0, 5, Zb) + arc r6b r7b evert(0, 6, Zb) + arc r7b r0sb evert(0, 7, Zb) + + arc rb0b rb1b evert(1, 0, Zb) + arc rb1b rb2b evert(1, 1, Zb) + arc rb2b rb3b evert(1, 2, Zb) + arc rb3b rb4b evert(1, 3, Zb) + arc rb4b rb5b evert(1, 4, Zb) + arc rb5b rb6b evert(1, 5, Zb) + arc rb6b rb7b evert(1, 6, Zb) + arc rb7b rb0b evert(1, 7, Zb) + + arc ri0b ri1b evert(2, 0, Zb) + arc ri1b ri2b evert(2, 1, Zb) + arc ri2b ri3b evert(2, 2, Zb) + arc ri3b ri4b evert(2, 3, Zb) + arc ri4b ri5b evert(2, 4, Zb) + arc ri5b ri6b evert(2, 5, Zb) + arc ri6b ri7b evert(2, 6, Zb) + arc ri7b ri0b evert(2, 7, Zb) + + arc Rb0b Rb1b evert(3, 0, Zb) + arc Rb1b Rb2b evert(3, 1, Zb) + arc Rb2b Rb3b evert(3, 2, Zb) + arc Rb3b Rb4b evert(3, 3, Zb) + arc Rb4b Rb5b evert(3, 4, Zb) + arc Rb5b Rb6b evert(3, 5, Zb) + arc Rb6b Rb7b evert(3, 6, Zb) + arc Rb7b Rb0b evert(3, 7, Zb) + + arc R0b R1sb evert(4, 0, Zb) + arc R1b R2b evert(4, 1, Zb) + arc R2b R3sb evert(4, 2, Zb) + arc R3b R4b evert(4, 3, Zb) + arc R4b R5sb evert(4, 4, Zb) + arc R5b R6b evert(4, 5, Zb) + arc R6b R7sb evert(4, 6, Zb) + arc R7b R0b evert(4, 7, Zb) + + arc r0t r1t evert(0, 0, Zt) + arc r1t r2st evert(0, 1, Zt) + arc r2t r3t evert(0, 2, Zt) + arc r3t r4st evert(0, 3, Zt) + arc r4t r5t evert(0, 4, Zt) + arc r5t r6st evert(0, 5, Zt) + arc r6t r7t evert(0, 6, Zt) + arc r7t r0st evert(0, 7, Zt) + + arc rb0t rb1t evert(1, 0, Zt) + arc rb1t rb2t evert(1, 1, Zt) + arc rb2t rb3t evert(1, 2, Zt) + arc rb3t rb4t evert(1, 3, Zt) + arc rb4t rb5t evert(1, 4, Zt) + arc rb5t rb6t evert(1, 5, Zt) + arc rb6t rb7t evert(1, 6, Zt) + arc rb7t rb0t evert(1, 7, Zt) + + arc ri0t ri1t evert(2, 0, Zt) + arc ri1t ri2t evert(2, 1, Zt) + arc ri2t ri3t evert(2, 2, Zt) + arc ri3t ri4t evert(2, 3, Zt) + arc ri4t ri5t evert(2, 4, Zt) + arc ri5t ri6t evert(2, 5, Zt) + arc ri6t ri7t evert(2, 6, Zt) + arc ri7t ri0t evert(2, 7, Zt) + + arc Rb0t Rb1t evert(3, 0, Zt) + arc Rb1t Rb2t evert(3, 1, Zt) + arc Rb2t Rb3t evert(3, 2, Zt) + arc Rb3t Rb4t evert(3, 3, Zt) + arc Rb4t Rb5t evert(3, 4, Zt) + arc Rb5t Rb6t evert(3, 5, Zt) + arc Rb6t Rb7t evert(3, 6, Zt) + arc Rb7t Rb0t evert(3, 7, Zt) + + arc R0t R1st evert(4, 0, Zt) + arc R1t R2t evert(4, 1, Zt) + arc R2t R3st evert(4, 2, Zt) + arc R3t R4t evert(4, 3, Zt) + arc R4t R5st evert(4, 4, Zt) + arc R5t R6t evert(4, 5, Zt) + arc R6t R7st evert(4, 6, Zt) + arc R7t R0t evert(4, 7, Zt) +); + +patches +( + wall rotor + ( + quad2D(r0, r1) + quad2D(r1, r2s) + quad2D(r2, r3) + quad2D(r3, r4s) + quad2D(r4, r5) + quad2D(r5, r6s) + quad2D(r6, r7) + quad2D(r7, r0s) + + quad2D(r0, rb0) + quad2D(r0s, rb0) + + quad2D(r2, rb2) + quad2D(r2s, rb2) + + quad2D(r4, rb4) + quad2D(r4s, rb4) + + quad2D(r6, rb6) + quad2D(r6s, rb6) + ) + + wall stator + ( + quad2D(R0, R1s) + quad2D(R1, R2) + quad2D(R2, R3s) + quad2D(R3, R4) + quad2D(R4, R5s) + quad2D(R5, R6) + quad2D(R6, R7s) + quad2D(R7, R0) + + quad2D(R1, Rb1) + quad2D(R1s, Rb1) + + quad2D(R3, Rb3) + quad2D(R3s, Rb3) + + quad2D(R5, Rb5) + quad2D(R5s, Rb5) + + quad2D(R7, Rb7) + quad2D(R7s, Rb7) + ) + + empty front + ( + frontQuad(r0, r1, rb1, rb0) + frontQuad(r1, r2s, rb2, rb1) + frontQuad(r2, r3, rb3, rb2) + frontQuad(r3, r4s, rb4, rb3) + frontQuad(r4, r5, rb5, rb4) + frontQuad(r5, r6s, rb6, rb5) + frontQuad(r6, r7, rb7, rb6) + frontQuad(r7, r0s, rb0, rb7) + frontQuad(rb0, rb1, ri1, ri0) + frontQuad(rb1, rb2, ri2, ri1) + frontQuad(rb2, rb3, ri3, ri2) + frontQuad(rb3, rb4, ri4, ri3) + frontQuad(rb4, rb5, ri5, ri4) + frontQuad(rb5, rb6, ri6, ri5) + frontQuad(rb6, rb7, ri7, ri6) + frontQuad(rb7, rb0, ri0, ri7) + frontQuad(ri0, ri1, Rb1, Rb0) + frontQuad(ri1, ri2, Rb2, Rb1) + frontQuad(ri2, ri3, Rb3, Rb2) + frontQuad(ri3, ri4, Rb4, Rb3) + frontQuad(ri4, ri5, Rb5, Rb4) + frontQuad(ri5, ri6, Rb6, Rb5) + frontQuad(ri6, ri7, Rb7, Rb6) + frontQuad(ri7, ri0, Rb0, Rb7) + frontQuad(Rb0, Rb1, R1s, R0) + frontQuad(Rb1, Rb2, R2, R1) + frontQuad(Rb2, Rb3, R3s, R2) + frontQuad(Rb3, Rb4, R4, R3) + frontQuad(Rb4, Rb5, R5s, R4) + frontQuad(Rb5, Rb6, R6, R5) + frontQuad(Rb6, Rb7, R7s, R6) + frontQuad(Rb7, Rb0, R0, R7) + ) + + empty back + ( + backQuad(r0, r1, rb1, rb0) + backQuad(r1, r2s, rb2, rb1) + backQuad(r2, r3, rb3, rb2) + backQuad(r3, r4s, rb4, rb3) + backQuad(r4, r5, rb5, rb4) + backQuad(r5, r6s, rb6, rb5) + backQuad(r6, r7, rb7, rb6) + backQuad(r7, r0s, rb0, rb7) + backQuad(rb0, rb1, ri1, ri0) + backQuad(rb1, rb2, ri2, ri1) + backQuad(rb2, rb3, ri3, ri2) + backQuad(rb3, rb4, ri4, ri3) + backQuad(rb4, rb5, ri5, ri4) + backQuad(rb5, rb6, ri6, ri5) + backQuad(rb6, rb7, ri7, ri6) + backQuad(rb7, rb0, ri0, ri7) + backQuad(ri0, ri1, Rb1, Rb0) + backQuad(ri1, ri2, Rb2, Rb1) + backQuad(ri2, ri3, Rb3, Rb2) + backQuad(ri3, ri4, Rb4, Rb3) + backQuad(ri4, ri5, Rb5, Rb4) + backQuad(ri5, ri6, Rb6, Rb5) + backQuad(ri6, ri7, Rb7, Rb6) + backQuad(ri7, ri0, Rb0, Rb7) + backQuad(Rb0, Rb1, R1s, R0) + backQuad(Rb1, Rb2, R2, R1) + backQuad(Rb2, Rb3, R3s, R2) + backQuad(Rb3, Rb4, R4, R3) + backQuad(Rb4, Rb5, R5s, R4) + backQuad(Rb5, Rb6, R6, R5) + backQuad(Rb6, Rb7, R7s, R6) + backQuad(Rb7, Rb0, R0, R7) + ) +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/boundary b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..292f25b806357d9df75c7731f74dee0ec0aa3a40 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/boundary @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +4 +( + rotor + { + type wall; + nFaces 192; + startFace 5952; + } + stator + { + type wall; + nFaces 192; + startFace 6144; + } + front + { + type empty; + nFaces 3072; + startFace 6336; + } + back + { + type empty; + nFaces 3072; + startFace 9408; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/ppProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/ppProperties new file mode 100644 index 0000000000000000000000000000000000000000..eddbfd7ad7910a8a85af9c310b1424eb18d3eb1e --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/ppProperties @@ -0,0 +1,29 @@ +/*--------------------------------*- 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; + location "constant"; + object ppProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +preAlphaExp 300; + +expMax 10; + +alphaMax 0.6; + +g0 g0 [ 1 -1 -2 0 0 0 0 ] 0; + +packingLimiter off; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/transportProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..9ea9ed21895c06facd069c9507e3de6663ff40bf --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/transportProperties @@ -0,0 +1,65 @@ +/*--------------------------------*- 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; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phase1 +{ + rho0 0; + rho 0.88; + R 287; + Cp 1007; + nu 2.46e-05; + d 4e-3; + + kappa 2.63e-2; + diameterModel isothermal; + isothermalCoeffs + { + d0 3e-3; + p0 1e5; + } +} + +phase2 +{ + rho 733; + rho0 733; + R 1e10; + Cp 4195; + nu 2.73e-6; + d 1e-4; + + kappa 0.668; + diameterModel constant; + constantCoeffs + { + d 1e-4; + } +} + +// Virtual-mass ceofficient +Cvm 0.5; + +// Lift coefficient +Cl 0; + +// Dispersed-phase turbulence coefficient +Ct 0.2; + +// Minimum allowable pressure +pMin 10000; + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/makeMesh b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/makeMesh new file mode 100755 index 0000000000000000000000000000000000000000..8ef4993fdebc0faac8bb6c69426059aba4b3faac --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/makeMesh @@ -0,0 +1,6 @@ +#!/bin/sh + +m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict +blockMesh +topoSet +setsToZones -noFlipMap diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/controlDict b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..5d64d363fa3ce9c7ff47851867f0afb2ee4c156d --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/controlDict @@ -0,0 +1,55 @@ +/*--------------------------------*- 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; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application compressibleTwoPhaseEulerFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 20; + +deltaT 1e-4; + +writeControl adjustableRunTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.2; + +maxDeltaT 1; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSchemes b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..56e5e3fd0d7e4c845f278be2cf396398983107eb --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSchemes @@ -0,0 +1,67 @@ +/*--------------------------------*- 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; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,alpha1) Gauss limitedLinear01 1; + div(phir,alpha1) Gauss limitedLinear01 1; + "div\(phi.,U.\)" Gauss limitedLinearV 1; + "div\(alphaPhi.,U.\)" Gauss limitedLinearV 1; + "div\(\(alpha.*Rc.\)\)" Gauss linear; + "div\(alphaPhi.,(k|epsilon)\)" Gauss limitedLinear 1; + div(phi,Theta) Gauss limitedLinear 1; + "div\(phi.,K.\)" Gauss linear; + "div\(alphaPhi.,T.\)" Gauss limitedLinear 1; + "div\(phid.,p\)" Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p ; + alpha1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSolution b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..891746fcf3a92e0ced6790284457d8c20f54c4b0 --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSolution @@ -0,0 +1,102 @@ +/*--------------------------------*- 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; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + tolerance 1e-08; + relTol 0.05; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pFinal + { + $p; + tolerance 1e-08; + relTol 0; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + nSweeps 2; + tolerance 1e-07; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-07; + relTol 0; + } + + "alpha.*" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-10; + relTol 0; + } + + "(k|epsilon|Theta|T).*" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-06; + relTol 0; + } +} + +PIMPLE +{ + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 0; + nAlphaCorr 1; + correctAlpha yes; + pRefCell 0; + pRefValue 0; +} + +relaxationFactors +{ + fields + { + p 1; + } + equations + { + "U.*" 1; + "alpha.*" 1; + "Theta.*" 1; + "k.*" 1; + "epsilon.*" 1; + "T.*" 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones new file mode 100644 index 0000000000000000000000000000000000000000..0034a58c2293992131cec848f2dcb0f8ad50a0d4 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones @@ -0,0 +1,20 @@ +/*--------------------------------*- 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; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +0() + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/transportProperties b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/transportProperties index ef9a0fccf7ebf3a1cae087fd9ceab3414a7f50b2..6d05c03c615194a5d93c828ac477e6e029df5161 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/transportProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/transportProperties @@ -17,25 +17,22 @@ FoamFile phase1 { - rho rho [ 1 -3 0 0 0 ] 2640; - nu nu [ 0 2 -1 0 0 ] 1e-06; - d d [ 0 1 0 0 0 0 0 ] 0.00048; + rho 2640; + nu 1e-06; + d 0.00048; } phase2 { - rho rho [ 1 -3 0 0 0 ] 1.28; - nu nu [ 0 2 -1 0 0 ] 1.328e-05; - d d [ 0 1 0 0 0 0 0 ] 1; + rho 1.28; + nu 1.328e-05; + d 1; } -Cvm Cvm [ 0 0 0 0 0 ] 0; +Cvm 0; -Cl Cl [ 0 0 0 0 0 ] 0; - -Ct Ct [ 0 0 0 0 0 ] 0; - -alpha1Alpha alpha1Alpha [ 0 0 0 0 0 ] 0; +Cl 0; +Ct 0; // ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution b/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution index bdb02666e34b4bd55546ef3a66204ff11f3f10e5..5800e2a4b4dc1f19677781a8a5487b289bb2296e 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution @@ -49,25 +49,21 @@ solvers "(k|epsilon)Final" { - solver PBiCG; - preconditioner DILU; - tolerance 1e-05; + $k; relTol 0; } alpha { - solver PBiCG; - preconditioner DILU; + solver PCG; + preconditioner DIC; tolerance 1e-10; relTol 0.1; } alpha1Final { - solver PBiCG; - preconditioner DILU; - tolerance 1e-10; + $alpha; relTol 0; } } @@ -77,6 +73,7 @@ PIMPLE nCorrectors 2; nNonOrthogonalCorrectors 0; nAlphaCorr 2; + nAlphaSubCycles 3; correctAlpha yes; pRefCell 0; pRefValue 0; diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones new file mode 100644 index 0000000000000000000000000000000000000000..0034a58c2293992131cec848f2dcb0f8ad50a0d4 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones @@ -0,0 +1,20 @@ +/*--------------------------------*- 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; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +0() + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/transportProperties b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/transportProperties index 859bd94263b9a0feb42e07c489ff4d1a48b79beb..1afd6e92c52bc8aa1afe3bf34f2b086f99c886a0 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/transportProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/transportProperties @@ -17,25 +17,20 @@ FoamFile phase1 { - rho rho [ 1 -3 0 0 0 ] 2500; - nu nu [ 0 2 -1 0 0 ] 1e-06; - d d [ 0 1 0 0 0 0 0 ] 0.0003; + rho 2500; + nu 1e-06; + d 0.0003; } phase2 { - rho rho [ 1 -3 0 0 0 ] 1.2; - nu nu [ 0 2 -1 0 0 ] 1.5e-05; - d d [ 0 1 0 0 0 0 0 ] 1; + rho 1.2; + nu 1.5e-05; + d 1; } -Cvm Cvm [ 0 0 0 0 0 ] 0; - -Cl Cl [ 0 0 0 0 0 ] 0; - -Ct Ct [ 0 0 0 0 0 ] 0; - -alpha1Alpha alpha1Alpha [ 0 0 0 0 0 ] 0; - +Cvm 0; +Cl 0; +Ct 0; // ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/system/fvSolution b/tutorials/multiphase/twoPhaseEulerFoam/bed2/system/fvSolution index bdb02666e34b4bd55546ef3a66204ff11f3f10e5..2e3cdfa4aaee926062296b0c2d40cb381f41ebcb 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/system/fvSolution +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/system/fvSolution @@ -76,7 +76,8 @@ PIMPLE { nCorrectors 2; nNonOrthogonalCorrectors 0; - nAlphaCorr 2; + nAlphaCorr 1; + nAlphaSubCycles 3; correctAlpha yes; pRefCell 0; pRefValue 0; diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones new file mode 100644 index 0000000000000000000000000000000000000000..0034a58c2293992131cec848f2dcb0f8ad50a0d4 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones @@ -0,0 +1,20 @@ +/*--------------------------------*- 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; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +0() + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/transportProperties b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/transportProperties index 276c521ad3c505013c1cddb3b71b1d7074dbca50..e013730cb5cce44d7638b78954289a6b2a79d261 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/transportProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/transportProperties @@ -17,23 +17,21 @@ FoamFile phase1 { - nu nu [ 0 2 -1 0 0 0 0 ] 1.6e-05; - rho rho [ 1 -3 0 0 0 0 0 ] 1; - d d [ 0 1 0 0 0 0 0 ] 0.003; + nu 1.6e-05; + rho 1; + d 0.003; } phase2 { - nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; - rho rho [ 1 -3 0 0 0 0 0 ] 1000; - d d [ 0 1 0 0 0 0 0 ] 0.0001; + nu 1e-06; + rho 1000; + d 0.0001; } -Cvm Cvm [ 0 0 0 0 0 0 0 ] 0.5; - -Cl Cl [ 0 0 0 0 0 0 0 ] 0; - -Ct Ct [ 0 0 0 0 0 0 0 ] 1; +Cvm 0.5; +Cl 0; +Ct 1; // ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/system/fvSolution b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/system/fvSolution index d0491f6d65a4f3c8b19e4823866f87a171501921..76a95c8327cadc21206927893a86f255c8cd1c8c 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/system/fvSolution +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/system/fvSolution @@ -76,7 +76,8 @@ PIMPLE { nCorrectors 2; nNonOrthogonalCorrectors 0; - nAlphaCorr 2; + nAlphaCorr 1; + nAlphaSubCycles 2; correctAlpha yes; pRefCell 0; pRefValue 0; diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/Theta b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/Theta new file mode 100644 index 0000000000000000000000000000000000000000..b18d202df894c0276dd7f546fd3820cd154623e4 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/Theta @@ -0,0 +1,44 @@ +/*--------------------------------*- 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 volScalarField; + object Theta; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/U1 b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/U1 new file mode 100644 index 0000000000000000000000000000000000000000..7a88b384782d81444c1dbc8643f955a4720536da --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/U1 @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 volVectorField; + object U1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + rotor + { + type fixedValue; + value uniform (0 0 0); + } + + stator + { + type fixedValue; + value uniform (0 0 0); + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/U2 b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/U2 new file mode 100644 index 0000000000000000000000000000000000000000..b93b8d870de47ad7c0f257b0301895c8c8ed05d9 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/U2 @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 volVectorField; + object U2; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + rotor + { + type fixedValue; + value uniform (0 0 0); + } + + stator + { + type fixedValue; + value uniform (0 0 0); + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/alpha1 b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/alpha1 new file mode 100644 index 0000000000000000000000000000000000000000..637ebed0e893d74b6cff62103ebf3c627ec682b9 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/alpha1 @@ -0,0 +1,44 @@ +/*--------------------------------*- 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 volScalarField; + object alpha1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.5; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/epsilon b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..3f507afed8ea6ba738e2fc7772a1fe96b57609de --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/epsilon @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 20; + +boundaryField +{ + rotor + { + type zeroGradient; + value uniform 20; + } + + stator + { + type zeroGradient; + value uniform 20; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/k b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/k new file mode 100644 index 0000000000000000000000000000000000000000..4704b49c838eb9f1f6c32dad5d2440ad7e7989f6 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/k @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + rotor + { + type zeroGradient; + value uniform 0; + } + + stator + { + type zeroGradient; + value uniform 0; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/p b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/p new file mode 100644 index 0000000000000000000000000000000000000000..9c4de0da512d78d3fcd7499ef5621c328e3d56e0 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/0/p @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + rotor + { + type multiphaseFixedFluxPressure; + value $internalField; + } + + stator + { + type multiphaseFixedFluxPressure; + value $internalField; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/Allrun b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..a718eaf7e662bad616179bd183caa9fd72de8b79 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/Allrun @@ -0,0 +1,12 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +application=`getApplication` + +runApplication ./makeMesh +runApplication $application + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones new file mode 100644 index 0000000000000000000000000000000000000000..25c3311d0b7ff552c41b5844854959e33685d807 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones @@ -0,0 +1,31 @@ +/*--------------------------------*- 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; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +1 +( + rotor + { + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin origin [0 1 0 0 0 0 0] (0 0 0); + axis axis [0 0 0 0 0 0 0] (0 0 1); + omega omega [0 0 -1 0 0 0 0] 10.472; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/RASProperties b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..41b54318fe41ab6593fd868ca5c080769a1988c1 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- 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; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence off; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/g b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..508d65849430f8e5abf4b12d7baa53d70521a1c3 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- 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 uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 0); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/interfacialProperties b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/interfacialProperties new file mode 100644 index 0000000000000000000000000000000000000000..41159fe9def1d68030d4d4c65aacca7947e0610b --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/interfacialProperties @@ -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; + location "constant"; + object interfacialProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dragModel1 SchillerNaumann; +dragModel2 SchillerNaumann; + +heatTransferModel1 RanzMarshall; +heatTransferModel2 RanzMarshall; + +dispersedPhase both; +dragPhase blended; + +residualSlip 1e-2; +minInterfaceAlpha 1e-3; + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/kineticTheoryProperties b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/kineticTheoryProperties new file mode 100644 index 0000000000000000000000000000000000000000..53521fbae309deb8893eed645ceaf0776fb9786a --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/kineticTheoryProperties @@ -0,0 +1,52 @@ +/*--------------------------------*- 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; + location "constant"; + object kineticTheoryProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +kineticTheory off; + +equilibrium on; + +e e [ 0 0 0 0 0 0 0 ] 0.9; + +alphaMax alphaMax [ 0 0 0 0 0 0 0 ] 0.6; + +alphaMinFriction alphaMinFriction [ 0 0 0 0 0 0 0 ] 0.5; + +Fr Fr [ 1 -1 -2 0 0 0 0 ] 0.05; + +eta eta [ 0 0 0 0 0 0 0 ] 2; + +p p [ 0 0 0 0 0 0 0 ] 5; + +phi phi [ 0 0 0 0 0 0 0 ] 25; + +viscosityModel Syamlal; + +conductivityModel HrenyaSinclair; + +granularPressureModel Lun; + +frictionalStressModel JohnsonJackson; + +radialModel Gidaspow; + +HrenyaSinclairCoeffs +{ + L L [ 0 1 0 0 0 0 0 ] 0.0005; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 new file mode 100644 index 0000000000000000000000000000000000000000..a93868498ba68d11b25b0875ff69205f62f822ed --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 @@ -0,0 +1,818 @@ +/*--------------------------------*- 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 blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// General macros to create 2D/extruded-2D meshes + +changecom(//)changequote([,]) +define(calc, [esyscmd(perl -e 'print ($1)')]) +define(VCOUNT, 0) +define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) +define(pi, 3.14159265) + +define(hex2D, hex ($1b $2b $3b $4b $1t $2t $3t $4t)) +define(quad2D, ($1b $2b $2t $1t)) +define(frontQuad, ($1t $2t $3t $4t)) +define(backQuad, ($1b $4b $3b $2b)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +// Hub radius +define(r, 0.2) + +// Impeller-tip radius +define(rb, 0.5) + +// Baffle-tip radius +define(Rb, 0.7) + +// Tank radius +define(R, 1) + +// MRF region radius +define(ri, calc(0.5*(rb + Rb))) + +// Thickness of 2D slab +define(z, 0.1) + +// Base z +define(Zb, 0) + +// Top z +define(Zt, calc(Zb + z)) + +// Number of cells radially between hub and impeller tip +define(Nr, 12) + +// Number of cells radially in each of the two regions between +// impeller and baffle tips +define(Ni, 4) + +// Number of cells radially between baffle tip and tank +define(NR, 12) + +// Number of cells azimuthally in each of the 8 blocks +define(Na, 12) + +// Number of cells in the thickness of the slab +define(Nz, 1) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +define(vert, (x$1$2 y$1$2 $3)) +define(evert, (ex$1$2 ey$1$2 $3)) + +define(a0, 0) +define(a1, -45) +define(a2, -90) +define(a3, -135) +define(a4, 180) +define(a5, 135) +define(a6, 90) +define(a7, 45) + +define(ea0, -22.5) +define(ea1, -67.5) +define(ea2, -112.5) +define(ea3, -157.5) +define(ea4, 157.5) +define(ea5, 112.5) +define(ea6, 67.5) +define(ea7, 22.5) + +define(ca0, calc(cos((pi/180)*a0))) +define(ca1, calc(cos((pi/180)*a1))) +define(ca2, calc(cos((pi/180)*a2))) +define(ca3, calc(cos((pi/180)*a3))) +define(ca4, calc(cos((pi/180)*a4))) +define(ca5, calc(cos((pi/180)*a5))) +define(ca6, calc(cos((pi/180)*a6))) +define(ca7, calc(cos((pi/180)*a7))) + +define(sa0, calc(sin((pi/180)*a0))) +define(sa1, calc(sin((pi/180)*a1))) +define(sa2, calc(sin((pi/180)*a2))) +define(sa3, calc(sin((pi/180)*a3))) +define(sa4, calc(sin((pi/180)*a4))) +define(sa5, calc(sin((pi/180)*a5))) +define(sa6, calc(sin((pi/180)*a6))) +define(sa7, calc(sin((pi/180)*a7))) + +define(cea0, calc(cos((pi/180)*ea0))) +define(cea1, calc(cos((pi/180)*ea1))) +define(cea2, calc(cos((pi/180)*ea2))) +define(cea3, calc(cos((pi/180)*ea3))) +define(cea4, calc(cos((pi/180)*ea4))) +define(cea5, calc(cos((pi/180)*ea5))) +define(cea6, calc(cos((pi/180)*ea6))) +define(cea7, calc(cos((pi/180)*ea7))) + +define(sea0, calc(sin((pi/180)*ea0))) +define(sea1, calc(sin((pi/180)*ea1))) +define(sea2, calc(sin((pi/180)*ea2))) +define(sea3, calc(sin((pi/180)*ea3))) +define(sea4, calc(sin((pi/180)*ea4))) +define(sea5, calc(sin((pi/180)*ea5))) +define(sea6, calc(sin((pi/180)*ea6))) +define(sea7, calc(sin((pi/180)*ea7))) + +define(x00, calc(r*ca0)) +define(x01, calc(r*ca1)) +define(x02, calc(r*ca2)) +define(x03, calc(r*ca3)) +define(x04, calc(r*ca4)) +define(x05, calc(r*ca5)) +define(x06, calc(r*ca6)) +define(x07, calc(r*ca7)) + +define(x10, calc(rb*ca0)) +define(x11, calc(rb*ca1)) +define(x12, calc(rb*ca2)) +define(x13, calc(rb*ca3)) +define(x14, calc(rb*ca4)) +define(x15, calc(rb*ca5)) +define(x16, calc(rb*ca6)) +define(x17, calc(rb*ca7)) + +define(x20, calc(ri*ca0)) +define(x21, calc(ri*ca1)) +define(x22, calc(ri*ca2)) +define(x23, calc(ri*ca3)) +define(x24, calc(ri*ca4)) +define(x25, calc(ri*ca5)) +define(x26, calc(ri*ca6)) +define(x27, calc(ri*ca7)) + +define(x30, calc(Rb*ca0)) +define(x31, calc(Rb*ca1)) +define(x32, calc(Rb*ca2)) +define(x33, calc(Rb*ca3)) +define(x34, calc(Rb*ca4)) +define(x35, calc(Rb*ca5)) +define(x36, calc(Rb*ca6)) +define(x37, calc(Rb*ca7)) + +define(x40, calc(R*ca0)) +define(x41, calc(R*ca1)) +define(x42, calc(R*ca2)) +define(x43, calc(R*ca3)) +define(x44, calc(R*ca4)) +define(x45, calc(R*ca5)) +define(x46, calc(R*ca6)) +define(x47, calc(R*ca7)) + +define(y00, calc(r*sa0)) +define(y01, calc(r*sa1)) +define(y02, calc(r*sa2)) +define(y03, calc(r*sa3)) +define(y04, calc(r*sa4)) +define(y05, calc(r*sa5)) +define(y06, calc(r*sa6)) +define(y07, calc(r*sa7)) + +define(y10, calc(rb*sa0)) +define(y11, calc(rb*sa1)) +define(y12, calc(rb*sa2)) +define(y13, calc(rb*sa3)) +define(y14, calc(rb*sa4)) +define(y15, calc(rb*sa5)) +define(y16, calc(rb*sa6)) +define(y17, calc(rb*sa7)) + +define(y20, calc(ri*sa0)) +define(y21, calc(ri*sa1)) +define(y22, calc(ri*sa2)) +define(y23, calc(ri*sa3)) +define(y24, calc(ri*sa4)) +define(y25, calc(ri*sa5)) +define(y26, calc(ri*sa6)) +define(y27, calc(ri*sa7)) + +define(y30, calc(Rb*sa0)) +define(y31, calc(Rb*sa1)) +define(y32, calc(Rb*sa2)) +define(y33, calc(Rb*sa3)) +define(y34, calc(Rb*sa4)) +define(y35, calc(Rb*sa5)) +define(y36, calc(Rb*sa6)) +define(y37, calc(Rb*sa7)) + +define(y40, calc(R*sa0)) +define(y41, calc(R*sa1)) +define(y42, calc(R*sa2)) +define(y43, calc(R*sa3)) +define(y44, calc(R*sa4)) +define(y45, calc(R*sa5)) +define(y46, calc(R*sa6)) +define(y47, calc(R*sa7)) + +define(ex00, calc(r*cea0)) +define(ex01, calc(r*cea1)) +define(ex02, calc(r*cea2)) +define(ex03, calc(r*cea3)) +define(ex04, calc(r*cea4)) +define(ex05, calc(r*cea5)) +define(ex06, calc(r*cea6)) +define(ex07, calc(r*cea7)) + +define(ex10, calc(rb*cea0)) +define(ex11, calc(rb*cea1)) +define(ex12, calc(rb*cea2)) +define(ex13, calc(rb*cea3)) +define(ex14, calc(rb*cea4)) +define(ex15, calc(rb*cea5)) +define(ex16, calc(rb*cea6)) +define(ex17, calc(rb*cea7)) + +define(ex20, calc(ri*cea0)) +define(ex21, calc(ri*cea1)) +define(ex22, calc(ri*cea2)) +define(ex23, calc(ri*cea3)) +define(ex24, calc(ri*cea4)) +define(ex25, calc(ri*cea5)) +define(ex26, calc(ri*cea6)) +define(ex27, calc(ri*cea7)) + +define(ex30, calc(Rb*cea0)) +define(ex31, calc(Rb*cea1)) +define(ex32, calc(Rb*cea2)) +define(ex33, calc(Rb*cea3)) +define(ex34, calc(Rb*cea4)) +define(ex35, calc(Rb*cea5)) +define(ex36, calc(Rb*cea6)) +define(ex37, calc(Rb*cea7)) + +define(ex40, calc(R*cea0)) +define(ex41, calc(R*cea1)) +define(ex42, calc(R*cea2)) +define(ex43, calc(R*cea3)) +define(ex44, calc(R*cea4)) +define(ex45, calc(R*cea5)) +define(ex46, calc(R*cea6)) +define(ex47, calc(R*cea7)) + +define(ey00, calc(r*sea0)) +define(ey01, calc(r*sea1)) +define(ey02, calc(r*sea2)) +define(ey03, calc(r*sea3)) +define(ey04, calc(r*sea4)) +define(ey05, calc(r*sea5)) +define(ey06, calc(r*sea6)) +define(ey07, calc(r*sea7)) + +define(ey10, calc(rb*sea0)) +define(ey11, calc(rb*sea1)) +define(ey12, calc(rb*sea2)) +define(ey13, calc(rb*sea3)) +define(ey14, calc(rb*sea4)) +define(ey15, calc(rb*sea5)) +define(ey16, calc(rb*sea6)) +define(ey17, calc(rb*sea7)) + +define(ey20, calc(ri*sea0)) +define(ey21, calc(ri*sea1)) +define(ey22, calc(ri*sea2)) +define(ey23, calc(ri*sea3)) +define(ey24, calc(ri*sea4)) +define(ey25, calc(ri*sea5)) +define(ey26, calc(ri*sea6)) +define(ey27, calc(ri*sea7)) + +define(ey30, calc(Rb*sea0)) +define(ey31, calc(Rb*sea1)) +define(ey32, calc(Rb*sea2)) +define(ey33, calc(Rb*sea3)) +define(ey34, calc(Rb*sea4)) +define(ey35, calc(Rb*sea5)) +define(ey36, calc(Rb*sea6)) +define(ey37, calc(Rb*sea7)) + +define(ey40, calc(R*sea0)) +define(ey41, calc(R*sea1)) +define(ey42, calc(R*sea2)) +define(ey43, calc(R*sea3)) +define(ey44, calc(R*sea4)) +define(ey45, calc(R*sea5)) +define(ey46, calc(R*sea6)) +define(ey47, calc(R*sea7)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +vertices +( + vert(0, 0, Zb) vlabel(r0b) + vert(0, 0, Zb) vlabel(r0sb) + vert(0, 1, Zb) vlabel(r1b) + vert(0, 2, Zb) vlabel(r2b) + vert(0, 2, Zb) vlabel(r2sb) + vert(0, 3, Zb) vlabel(r3b) + vert(0, 4, Zb) vlabel(r4b) + vert(0, 4, Zb) vlabel(r4sb) + vert(0, 5, Zb) vlabel(r5b) + vert(0, 6, Zb) vlabel(r6b) + vert(0, 6, Zb) vlabel(r6sb) + vert(0, 7, Zb) vlabel(r7b) + + vert(1, 0, Zb) vlabel(rb0b) + vert(1, 1, Zb) vlabel(rb1b) + vert(1, 2, Zb) vlabel(rb2b) + vert(1, 3, Zb) vlabel(rb3b) + vert(1, 4, Zb) vlabel(rb4b) + vert(1, 5, Zb) vlabel(rb5b) + vert(1, 6, Zb) vlabel(rb6b) + vert(1, 7, Zb) vlabel(rb7b) + + vert(2, 0, Zb) vlabel(ri0b) + vert(2, 1, Zb) vlabel(ri1b) + vert(2, 2, Zb) vlabel(ri2b) + vert(2, 3, Zb) vlabel(ri3b) + vert(2, 4, Zb) vlabel(ri4b) + vert(2, 5, Zb) vlabel(ri5b) + vert(2, 6, Zb) vlabel(ri6b) + vert(2, 7, Zb) vlabel(ri7b) + + vert(3, 0, Zb) vlabel(Rb0b) + vert(3, 1, Zb) vlabel(Rb1b) + vert(3, 2, Zb) vlabel(Rb2b) + vert(3, 3, Zb) vlabel(Rb3b) + vert(3, 4, Zb) vlabel(Rb4b) + vert(3, 5, Zb) vlabel(Rb5b) + vert(3, 6, Zb) vlabel(Rb6b) + vert(3, 7, Zb) vlabel(Rb7b) + + vert(4, 0, Zb) vlabel(R0b) + vert(4, 1, Zb) vlabel(R1b) + vert(4, 1, Zb) vlabel(R1sb) + vert(4, 2, Zb) vlabel(R2b) + vert(4, 3, Zb) vlabel(R3b) + vert(4, 3, Zb) vlabel(R3sb) + vert(4, 4, Zb) vlabel(R4b) + vert(4, 5, Zb) vlabel(R5b) + vert(4, 5, Zb) vlabel(R5sb) + vert(4, 6, Zb) vlabel(R6b) + vert(4, 7, Zb) vlabel(R7b) + vert(4, 7, Zb) vlabel(R7sb) + + vert(0, 0, Zt) vlabel(r0t) + vert(0, 0, Zt) vlabel(r0st) + vert(0, 1, Zt) vlabel(r1t) + vert(0, 2, Zt) vlabel(r2t) + vert(0, 2, Zt) vlabel(r2st) + vert(0, 3, Zt) vlabel(r3t) + vert(0, 4, Zt) vlabel(r4t) + vert(0, 4, Zt) vlabel(r4st) + vert(0, 5, Zt) vlabel(r5t) + vert(0, 6, Zt) vlabel(r6t) + vert(0, 6, Zt) vlabel(r6st) + vert(0, 7, Zt) vlabel(r7t) + + vert(1, 0, Zt) vlabel(rb0t) + vert(1, 1, Zt) vlabel(rb1t) + vert(1, 2, Zt) vlabel(rb2t) + vert(1, 3, Zt) vlabel(rb3t) + vert(1, 4, Zt) vlabel(rb4t) + vert(1, 5, Zt) vlabel(rb5t) + vert(1, 6, Zt) vlabel(rb6t) + vert(1, 7, Zt) vlabel(rb7t) + + vert(2, 0, Zt) vlabel(ri0t) + vert(2, 1, Zt) vlabel(ri1t) + vert(2, 2, Zt) vlabel(ri2t) + vert(2, 3, Zt) vlabel(ri3t) + vert(2, 4, Zt) vlabel(ri4t) + vert(2, 5, Zt) vlabel(ri5t) + vert(2, 6, Zt) vlabel(ri6t) + vert(2, 7, Zt) vlabel(ri7t) + + vert(3, 0, Zt) vlabel(Rb0t) + vert(3, 1, Zt) vlabel(Rb1t) + vert(3, 2, Zt) vlabel(Rb2t) + vert(3, 3, Zt) vlabel(Rb3t) + vert(3, 4, Zt) vlabel(Rb4t) + vert(3, 5, Zt) vlabel(Rb5t) + vert(3, 6, Zt) vlabel(Rb6t) + vert(3, 7, Zt) vlabel(Rb7t) + + vert(4, 0, Zt) vlabel(R0t) + vert(4, 1, Zt) vlabel(R1t) + vert(4, 1, Zt) vlabel(R1st) + vert(4, 2, Zt) vlabel(R2t) + vert(4, 3, Zt) vlabel(R3t) + vert(4, 3, Zt) vlabel(R3st) + vert(4, 4, Zt) vlabel(R4t) + vert(4, 5, Zt) vlabel(R5t) + vert(4, 5, Zt) vlabel(R5st) + vert(4, 6, Zt) vlabel(R6t) + vert(4, 7, Zt) vlabel(R7t) + vert(4, 7, Zt) vlabel(R7st) +); + +blocks +( + // block0 + hex2D(r0, r1, rb1, rb0) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(r1, r2s, rb2, rb1) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(r2, r3, rb3, rb2) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(r3, r4s, rb4, rb3) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(r4, r5, rb5, rb4) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(r5, r6s, rb6, rb5) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(r6, r7, rb7, rb6) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(r7, r0s, rb0, rb7) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(rb0, rb1, ri1, ri0) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(rb1, rb2, ri2, ri1) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(rb2, rb3, ri3, ri2) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(rb3, rb4, ri4, ri3) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(rb4, rb5, ri5, ri4) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(rb5, rb6, ri6, ri5) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(rb6, rb7, ri7, ri6) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(rb7, rb0, ri0, ri7) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(ri0, ri1, Rb1, Rb0) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(ri1, ri2, Rb2, Rb1) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(ri2, ri3, Rb3, Rb2) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(ri3, ri4, Rb4, Rb3) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(ri4, ri5, Rb5, Rb4) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(ri5, ri6, Rb6, Rb5) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(ri6, ri7, Rb7, Rb6) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(ri7, ri0, Rb0, Rb7) + (Na Ni Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(Rb0, Rb1, R1s, R0) + (Na NR Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(Rb1, Rb2, R2, R1) + (Na NR Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(Rb2, Rb3, R3s, R2) + (Na NR Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(Rb3, Rb4, R4, R3) + (Na NR Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(Rb4, Rb5, R5s, R4) + (Na NR Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(Rb5, Rb6, R6, R5) + (Na NR Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(Rb6, Rb7, R7s, R6) + (Na NR Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(Rb7, Rb0, R0, R7) + (Na NR Nz) + simpleGrading (1 1 1) +); + +edges +( + arc r0b r1b evert(0, 0, Zb) + arc r1b r2sb evert(0, 1, Zb) + arc r2b r3b evert(0, 2, Zb) + arc r3b r4sb evert(0, 3, Zb) + arc r4b r5b evert(0, 4, Zb) + arc r5b r6sb evert(0, 5, Zb) + arc r6b r7b evert(0, 6, Zb) + arc r7b r0sb evert(0, 7, Zb) + + arc rb0b rb1b evert(1, 0, Zb) + arc rb1b rb2b evert(1, 1, Zb) + arc rb2b rb3b evert(1, 2, Zb) + arc rb3b rb4b evert(1, 3, Zb) + arc rb4b rb5b evert(1, 4, Zb) + arc rb5b rb6b evert(1, 5, Zb) + arc rb6b rb7b evert(1, 6, Zb) + arc rb7b rb0b evert(1, 7, Zb) + + arc ri0b ri1b evert(2, 0, Zb) + arc ri1b ri2b evert(2, 1, Zb) + arc ri2b ri3b evert(2, 2, Zb) + arc ri3b ri4b evert(2, 3, Zb) + arc ri4b ri5b evert(2, 4, Zb) + arc ri5b ri6b evert(2, 5, Zb) + arc ri6b ri7b evert(2, 6, Zb) + arc ri7b ri0b evert(2, 7, Zb) + + arc Rb0b Rb1b evert(3, 0, Zb) + arc Rb1b Rb2b evert(3, 1, Zb) + arc Rb2b Rb3b evert(3, 2, Zb) + arc Rb3b Rb4b evert(3, 3, Zb) + arc Rb4b Rb5b evert(3, 4, Zb) + arc Rb5b Rb6b evert(3, 5, Zb) + arc Rb6b Rb7b evert(3, 6, Zb) + arc Rb7b Rb0b evert(3, 7, Zb) + + arc R0b R1sb evert(4, 0, Zb) + arc R1b R2b evert(4, 1, Zb) + arc R2b R3sb evert(4, 2, Zb) + arc R3b R4b evert(4, 3, Zb) + arc R4b R5sb evert(4, 4, Zb) + arc R5b R6b evert(4, 5, Zb) + arc R6b R7sb evert(4, 6, Zb) + arc R7b R0b evert(4, 7, Zb) + + arc r0t r1t evert(0, 0, Zt) + arc r1t r2st evert(0, 1, Zt) + arc r2t r3t evert(0, 2, Zt) + arc r3t r4st evert(0, 3, Zt) + arc r4t r5t evert(0, 4, Zt) + arc r5t r6st evert(0, 5, Zt) + arc r6t r7t evert(0, 6, Zt) + arc r7t r0st evert(0, 7, Zt) + + arc rb0t rb1t evert(1, 0, Zt) + arc rb1t rb2t evert(1, 1, Zt) + arc rb2t rb3t evert(1, 2, Zt) + arc rb3t rb4t evert(1, 3, Zt) + arc rb4t rb5t evert(1, 4, Zt) + arc rb5t rb6t evert(1, 5, Zt) + arc rb6t rb7t evert(1, 6, Zt) + arc rb7t rb0t evert(1, 7, Zt) + + arc ri0t ri1t evert(2, 0, Zt) + arc ri1t ri2t evert(2, 1, Zt) + arc ri2t ri3t evert(2, 2, Zt) + arc ri3t ri4t evert(2, 3, Zt) + arc ri4t ri5t evert(2, 4, Zt) + arc ri5t ri6t evert(2, 5, Zt) + arc ri6t ri7t evert(2, 6, Zt) + arc ri7t ri0t evert(2, 7, Zt) + + arc Rb0t Rb1t evert(3, 0, Zt) + arc Rb1t Rb2t evert(3, 1, Zt) + arc Rb2t Rb3t evert(3, 2, Zt) + arc Rb3t Rb4t evert(3, 3, Zt) + arc Rb4t Rb5t evert(3, 4, Zt) + arc Rb5t Rb6t evert(3, 5, Zt) + arc Rb6t Rb7t evert(3, 6, Zt) + arc Rb7t Rb0t evert(3, 7, Zt) + + arc R0t R1st evert(4, 0, Zt) + arc R1t R2t evert(4, 1, Zt) + arc R2t R3st evert(4, 2, Zt) + arc R3t R4t evert(4, 3, Zt) + arc R4t R5st evert(4, 4, Zt) + arc R5t R6t evert(4, 5, Zt) + arc R6t R7st evert(4, 6, Zt) + arc R7t R0t evert(4, 7, Zt) +); + +patches +( + wall rotor + ( + quad2D(r0, r1) + quad2D(r1, r2s) + quad2D(r2, r3) + quad2D(r3, r4s) + quad2D(r4, r5) + quad2D(r5, r6s) + quad2D(r6, r7) + quad2D(r7, r0s) + + quad2D(r0, rb0) + quad2D(r0s, rb0) + + quad2D(r2, rb2) + quad2D(r2s, rb2) + + quad2D(r4, rb4) + quad2D(r4s, rb4) + + quad2D(r6, rb6) + quad2D(r6s, rb6) + ) + + wall stator + ( + quad2D(R0, R1s) + quad2D(R1, R2) + quad2D(R2, R3s) + quad2D(R3, R4) + quad2D(R4, R5s) + quad2D(R5, R6) + quad2D(R6, R7s) + quad2D(R7, R0) + + quad2D(R1, Rb1) + quad2D(R1s, Rb1) + + quad2D(R3, Rb3) + quad2D(R3s, Rb3) + + quad2D(R5, Rb5) + quad2D(R5s, Rb5) + + quad2D(R7, Rb7) + quad2D(R7s, Rb7) + ) + + empty front + ( + frontQuad(r0, r1, rb1, rb0) + frontQuad(r1, r2s, rb2, rb1) + frontQuad(r2, r3, rb3, rb2) + frontQuad(r3, r4s, rb4, rb3) + frontQuad(r4, r5, rb5, rb4) + frontQuad(r5, r6s, rb6, rb5) + frontQuad(r6, r7, rb7, rb6) + frontQuad(r7, r0s, rb0, rb7) + frontQuad(rb0, rb1, ri1, ri0) + frontQuad(rb1, rb2, ri2, ri1) + frontQuad(rb2, rb3, ri3, ri2) + frontQuad(rb3, rb4, ri4, ri3) + frontQuad(rb4, rb5, ri5, ri4) + frontQuad(rb5, rb6, ri6, ri5) + frontQuad(rb6, rb7, ri7, ri6) + frontQuad(rb7, rb0, ri0, ri7) + frontQuad(ri0, ri1, Rb1, Rb0) + frontQuad(ri1, ri2, Rb2, Rb1) + frontQuad(ri2, ri3, Rb3, Rb2) + frontQuad(ri3, ri4, Rb4, Rb3) + frontQuad(ri4, ri5, Rb5, Rb4) + frontQuad(ri5, ri6, Rb6, Rb5) + frontQuad(ri6, ri7, Rb7, Rb6) + frontQuad(ri7, ri0, Rb0, Rb7) + frontQuad(Rb0, Rb1, R1s, R0) + frontQuad(Rb1, Rb2, R2, R1) + frontQuad(Rb2, Rb3, R3s, R2) + frontQuad(Rb3, Rb4, R4, R3) + frontQuad(Rb4, Rb5, R5s, R4) + frontQuad(Rb5, Rb6, R6, R5) + frontQuad(Rb6, Rb7, R7s, R6) + frontQuad(Rb7, Rb0, R0, R7) + ) + + empty back + ( + backQuad(r0, r1, rb1, rb0) + backQuad(r1, r2s, rb2, rb1) + backQuad(r2, r3, rb3, rb2) + backQuad(r3, r4s, rb4, rb3) + backQuad(r4, r5, rb5, rb4) + backQuad(r5, r6s, rb6, rb5) + backQuad(r6, r7, rb7, rb6) + backQuad(r7, r0s, rb0, rb7) + backQuad(rb0, rb1, ri1, ri0) + backQuad(rb1, rb2, ri2, ri1) + backQuad(rb2, rb3, ri3, ri2) + backQuad(rb3, rb4, ri4, ri3) + backQuad(rb4, rb5, ri5, ri4) + backQuad(rb5, rb6, ri6, ri5) + backQuad(rb6, rb7, ri7, ri6) + backQuad(rb7, rb0, ri0, ri7) + backQuad(ri0, ri1, Rb1, Rb0) + backQuad(ri1, ri2, Rb2, Rb1) + backQuad(ri2, ri3, Rb3, Rb2) + backQuad(ri3, ri4, Rb4, Rb3) + backQuad(ri4, ri5, Rb5, Rb4) + backQuad(ri5, ri6, Rb6, Rb5) + backQuad(ri6, ri7, Rb7, Rb6) + backQuad(ri7, ri0, Rb0, Rb7) + backQuad(Rb0, Rb1, R1s, R0) + backQuad(Rb1, Rb2, R2, R1) + backQuad(Rb2, Rb3, R3s, R2) + backQuad(Rb3, Rb4, R4, R3) + backQuad(Rb4, Rb5, R5s, R4) + backQuad(Rb5, Rb6, R6, R5) + backQuad(Rb6, Rb7, R7s, R6) + backQuad(Rb7, Rb0, R0, R7) + ) +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/boundary b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..292f25b806357d9df75c7731f74dee0ec0aa3a40 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/polyMesh/boundary @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +4 +( + rotor + { + type wall; + nFaces 192; + startFace 5952; + } + stator + { + type wall; + nFaces 192; + startFace 6144; + } + front + { + type empty; + nFaces 3072; + startFace 6336; + } + back + { + type empty; + nFaces 3072; + startFace 9408; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/ppProperties b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/ppProperties new file mode 100644 index 0000000000000000000000000000000000000000..eddbfd7ad7910a8a85af9c310b1424eb18d3eb1e --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/ppProperties @@ -0,0 +1,29 @@ +/*--------------------------------*- 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; + location "constant"; + object ppProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +preAlphaExp 300; + +expMax 10; + +alphaMax 0.6; + +g0 g0 [ 1 -1 -2 0 0 0 0 ] 0; + +packingLimiter off; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/transportProperties b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..9ea9ed21895c06facd069c9507e3de6663ff40bf --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/transportProperties @@ -0,0 +1,65 @@ +/*--------------------------------*- 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; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phase1 +{ + rho0 0; + rho 0.88; + R 287; + Cp 1007; + nu 2.46e-05; + d 4e-3; + + kappa 2.63e-2; + diameterModel isothermal; + isothermalCoeffs + { + d0 3e-3; + p0 1e5; + } +} + +phase2 +{ + rho 733; + rho0 733; + R 1e10; + Cp 4195; + nu 2.73e-6; + d 1e-4; + + kappa 0.668; + diameterModel constant; + constantCoeffs + { + d 1e-4; + } +} + +// Virtual-mass ceofficient +Cvm 0.5; + +// Lift coefficient +Cl 0; + +// Dispersed-phase turbulence coefficient +Ct 0.2; + +// Minimum allowable pressure +pMin 10000; + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/makeMesh b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/makeMesh new file mode 100755 index 0000000000000000000000000000000000000000..8ef4993fdebc0faac8bb6c69426059aba4b3faac --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/makeMesh @@ -0,0 +1,6 @@ +#!/bin/sh + +m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict +blockMesh +topoSet +setsToZones -noFlipMap diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/controlDict b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..7b2bf5a816c8966dabb1ec9ec14fefd77ddb630e --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/controlDict @@ -0,0 +1,55 @@ +/*--------------------------------*- 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; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application twoPhaseEulerFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 20; + +deltaT 1e-4; + +writeControl adjustableRunTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.5; + +maxDeltaT 1; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/fvSchemes b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..22f964670702bc54b4221f5d022ce0f0bf942bd8 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/fvSchemes @@ -0,0 +1,62 @@ +/*--------------------------------*- 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; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,alpha1) Gauss limitedLinear01 1; + div(phir,alpha1) Gauss limitedLinear01 1; + "div\(phi.,U.\)" Gauss limitedLinearV 1; + "div\(Rc.\)" Gauss linear; + "div\(phi.,(k|epsilon)\)" Gauss limitedLinear 1; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p ; + alpha1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/fvSolution b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..69208cbe950050e6f399b103952793cc7037bdf1 --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/system/fvSolution @@ -0,0 +1,103 @@ +/*--------------------------------*- 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; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + tolerance 1e-08; + relTol 0.05; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pFinal + { + $p; + tolerance 1e-08; + relTol 0; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + nSweeps 2; + tolerance 1e-07; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-07; + relTol 0; + } + + "alpha.*" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-10; + relTol 0; + } + + "(k|epsilon|Theta|T).*" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-06; + relTol 0; + } +} + +PIMPLE +{ + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 0; + nAlphaCorr 1; + nAlphaSubCycles 3; + correctAlpha yes; + pRefCell 0; + pRefValue 0; +} + +relaxationFactors +{ + fields + { + p 1; + } + equations + { + "U.*" 1; + "alpha.*" 1; + "Theta.*" 1; + "k.*" 1; + "epsilon.*" 1; + "T.*" 1; + } +} + + +// ************************************************************************* //