diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/Make/options b/applications/solvers/heatTransfer/buoyantPisoFoam/Make/options index 9ac482d92e..f26563fc0f 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantPisoFoam/Make/options @@ -1,7 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I../XiFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C b/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C index 18dadabf8b..83527f8215 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C +++ b/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C @@ -70,11 +70,12 @@ int main(int argc, char *argv[]) #include "UEqn.H" + #include "hEqn.H" + // --- PISO loop for (int corr=0; corrlookup("pRef")); diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H index 91e190b4cd..53f6688a6a 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H @@ -12,8 +12,8 @@ ( fvc::interpolate(rho) *( - (fvc::interpolate(U) & mesh.Sf()) - + fvc::ddtPhiCorr(rUA, rho, U, phi) + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, rho, U, phi) ) ); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H index d26da5cb32..879ee722b9 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H @@ -53,7 +53,7 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("gh", g & mesh.Cf()); + surfaceScalarField ghf("ghf", g & mesh.Cf()); dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef")); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H index 5a78299a7a..34c32b1abf 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H @@ -103,8 +103,8 @@ public: const dictionary& ); - //- Construct by mapping given solidWallMixedTemperatureCoupledFvPatchScalarField - // onto a new patch + //- Construct by mapping given + // solidWallMixedTemperatureCoupledFvPatchScalarField onto a new patch solidWallMixedTemperatureCoupledFvPatchScalarField ( const solidWallMixedTemperatureCoupledFvPatchScalarField&, diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index bc4590a428..35a64418a8 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -4,7 +4,7 @@ volScalarField& rho = rhoFluid[i]; volScalarField& K = KFluid[i]; volVectorField& U = UFluid[i]; - surfaceScalarField phi = phiFluid[i]; + surfaceScalarField& phi = phiFluid[i]; compressible::turbulenceModel& turb = turbulence[i]; volScalarField& DpDt = DpDtFluid[i]; const volScalarField& gh = ghFluid[i]; diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index af349d7917..53dd01672a 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -85,7 +85,7 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("gh", g & mesh.Cf()); + surfaceScalarField ghf("ghf", g & mesh.Cf()); volScalarField p diff --git a/applications/solvers/multiphase/multiphaseInterFoam/createFields.H b/applications/solvers/multiphase/multiphaseInterFoam/createFields.H index aa62d0f2a1..9119631d0c 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/createFields.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/createFields.H @@ -47,7 +47,7 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("gh", g & mesh.Cf()); + surfaceScalarField ghf("ghf", g & mesh.Cf()); volScalarField p diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index 400f89c43b..b13649c312 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -339,4 +339,4 @@ ); Info<< "Calculating field (g.h)f\n" << endl; - surfaceScalarField ghf = surfaceScalarField("gh", g & mesh.Cf()); + surfaceScalarField ghf = surfaceScalarField("ghf", g & mesh.Cf()); diff --git a/applications/test/List/ListTest.C b/applications/test/List/ListTest.C index bc8901b03b..d4834cb1db 100644 --- a/applications/test/List/ListTest.C +++ b/applications/test/List/ListTest.C @@ -43,31 +43,33 @@ using namespace Foam; int main(int argc, char *argv[]) { - List list(IStringStream("1 ((0 1 2))")()); - Info<< list << endl; + List list1(IStringStream("1 ((0 1 2))")()); + Info<< "list1: " << list1 << endl; List list2(IStringStream("((0 1 2) (3 4 5) (6 7 8))")()); - Info<< list2 << endl; + Info<< "list2: " << list2 << endl; + + list1.append(list2); + Info<< "list1.append(list2): " << list1 << endl; Info<< findIndex(list2, vector(3, 4, 5)) << endl; list2.setSize(10, vector(1, 2, 3)); - Info<< list2 << endl; + Info<< "list2: " << list2 << endl; List list3(list2.xfer()); Info<< "Transferred via the xfer() method" << endl; - Info<< list2 << nl - << list3 << endl; + Info<< "list2: " << list2 << nl + << "list3: " << list3 << endl; // Subset const labelList map(IStringStream("2 (0 2)")()); List subList3(list3, map); Info<< "Elements " << map << " out of " << list3 - << " : " << subList3 << endl; + << " => " << subList3 << endl; return 0; } - // ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C index d8042fdaa8..9eaaf2c199 100644 --- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C +++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C @@ -344,6 +344,7 @@ int main(int argc, char *argv[]) argList::validOptions.insert("point", "pointI"); argList::validOptions.insert("cellSet", "setName"); argList::validOptions.insert("faceSet", "setName"); +# include "addRegionOption.H" # include "setRootCase.H" # include "createTime.H" @@ -364,7 +365,7 @@ int main(int argc, char *argv[]) instantList timeDirs = timeSelector::select0(runTime, args); -# include "createPolyMesh.H" +# include "createNamedPolyMesh.H" forAll(timeDirs, timeI) { diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index cc975eb970..205c767600 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -274,6 +274,14 @@ addLayersControls // Create buffer region for new layer terminations nBufferCellsNoExtrude 0; + + + // Overall max number of layer addition iterations + nLayerIter 50; + + // Max number of iterations after which relaxed meshQuality controls + // get used. + nRelaxedIter 20; } @@ -335,6 +343,16 @@ meshQualityControls nSmoothScale 4; //- amount to scale back displacement at error points errorReduction 0.75; + + + + // Optional : some meshing phases allow usage of relaxed rules. + // See e.g. addLayersControls::nRelaxedIter. + relaxed + { + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 75; + } } diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 4970d0bcce..051f74968b 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -48,12 +48,164 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +void createBaffles +( + const polyMesh& mesh, + const label faceI, + const label oldPatchI, + const labelList& newPatches, + PackedBoolList& doneFace, + polyTopoChange& meshMod +) +{ + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + const faceZoneMesh& faceZones = mesh.faceZones(); + + const face& f = mesh.faces()[faceI]; + label zoneID = faceZones.whichZone(faceI); + bool zoneFlip = false; + if (zoneID >= 0) + { + const faceZone& fZone = faceZones[zoneID]; + zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)]; + } + label nei = -1; + if (oldPatchI == -1) + { + nei = mesh.faceNeighbour()[faceI]; + } + + + face revFace(f.reverseFace()); + + forAll(newPatches, i) + { + if (oldPatchI == -1) + { + // Internal face + if (doneFace.set(faceI)) + { + // First usage of face. Modify. + meshMod.setAction + ( + polyModifyFace + ( + f, // modified face + faceI, // label of face + mesh.faceOwner()[faceI], // owner + -1, // neighbour + false, // face flip + newPatches[i], // patch for face + false, // remove from zone + zoneID, // zone for face + zoneFlip // face flip in zone + ) + ); + } + else + { + // Second or more usage of face. Add. + meshMod.setAction + ( + polyAddFace + ( + f, // modified face + mesh.faceOwner()[faceI], // owner + -1, // neighbour + -1, // master point + -1, // master edge + faceI, // master face + false, // face flip + newPatches[i], // patch for face + zoneID, // zone for face + zoneFlip // face flip in zone + ) + ); + } + + meshMod.setAction + ( + polyAddFace + ( + revFace, // modified face + nei, // owner + -1, // neighbour + -1, // masterPointID + -1, // masterEdgeID + faceI, // masterFaceID, + true, // face flip + newPatches[i], // patch for face + zoneID, // zone for face + zoneFlip // face flip in zone + ) + ); + } + else if + ( + patches[oldPatchI].coupled() + && patches[newPatches[i]].coupled() + ) + { + // Do not allow coupled patches to be moved to different coupled + // patches. + //WarningIn("createBaffles()") + // << "Not moving face from coupled patch " + // << patches[oldPatchI].name() + // << " to another coupled patch " << patches[newPatches[i]] + // << endl; + } + else + { + if (doneFace.set(faceI)) + { + meshMod.setAction + ( + polyModifyFace + ( + f, // modified face + faceI, // label of face + mesh.faceOwner()[faceI], // owner + -1, // neighbour + false, // face flip + newPatches[i], // patch for face + false, // remove from zone + zoneID, // zone for face + zoneFlip // face flip in zone + ) + ); + } + else + { + meshMod.setAction + ( + polyAddFace + ( + f, // modified face + mesh.faceOwner()[faceI], // owner + -1, // neighbour + -1, // master point + -1, // master edge + faceI, // master face + false, // face flip + newPatches[i], // patch for face + zoneID, // zone for face + zoneFlip // face flip in zone + ) + ); + } + } + } +} + + + // Main program: int main(int argc, char *argv[]) { argList::validArgs.append("set"); argList::validArgs.append("patch"); + argList::validOptions.insert("additionalPatches", "(patch2 .. patchN)"); argList::validOptions.insert("overwrite", ""); # include "setRootCase.H" @@ -63,29 +215,64 @@ int main(int argc, char *argv[]) const word oldInstance = mesh.pointsInstance(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); - const faceZoneMesh& faceZones = mesh.faceZones(); // Faces to baffle word setName(args.additionalArgs()[0]); Pout<< "Reading faceSet from " << setName << nl << endl; faceSet facesToSplit(mesh, setName); + // Make sure set is synchronised across couples + facesToSplit.sync(mesh); Pout<< "Read " << facesToSplit.size() << " faces from " << setName << nl << endl; - // Patch to put them into + + // Patches to put baffles into + labelList newPatches(1); + word patchName(args.additionalArgs()[1]); - label wantedPatchI = patches.findPatchID(patchName); + newPatches[0] = patches.findPatchID(patchName); + Pout<< "Using patch " << patchName + << " at index " << newPatches[0] << endl; - Pout<< "Using patch " << patchName << " at index " << wantedPatchI << endl; - - if (wantedPatchI == -1) + if (newPatches[0] == -1) { FatalErrorIn(args.executable()) - << "Cannot find patch " << patchName << exit(FatalError); + << "Cannot find patch " << patchName << endl + << "Valid patches are " << patches.names() << exit(FatalError); } + + // Additional patches + if (args.options().found("additionalPatches")) + { + const wordList patchNames + ( + IStringStream(args.options()["additionalPatches"])() + ); + + forAll(patchNames, i) + { + label patchI = patches.findPatchID(patchNames[i]); + Info<< "Using additional patch " << patchNames[i] + << " at index " << patchI << endl; + + if (patchI == -1) + { + FatalErrorIn(args.executable()) + << "Cannot find patch " << patchNames[i] << endl + << "Valid patches are " << patches.names() + << exit(FatalError); + } + + newPatches.append(patchI); + } + } + + bool overwrite = args.options().found("overwrite"); + + // Read objects in time directory IOobjectList objects(mesh, runTime.timeName()); @@ -128,107 +315,53 @@ int main(int argc, char *argv[]) polyTopoChange meshMod(mesh); - // Creating baffles: - // - coupled boundary faces : become the patch specified - // - non-coupled ,, : illegal - // - internal faces : converted into boundary faces. - - labelList newPatch(mesh.nFaces(), -1); - - forAllConstIter(faceSet, facesToSplit, iter) - { - label faceI = iter.key(); - - label patchI = patches.whichPatch(faceI); - - if (patchI == -1) - { - newPatch[faceI] = wantedPatchI; - } - else - { - if (patches[patchI].coupled()) - { - if (patchI != wantedPatchI) - { - newPatch[faceI] = wantedPatchI; - } - } - else - { - FatalErrorIn(args.executable()) - << "Can only create baffles from internal faces" - << " or coupled boundary faces." << endl - << "Face " << faceI << " is a boundary face on patch " - << patches[patchI].name() << exit(FatalError); - } - } - } - - - // If one side of a coupled boundary is marked for baffling, make sure to - // also do the other side. - - syncTools::syncFaceList(mesh, newPatch, maxEqOp