diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/alphaEqn.H index f6e57df771..f0e9dab403 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/alphaEqn.H @@ -6,7 +6,8 @@ phic = min(interface.cAlpha()*phic, max(phic)); surfaceScalarField phir(phic*interface.nHatf()); - if (pimple.firstIter() && MULESCorr) + //***HGW if (pimple.firstIter() && MULESCorr) + if (MULESCorr) { fvScalarMatrix alpha1Eqn ( diff --git a/applications/test/ODE/Test-ODE.C b/applications/test/ODE/Test-ODE.C index c5dec29661..e5d3026828 100644 --- a/applications/test/ODE/Test-ODE.C +++ b/applications/test/ODE/Test-ODE.C @@ -27,7 +27,7 @@ Description #include "argList.H" #include "IOmanip.H" -#include "ODE.H" +#include "ODESystem.H" #include "ODESolver.H" #include "RK.H" @@ -37,7 +37,7 @@ using namespace Foam; class testODE : - public ODE + public ODESystem { public: @@ -107,9 +107,13 @@ int main(int argc, char *argv[]) argList::validArgs.append("ODESolver"); argList args(argc, argv); + // Create the ODE system testODE ode; + + // Create the selected ODE system solver autoPtr odeSolver = ODESolver::New(args[1], ode); + // Initialise the ODE system fields scalar xStart = 1.0; scalarField yStart(ode.nEqns()); yStart[0] = ::Foam::j0(xStart); @@ -117,6 +121,7 @@ int main(int argc, char *argv[]) yStart[2] = ::Foam::jn(2, xStart); yStart[3] = ::Foam::jn(3, xStart); + // Print the evolution of the solution and the time-step scalarField dyStart(ode.nEqns()); ode.derivatives(xStart, yStart, dyStart); 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/ODE/ODESolvers/KRR4/KRR4.C b/src/ODE/ODESolvers/KRR4/KRR4.C index 9246605b51..e9218641a7 100644 --- a/src/ODE/ODESolvers/KRR4/KRR4.C +++ b/src/ODE/ODESolvers/KRR4/KRR4.C @@ -55,7 +55,7 @@ const scalar // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::KRR4::KRR4(const ODE& ode) +Foam::KRR4::KRR4(const ODESystem& ode) : ODESolver(ode), yTemp_(n_, 0.0), @@ -76,7 +76,7 @@ Foam::KRR4::KRR4(const ODE& ode) void Foam::KRR4::solve ( - const ODE& ode, + const ODESystem& ode, scalar& x, scalarField& y, scalarField& dydx, @@ -168,7 +168,7 @@ void Foam::KRR4::solve ( "void Foam::KRR4::solve" "(" - "const ODE&, " + "const ODESystem&, " "scalar&, " "scalarField&, " "scalarField&, " @@ -206,7 +206,7 @@ void Foam::KRR4::solve ( "void Foam::KRR4::solve" "(" - "const ODE&, " + "const ODESystem&, " "scalar&, " "scalarField&, " "scalarField&, " diff --git a/src/ODE/ODESolvers/KRR4/KRR4.H b/src/ODE/ODESolvers/KRR4/KRR4.H index 17e9a8caa0..1eb434a0ba 100644 --- a/src/ODE/ODESolvers/KRR4/KRR4.H +++ b/src/ODE/ODESolvers/KRR4/KRR4.H @@ -88,14 +88,14 @@ public: // Constructors //- Construct from ODE - KRR4(const ODE& ode); + KRR4(const ODESystem& ode); // Member Functions void solve ( - const ODE& ode, + const ODESystem& ode, scalar& x, scalarField& y, scalarField& dydx, diff --git a/src/ODE/ODESolvers/ODESolver/ODESolver.C b/src/ODE/ODESolvers/ODESolver/ODESolver.C index 7a981dfd16..5f7188a079 100644 --- a/src/ODE/ODESolvers/ODESolver/ODESolver.C +++ b/src/ODE/ODESolvers/ODESolver/ODESolver.C @@ -36,7 +36,7 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::ODESolver::ODESolver(const ODE& ode) +Foam::ODESolver::ODESolver(const ODESystem& ode) : n_(ode.nEqns()), yScale_(n_), @@ -48,7 +48,7 @@ Foam::ODESolver::ODESolver(const ODE& ode) void Foam::ODESolver::solve ( - const ODE& ode, + const ODESystem& ode, const scalar xStart, const scalar xEnd, scalarField& y, @@ -102,7 +102,7 @@ void Foam::ODESolver::solve FatalErrorIn ( "ODESolver::solve" - "(const ODE& ode, const scalar xStart, const scalar xEnd," + "(const ODESystem& ode, const scalar xStart, const scalar xEnd," "scalarField& yStart, const scalar eps, scalar& hEst) const" ) << "Too many integration steps" << exit(FatalError); diff --git a/src/ODE/ODESolvers/ODESolver/ODESolver.H b/src/ODE/ODESolvers/ODESolver/ODESolver.H index 79c3fc5d1b..04315ea7dc 100644 --- a/src/ODE/ODESolvers/ODESolver/ODESolver.H +++ b/src/ODE/ODESolvers/ODESolver/ODESolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::ODESolver Description - Selection for ODE solver + Abstract base-class for ODE system solvers SourceFiles ODESolver.C @@ -35,7 +35,7 @@ SourceFiles #ifndef ODESolver_H #define ODESolver_H -#include "ODE.H" +#include "ODESystem.H" #include "typeInfo.H" #include "autoPtr.H" @@ -82,7 +82,7 @@ public: autoPtr, ODESolver, ODE, - (const ODE& ode), + (const ODESystem& ode), (ode) ); @@ -90,7 +90,7 @@ public: // Constructors //- Construct for given ODE - ODESolver(const ODE& ode); + ODESolver(const ODESystem& ode); // Selectors @@ -99,7 +99,7 @@ public: static autoPtr New ( const word& ODESolverTypeName, - const ODE& ode + const ODESystem& ode ); @@ -112,7 +112,7 @@ public: virtual void solve ( - const ODE& ode, + const ODESystem& ode, scalar& x, scalarField& y, scalarField& dydx, @@ -126,7 +126,7 @@ public: virtual void solve ( - const ODE& ode, + const ODESystem& ode, const scalar xStart, const scalar xEnd, scalarField& y, diff --git a/src/ODE/ODESolvers/ODESolver/ODESolverNew.C b/src/ODE/ODESolvers/ODESolver/ODESolverNew.C index 186e557726..aa8ed538cc 100644 --- a/src/ODE/ODESolvers/ODESolver/ODESolverNew.C +++ b/src/ODE/ODESolvers/ODESolver/ODESolverNew.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 @@ -30,7 +30,7 @@ License Foam::autoPtr Foam::ODESolver::New ( const Foam::word& ODESolverTypeName, - const Foam::ODE& ode + const Foam::ODESystem& ode ) { Info<< "Selecting ODE solver " << ODESolverTypeName << endl; @@ -42,7 +42,8 @@ Foam::autoPtr Foam::ODESolver::New { FatalErrorIn ( - "ODESolver::New(const word& ODESolverTypeName, const ODE& ode)" + "ODESolver::New" + "(const word& ODESolverTypeName, const ODESystem& ode)" ) << "Unknown ODESolver type " << ODESolverTypeName << nl << nl << "Valid ODESolvers are : " << endl diff --git a/src/ODE/ODESolvers/RK/RK.C b/src/ODE/ODESolvers/RK/RK.C index 6ae5036078..06c5e6ae81 100644 --- a/src/ODE/ODESolvers/RK/RK.C +++ b/src/ODE/ODESolvers/RK/RK.C @@ -54,7 +54,7 @@ const scalar // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::RK::RK(const ODE& ode) +Foam::RK::RK(const ODESystem& ode) : ODESolver(ode), yTemp_(n_, 0.0), @@ -72,7 +72,7 @@ Foam::RK::RK(const ODE& ode) void Foam::RK::solve ( - const ODE& ode, + const ODESystem& ode, const scalar x, const scalarField& y, const scalarField& dydx, @@ -142,7 +142,7 @@ void Foam::RK::solve void Foam::RK::solve ( - const ODE& ode, + const ODESystem& ode, scalar& x, scalarField& y, scalarField& dydx, diff --git a/src/ODE/ODESolvers/RK/RK.H b/src/ODE/ODESolvers/RK/RK.H index 5ab15fa0d1..20fa3aa789 100644 --- a/src/ODE/ODESolvers/RK/RK.H +++ b/src/ODE/ODESolvers/RK/RK.H @@ -81,14 +81,14 @@ public: // Constructors //- Construct from ODE - RK(const ODE& ode); + RK(const ODESystem& ode); // Member Functions void solve ( - const ODE& ode, + const ODESystem& ode, const scalar x, const scalarField& y, const scalarField& dydx, @@ -100,7 +100,7 @@ public: void solve ( - const ODE& ode, + const ODESystem& ode, scalar& x, scalarField& y, scalarField& dydx, diff --git a/src/ODE/ODESolvers/SIBS/SIBS.C b/src/ODE/ODESolvers/SIBS/SIBS.C index d86f60d5c9..95ab44776c 100644 --- a/src/ODE/ODESolvers/SIBS/SIBS.C +++ b/src/ODE/ODESolvers/SIBS/SIBS.C @@ -47,7 +47,7 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::SIBS::SIBS(const ODE& ode) +Foam::SIBS::SIBS(const ODESystem& ode) : ODESolver(ode), a_(iMaxX_, 0.0), @@ -70,7 +70,7 @@ Foam::SIBS::SIBS(const ODE& ode) void Foam::SIBS::solve ( - const ODE& ode, + const ODESystem& ode, scalar& x, scalarField& y, scalarField& dydx, diff --git a/src/ODE/ODESolvers/SIBS/SIBS.H b/src/ODE/ODESolvers/SIBS/SIBS.H index 7c1d9c6fbe..a031b1c83b 100644 --- a/src/ODE/ODESolvers/SIBS/SIBS.H +++ b/src/ODE/ODESolvers/SIBS/SIBS.H @@ -78,7 +78,7 @@ class SIBS void SIMPR ( - const ODE& ode, + const ODESystem& ode, const scalar xStart, const scalarField& y, const scalarField& dydx, @@ -110,14 +110,14 @@ public: // Constructors //- Construct from ODE - SIBS(const ODE& ode); + SIBS(const ODESystem& ode); // Member Functions void solve ( - const ODE& ode, + const ODESystem& ode, scalar& x, scalarField& y, scalarField& dydx, diff --git a/src/ODE/ODESolvers/SIBS/SIMPR.C b/src/ODE/ODESolvers/SIBS/SIMPR.C index 9c67ce1158..36402a202d 100644 --- a/src/ODE/ODESolvers/SIBS/SIMPR.C +++ b/src/ODE/ODESolvers/SIBS/SIMPR.C @@ -29,7 +29,7 @@ License void Foam::SIBS::SIMPR ( - const ODE& ode, + const ODESystem& ode, const scalar xStart, const scalarField& y, const scalarField& dydx, diff --git a/src/ODE/ODE/ODE.H b/src/ODE/ODESystem/ODESystem.H similarity index 80% rename from src/ODE/ODE/ODE.H rename to src/ODE/ODESystem/ODESystem.H index 4c98d8dc4c..90da37c427 100644 --- a/src/ODE/ODE/ODE.H +++ b/src/ODE/ODESystem/ODESystem.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,15 +22,15 @@ License along with OpenFOAM. If not, see . Class - Foam::ODE + Foam::ODESystem Description - Abstract base class for the ODE solvers. + Abstract base class for the systems of ordinary differential equations. \*---------------------------------------------------------------------------*/ -#ifndef ODE_H -#define ODE_H +#ifndef ODESystem_H +#define ODESystem_H #include "scalarField.H" #include "scalarMatrices.H" @@ -41,30 +41,32 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class ODE Declaration + Class ODESystem Declaration \*---------------------------------------------------------------------------*/ -class ODE +class ODESystem { public: // Constructors - //- Construct null - ODE() + //- Construct null8 + ODESystem() {} //- Destructor - virtual ~ODE() + virtual ~ODESystem() {} // Member Functions + //- Return the number of equations in the system virtual label nEqns() const = 0; + //- Calculate the derivatives in dydx virtual void derivatives ( const scalar x, @@ -72,7 +74,8 @@ public: scalarField& dydx ) const = 0; - + //- Calculate the Jacobian of the system + // Need by the stiff-system solvers virtual void jacobian ( const scalar x, 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/OpenFOAM/primitives/Tuple2/Tuple2.H b/src/OpenFOAM/primitives/Tuple2/Tuple2.H index 26ca000575..4b7b45a1f8 100644 --- a/src/OpenFOAM/primitives/Tuple2/Tuple2.H +++ b/src/OpenFOAM/primitives/Tuple2/Tuple2.H @@ -25,7 +25,7 @@ Class Foam::Tuple2 Description - A 2-tuple. + A 2-tuple for storing two objects of different types. SeeAlso Foam::Pair for storing two objects of identical types. 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