diff --git a/applications/solvers/combustion/PDRFoam/EaEqn.H b/applications/solvers/combustion/PDRFoam/EaEqn.H index 03d13f2693..1baaa7180f 100644 --- a/applications/solvers/combustion/PDRFoam/EaEqn.H +++ b/applications/solvers/combustion/PDRFoam/EaEqn.H @@ -7,7 +7,12 @@ + betav*fvc::ddt(rho, K) + fvc::div(phi, K) + ( hea.name() == "ea" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + phi/fvc::interpolate(rho), + p, + "div(phiv,p)" + ) : -betav*dpdt ) - fvm::laplacian(Db, hea) diff --git a/applications/solvers/combustion/PDRFoam/EauEqn.H b/applications/solvers/combustion/PDRFoam/EauEqn.H index 96412cc3c3..f031d90732 100644 --- a/applications/solvers/combustion/PDRFoam/EauEqn.H +++ b/applications/solvers/combustion/PDRFoam/EauEqn.H @@ -8,7 +8,12 @@ if (ign.ignited()) + (betav*fvc::ddt(rho, K) + fvc::div(phi, K))*rho/thermo.rhou() + ( heau.name() == "eau" - ? fvc::div(phi, volScalarField("Ep", p/rho))*rho/thermo.rhou() + ? fvc::div + ( + phi/fvc::interpolate(rho), + p, + "div(phiv,p)" + )*rho/thermo.rhou() : -betav*dpdt*rho/thermo.rhou() ) - fvm::laplacian(Db, heau) diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C index 79b9fb7756..44c4f6052f 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C @@ -116,7 +116,7 @@ void PDRkEpsilon::correct() } tmp tgradU = fvc::grad(U_); - volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU())))); + volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); // Update espsilon and G at the wall diff --git a/applications/solvers/combustion/XiFoam/EaEqn.H b/applications/solvers/combustion/XiFoam/EaEqn.H index a9e72b4627..6840c4eb6d 100644 --- a/applications/solvers/combustion/XiFoam/EaEqn.H +++ b/applications/solvers/combustion/XiFoam/EaEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( hea.name() == "ea" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), hea) diff --git a/applications/solvers/combustion/XiFoam/EauEqn.H b/applications/solvers/combustion/XiFoam/EauEqn.H index 0d81bd6e60..b13a63bb60 100644 --- a/applications/solvers/combustion/XiFoam/EauEqn.H +++ b/applications/solvers/combustion/XiFoam/EauEqn.H @@ -8,7 +8,12 @@ if (ign.ignited()) + (fvc::ddt(rho, K) + fvc::div(phi, K))*rho/thermo.rhou() + ( heau.name() == "eau" - ? fvc::div(phi, volScalarField("Ep", p/rho))*rho/thermo.rhou() + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + )*rho/thermo.rhou() : -dpdt*rho/thermo.rhou() ) - fvm::laplacian(turbulence->alphaEff(), heau) diff --git a/applications/solvers/combustion/coldEngineFoam/Make/options b/applications/solvers/combustion/coldEngineFoam/Make/options index a59f3b8053..25217ab23f 100644 --- a/applications/solvers/combustion/coldEngineFoam/Make/options +++ b/applications/solvers/combustion/coldEngineFoam/Make/options @@ -7,7 +7,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lengine \ @@ -16,4 +19,7 @@ EXE_LIBS = \ -lcompressibleLESModels \ -lfluidThermophysicalModels \ -lspecie \ - -lfiniteVolume + -lfiniteVolume \ + -lsampling \ + -lmeshTools \ + -lfieldSources diff --git a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C index 87474e778f..401690c3e4 100644 --- a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C +++ b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C @@ -35,6 +35,7 @@ Description #include "psiThermo.H" #include "turbulenceModel.H" #include "OFstream.H" +#include "IObasicSourceList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/coldEngineFoam/createFields.H b/applications/solvers/combustion/coldEngineFoam/createFields.H index f78e5bde29..72e88435ac 100644 --- a/applications/solvers/combustion/coldEngineFoam/createFields.H +++ b/applications/solvers/combustion/coldEngineFoam/createFields.H @@ -69,3 +69,6 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index d66cdd8130..7b005cc311 100644 --- a/applications/solvers/combustion/engineFoam/pEqn.H +++ b/applications/solvers/combustion/engineFoam/pEqn.H @@ -66,5 +66,5 @@ K = 0.5*magSqr(U); if (thermo.dpdt()) { - dpdt = fvc::ddt(p); + dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p); } diff --git a/applications/solvers/combustion/fireFoam/YEEqn.H b/applications/solvers/combustion/fireFoam/YEEqn.H index 340cfc63b1..f979d3bb7d 100644 --- a/applications/solvers/combustion/fireFoam/YEEqn.H +++ b/applications/solvers/combustion/fireFoam/YEEqn.H @@ -55,7 +55,12 @@ tmp > mvConvection + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/combustion/reactingFoam/EEqn.H b/applications/solvers/combustion/reactingFoam/EEqn.H index 33dbc46287..e1bf055604 100644 --- a/applications/solvers/combustion/reactingFoam/EEqn.H +++ b/applications/solvers/combustion/reactingFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/compressible/rhoCentralFoam/Allwmake b/applications/solvers/compressible/rhoCentralFoam/Allwmake index 671c640231..33e08e1076 100755 --- a/applications/solvers/compressible/rhoCentralFoam/Allwmake +++ b/applications/solvers/compressible/rhoCentralFoam/Allwmake @@ -2,8 +2,6 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wmake libso BCs -wmake -wmake rhoCentralDyMFoam +(wmake libso BCs && wmake && wmake rhoCentralDyMFoam) # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C index 063aaa4fb5..84a122d0dd 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C @@ -228,13 +228,10 @@ int main(int argc, char *argv[]) if (!inviscid) { - volScalarField k("k", thermo.Cp()*muEff/Pr); solve ( fvm::ddt(rho, e) - fvc::ddt(rho, e) - fvm::laplacian(turbulence->alphaEff(), e) - + fvc::laplacian(turbulence->alpha(), e) - - fvc::laplacian(k, T) ); thermo.correct(); rhoE = rho*(e + 0.5*magSqr(U)); diff --git a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H index 3ad3c0f03e..1cc6ed584c 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H @@ -7,13 +7,21 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) + == + sources(rho, he) ); EEqn.relax(); + sources.constrain(EEqn); EEqn.solve(); thermo.correct(); diff --git a/applications/solvers/compressible/rhoPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/Make/options index f21e7394e4..c96a146eca 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/Make/options @@ -2,7 +2,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -11,4 +14,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H index 0f5ec2487b..397e893035 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H @@ -9,8 +9,10 @@ tmp UEqn UEqn().relax(); +sources.constrain(UEqn()); + if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(rho, U)); K = 0.5*magSqr(U); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index 67cc0c3e45..8b3cfd10b9 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -69,3 +69,6 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index d40c66d402..5f28a3456d 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -5,7 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +HbyA = rAU*(UEqn() == sources(rho, U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -33,8 +33,12 @@ if (pimple.transonic()) fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -65,8 +69,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -92,6 +100,7 @@ Info<< "rho max/min : " << max(rho).value() U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index adb6882268..f9b8a901f7 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -38,6 +38,7 @@ Description #include "turbulenceModel.H" #include "bound.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options index 6d3c41f0df..c78d474b4f 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options @@ -3,7 +3,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -12,4 +15,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H index 75ed20e271..628eb71f29 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H @@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn().A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1())); volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +HbyA = rAU*(UEqn() == sources(rho, U))().H(); if (pimple.nCorrPIMPLE() <= 1) { @@ -44,11 +44,15 @@ if (pimple.transonic()) + fvm::div(phid, p) + fvc::div(phic) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); // Relax the pressure equation to maintain diagonal dominance pEqn.relax(); + sources.constrain(pEqn, rho.name()); + pEqn.solve(); if (pimple.finalNonOrthogonalIter()) @@ -81,8 +85,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(); if (pimple.finalNonOrthogonalIter()) @@ -100,6 +108,7 @@ p.relax(); U = HbyA - rAtU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C index cf8aed0bca..7e1664dbea 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C @@ -38,6 +38,7 @@ Description #include "turbulenceModel.H" #include "bound.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options index 5c83c910d9..2976366c08 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options @@ -5,7 +5,9 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -14,4 +16,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C index 3a8eb884ba..82ba5cbac1 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C @@ -38,7 +38,8 @@ Description #include "psiThermo.H" #include "turbulenceModel.H" #include "MRFZones.H" -#include "porousZones.H" +#include "IOporosityModelList.H" +#include "IObasicSourceList.H" #include "fvcSmooth.H" #include "pimpleControl.H" #include "bound.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options index f01ebda533..c78d474b4f 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options @@ -4,7 +4,9 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -13,4 +15,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H index c24b1f587a..9651610157 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H @@ -11,9 +11,12 @@ tmp UEqn UEqn().relax(); mrfZones.addCoriolis(rho, UEqn()); + pZones.addResistance(UEqn()); +sources.constrain(UEqn()); + if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(rho, U)); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H index 487a55d8ed..d2522b8c75 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H @@ -1,5 +1,5 @@ MRFZones mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); Switch pressureImplicitPorosity(false); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H index b68823c6e3..304798b966 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H @@ -5,7 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +HbyA = rAU*(UEqn() == sources(rho, U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -34,8 +34,12 @@ if (pimple.transonic()) fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -68,8 +72,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -94,6 +102,7 @@ Info<< "rho max/min : " << max(rho).value() U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index 16e6c0ad74..ac5dc1eadc 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -38,7 +38,8 @@ Description #include "turbulenceModel.H" #include "bound.H" #include "MRFZones.H" -#include "porousZones.H" +#include "IOporosityModelList.H" +#include "IObasicSourceList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H index e4c79b40cc..e496906d08 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H @@ -10,9 +10,12 @@ : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) ) - fvm::laplacian(turbulence->alphaEff(), he) + == + sources(rho, he) ); EEqn.relax(); + sources.constrain(EEqn); EEqn.solve(); thermo.correct(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/Make/options index 339cc53bd9..741dc4f822 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoSimpleFoam/Make/options @@ -3,7 +3,10 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -11,4 +14,6 @@ EXE_LIBS = \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lfiniteVolume \ - -lmeshTools + -lsampling \ + -lmeshTools \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index dea35b7657..3f4b2fd021 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -60,3 +60,6 @@ ); dimensionedScalar initialMass = fvc::domainIntegrate(rho); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 4d7334c5f8..2ea228f172 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -6,7 +6,7 @@ volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + HbyA = rAU*(UEqn() == sources(rho, U))().H(); UEqn.clear(); @@ -25,12 +25,16 @@ fvScalarMatrix pEqn ( fvm::div(phid, p) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); // Relax the pressure equation to ensure diagonal-dominance pEqn.relax(); + sources.constrain(pEqn, rho.name()); + pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); @@ -56,11 +60,15 @@ fvScalarMatrix pEqn ( fvc::div(phiHbyA) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); pEqn.setReference(pRefCell, pRefValue); + sources.constrain(pEqn, rho.name()); + pEqn.solve(); if (simple.finalNonOrthogonalIter()) @@ -78,6 +86,7 @@ U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H index ff467c0382..e496906d08 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H @@ -10,11 +10,12 @@ : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) ) - fvm::laplacian(turbulence->alphaEff(), he) + == + sources(rho, he) ); - pZones.addEnergySource(thermo, rho, EEqn); - EEqn.relax(); + sources.constrain(EEqn); EEqn.solve(); thermo.correct(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options index 2d328b3ed1..4ba7ed1f7d 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options @@ -1,18 +1,20 @@ EXE_INC = \ -I.. \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/thermalPorousZone/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ - -lthermalPorousZone \ -lspecie \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lfiniteVolume \ - -lmeshTools + -lsampling \ + -lmeshTools \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H index c0e087b536..52e15e07b5 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H @@ -24,11 +24,13 @@ trTU = inv(tTU()); trTU().rename("rAU"); + sources.constrain(UEqn()); + volVectorField gradp(fvc::grad(p)); for (int UCorr=0; UCorralphaEff(), e) ); diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H deleted file mode 100644 index 994c2862b8..0000000000 --- a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H +++ /dev/null @@ -1,11 +0,0 @@ -{ - solve - ( - fvm::ddt(rho, e) + fvm::div(phi, e) - + fvc::ddt(rho, K) + fvc::div(phi, K) - + fvc::div(phi/fvc::interpolate(rho) + mesh.phi(), p, "div(phiv,p)") - - fvm::laplacian(turbulence->alphaEff(), e) - ); - - thermo.correct(); -} diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options index f6e12a3b7c..5d86b094de 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options @@ -2,7 +2,10 @@ EXE_INC = \ -I../../compressible/rhoPimpleFoam \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ EXE_LIBS = \ -lmeshTools \ @@ -11,4 +14,8 @@ EXE_LIBS = \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ - -lfiniteVolume + -lfiniteVolume \ + -lsampling \ + -lmeshTools \ + -lfieldSources + diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H index 9597f6ac08..d8f3bb56ce 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H @@ -22,6 +22,7 @@ - fvc::snGrad(p_rgh) )*mesh.magSf() ) + + sources(rho, U) ); K = 0.5*magSqr(U); } diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index dfa88b59a9..79d3fb7f2f 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -37,6 +37,7 @@ Description #include "rhoThermo.H" #include "turbulenceModel.H" #include "fixedGradientFvPatchFields.H" +#include "IObasicSourceList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H index f6b183e3fc..9838978028 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H @@ -89,3 +89,6 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index d67011dba1..86c314c9c4 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -9,7 +9,7 @@ surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU)); volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + HbyA = rAU*(UEqn == sources(rho, U))().H(); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -28,6 +28,8 @@ ( fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) + fvc::div(phiHbyA) + == + sources(psi, p_rgh, rho.name()) ); while (pimple.correctNonOrthogonal()) @@ -38,6 +40,8 @@ - fvm::laplacian(rhorAUf, p_rgh) ); + sources.constrain(p_rghEqn, rho.name()); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -52,6 +56,7 @@ // calculated from the relaxed pressure U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf); U.correctBoundaryConditions(); + sources.correct(U); K = 0.5*magSqr(U); } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index 25e661dfc3..557017ccad 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -45,7 +45,7 @@ Description #include "solidRegionDiffNo.H" #include "solidThermo.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index c875d850cd..2f4b801cb3 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -36,7 +36,7 @@ Description #include "regionProperties.H" #include "solidThermo.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H index c34b547350..3d66fa798b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -18,7 +18,7 @@ PtrList rhoMin(fluidRegions.size()); PtrList heatSources(fluidRegions.size()); - PtrList porousZonesFluid(fluidRegions.size()); + PtrList porousZonesFluid(fluidRegions.size()); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -205,7 +205,7 @@ porousZonesFluid.set ( i, - new porousZones(fluidRegions[i]) + new IOporosityModelList(fluidRegions[i]) ); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H index 3abad39417..4f15d8c619 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H @@ -14,7 +14,7 @@ IObasicSourceList& sources = heatSources[i]; - const porousZones& pZones = porousZonesFluid[i]; + const IOporosityModelList& pZones = porousZonesFluid[i]; const dimensionedScalar initialMass ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H index c5680e7777..9f41c9eb37 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turb.alphaEff(), he) diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index 81cb541ea4..a2021a5edc 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -15,7 +15,7 @@ List initialMassFluid(fluidRegions.size()); PtrList heatSources(fluidRegions.size()); - PtrList porousZonesFluid(fluidRegions.size()); + PtrList porousZonesFluid(fluidRegions.size()); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -202,6 +202,6 @@ porousZonesFluid.set ( i, - new porousZones(fluidRegions[i]) + new IOporosityModelList(fluidRegions[i]) ); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index 04986d1289..28f0ea9683 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -22,7 +22,7 @@ IObasicSourceList& sources = heatSources[i]; - const porousZones& pZones = porousZonesFluid[i]; + const IOporosityModelList& pZones = porousZonesFluid[i]; const dimensionedScalar initialMass ( diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H index e4614b7063..5c6dbea19c 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H @@ -1,9 +1,9 @@ - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); Switch pressureImplicitPorosity(false); // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; - if (pZones.size()) + if (pZones.active()) { // nUCorrectors for pressureImplicitPorosity nUCorr = simple.dict().lookupOrDefault("nUCorrectors", 0); diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C index ef10119a9e..bde78bcbe1 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C @@ -33,7 +33,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "simpleControl.H" #include "IObasicSourceList.H" diff --git a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H index 006d2231f4..92219b9879 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H index cdc475d42f..f5a909a9dd 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H index 14996cfdf5..c8ef9bf84e 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C index fabb0bba60..4ea17727d9 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -40,7 +40,7 @@ Description #include "basicReactingMultiphaseCloud.H" #include "rhoCombustionModel.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" #include "SLGThermo.H" #include "fvcSmooth.H" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H b/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H index 90506856d2..05f0f044ce 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H @@ -1,3 +1,3 @@ Info<< "Creating porous zones" << nl << endl; - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index 5b90227323..1bcdf7c92f 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -10,7 +10,7 @@ HbyA = rAU*(UEqn == sources(rho, U))().H(); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); - if (pZones.size() == 0) + if (!pZones.active()) { // ddtPhiCorr only used without porosity phiHbyA += fvc::ddtPhiCorr(rAU, rho, U, phi); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 8ef6838c59..a8f4328543 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -44,7 +44,7 @@ Description #include "basicReactingMultiphaseCloud.H" #include "rhoCombustionModel.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" #include "SLGThermo.H" #include "pimpleControl.H" diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H index 475077d317..0301fba2ea 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H @@ -79,5 +79,5 @@ K = 0.5*magSqr(U); if (thermo.dpdt()) { - dpdt = fvc::ddt(p); + dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p); } diff --git a/applications/solvers/multiphase/cavitatingFoam/Allwclean b/applications/solvers/multiphase/cavitatingFoam/Allwclean new file mode 100755 index 0000000000..62548246e9 --- /dev/null +++ b/applications/solvers/multiphase/cavitatingFoam/Allwclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wclean +wclean cavitatingDyMFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/cavitatingFoam/Allwmake b/applications/solvers/multiphase/cavitatingFoam/Allwmake new file mode 100755 index 0000000000..211c1978b2 --- /dev/null +++ b/applications/solvers/multiphase/cavitatingFoam/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake +wmake cavitatingDyMFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files new file mode 100644 index 0000000000..57cd74e01d --- /dev/null +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files @@ -0,0 +1,3 @@ +cavitatingDyMFoam.C + +EXE = $(FOAM_APPBIN)/cavitatingDyMFoam diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options new file mode 100644 index 0000000000..fa204ce58f --- /dev/null +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options @@ -0,0 +1,22 @@ +EXE_INC = \ + -I.. \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ + -I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude + +EXE_LIBS = \ + -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ + -lincompressibleRASModels \ + -lincompressibleLESModels \ + -lfiniteVolume \ + -lbarotropicCompressibilityModel \ + -ldynamicMesh \ + -lmeshTools \ + -ldynamicFvMesh diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C new file mode 100644 index 0000000000..45bc766761 --- /dev/null +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Application + cavitatingFoam + +Description + Transient cavitation code based on the homogeneous equilibrium model + from which the compressibility of the liquid/vapour "mixture" is obtained. + + Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "barotropicCompressibilityModel.H" +#include "twoPhaseMixture.H" +#include "turbulenceModel.H" +#include "pimpleControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "readThermodynamicProperties.H" + #include "readControls.H" + #include "createFields.H" + #include "initContinuityErrs.H" + + pimpleControl pimple(mesh); + + surfaceScalarField phivAbs("phivAbs", phiv); + fvc::makeAbsolute(phivAbs, U); + + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + #include "CourantNo.H" + #include "setDeltaT.H" + + runTime++; + Info<< "Time = " << runTime.timeName() << nl << endl; + + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); + + { + // Calculate the relative velocity used to map relative flux phiv + volVectorField Urel("Urel", U); + + if (mesh.moving()) + { + Urel -= fvc::reconstruct(fvc::meshPhi(U)); + } + + // Do any mesh changes + mesh.update(); + } + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + + #include "correctPhi.H" + } + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "rhoEqn.H" + #include "gammaPsi.H" + #include "UEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H new file mode 100644 index 0000000000..8115b791e9 --- /dev/null +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H @@ -0,0 +1,48 @@ +{ + wordList pcorrTypes + ( + p.boundaryField().size(), + zeroGradientFvPatchScalarField::typeName + ); + + forAll (p.boundaryField(), i) + { + if (p.boundaryField()[i].fixesValue()) + { + pcorrTypes[i] = fixedValueFvPatchScalarField::typeName; + } + } + + volScalarField pcorr + ( + IOobject + ( + "pcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("pcorr", p.dimensions(), 0.0), + pcorrTypes + ); + + surfaceScalarField rhof(fvc::interpolate(rho, "div(phiv,rho)")); + dimensionedScalar rAUf("(1|A(U))", dimTime, 1.0); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pcorrEqn + ( + fvm::laplacian(rAUf, pcorr) == fvc::ddt(rho) + fvc::div(phiv*rhof) + ); + + pcorrEqn.solve(); + + if (pimple.finalNonOrthogonalIter()) + { + phiv -= pcorrEqn.flux()/rhof; + } + } +} diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H new file mode 100644 index 0000000000..a4e9e0b40f --- /dev/null +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H @@ -0,0 +1,85 @@ +{ + if (pimple.nCorrPIMPLE() == 1) + { + p = + ( + rho + - (1.0 - gamma)*rhol0 + - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat + )/psi; + } + + surfaceScalarField rhof("rhof", fvc::interpolate(rho)); + + volScalarField rAU(1.0/UEqn.A()); + surfaceScalarField rAUf("Dp", rhof*fvc::interpolate(rAU)); + + volVectorField HbyA("HbyA", U); + HbyA = rAU*UEqn.H(); + + phiv = (fvc::interpolate(HbyA) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phivAbs); + fvc::makeRelative(phiv, U); + + surfaceScalarField phiGradp(rAUf*mesh.magSf()*fvc::snGrad(p)); + + phiv -= phiGradp/rhof; + + volScalarField rho0(rho - psi*p); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvc::ddt(rho) + + psi*correction(fvm::ddt(p)) + + fvc::div(phiv, rho) + + fvc::div(phiGradp) + - fvm::laplacian(rAUf, p) + ); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phiv += (phiGradp + pEqn.flux())/rhof; + phivAbs = fvc::absolute(phiv, U); + } + } + + Info<< "Predicted p max-min : " << max(p).value() + << " " << min(p).value() << endl; + + rho == max(rho0 + psi*p, rhoMin); + + #include "gammaPsi.H" + + p = + ( + rho + - (1.0 - gamma)*rhol0 + - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat + )/psi; + + p.correctBoundaryConditions(); + + Info<< "Phase-change corrected p max-min : " << max(p).value() + << " " << min(p).value() << endl; + + // Correct velocity + + U = HbyA - rAU*fvc::grad(p); + + // Remove the swirl component of velocity for "wedge" cases + if (pimple.dict().found("removeSwirl")) + { + label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl"))); + + Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl; + U.field().replace(swirlCmpt, 0.0); + } + + U.correctBoundaryConditions(); + + Info<< "max(U) " << max(mag(U)).value() << endl; +} diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H index 2d70a5bab5..be34ab52ed 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H @@ -6,7 +6,7 @@ surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); - volScalarField divU(fvc::div(phi)); + volScalarField divU(fvc::div(fvc::absolute(phi, U))); if (nAlphaSubCycles > 1) { @@ -29,10 +29,4 @@ { #include "alphaEqns.H" } - - // correct interface on first PIMPLE corrector - if (pimple.corr() == 1) - { - interface.correct(); - } } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H deleted file mode 100644 index ade8af0081..0000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H +++ /dev/null @@ -1,40 +0,0 @@ -{ - label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - - surfaceScalarField phic(mag(phi/mesh.magSf())); - phic = min(interface.cAlpha()*phic, max(phic)); - - fvc::makeAbsolute(phi, U); - volScalarField divU(fvc::div(phi)); - fvc::makeRelative(phi, U); - - if (nAlphaSubCycles > 1) - { - dimensionedScalar totalDeltaT = runTime.deltaT(); - surfaceScalarField rhoPhiSum(0.0*rhoPhi); - - for - ( - subCycle alphaSubCycle(alpha1, nAlphaSubCycles); - !(++alphaSubCycle).end(); - ) - { - #include "alphaEqns.H" - rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; - } - - rhoPhi = rhoPhiSum; - } - else - { - #include "alphaEqns.H" - } - - // correct interface on first PIMPLE corrector - if (pimple.corr() == 1) - { - interface.correct(); - } -} diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index b9f52944e8..acf563fc8e 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -122,6 +122,12 @@ int main(int argc, char *argv[]) { #include "alphaEqnsSubCycle.H" + // correct interface on first PIMPLE corrector + if (pimple.corr() == 1) + { + interface.correct(); + } + solve(fvm::ddt(rho) + fvc::div(rhoPhi)); #include "UEqn.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 7c24e05a1a..54c246f203 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -80,6 +80,12 @@ int main(int argc, char *argv[]) { #include "alphaEqnsSubCycle.H" + // correct interface on first PIMPLE corrector + if (pimple.corr() == 1) + { + interface.correct(); + } + solve(fvm::ddt(rho) + fvc::div(rhoPhi)); #include "UEqn.H" diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C index 06811c2191..9d221b5ca9 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.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 @@ -77,6 +77,7 @@ int main(int argc, char *argv[]) twoPhaseProperties.correct(); #include "alphaEqnSubCycle.H" + interface.correct(); turbulence->correct(); diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H index 0c2cf71e4e..5f5ac824b8 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H @@ -30,8 +30,8 @@ rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2; } - Info<< "Liquid phase volume fraction = " - << alpha1.weightedAverage(mesh.V()).value() + Info<< "Phase-1 volume fraction = " + << alpha1.weightedAverage(mesh.Vsc()).value() << " Min(alpha1) = " << min(alpha1).value() << " Max(alpha1) = " << max(alpha1).value() << endl; diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H index b59b0ae5fe..6c82f94049 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H @@ -1,8 +1,5 @@ -const dictionary& pimpleDict = pimple.dict(); - -label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr"))); - -label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); +label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); +label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); if (nAlphaSubCycles > 1) { @@ -26,6 +23,4 @@ else #include "alphaEqn.H" } -interface.correct(); - rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2; diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C index 042a17e1f3..5cbbc0b3ab 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.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 @@ -81,6 +81,7 @@ int main(int argc, char *argv[]) twoPhaseProperties.correct(); #include "alphaEqnSubCycle.H" + interface.correct(); #include "zonePhaseVolumes.H" // --- Pressure-velocity PIMPLE corrector loop diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H index fa56de00bb..6c82f94049 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H @@ -23,6 +23,4 @@ else #include "alphaEqn.H" } -interface.correct(); - rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2; diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 3d450a3917..ee92734509 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.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 @@ -114,6 +114,7 @@ int main(int argc, char *argv[]) twoPhaseProperties.correct(); #include "alphaEqnSubCycle.H" + interface.correct(); // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 559916f2ce..69eb0964ce 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.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 @@ -43,7 +43,6 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" -#include "interpolationTable.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -82,6 +81,7 @@ int main(int argc, char *argv[]) twoPhaseProperties.correct(); #include "alphaEqnSubCycle.H" + interface.correct(); // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H b/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H index 430b466aac..983906074a 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H @@ -1 +1 @@ - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C index 891736c77f..795b7c14a1 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.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,7 +44,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -83,6 +83,7 @@ int main(int argc, char *argv[]) twoPhaseProperties.correct(); #include "alphaEqnSubCycle.H" + interface.correct(); // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) diff --git a/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H index d816f8aced..97a09ce017 100644 --- a/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H @@ -24,8 +24,6 @@ else #include "alphaEqns.H" } -interface.correct(); - { volScalarField rhoNew(alpha1*rho1 + alpha2*rho2 + alpha3*rho3); diff --git a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C index d4b1194ba1..33647cd28d 100644 --- a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.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 @@ -74,6 +74,7 @@ int main(int argc, char *argv[]) threePhaseProperties.correct(); #include "alphaEqnsSubCycle.H" + interface.correct(); #define twoPhaseProperties threePhaseProperties diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H index 6e02524e26..ad2cf243d2 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H @@ -40,10 +40,5 @@ surfaceScalarField rhoPhi #include "alphaEqn.H" } - if (pimple.nCorrPIMPLE() == 1) - { - interface.correct(); - } - rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2; } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index 5ed807bbad..00a7976a2e 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.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 @@ -82,6 +82,11 @@ int main(int argc, char *argv[]) #include "alphaEqnSubCycle.H" + if (pimple.nCorrPIMPLE() == 1) + { + interface.correct(); + } + turbulence->correct(); // --- Pressure-velocity PIMPLE corrector loop diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options index c8ce69c074..6e20519ec9 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I../interFoam \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaDiffusionEqn.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaDiffusionEqn.H new file mode 100644 index 0000000000..139646e43c --- /dev/null +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaDiffusionEqn.H @@ -0,0 +1,18 @@ +{ + fvScalarMatrix alpha1Eqn + ( + fvm::ddt(alpha1) + - fvc::ddt(alpha1) + - fvm::laplacian + ( + volScalarField("Dab", Dab + alphatab*turbulence->nut()), + alpha1 + ) + ); + + alpha1Eqn.solve(); + + rhoPhi += alpha1Eqn.flux()*(rho1 - rho2); +} + +rho = alpha1*rho1 + (scalar(1) - alpha1)*rho2; diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqn.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqn.H index d152baba0b..c68a0e56c5 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqn.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqn.H @@ -1,22 +1,22 @@ { - fvScalarMatrix alpha1Eqn + word alphaScheme("div(phi,alpha1)"); + + surfaceScalarField phiAlpha ( - fvm::ddt(alpha1) - + fvm::div(phi, alpha1) - - fvm::laplacian + fvc::flux ( - Dab + alphatab*turbulence->nut(), alpha1, - "laplacian(Dab,alpha1)" + phi, + alpha1, + alphaScheme ) ); - alpha1Eqn.solve(); + MULES::explicitSolve(alpha1, phi, phiAlpha, 1, 0); - rhoPhi = alpha1Eqn.flux()*(rho1 - rho2) + phi*rho2; - rho = alpha1*rho1 + (scalar(1) - alpha1)*rho2; + rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2; - Info<< "Phase 1 volume fraction = " - << alpha1.weightedAverage(mesh.V()).value() + Info<< "Phase-1 volume fraction = " + << alpha1.weightedAverage(mesh.Vsc()).value() << " Min(alpha1) = " << min(alpha1).value() << " Max(alpha1) = " << max(alpha1).value() << endl; diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H new file mode 100644 index 0000000000..6c82f94049 --- /dev/null +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H @@ -0,0 +1,26 @@ +label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); +label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); + +if (nAlphaSubCycles > 1) +{ + dimensionedScalar totalDeltaT = runTime.deltaT(); + surfaceScalarField rhoPhiSum(0.0*rhoPhi); + + for + ( + subCycle alphaSubCycle(alpha1, nAlphaSubCycles); + !(++alphaSubCycle).end(); + ) + { + #include "alphaEqn.H" + rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; + } + + rhoPhi = rhoPhiSum; +} +else +{ + #include "alphaEqn.H" +} + +rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2; diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C index 8a2b20e153..6113aba01f 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.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 @@ -32,6 +32,8 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "MULES.H" +#include "subCycle.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" #include "pimpleControl.H" @@ -60,19 +62,21 @@ int main(int argc, char *argv[]) { #include "readTimeControls.H" #include "CourantNo.H" + #include "alphaCourantNo.H" #include "setDeltaT.H" runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; + twoPhaseProperties.correct(); + + #include "alphaEqnSubCycle.H" + #include "alphaDiffusionEqn.H" + // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - twoPhaseProperties.correct(); - - #include "alphaEqn.H" - #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/test/dictionary/Test-dictionary.C b/applications/test/dictionary/Test-dictionary.C index 42bdcabeaf..287c63db21 100644 --- a/applications/test/dictionary/Test-dictionary.C +++ b/applications/test/dictionary/Test-dictionary.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 @@ -33,6 +33,7 @@ Description #include "IOobject.H" #include "IFstream.H" #include "dictionary.H" +#include "stringOps.H" using namespace Foam; @@ -45,6 +46,16 @@ int main(int argc, char *argv[]) argList::validArgs.insert("dict .. dictN"); argList args(argc, argv, false, true); + { + dictionary dict; + dict.add("aaOPENMPIcc", 1); + + string s("DDD${aa${WM_MPLIB}cc}EEE"); + stringOps::inplaceExpand(s, dict, true, false); + Info<< "variable expansion:" << s << endl; + } + + Info<< nl << "FOAM_CASE=" << getEnv("FOAM_CASE") << nl << "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl diff --git a/applications/test/dictionary/testDict b/applications/test/dictionary/testDict index af6c565f6f..9aee1a35bf 100644 --- a/applications/test/dictionary/testDict +++ b/applications/test/dictionary/testDict @@ -38,6 +38,15 @@ inactive type zeroGradient; } + +// Indirection +varType active; + +// Indirection of values +x 5; +varName x; + + boundaryField { Default_Boundary_Region @@ -52,7 +61,7 @@ boundaryField inlet_5 "a primitiveEntry is squashed by a directory entry"; inlet_5 { $inactive } inlet_6 { $.inactive } // Test scoping - inlet_7 { $inactive } + inlet_7 { ${inactive}} // Test variable expansion inlet_8 { $inactive } #include "testDictInc" @@ -63,14 +72,14 @@ boundaryField inletValue $internalField; value #include "value"; // error #remove self; - x 5; + x ${${varName}}; // Test indirection/recursive expansion y 6; } // this should have no effect #remove inactive - inlet_7 { $active } + inlet_7 { ${${varType}}} // Test indirection/recursive expansion #inputMode overwrite inlet_8 { $active } } diff --git a/applications/test/dimensionedType/Test-dimensionedType.C b/applications/test/dimensionedType/Test-dimensionedType.C index 5c826d256f..ccf56fff6b 100644 --- a/applications/test/dimensionedType/Test-dimensionedType.C +++ b/applications/test/dimensionedType/Test-dimensionedType.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,6 +41,45 @@ int main(int argc, char *argv[]) Info<< ds*dt << " " << dt*ds << endl; + + // dimensionSet + { + Pout<< "dimensionSet construct from is:" + << dimensionSet(IStringStream("[Pa m^2 s^-2]")()) + << endl; + + IStringStream is("[Pa m^2 s^-2]"); + dimensionSet dset(dimless); + is >> dset; + Pout<< "dimensionSet read:" << dset << endl; + } + // dimensionedType + { + Pout<< "construct from is:" + << dimensionedScalar(IStringStream("bla [Pa mm^2 s^-2] 3.0")()) + << endl; + Pout<< "construct from name,is:" + << dimensionedScalar + ( + "ABC", + IStringStream("[Pa mm^2 s^-2] 3.0")() + ) << endl; + Pout<< "construct from name,dimensionSet,is:" + << dimensionedScalar + ( + "ABC", + dimLength, + IStringStream("bla [mm] 3.0")() + ) << endl; + { + IStringStream is("bla [mm] 3.0"); + dimensionedScalar ds; + is >> ds; + Pout<< "read:" << ds << endl; + } + } + + Info<< "End\n" << endl; return 0; diff --git a/applications/test/mesh/Test-mesh.C b/applications/test/mesh/Test-mesh.C index 2616a2fd72..bab19bcc5e 100644 --- a/applications/test/mesh/Test-mesh.C +++ b/applications/test/mesh/Test-mesh.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 @@ -58,6 +58,58 @@ int main(int argc, char *argv[]) Info<< Cf << endl; + // Test construct from cellShapes + { + pointField points(mesh.points()); + cellShapeList shapes(mesh.cellShapes()); + + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + faceListList boundaryFaces(pbm.size()); + forAll(pbm, patchI) + { + boundaryFaces[patchI] = pbm[patchI]; + } + wordList boundaryPatchNames(pbm.names()); + PtrList boundaryDicts(pbm.size()); + forAll(pbm, patchI) + { + OStringStream os; + os << pbm[patchI]; + IStringStream is(os.str()); + boundaryDicts.set(patchI, new dictionary(is)); + } + + word defaultBoundaryPatchName = "defaultFaces"; + word defaultBoundaryPatchType = emptyPolyPatch::typeName; + + fvMesh newMesh + ( + IOobject + ( + "newMesh", + runTime.timeName(), + runTime, + Foam::IOobject::NO_READ + ), + Xfer(points), + shapes, + boundaryFaces, + boundaryPatchNames, + boundaryDicts, + defaultBoundaryPatchName, + defaultBoundaryPatchType + ); + + Info<< newMesh.C() << endl; + Info<< newMesh.V() << endl; + + surfaceVectorField Cf = newMesh.Cf(); + + Info<< Cf << endl; + } + + Info<< "End\n" << endl; return 0; diff --git a/applications/test/thermoMixture/Make/files b/applications/test/thermoMixture/Make/files new file mode 100644 index 0000000000..ffef737866 --- /dev/null +++ b/applications/test/thermoMixture/Make/files @@ -0,0 +1,3 @@ +Test-thermoMixture.C + +EXE = $(FOAM_USER_APPBIN)/Test-thermoMixture diff --git a/applications/test/thermoMixture/Make/options b/applications/test/thermoMixture/Make/options new file mode 100644 index 0000000000..98bf79aaa4 --- /dev/null +++ b/applications/test/thermoMixture/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + +EXE_LIBS = \ + -lspecie diff --git a/applications/test/thermoMixture/Test-thermoMixture.C b/applications/test/thermoMixture/Test-thermoMixture.C new file mode 100644 index 0000000000..1a2883cb0a --- /dev/null +++ b/applications/test/thermoMixture/Test-thermoMixture.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Application + ThermoMixture + +Description + +\*---------------------------------------------------------------------------*/ + +#include "dictionary.H" +#include "IFstream.H" +#include "specie.H" +#include "perfectGas.H" +#include "hConstThermo.H" +#include "sensibleEnthalpy.H" +#include "thermo.H" +#include "constTransport.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + typedef constTransport + < + species::thermo + < + hConstThermo >, + sensibleEnthalpy + > + > ThermoType; + + dictionary dict(IFstream("thermoDict")()); + + ThermoType t1(dict.subDict("specie1")); + ThermoType t2(dict.subDict("specie2")); + + Info<< "Checking Cp of mixture of hConstThermo" << endl; + + Info<< "W 1, 2, (1 + 2) = " << t1.W() << " " << t2.W() << " " + << (t1 + t2).W() << endl; + + Info<< "Cp 1, 2, 1 + 2 = " << t1.cp(1, 1) << " " << t2.cp(1, 1) << " " + << (t1 + t2).cp(1, 1) << endl; + + ThermoType t3(t1); + t3 += t2; + Info<< "Cp (1 += 2) = " << t3.cp(1, 1) << endl; + + Info<< "\nEnd\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/thermoMixture/thermoDict b/applications/test/thermoMixture/thermoDict new file mode 100644 index 0000000000..426ae0a9f3 --- /dev/null +++ b/applications/test/thermoMixture/thermoDict @@ -0,0 +1,43 @@ +specie1 +{ + specie + { + nMoles 1; + molWeight 1; + } + + thermodynamics + { + Cp 1; + Cv 1; + Hf 0; + } + + transport + { + mu 1; + Pr 1; + } +} + +specie2 +{ + specie + { + nMoles 1; + molWeight 0.5; + } + + thermodynamics + { + Cp 2; + Cv 2; + Hf 0; + } + + transport + { + mu 1; + Pr 1; + } +} diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index b3be8fe96f..4bef1736f0 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -96,20 +96,29 @@ castellatedMeshControls // refinement. nCellsBetweenLevels 1; + // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by explicitly provided // edges. // This is a featureEdgeMesh, read from constant/triSurface for now. + // Specify 'levels' in the same way as the 'distance' mode in the + // refinementRegions (see below). The old specification + // level 2; + // is equivalent to + // levels ((0 2)); + features ( //{ // file "someLine.eMesh"; - // level 2; + // //level 2; + // levels ((0.0 2) (1.0 3)); //} ); + // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -178,7 +187,7 @@ castellatedMeshControls // three modes // - distance. 'levels' specifies per distance to the surface the // wanted refinement level. The distances need to be specified in - // descending order. + // increasing order. // - inside. 'levels' is only one entry and only the level is used. All // cells inside the surface get refined up to the level. The surface // needs to be closed for this to be possible. @@ -245,6 +254,10 @@ snapControls //- Use castellatedMeshControls::features (default = true) explicitFeatureSnap true; + + //- Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap false; } // Settings for the layer addition. diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index d129efde6d..4abdc6c607 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -55,6 +55,8 @@ Description this if you don't mind having disconnected domains in a single region. This option requires all cells to be in one (and one only) cellZone. + - prefixRegion prefixes all normal patches with region name (interface + (patches already have region name prefix) - Should work in parallel. cellZones can differ on either side of processor boundaries in which case @@ -389,6 +391,40 @@ void reorderPatches } +// Prepend prefix to selected patches. +void renamePatches +( + fvMesh& mesh, + const word& prefix, + const labelList& patchesToRename +) +{ + polyBoundaryMesh& polyPatches = + const_cast(mesh.boundaryMesh()); + forAll(patchesToRename, i) + { + label patchI = patchesToRename[i]; + polyPatch& pp = polyPatches[patchI]; + + if (isA(pp)) + { + WarningIn + ( + "renamePatches(fvMesh&, const word&, const labelList&" + ) << "Encountered coupled patch " << pp.name() + << ". Will only rename the patch itself," + << " not any referred patches." + << " This might have to be done by hand." + << endl; + } + + pp.name() = prefix + '_' + pp.name(); + } + // Recalculate any demand driven data (e.g. group to name lookup) + polyPatches.updateMesh(); +} + + template void subsetVolFields ( @@ -987,6 +1023,7 @@ void createAndWriteRegion const fvMesh& mesh, const labelList& cellRegion, const wordList& regionNames, + const bool prefixRegion, const labelList& faceToInterface, const labelList& interfacePatches, const label regionI, @@ -1017,6 +1054,7 @@ void createAndWriteRegion addedPatches.insert(interfacePatches[interfaceI]+1); } + Info<< "Mapping fields" << endl; // Map existing fields @@ -1109,6 +1147,7 @@ void createAndWriteRegion // Create reordering list to move patches-to-be-deleted to end labelList oldToNew(newPatches.size(), -1); + DynamicList