From 2131f9f3e4345944527a576ecd1e7e1e44efa433 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 30 Oct 2013 09:08:27 +0000 Subject: [PATCH 1/6] BUG: reconstructPar: mesh re-reading --- .../reconstruct/reconstruct/processorMeshes.C | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/parallel/reconstruct/reconstruct/processorMeshes.C b/src/parallel/reconstruct/reconstruct/processorMeshes.C index b3729c8b7e..875e96c38e 100644 --- a/src/parallel/reconstruct/reconstruct/processorMeshes.C +++ b/src/parallel/reconstruct/reconstruct/processorMeshes.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,15 @@ License void Foam::processorMeshes::read() { + forAll(databases_, procI) + { + meshes_.set(procI, NULL); + pointProcAddressing_.set(procI, NULL); + faceProcAddressing_.set(procI, NULL); + cellProcAddressing_.set(procI, NULL); + boundaryProcAddressing_.set(procI, NULL); + } + forAll(databases_, procI) { meshes_.set From dfc680a212e1e096e980aeacb4a12b8c038f1309 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 30 Oct 2013 11:57:15 +0000 Subject: [PATCH 2/6] ENH: mapDistribute: missing default --- .../polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H index 7c94b9b138..96004c3e26 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H @@ -542,8 +542,11 @@ public: //- Compact maps. Gets per field a bool whether it is used (locally) // and works out itself what this side and sender side can remove // from maps. - void compact(const boolList& elemIsUsed, const int tag); - + void compact + ( + const boolList& elemIsUsed, + const int tag = UPstream::msgType() + ); //- Distribute data. Note:schedule only used for Pstream::scheduled // for now, all others just use send-to-all, receive-from-all. From f5fd050293258e43d9309fc0d86fb73e7cc48453 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 30 Oct 2013 12:50:12 +0000 Subject: [PATCH 3/6] VoF solvers: phase-fraction equation and move mesh motion into PIMPLE loop --- .../compressibleInterFoam/createFields.H | 2 +- .../multiphaseMixtureThermo.C | 4 +- .../interFoam/LTSInterFoam/LTSInterFoam.C | 25 ++++-- .../interFoam/MRFInterFoam/MRFInterFoam.C | 17 ++-- .../solvers/multiphase/interFoam/Make/options | 2 +- .../solvers/multiphase/interFoam/alphaEqn.H | 4 +- .../multiphase/interFoam/alphaEqnSubCycle.H | 2 - .../multiphase/interFoam/createFields.H | 5 +- .../interFoam/interDyMFoam/interDyMFoam.C | 82 +++++++++-------- .../interFoam/interDyMFoam/readControls.H | 20 +++-- .../solvers/multiphase/interFoam/interFoam.C | 15 +++- .../interFoam/interMixingFoam/createFields.H | 2 +- .../interMixingFoam/interMixingFoam.C | 19 ++-- .../porousInterFoam/porousInterFoam.C | 15 +++- .../interPhaseChangeFoam/alphaEqnSubCycle.H | 14 --- .../interPhaseChangeDyMFoam.C | 90 +++++++++++-------- .../interPhaseChangeFoam.C | 27 ++++-- .../multiphaseMixture/multiphaseMixture.C | 4 +- .../twoLiquidMixingFoam/createFields.H | 2 +- .../cfdTools/general/include/alphaControls.H | 10 ++- .../pimpleControl/pimpleControl.C | 2 +- .../pimpleControl/pimpleControl.H | 3 + .../pimpleControl/pimpleControlI.H | 12 ++- .../laminar/damBreak/system/controlDict | 4 +- .../laminar/damBreak/system/fvSolution | 36 ++++++-- .../constant/polyMesh/boundary | 2 +- 26 files changed, 266 insertions(+), 154 deletions(-) diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index c7289b23f9..c4edc961d8 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -70,7 +70,7 @@ ( IOobject ( - "rho*phi", + "rhoPhi", runTime.timeName(), mesh, IOobject::NO_READ, diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C index 602affd4e0..12dc93795c 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C @@ -83,14 +83,14 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo ( IOobject ( - "rho*phi", + "rhoPhi", mesh_.time().timeName(), mesh_, IOobject::NO_READ, IOobject::NO_WRITE ), mesh_, - dimensionedScalar("rho*phi", dimMass/dimTime, 0.0) + dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0) ), alphas_ diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C index 317a18120c..e9aa9fb9b9 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C @@ -77,19 +77,26 @@ int main(int argc, char *argv[]) #include "setrDeltaT.H" - twoPhaseProperties.correct(); - - #define LTSSOLVE - #include "alphaEqnSubCycle.H" - #undef LTSSOLVE - - interface.correct(); - - turbulence->correct(); + tmp tphiAlpha; // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + #include "alphaControls.H" + + if (pimple.firstIter() || alphaOuterCorrectors) + { + twoPhaseProperties.correct(); + + #define LTSSOLVE + #include "alphaEqnSubCycle.H" + #undef LTSSOLVE + + interface.correct(); + } + + turbulence->correct(); + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C index 0fa1a50ee2..56527781a2 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C @@ -81,15 +81,22 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - twoPhaseProperties.correct(); - - #include "alphaEqnSubCycle.H" - interface.correct(); - #include "zonePhaseVolumes.H" + tmp tphiAlpha; // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + #include "alphaControls.H" + + if (pimple.firstIter() || alphaOuterCorrectors) + { + twoPhaseProperties.correct(); + + #include "alphaEqnSubCycle.H" + interface.correct(); + #include "zonePhaseVolumes.H" + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options index b1cfcac9bd..8811a53df6 100644 --- a/applications/solvers/multiphase/interFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/Make/options @@ -1,4 +1,4 @@ -EXE_INC = \ +EXE_INC = -ggdb3 \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/alphaEqn.H index b0dd8ebef2..f6e57df771 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/alphaEqn.H @@ -6,9 +6,7 @@ phic = min(interface.cAlpha()*phic, max(phic)); surfaceScalarField phir(phic*interface.nHatf()); - tmp tphiAlpha; - - if (MULESCorr) + if (pimple.firstIter() && MULESCorr) { fvScalarMatrix alpha1Eqn ( diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H index 81c65c1caf..5db9f16546 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H @@ -1,5 +1,3 @@ -#include "alphaControls.H" - if (nAlphaSubCycles > 1) { dimensionedScalar totalDeltaT = runTime.deltaT(); diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index f0d1809848..3039171f77 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -62,13 +62,14 @@ ( IOobject ( - "rho*phi", + "rhoPhi", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), - rho1*phi + mesh, + dimensionedScalar("0", dimMass/dimTime, 0) ); diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 4a673c6a3f..d56e300581 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -77,46 +77,56 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); - - mesh.update(); - - if (mesh.changing()) - { - Info<< "Execution time for mesh.update() = " - << runTime.elapsedCpuTime() - timeBeforeMeshUpdate - << " s" << endl; - - gh = g & mesh.C(); - ghf = g & mesh.Cf(); - } - - if (mesh.changing() && correctPhi) - { - // Calculate absolute flux from the mapped surface velocity - phi = mesh.Sf() & Uf; - - #include "correctPhi.H" - - // Make the flux relative to the mesh motion - fvc::makeRelative(phi, U); - - interface.correct(); - } - - if (mesh.changing() && checkMeshCourantNo) - { - #include "meshCourantNo.H" - } - - twoPhaseProperties.correct(); - - #include "alphaEqnSubCycle.H" - interface.correct(); + tmp tphiAlpha; // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + if (pimple.firstIter() || moveMeshOuterCorrectors) + { + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); + + mesh.update(); + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + + gh = g & mesh.C(); + ghf = g & mesh.Cf(); + } + + if (mesh.changing() && correctPhi) + { + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & Uf; + + #include "correctPhi.H" + + // Make the flux relative to the mesh motion + fvc::makeRelative(phi, U); + + interface.correct(); + } + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + } + + #include "alphaControls.H" + + if (pimple.firstIter() || alphaOuterCorrectors) + { + twoPhaseProperties.correct(); + + #include "alphaEqnSubCycle.H" + interface.correct(); + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/readControls.H b/applications/solvers/multiphase/interFoam/interDyMFoam/readControls.H index d4e332ff38..bf8b38f426 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/readControls.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/readControls.H @@ -1,6 +1,16 @@ - #include "readTimeControls.H" +#include "readTimeControls.H" - bool correctPhi = - pimple.dict().lookupOrDefault("correctPhi", true); - bool checkMeshCourantNo = - pimple.dict().lookupOrDefault("checkMeshCourantNo", false); +bool correctPhi +( + pimple.dict().lookupOrDefault("correctPhi", true) +); + +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault("checkMeshCourantNo", false) +); + +bool moveMeshOuterCorrectors +( + pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false) +); diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 4ce08d27db..0ddfed5039 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -80,14 +80,21 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - twoPhaseProperties.correct(); - - #include "alphaEqnSubCycle.H" - interface.correct(); + tmp tphiAlpha; // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + #include "alphaControls.H" + + if (pimple.firstIter() || alphaOuterCorrectors) + { + twoPhaseProperties.correct(); + + #include "alphaEqnSubCycle.H" + interface.correct(); + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H index 196c82194c..3fd5874d5b 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H @@ -63,7 +63,7 @@ ( IOobject ( - "rho*phi", + "rhoPhi", runTime.timeName(), mesh, IOobject::NO_READ, diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index 12bc57d785..3321da57f9 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -74,16 +74,23 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - threePhaseProperties.correct(); - - #include "alphaEqnsSubCycle.H" - interface.correct(); - - #define twoPhaseProperties threePhaseProperties + tmp tphiAlpha; // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + #include "alphaControls.H" + + if (pimple.firstIter() || alphaOuterCorrectors) + { + threePhaseProperties.correct(); + + #include "alphaEqnsSubCycle.H" + interface.correct(); + + #define twoPhaseProperties threePhaseProperties + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C index 3423a4654a..15b4439220 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C @@ -83,14 +83,21 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - twoPhaseProperties.correct(); - - #include "alphaEqnSubCycle.H" - interface.correct(); + tmp tphiAlpha; // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + #include "alphaControls.H" + + if (pimple.firstIter() || alphaOuterCorrectors) + { + twoPhaseProperties.correct(); + + #include "alphaEqnSubCycle.H" + interface.correct(); + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H index a4338b907f..077738ccb2 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H @@ -1,18 +1,4 @@ -surfaceScalarField rhoPhi -( - IOobject - ( - "rhoPhi", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar("0", dimMass/dimTime, 0) -); - { - #include "alphaControls.H" - surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C index 31fa619754..0bfd8ad56e 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C @@ -86,44 +86,64 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); - - mesh.update(); - - if (mesh.changing()) - { - Info<< "Execution time for mesh.update() = " - << runTime.elapsedCpuTime() - timeBeforeMeshUpdate - << " s" << endl; - - gh = g & mesh.C(); - ghf = g & mesh.Cf(); - } - - if (mesh.changing() && correctPhi) - { - // Calculate absolute flux from the mapped surface velocity - phi = mesh.Sf() & Uf; - - #include "../interFoam/interDyMFoam/correctPhi.H" - - // Make the flux relative to the mesh motion - fvc::makeRelative(phi, U); - } - - if (mesh.changing() && checkMeshCourantNo) - { - #include "meshCourantNo.H" - } - - twoPhaseProperties->correct(); - - #include "alphaEqnSubCycle.H" - interface.correct(); - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + if (pimple.firstIter() || moveMeshOuterCorrectors) + { + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); + + mesh.update(); + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + + gh = g & mesh.C(); + ghf = g & mesh.Cf(); + } + + if (mesh.changing() && correctPhi) + { + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & Uf; + + #include "../interFoam/interDyMFoam/correctPhi.H" + + // Make the flux relative to the mesh motion + fvc::makeRelative(phi, U); + } + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + } + + #include "alphaControls.H" + + surfaceScalarField rhoPhi + ( + IOobject + ( + "rhoPhi", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("0", dimMass/dimTime, 0) + ); + + if (pimple.firstIter() || alphaOuterCorrectors) + { + twoPhaseProperties->correct(); + + #include "alphaEqnSubCycle.H" + interface.correct(); + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index 28ef7f0a69..2a653dcf37 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -83,14 +83,31 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - twoPhaseProperties->correct(); - - #include "alphaEqnSubCycle.H" - interface.correct(); - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { + #include "alphaControls.H" + + surfaceScalarField rhoPhi + ( + IOobject + ( + "rhoPhi", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("0", dimMass/dimTime, 0) + ); + + if (pimple.firstIter() || alphaOuterCorrectors) + { + twoPhaseProperties->correct(); + + #include "alphaEqnSubCycle.H" + interface.correct(); + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 20afd1f72f..e41b012860 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -87,14 +87,14 @@ Foam::multiphaseMixture::multiphaseMixture ( IOobject ( - "rho*phi", + "rhoPhi", mesh_.time().timeName(), mesh_, IOobject::NO_READ, IOobject::NO_WRITE ), mesh_, - dimensionedScalar("rho*phi", dimMass/dimTime, 0.0) + dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0) ), alphas_ diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H b/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H index 18b686f4f8..31e1e61d5d 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H @@ -54,7 +54,7 @@ ( IOobject ( - "rho*phi", + "rhoPhi", runTime.timeName(), mesh, IOobject::NO_READ, diff --git a/src/finiteVolume/cfdTools/general/include/alphaControls.H b/src/finiteVolume/cfdTools/general/include/alphaControls.H index e7b3cf7794..e57869309a 100644 --- a/src/finiteVolume/cfdTools/general/include/alphaControls.H +++ b/src/finiteVolume/cfdTools/general/include/alphaControls.H @@ -1,4 +1,12 @@ const dictionary& alphaControls = mesh.solverDict(alpha1.name()); + label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); + label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); -Switch MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false)); + +bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false)); + +bool alphaOuterCorrectors +( + alphaControls.lookupOrDefault("alphaOuterCorrectors", false) +); diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C index 2c89cc4cae..8329580bff 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H index 6cb9d3a21f..43ac8d94f7 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H @@ -129,6 +129,9 @@ public: //- Helper function to identify when to store the intial residuals inline bool storeInitialResiduals() const; + //- Helper function to identify first PIMPLE (outer) iteration + inline bool firstIter() const; + //- Helper function to identify final PIMPLE (outer) iteration inline bool finalIter() const; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H index 1d8917de89..8ac86bdfa8 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -66,14 +66,20 @@ inline bool Foam::pimpleControl::correct() inline bool Foam::pimpleControl::storeInitialResiduals() const { - // start from second PIMPLE iteration + // Start from second PIMPLE iteration return (corr_ == 2) && (corrPISO_ == 0) && (corrNonOrtho_ == 0); } +inline bool Foam::pimpleControl::firstIter() const +{ + return corr_ == 1; +} + + inline bool Foam::pimpleControl::finalIter() const { - return converged_ || (corr_ == nCorrPIMPLE_); + return converged_ || (corr_ == corrPISO_); } diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/system/controlDict b/tutorials/multiphase/interFoam/laminar/damBreak/system/controlDict index bae61318bb..77ec4eba87 100644 --- a/tutorials/multiphase/interFoam/laminar/damBreak/system/controlDict +++ b/tutorials/multiphase/interFoam/laminar/damBreak/system/controlDict @@ -47,8 +47,8 @@ runTimeModifiable yes; adjustTimeStep yes; -maxCo 0.5; -maxAlphaCo 0.5; +maxCo 1; +maxAlphaCo 1; maxDeltaT 1; diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution b/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution index 36156e8614..9e473a7865 100644 --- a/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution +++ b/tutorials/multiphase/interFoam/laminar/damBreak/system/fvSolution @@ -19,16 +19,25 @@ solvers { alpha.water { - nAlphaCorr 1; - nAlphaSubCycles 2; + nAlphaCorr 2; + nAlphaSubCycles 1; + alphaOuterCorrectors yes; cAlpha 1; + + MULESCorr yes; + nLimiterIter 3; + + solver PBiCG; + preconditioner DILU; + tolerance 1e-8; + relTol 0; } pcorr { solver PCG; preconditioner DIC; - tolerance 1e-10; + tolerance 1e-5; relTol 0; } @@ -43,14 +52,13 @@ solvers p_rghFinal { $p_rgh; - tolerance 1e-07; relTol 0; } U { - solver PBiCG; - preconditioner DILU; + solver smoothSolver; + smoother symGaussSeidel; tolerance 1e-06; relTol 0; } @@ -58,10 +66,22 @@ solvers PIMPLE { - momentumPredictor no; - nCorrectors 3; + momentumPredictor no; + nOuterCorrectors 1; + nCorrectors 3; nNonOrthogonalCorrectors 0; } +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + // ************************************************************************* // diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/constant/polyMesh/boundary b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/constant/polyMesh/boundary index 8b9ef8e645..17c34d0093 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/constant/polyMesh/boundary +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/constant/polyMesh/boundary @@ -39,7 +39,7 @@ FoamFile bullet { type wall; - nFaces 37752; + nFaces 37743; startFace 1133431; } ) From 6cabbe5e7ab23e6f5c5958b0e28e1e9b5b046911 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 30 Oct 2013 12:50:54 +0000 Subject: [PATCH 4/6] Update header --- .../general/solutionControl/pimpleControl/pimpleControl.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H index 43ac8d94f7..510e308188 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From fa328ab6783221e513560163dd1349beeb94c926 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 30 Oct 2013 15:12:36 +0000 Subject: [PATCH 5/6] ENH: reconstructPar: additional printing --- .../reconstructPar/reconstructPar.C | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 3ad100d4f2..aa7fa5554b 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -720,6 +720,20 @@ int main(int argc, char *argv[]) PtrList faceSets(fSetNames.size()); PtrList pointSets(pSetNames.size()); + Info<< "Reconstructing sets:" << endl; + if (cSetNames.size()) + { + Info<< " cellSets " << cSetNames.sortedToc() << endl; + } + if (fSetNames.size()) + { + Info<< " faceSets " << fSetNames.sortedToc() << endl; + } + if (pSetNames.size()) + { + Info<< " pointSets " << pSetNames.sortedToc() << endl; + } + // Load sets forAll(procMeshes.meshes(), procI) { From cca229f78522f1c20a861b00a4faba7581e15a32 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 30 Oct 2013 15:17:57 +0000 Subject: [PATCH 6/6] ENH: snappyHexMesh: layer coverage volfields --- .../generation/snappyHexMesh/snappyHexMesh.C | 6 +- .../snappyHexMesh/snappyHexMeshDict | 4 +- .../autoHexMeshDriver/autoLayerDriver.C | 348 ++++++++++++++---- .../autoHexMeshDriver/autoLayerDriver.H | 24 +- .../layerParameters/layerParameters.C | 37 +- .../layerParameters/layerParameters.H | 4 +- 6 files changed, 346 insertions(+), 77 deletions(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 65bc15d852..c349740ea7 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -1253,6 +1253,9 @@ int main(int argc, char *argv[]) // Snap parameters const snapParameters snapParams(snapDict); + // Layer addition parameters + const layerParameters layerParams(layerDict, mesh.boundaryMesh()); + if (wantRefine) { @@ -1346,9 +1349,6 @@ int main(int argc, char *argv[]) globalToSlavePatch ); - // Layer addition parameters - layerParameters layerParams(layerDict, mesh.boundaryMesh()); - // Use the maxLocalCells from the refinement parameters bool preBalance = returnReduce ( diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 9db10ea85e..b850033a44 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -304,11 +304,13 @@ addLayersControls // size of the refined cell outside layer (true) or absolute sizes (false). relativeSizes true; - // Layer thickness specification. This can be specified in one of four ways + // Layer thickness specification. This can be specified in one of following + // ways: // - expansionRatio and finalLayerThickness (cell nearest internal mesh) // - expansionRatio and firstLayerThickness (cell on surface) // - overall thickness and firstLayerThickness // - overall thickness and finalLayerThickness + // - overall thickness and expansionRatio // Expansion factor for layer mesh expansionRatio 1.0; diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 2c6add9fc9..7bb72786b8 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -52,6 +52,7 @@ Description #include "fixedValuePointPatchFields.H" #include "calculatedPointPatchFields.H" #include "cyclicSlipPointPatchFields.H" +#include "fixedValueFvPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -110,6 +111,31 @@ void Foam::autoLayerDriver::dumpDisplacement } +Foam::tmp Foam::autoLayerDriver::avgPointData +( + const indirectPrimitivePatch& pp, + const scalarField& pointFld +) +{ + tmp tfaceFld(new scalarField(pp.size(), 0.0)); + scalarField& faceFld = tfaceFld(); + + forAll(pp.localFaces(), faceI) + { + const face& f = pp.localFaces()[faceI]; + if (f.size()) + { + forAll(f, fp) + { + faceFld[faceI] += pointFld[f[fp]]; + } + faceFld[faceI] /= f.size(); + } + } + return tfaceFld; +} + + // Check that primitivePatch is not multiply connected. Collect non-manifold // points in pointSet. void Foam::autoLayerDriver::checkManifold @@ -2391,19 +2417,21 @@ Foam::label Foam::autoLayerDriver::countExtrusion } -// Collect layer faces and layer cells into bools for ease of handling +// Collect layer faces and layer cells into mesh fields for ease of handling void Foam::autoLayerDriver::getLayerCellsFaces ( const polyMesh& mesh, const addPatchCellLayer& addLayer, - boolList& flaggedCells, - boolList& flaggedFaces + const scalarField& oldRealThickness, + + labelList& cellNLayers, + scalarField& faceRealThickness ) { - flaggedCells.setSize(mesh.nCells()); - flaggedCells = false; - flaggedFaces.setSize(mesh.nFaces()); - flaggedFaces = false; + cellNLayers.setSize(mesh.nCells()); + cellNLayers = 0; + faceRealThickness.setSize(mesh.nFaces()); + faceRealThickness = 0; // Mark all faces in the layer const labelListList& layerFaces = addLayer.layerFaces(); @@ -2415,27 +2443,195 @@ void Foam::autoLayerDriver::getLayerCellsFaces { const labelList& added = addedCells[oldPatchFaceI]; - forAll(added, i) + const labelList& layer = layerFaces[oldPatchFaceI]; + + if (layer.size()) { - flaggedCells[added[i]] = true; + forAll(added, i) + { + cellNLayers[added[i]] = layer.size()-1; + } } } forAll(layerFaces, oldPatchFaceI) { const labelList& layer = layerFaces[oldPatchFaceI]; + const scalar realThickness = oldRealThickness[oldPatchFaceI]; if (layer.size()) { - for (label i = 1; i < layer.size()-1; i++) + // Layer contains both original boundary face and new boundary + // face so is nLayers+1 + forAll(layer, i) { - flaggedFaces[layer[i]] = true; + faceRealThickness[layer[i]] = realThickness; } } } } +bool Foam::autoLayerDriver::writeLayerData +( + const fvMesh& mesh, + const labelList& patchIDs, + const labelList& cellNLayers, + const scalarField& faceWantedThickness, + const scalarField& faceRealThickness +) const +{ + bool allOk = true; + + { + label nAdded = 0; + forAll(cellNLayers, cellI) + { + if (cellNLayers[cellI] > 0) + { + nAdded++; + } + } + cellSet addedCellSet(mesh, "addedCells", nAdded); + forAll(cellNLayers, cellI) + { + if (cellNLayers[cellI] > 0) + { + addedCellSet.insert(cellI); + } + } + addedCellSet.instance() = meshRefiner_.timeName(); + Info<< "Writing " + << returnReduce(addedCellSet.size(), sumOp