Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2013-04-12 16:19:49 +01:00
14 changed files with 143 additions and 43 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -47,6 +47,8 @@ Description
#include "snapParameters.H" #include "snapParameters.H"
#include "layerParameters.H" #include "layerParameters.H"
#include "vtkSetWriter.H" #include "vtkSetWriter.H"
#include "faceSet.H"
#include "motionSmoother.H"
using namespace Foam; 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 = " Info<< "Finished meshing in = "
<< runTime.elapsedCpuTime() << " s." << endl; << runTime.elapsedCpuTime() << " s." << endl;

View File

@ -138,6 +138,8 @@ baffles
//- Select faces and orientation through a searchableSurface //- Select faces and orientation through a searchableSurface
type searchableSurface; type searchableSurface;
surface searchablePlate; surface searchablePlate;
//name sphere.stl; // name if surface=triSurfaceMesh
origin (0.099 -0.006 0.004); origin (0.099 -0.006 0.004);
span (0 0.012 0.012); span (0 0.012 0.012);

View File

@ -28,6 +28,7 @@ License
#include "syncTools.H" #include "syncTools.H"
#include "searchableSurface.H" #include "searchableSurface.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -61,7 +62,15 @@ Foam::faceSelections::searchableSurfaceSelection::searchableSurfaceSelection
searchableSurface::New searchableSurface::New
( (
word(dict.lookup("surface")), 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 dict
) )
) )

View File

@ -378,6 +378,7 @@ FoamFile
// surface searchableSphere; // surface searchableSphere;
// centre (0.05 0.05 0.005); // centre (0.05 0.05 0.005);
// radius 0.025; // radius 0.025;
// //name sphere.stl; // Optional name if surface triSurfaceMesh
// } // }
// } // }
// //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -179,7 +179,10 @@ void Foam::vtkPV3Foam::convertMeshPatches
const word patchName = getPartName(partId); const word patchName = getPartName(partId);
labelHashSet patchIds(patches.patchSet(List<wordRe>(1, patchName))); labelHashSet patchIds
(
patches.patchSet(List<wordRe>(1, wordRe(patchName)))
);
if (debug) if (debug)
{ {

View File

@ -120,22 +120,25 @@ public:
inline wordRe(const wordRe&); inline wordRe(const wordRe&);
//- Construct from keyType //- 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 //- Construct as copy of word
inline explicit wordRe(const word&); inline explicit wordRe(const word&);
//- Construct as copy of character array //- Construct as copy of character array
// Optionally specify how it should be treated. // 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. //- Construct as copy of string.
// Optionally specify how it should be treated. // 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 //- Construct as copy of std::string
// Optionally specify how it should be treated. // 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 //- Construct from Istream
// Words are treated as literals, strings with an auto-test // Words are treated as literals, strings with an auto-test

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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) inline Foam::wordRe::wordRe(const keyType& str, const compOption opt)
: :
word(str, false), word(str, false),

View File

@ -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 // Adapt the fixedValue bc's (i.e. copy internal point data to
// boundaryField for all affected patches) // boundaryField for all affected patches)
forAll(adaptPatchIDs_, i) forAll(adaptPatchIDs_, i)
@ -765,6 +739,42 @@ void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
displacement_.boundaryField()[patchI] == displacement_.boundaryField()[patchI] ==
displacement_.boundaryField()[patchI].patchInternalField(); 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) if (debug)
{ {

View File

@ -385,6 +385,10 @@ public:
//- Take over existing mesh position. //- Take over existing mesh position.
void correct(); void correct();
//- Set patch fields on displacement to be consistent with
// internal values.
void setDisplacementPatchFields();
//- Set displacement field from displacement on patch points. //- Set displacement field from displacement on patch points.
// Modify provided displacement to be consistent with actual // Modify provided displacement to be consistent with actual
// boundary conditions on displacement. Note: resets the // boundary conditions on displacement. Note: resets the

View File

@ -25,7 +25,18 @@ Class
Foam::mappedPatchFieldBase Foam::mappedPatchFieldBase
Description 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 SourceFiles
mappedPatchFieldBase.C mappedPatchFieldBase.C

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ Group
Description Description
This velocity inlet/outlet boundary condition is applied to pressure 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 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. obtained from the patch-face normal component of the internal-cell value.

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -138,6 +138,7 @@ Foam::layerParameters::layerParameters
readLabel(dict.lookup("nSmoothSurfaceNormals")) readLabel(dict.lookup("nSmoothSurfaceNormals"))
), ),
nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))), nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
nSmoothDisplacement_(dict.lookupOrDefault("nSmoothDisplacement", 0)),
nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))), nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
maxFaceThicknessRatio_ maxFaceThicknessRatio_
( (
@ -278,7 +279,7 @@ Foam::layerParameters::layerParameters
const keyType& key = iter().keyword(); const keyType& key = iter().keyword();
const labelHashSet patchIDs const labelHashSet patchIDs
( (
boundaryMesh.patchSet(List<wordRe>(1, key)) boundaryMesh.patchSet(List<wordRe>(1, wordRe(key)))
); );
if (patchIDs.size() == 0) if (patchIDs.size() == 0)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -119,6 +119,8 @@ private:
label nSmoothNormals_; label nSmoothNormals_;
label nSmoothDisplacement_;
label nSmoothThickness_; label nSmoothThickness_;
scalar maxFaceThicknessRatio_; scalar maxFaceThicknessRatio_;
@ -275,6 +277,12 @@ public:
return layerTerminationCos_; return layerTerminationCos_;
} }
//- Smooth internal displacement
label nSmoothDisplacement() const
{
return nSmoothDisplacement_;
}
//- Smooth layer thickness over surface patches //- Smooth layer thickness over surface patches
label nSmoothThickness() const label nSmoothThickness() const
{ {

View File

@ -28,6 +28,7 @@ License
#include "faceZoneSet.H" #include "faceZoneSet.H"
#include "searchableSurface.H" #include "searchableSurface.H"
#include "syncTools.H" #include "syncTools.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
@ -69,7 +70,15 @@ Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
searchableSurface::New searchableSurface::New
( (
word(dict.lookup("surface")), 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 dict
) )
) )