diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 2406cb667c45098ebd0ae54dfbf61f325e48d68c..14bf0ee9eb9d5eec0442060b3ca8a308f2bd1e74 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.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 @@ -47,6 +47,8 @@ Description #include "snapParameters.H" #include "layerParameters.H" #include "vtkSetWriter.H" +#include "faceSet.H" +#include "motionSmoother.H" using namespace Foam; @@ -675,6 +677,31 @@ int main(int argc, char *argv[]) } + { + // Check final mesh + Info<< "Checking final mesh ..." << endl; + faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100); + motionSmoother::checkMesh(false, mesh, motionDict, wrongFaces); + const label nErrors = returnReduce + ( + wrongFaces.size(), + sumOp<label>() + ); + + if (nErrors > 0) + { + Info<< "Finished meshing with " << nErrors << " illegal faces" + << " (concave, zero area or negative cell pyramid volume)" + << endl; + wrongFaces.write(); + } + else + { + Info<< "Finished meshing without any errors" << endl; + } + } + + Info<< "Finished meshing in = " << runTime.elapsedCpuTime() << " s." << endl; diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBafflesDict b/applications/utilities/mesh/manipulation/createBaffles/createBafflesDict index 99c03b4cfc7429af81364a42f2613eec1ee21bb9..b392f0764278002f565c875be900379d73f6e039 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBafflesDict +++ b/applications/utilities/mesh/manipulation/createBaffles/createBafflesDict @@ -138,6 +138,8 @@ baffles //- Select faces and orientation through a searchableSurface type searchableSurface; surface searchablePlate; + //name sphere.stl; // name if surface=triSurfaceMesh + origin (0.099 -0.006 0.004); span (0 0.012 0.012); diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C index 04dbe07929ed96a0474109c32fdd149baf0a88ee..e7439d52f68ed987b84f1bddbb799ca3706eb58c 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C @@ -28,6 +28,7 @@ License #include "syncTools.H" #include "searchableSurface.H" #include "fvMesh.H" +#include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -61,7 +62,15 @@ Foam::faceSelections::searchableSurfaceSelection::searchableSurfaceSelection searchableSurface::New ( word(dict.lookup("surface")), - mesh.objectRegistry::db(), + IOobject + ( + dict.lookupOrDefault("name", mesh.objectRegistry::db().name()), + mesh.time().constant(), + "triSurface", + mesh.objectRegistry::db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ), dict ) ) diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 57514a205352c76e8b6f0e167a8a8739c436c808..11dccf942b0f35486f18d55f8fca470b437c465f 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -378,6 +378,7 @@ FoamFile // surface searchableSphere; // centre (0.05 0.05 0.005); // radius 0.025; +// //name sphere.stl; // Optional name if surface triSurfaceMesh // } // } // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C index b80acb4949984b50d1145d06d96c20d65f4eb012..bbb7072b22f24690bfe262350b22852c791b2cf0 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.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 @@ -179,7 +179,10 @@ void Foam::vtkPV3Foam::convertMeshPatches const word patchName = getPartName(partId); - labelHashSet patchIds(patches.patchSet(List<wordRe>(1, patchName))); + labelHashSet patchIds + ( + patches.patchSet(List<wordRe>(1, wordRe(patchName))) + ); if (debug) { diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H index e45044c9975b3cc951a0d65e52add51492f5cdc0..b0cb62e0b43f490c8c62befe5e2d618dfec493ce 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H @@ -120,22 +120,25 @@ public: inline wordRe(const wordRe&); //- Construct from keyType - inline wordRe(const keyType&, const compOption=LITERAL); + inline explicit wordRe(const keyType&); + + //- Construct from keyType + inline wordRe(const keyType&, const compOption); //- Construct as copy of word inline explicit wordRe(const word&); //- Construct as copy of character array // Optionally specify how it should be treated. - inline wordRe(const char*, const compOption = LITERAL); + inline explicit wordRe(const char*, const compOption = LITERAL); //- Construct as copy of string. // Optionally specify how it should be treated. - inline wordRe(const string&, const compOption = LITERAL); + inline explicit wordRe(const string&, const compOption = LITERAL); //- Construct as copy of std::string // Optionally specify how it should be treated. - inline wordRe(const std::string&, const compOption = LITERAL); + inline explicit wordRe(const std::string&, const compOption = LITERAL); //- Construct from Istream // Words are treated as literals, strings with an auto-test diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H index 431106716544710f262d89bc37946a8372c2582a..01a3114c6c9b2c6da7c389b501831eaaa7dca735 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordReI.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 @@ -65,6 +65,18 @@ inline Foam::wordRe::wordRe(const word& str) {} +inline Foam::wordRe::wordRe(const keyType& str) +: + word(str, false), + re_() +{ + if (str.isPattern()) + { + compile(); + } +} + + inline Foam::wordRe::wordRe(const keyType& str, const compOption opt) : word(str, false), diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C index c7d5d28e765ada2e25f0562519b16b5b5c7c4d7d..dad3ea59774e79359825640844dcd9ce9d83a3b1 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.C +++ b/src/dynamicMesh/motionSmoother/motionSmoother.C @@ -678,34 +678,8 @@ void Foam::motionSmoother::correct() } -void Foam::motionSmoother::setDisplacement(pointField& patchDisp) +void Foam::motionSmoother::setDisplacementPatchFields() { - // See comment in .H file about shared points. - const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - - forAll(patches, patchI) - { - const polyPatch& pp = patches[patchI]; - - if (pp.coupled()) - { - const labelList& meshPoints = pp.meshPoints(); - - forAll(meshPoints, i) - { - displacement_[meshPoints[i]] = vector::zero; - } - } - } - - const labelList& ppMeshPoints = pp_.meshPoints(); - - // Set internal point data from displacement on combined patch points. - forAll(ppMeshPoints, patchPointI) - { - displacement_[ppMeshPoints[patchPointI]] = patchDisp[patchPointI]; - } - // Adapt the fixedValue bc's (i.e. copy internal point data to // boundaryField for all affected patches) forAll(adaptPatchIDs_, i) @@ -765,6 +739,42 @@ void Foam::motionSmoother::setDisplacement(pointField& patchDisp) displacement_.boundaryField()[patchI] == displacement_.boundaryField()[patchI].patchInternalField(); } +} + + +void Foam::motionSmoother::setDisplacement(pointField& patchDisp) +{ + // See comment in .H file about shared points. + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + + if (pp.coupled()) + { + const labelList& meshPoints = pp.meshPoints(); + + forAll(meshPoints, i) + { + displacement_[meshPoints[i]] = vector::zero; + } + } + } + + const labelList& ppMeshPoints = pp_.meshPoints(); + + // Set internal point data from displacement on combined patch points. + forAll(ppMeshPoints, patchPointI) + { + displacement_[ppMeshPoints[patchPointI]] = patchDisp[patchPointI]; + } + + + // Adapt the fixedValue bc's (i.e. copy internal point data to + // boundaryField for all affected patches) + setDisplacementPatchFields(); + if (debug) { diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.H b/src/dynamicMesh/motionSmoother/motionSmoother.H index ee5432ad4ec4218768f8226a95770ecd71915897..fff07c4b94a8a73c1490ef084024a93bb73f8a3b 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.H +++ b/src/dynamicMesh/motionSmoother/motionSmoother.H @@ -385,6 +385,10 @@ public: //- Take over existing mesh position. void correct(); + //- Set patch fields on displacement to be consistent with + // internal values. + void setDisplacementPatchFields(); + //- Set displacement field from displacement on patch points. // Modify provided displacement to be consistent with actual // boundary conditions on displacement. Note: resets the diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H index 50728410949b23ae732b5110718dfc7a3b2642c3..22a3872effe9d5eb7b007c37a350c91ec9d9ad24 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H @@ -25,7 +25,18 @@ Class Foam::mappedPatchFieldBase Description - Functionality for sampling fields using mappedPatchBase. + Functionality for sampling fields using mappedPatchBase. Every call to + mappedField() returns a sampled field, optionally scaled to maintain an + area-weighted average. + + Example usage: + + { + fieldName T; // default is same as fvPatchField + setAverage false; + average 1.0; // only if setAverage=true + interpolationScheme cellPoint; // default is cell + } SourceFiles mappedPatchFieldBase.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H index 1ed301b191ea185db943a58de71215682d509370..49ebb5d77e8ca16dfd2ba119b0b49cd3cf3fb367 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.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 @@ -29,7 +29,7 @@ Group Description This velocity inlet/outlet boundary condition is applied to pressure - boundaries where the pressure is specified. A zero-gradient condtion is + boundaries where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the patch-face normal component of the internal-cell value. diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C index 6574ad9cbd88f9ac84769eca3eb87f2eff793750..8444b6632c8237e5ab6316ec9d36d0e5171ee3a0 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.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 @@ -138,6 +138,7 @@ Foam::layerParameters::layerParameters readLabel(dict.lookup("nSmoothSurfaceNormals")) ), nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))), + nSmoothDisplacement_(dict.lookupOrDefault("nSmoothDisplacement", 0)), nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))), maxFaceThicknessRatio_ ( @@ -278,7 +279,7 @@ Foam::layerParameters::layerParameters const keyType& key = iter().keyword(); const labelHashSet patchIDs ( - boundaryMesh.patchSet(List<wordRe>(1, key)) + boundaryMesh.patchSet(List<wordRe>(1, wordRe(key))) ); if (patchIDs.size() == 0) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H index 2578c44b687459cadb2daf8e11798fae1b069a7d..4005dd5df82e58192e04e7fc05cdc69fba0c939b 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.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 @@ -119,6 +119,8 @@ private: label nSmoothNormals_; + label nSmoothDisplacement_; + label nSmoothThickness_; scalar maxFaceThicknessRatio_; @@ -275,6 +277,12 @@ public: return layerTerminationCos_; } + //- Smooth internal displacement + label nSmoothDisplacement() const + { + return nSmoothDisplacement_; + } + //- Smooth layer thickness over surface patches label nSmoothThickness() const { diff --git a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C index 039e14555f8515fa01346f9cc2a643d563606bab..c9ce92f25b040bb31023d61714a77715b7677577 100644 --- a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C +++ b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C @@ -28,6 +28,7 @@ License #include "faceZoneSet.H" #include "searchableSurface.H" #include "syncTools.H" +#include "Time.H" #include "addToRunTimeSelectionTable.H" @@ -69,7 +70,15 @@ Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone searchableSurface::New ( word(dict.lookup("surface")), - mesh.objectRegistry::db(), + IOobject + ( + dict.lookupOrDefault("name", mesh.objectRegistry::db().name()), + mesh.time().constant(), + "triSurface", + mesh.objectRegistry::db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ), dict ) )