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/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/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) { 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. 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..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 @@ -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/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