diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H index a86b142276..8b496a6aed 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H @@ -9,4 +9,6 @@ UrelEqn().relax(); - solve(UrelEqn() == -fvc::grad(p)); + sources.constrain(UrelEqn()); + + solve(UrelEqn() == -fvc::grad(p) + sources(Urel)); diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H index df3b09adc6..72c0d66290 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H @@ -1,5 +1,5 @@ volScalarField rAUrel(1.0/UrelEqn().A()); -Urel = rAUrel*UrelEqn().H(); +Urel = rAUrel*(UrelEqn() == sources(Urel))().H(); if (pimple.nCorrPISO() <= 1) { @@ -37,3 +37,4 @@ p.relax(); // Momentum corrector Urel -= rAUrel*fvc::grad(p); Urel.correctBoundaryConditions(); +sources.correct(Urel); diff --git a/applications/solvers/incompressible/pimpleFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/UEqn.H index d7be010a9f..a6aef51daf 100644 --- a/applications/solvers/incompressible/pimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/UEqn.H @@ -5,8 +5,6 @@ tmp UEqn fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) - == - sources(U) ); UEqn().relax(); @@ -17,5 +15,5 @@ volScalarField rAU(1.0/UEqn().A()); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(U)); } diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index 61acd7d697..55062637c2 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -1,4 +1,4 @@ -U = rAU*UEqn().H(); +U = rAU*(UEqn() == sources(U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -36,3 +36,4 @@ p.relax(); U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H index 5a211caa9c..618816f5fe 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H @@ -9,9 +9,11 @@ tmp UEqn UEqn().relax(); +sources.constrain(UEqn()); + rAU = 1.0/UEqn().A(); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(U)); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H index aeef26a837..dd90826e7d 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H @@ -1,4 +1,4 @@ -U = rAU*UEqn().H(); +U = rAU*(UEqn() == sources(U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -46,3 +46,4 @@ fvc::makeRelative(phi, U); U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H index c869df39a2..74e84d9bfc 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H @@ -3,8 +3,6 @@ tmp UEqn fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) - == - sources(U) ); @@ -14,5 +12,5 @@ sources.constrain(UEqn()); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p_gh)); + solve(UEqn() == -fvc::grad(p_gh) + sources(U)); } diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H index a5adeb9e91..d7cf6cd5b1 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H @@ -1,7 +1,7 @@ volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rAUf(rAU.name() + 'f', fvc::interpolate(rAU)); -U = rAU*UEqn().H(); +U = rAU*(UEqn() == sources(U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -41,3 +41,4 @@ p = p_gh + (g & (mesh.C() + zeta - refLevel)); U -= rAU*fvc::grad(p_gh); U.correctBoundaryConditions(); +sources.correct(U); diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H index 2d2540d303..93d6537b6a 100644 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H @@ -34,4 +34,5 @@ // Momentum corrector U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); } diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H index 54eab9cba7..b9a9079b92 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H @@ -34,4 +34,5 @@ // Momentum corrector Urel -= rAUrel*fvc::grad(p); Urel.correctBoundaryConditions(); + sources.correct(Urel); } diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 966dedb616..78dd40500b 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -34,4 +34,5 @@ // Momentum corrector U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); } diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/Make/options b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/Make/options index f1887d9aff..8ffc7f6d58 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/Make/options +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/Make/options @@ -5,11 +5,16 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + EXE_LIBS = \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleTransportModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lfieldSources \ + -lsampling diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H index 70f7520190..b381b2901d 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H @@ -7,7 +7,6 @@ == rho.dimensionedInternalField()*g + parcels.SU(U) - + sources(rho, U) ); sources.constrain(UEqn); @@ -16,5 +15,5 @@ if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p)); + solve(UEqn == -fvc::grad(p) + sources(rho, U)); } diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H index 141faa30bf..8a77a2656e 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H @@ -6,7 +6,7 @@ thermo.rho() -= psi*p; volScalarField rAU(1.0/UEqn.A()); - U = rAU*UEqn.H(); + U = rAU*(UEqn == sources(rho, U))().H(); if (pZones.size() > 0) { @@ -60,6 +60,7 @@ U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); rho = thermo.rho(); rho = max(rho, rhoMin); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H index fe7b047d9a..24f56e83d2 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H @@ -7,7 +7,6 @@ rho.dimensionedInternalField()*g + coalParcels.SU(U) + limestoneParcels.SU(U) - + sources(rho, U) ); UEqn.relax(); @@ -16,6 +15,6 @@ 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/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index 56435d31ce..cb8553bbfb 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -1,7 +1,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); -U = rAU*UEqn.H(); +U = rAU*(UEqn == sources(rho, U))().H(); if (pimple.transonic()) { @@ -74,6 +74,8 @@ else U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); + K = 0.5*magSqr(U); dpdt = fvc::ddt(p); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H index 28f6f81d9f..ce25309532 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H @@ -7,7 +7,6 @@ == rho.dimensionedInternalField()*g + parcels.SU(U) - + sources(rho, U) ); UEqn.relax(); @@ -18,7 +17,7 @@ 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/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H index 080faecced..6ed7affe77 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H @@ -6,7 +6,7 @@ thermo.rho() -= psi*p; volScalarField rAU(1.0/UEqn.A()); - U = rAU*UEqn.H(); + U = rAU*(UEqn == sources(rho, U))().H(); if (pZones.size() > 0) { @@ -59,6 +59,8 @@ U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); + K = 0.5*magSqr(U); dpdt = fvc::ddt(p); diff --git a/applications/solvers/lagrangian/sprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/Make/options index f9cb15cc2f..9d6d7d5398 100644 --- a/applications/solvers/lagrangian/sprayFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ @@ -20,8 +21,7 @@ EXE_INC = \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/combustionModels/lnInclude \ - -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam + -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/Make/files b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/files similarity index 100% rename from applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/Make/files rename to applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/files diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options similarity index 100% rename from applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/Make/options rename to applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/createClouds.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/createClouds.H similarity index 100% rename from applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/createClouds.H rename to applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/createClouds.H diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/logSummary.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/logSummary.H similarity index 100% rename from applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/logSummary.H rename to applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/logSummary.H diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H new file mode 100644 index 0000000000..5109788ea1 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H @@ -0,0 +1,73 @@ +rho = thermo.rho(); + +volScalarField rAU(1.0/UEqn.A()); +U = rAU*UEqn.H(); + +if (pimple.transonic()) +{ + surfaceScalarField phid + ( + "phid", + fvc::interpolate(psi) + *( + ((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)) + + fvc::ddtPhiCorr(rAU, rho, U, phi) + ) + ); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvm::div(phid, p) + - fvm::laplacian(rho*rAU, p) + == + parcels.Srho() + ); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi == pEqn.flux(); + } + } +} +else +{ + phi = + fvc::interpolate(rho) + *( + ((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)) + + fvc::ddtPhiCorr(rAU, rho, U, phi) + ); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvc::div(phi) + - fvm::laplacian(rho*rAU, p) + == + parcels.Srho() + ); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi += pEqn.flux(); + } + } +} + +#include "rhoEqn.H" +#include "compressibleContinuityErrs.H" + +U -= rAU*fvc::grad(p); +U.correctBoundaryConditions(); +K = 0.5*magSqr(U); + +dpdt = fvc::ddt(p); diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/readEngineTimeControls.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/readEngineTimeControls.H similarity index 100% rename from applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/readEngineTimeControls.H rename to applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/readEngineTimeControls.H diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/sprayEngineFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C similarity index 99% rename from applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/sprayEngineFoam.C rename to applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C index 7014cc1af3..a4ae147f51 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/sprayEngineFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C @@ -74,6 +74,8 @@ int main(int argc, char *argv[]) Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl; + mesh.move(); + parcels.evolve(); #include "rhoEqn.H" diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/startSummary.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/startSummary.H similarity index 100% rename from applications/solvers/lagrangian/sprayFoam/sprayEnginFoam/startSummary.H rename to applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/startSummary.H diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H index 6d2add98f9..97c9d455f1 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H @@ -114,11 +114,11 @@ public: //- the dragfunction K used in the momentum eq. // ddt(alpha*rhoa*Ua) + ... = ... alpha*beta*K*(Ua-Ub) // ddt(beta*rhob*Ub) + ... = ... alpha*beta*K*(Ub-Ua) - // ********************************** NB ! ***************************** + // ********************************** NB! ***************************** // for numerical reasons alpha and beta has been // extracted from the dragFunction K, // so you MUST divide K by alpha*beta when implemnting the drag function - // ********************************** NB ! ***************************** + // ********************************** NB! ***************************** virtual tmp K(const volScalarField& Ur) const = 0; }; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H index e4871f2c51..f83a03804b 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H @@ -114,12 +114,12 @@ public: //- the heat-transfer function K used in the enthalpy eq. // ddt(alpha*rhoa*ha) + ... = ... alpha*beta*K*(Ta - Tb) // ddt(beta*rhob*hb) + ... = ... alpha*beta*K*(Tb - Ta) - // ********************************** NB ! ***************************** + // ********************************** NB!***************************** // for numerical reasons alpha and beta has been // extracted from the heat-transfer function K, // so you MUST divide K by alpha*beta when implementing the // heat-transfer function - // ********************************** NB ! ***************************** + // ********************************** NB!***************************** virtual tmp K(const volScalarField& Ur) const = 0; }; diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/alphaEqn.H index d19ae9bb70..dc1146944e 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/alphaEqn.H @@ -30,7 +30,7 @@ } Info<< "Liquid phase volume fraction = " - << alpha1.weightedAverage(mesh.V()).value() + << alpha1.weightedAverage(mesh.Vsc()).value() << " Min(alpha1) = " << min(alpha1).value() << " Max(alpha1) = " << max(alpha1).value() << endl; diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.H b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.H index 31ea8164df..74f8f2b931 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.H @@ -35,8 +35,8 @@ Description \verbatim Kunz, R.F., Boger, D.A., Stinebring, D.R., Chyczewski, Lindau. J.W., Gibeling, H.J., Venkateswaran, S., Govindan, T.R., - “A Preconditioned Implicit Method for Two-Phase Flows with Application - to Cavitation Prediction,†+ "A Preconditioned Implicit Method for Two-Phase Flows with Application + to Cavitation Prediction," Computers and Fluids, 29(8):849-875, 2000. \endverbatim diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H index a775d91e45..3a9536c881 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H @@ -131,11 +131,11 @@ public: //- the dragfunction K used in the momentum eq. // ddt(alpha*rhoa*Ua) + ... = ... alpha*beta*K*(Ua-Ub) // ddt(beta*rhob*Ub) + ... = ... alpha*beta*K*(Ub-Ua) - // ********************************** NB ! ***************************** + // ********************************** NB! ***************************** // for numerical reasons alpha and beta has been // extracted from the dragFunction K, // so you MUST divide K by alpha*beta when implemnting the drag function - // ********************************** NB ! ***************************** + // ********************************** NB! ***************************** virtual tmp K(const volScalarField& Ur) const = 0; }; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H index e4871f2c51..5541795bfd 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H @@ -114,12 +114,12 @@ public: //- the heat-transfer function K used in the enthalpy eq. // ddt(alpha*rhoa*ha) + ... = ... alpha*beta*K*(Ta - Tb) // ddt(beta*rhob*hb) + ... = ... alpha*beta*K*(Tb - Ta) - // ********************************** NB ! ***************************** + // ********************************** NB! ***************************** // for numerical reasons alpha and beta has been // extracted from the heat-transfer function K, // so you MUST divide K by alpha*beta when implementing the // heat-transfer function - // ********************************** NB ! ***************************** + // ********************************** NB! ***************************** virtual tmp K(const volScalarField& Ur) const = 0; }; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H index b93ea3a020..675a410a16 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H @@ -155,7 +155,6 @@ phasei++; } Dp = mag(Dp); - adjustPhi(phi0, U, p); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H index 237c7cfb64..0831f158b6 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.H @@ -114,11 +114,11 @@ public: //- the dragfunction K used in the momentum eq. // ddt(alpha*rhoa*Ua) + ... = ... alpha*beta*K*(Ua-Ub) // ddt(beta*rhob*Ub) + ... = ... alpha*beta*K*(Ub-Ua) - // ********************************** NB ! ***************************** + // ********************************** NB ! ***************************** // for numerical reasons alpha and beta has been // extracted from the dragFunction K, // so you MUST divide K by alpha*beta when implemnting the drag function - // ********************************** NB ! ***************************** + // ********************************** NB ! ***************************** virtual tmp K(const volScalarField& Ur) const = 0; }; diff --git a/applications/test/DLList/Test-DLList.C b/applications/test/DLList/Test-DLList.C index 8e76baa6e1..d370348982 100644 --- a/applications/test/DLList/Test-DLList.C +++ b/applications/test/DLList/Test-DLList.C @@ -65,30 +65,36 @@ int main(int argc, char *argv[]) } myList.append(500.3); + myList.append(200.3); myList.append(100.3); Info<< nl << "And again using STL const_iterator: " << nl << endl; - const DLList& const_myList = myList; - forAllConstIter(DLList, const_myList, iter) + forAllConstIter(DLList, myList, iter) { Info<< "element:" << *iter << endl; } + Info<< nl << "Testing swapUp and swapDown: " << endl; + + Info<< nl << "swapUp" << endl; + myList.swapUp(myList.DLListBase::first()); myList.swapUp(myList.DLListBase::last()); - forAllConstIter(DLList, const_myList, iter) + forAllIter(DLList, myList, iter) { Info<< "element:" << *iter << endl; } + Info<< nl << "swapDown" << endl; + myList.swapDown(myList.DLListBase::first()); myList.swapDown(myList.DLListBase::last()); - forAllConstIter(DLList, const_myList, iter) + forAllIter(DLList, myList, iter) { Info<< "element:" << *iter << endl; } @@ -103,8 +109,8 @@ int main(int argc, char *argv[]) Info<< nl << "source: " << myList << nl << nl << "target: " << newList << endl; - Info<< nl << "Done." << endl; + return 0; } diff --git a/applications/test/findSphereFeatureEdges-octree/Make/files b/applications/test/findSphereFeatureEdges-octree/Make/files new file mode 100644 index 0000000000..b9c5a5027f --- /dev/null +++ b/applications/test/findSphereFeatureEdges-octree/Make/files @@ -0,0 +1,3 @@ +Test-findSphereFeatureEdges-octree.C + +EXE = $(FOAM_USER_APPBIN)/Test-findSphereFeatureEdges-octree diff --git a/applications/test/findSphereFeatureEdges-octree/Make/options b/applications/test/findSphereFeatureEdges-octree/Make/options new file mode 100644 index 0000000000..6069034514 --- /dev/null +++ b/applications/test/findSphereFeatureEdges-octree/Make/options @@ -0,0 +1,9 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/edgeMesh/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -ledgeMesh diff --git a/applications/test/findSphereFeatureEdges-octree/Test-findSphereFeatureEdges-octree.C b/applications/test/findSphereFeatureEdges-octree/Test-findSphereFeatureEdges-octree.C new file mode 100644 index 0000000000..4842756d48 --- /dev/null +++ b/applications/test/findSphereFeatureEdges-octree/Test-findSphereFeatureEdges-octree.C @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "Time.H" +#include "fvMesh.H" +#include "IStringStream.H" +#include "indexedOctree.H" +#include "treeDataEdge.H" +#include "OFstream.H" +#include "extendedFeatureEdgeMesh.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + +# include "setRootCase.H" +# include "createTime.H" +# include "createMesh.H" + + fileName sFeatFileName("unit_cube_rotated.extendedFeatureEdgeMesh"); + + extendedFeatureEdgeMesh efem + ( + IOobject + ( + sFeatFileName, + runTime.time().constant(), + "extendedFeatureEdgeMesh", + runTime.time(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + // Slightly extended bb. Slightly off-centred just so on symmetric + // geometry there are less face/edge aligned items. + treeBoundBox bb + ( + efem.points() + ); + + bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL); + bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL); + + labelList allEdges(identity(efem.edges().size())); + + indexedOctree edgeTree + ( + treeDataEdge + ( + false, // cachebb + efem.edges(), // edges + efem.points(), // points + allEdges // selected edges + ), + bb, // bb + 8, // maxLevel + 10, // leafsize + 3.0 // duplicity + ); + + Info<< "Points: " << efem.points() << nl << endl; + Info<< "Edges: " << efem.edges() << nl << endl; + + Info<< "Find edge labels within sphere from point (0, 0, 0):" << endl; + + Info<< " Radius = 0 : " + << edgeTree.findSphere(point(0, 0, 0), 0) << endl; + + Info<< " Radius = 1 : " + << edgeTree.findSphere(point(0, 0, 0), 1) << endl; + + Info<< " Radius = root(1.5) : " + << edgeTree.findSphere(point(0, 0, 0), 1.5) << endl; + + Info<< " Radius = root(2) : " + << edgeTree.findSphere(point(0, 0, 0), 2) << endl; + + Info<< " Radius = root(0.5) : " + << edgeTree.findSphere(point(1, 0, 0), 0.5) << endl; + + Info<< " Radius = root(0.25) : " + << edgeTree.findSphere(point(0, 0, 0.5), 0.25) << endl; + + treeBoundBox tbb(point(0,0,0), point(0.1,0.1,0.1)); + Info<< " Box = " << tbb << " : " + << edgeTree.findBox(tbb) << endl; + + treeBoundBox tbb1(point(0,0,0), point(1,1,0.1)); + Info<< " Box = " << tbb1 << " : " + << edgeTree.findBox(tbb1) << endl; + + treeBoundBox tbb2(point(0.3,0,0), point(1,0.3,1)); + Info<< " Box = " << tbb2 << " : " + << edgeTree.findBox(tbb2) << endl; + + treeBoundBox tbb3(point(-0.2,0.5,0), point(0.3,0.9,1)); + Info<< " Box = " << tbb3 << " : " + << edgeTree.findBox(tbb3) << endl; + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/momentOfInertia/Test-momentOfInertia.C b/applications/test/momentOfInertia/Test-momentOfInertia.C index 0a825df73f..73aaee649b 100644 --- a/applications/test/momentOfInertia/Test-momentOfInertia.C +++ b/applications/test/momentOfInertia/Test-momentOfInertia.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 @@ -35,7 +35,7 @@ Description #include "polyMesh.H" #include "ListOps.H" #include "face.H" -#include "tetPointRef.H" +#include "tetrahedron.H" #include "triFaceList.H" #include "OFstream.H" #include "meshTools.H" diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 4ba6d43b4e..b32c249e7c 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1637,6 +1637,7 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" + argList::addOption("dict", "name", "specify alternative dictionary"); #include "setRootCase.H" #include "createTime.H" diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 01c9707958..b3d9d3f515 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.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 @@ -290,18 +290,6 @@ int main(int argc, char *argv[]) // Whether first use of face (modify) or consecutive (add) PackedBoolList modifiedFace(mesh.nFaces()); - // Never modify coupled faces - forAll(patches, patchI) - { - const polyPatch& pp = patches[patchI]; - if (pp.coupled()) - { - forAll(pp, i) - { - modifiedFace[pp.start()+i] = 1; - } - } - } label nModified = 0; forAll(newMasterPatches, i) diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 7afe8356a6..7922d487a2 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.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 @@ -490,11 +490,17 @@ void syncPoints int main(int argc, char *argv[]) { -# include "addOverwriteOption.H" -# include "addRegionOption.H" + #include "addOverwriteOption.H" + #include "addRegionOption.H" + argList::addOption + ( + "dict", + "word", + "name of dictionary to provide patch information" + ); -# include "setRootCase.H" -# include "createTime.H" + #include "setRootCase.H" + #include "createTime.H" runTime.functionObjects().off(); Foam::word meshRegionName = polyMesh::defaultRegion; @@ -502,13 +508,18 @@ int main(int argc, char *argv[]) const bool overwrite = args.optionFound("overwrite"); - Info<< "Reading createPatchDict." << nl << endl; + word dictName + ( + args.optionLookupOrDefault("dict", "createPatchDict") + ); + + Info<< "Reading " << dictName << nl << endl; IOdictionary dict ( IOobject ( - "createPatchDict", + dictName, runTime.system(), ( meshRegionName != polyMesh::defaultRegion @@ -526,7 +537,7 @@ int main(int argc, char *argv[]) // Whether to synchronise points const Switch pointSync(dict.lookup("pointSync")); -# include "createNamedPolyMesh.H" + #include "createNamedPolyMesh.H" const word oldInstance = mesh.pointsInstance(); @@ -607,6 +618,11 @@ int main(int argc, char *argv[]) ).ptr() ); } + else + { + Info<< "Patch '" << patchName << "' already exists. Only " + << "moving patch faces - type will remain the same" << endl; + } } // Copy old patches. diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C index 99631e1e49..3841e16bf3 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C @@ -61,6 +61,8 @@ int main(int argc, char *argv[]) ); argList::noParallel(); + #include "addOverwriteOption.H" + argList::validArgs.append("masterCase"); argList::addOption ( @@ -83,6 +85,8 @@ int main(int argc, char *argv[]) FatalError.exit(); } + const bool overwrite = args.optionFound("overwrite"); + fileName masterCase = args[1]; word masterRegion = polyMesh::defaultRegion; args.optionReadIfPresent("masterRegion", masterRegion); @@ -126,7 +130,10 @@ int main(int argc, char *argv[]) ) ); - runTimeMaster++; + if (!overwrite) + { + runTimeMaster++; + } Info<< "Writing combined mesh to " << runTimeMaster.timeName() << endl; diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Make/options b/applications/utilities/mesh/manipulation/renumberMesh/Make/options index dc78db3436..6a2c95738d 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/Make/options +++ b/applications/utilities/mesh/manipulation/renumberMesh/Make/options @@ -2,7 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/renumberMethods/lnInclude \ + -I$(LIB_SRC)/renumber/renumberMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude EXE_LIBS = \ diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index a96179e970..cb7f5705aa 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.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 @@ -35,6 +35,9 @@ Usage \param -ascii \n Write Ensight data in ASCII format instead of "C Binary" + \parm -name \\n + define sub-directory name to use for Ensight data (default: "Ensight") + \param -noZero \n Exclude the often incomplete initial conditions. @@ -46,6 +49,9 @@ Usage Suppress writing the geometry. Can be useful for converting partial results for a static geometry. + \param -width \\n + width of Ensight data subdir + Note - no parallel data. - writes to \a Ensight directory to avoid collisions with foamToEnsight. @@ -96,6 +102,19 @@ int main(int argc, char *argv[]) "suppress writing the geometry. " "Can be useful for converting partial results for a static geometry" ); + argList::addOption + ( + "name", + "subdir", + "define sub-directory name to use for Ensight data " + "(default: \"Ensight\")" + ); + argList::addOption + ( + "width", + "n", + "width of Ensight data subdir" + ); // the volume field types that we handle wordHashSet volFieldTypes; @@ -133,7 +152,21 @@ int main(int argc, char *argv[]) // always write the geometry, unless the -noMesh option is specified bool optNoMesh = args.optionFound("noMesh"); - fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight"; + // adjust output width + if (args.optionFound("width")) + { + ensightFile::subDirWidth(args.optionRead