mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cvMesh: Enable use of regions in conformationSurfaces. Make cell sizing relative to default.
This commit is contained in:
@ -1,73 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object meshQualityDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Maximum non-orthogonality allowed. Set to 180 to disable.
|
||||
maxNonOrtho 65;
|
||||
|
||||
//- Max skewness allowed. Set to <0 to disable.
|
||||
maxBoundarySkewness 50;
|
||||
maxInternalSkewness 10;
|
||||
|
||||
//- Max concaveness allowed. Is angle (in degrees) below which concavity
|
||||
// is allowed. 0 is straight face, <0 would be convex face.
|
||||
// Set to 180 to disable.
|
||||
maxConcave 80;
|
||||
|
||||
//- Minimum quality of the tet formed by the face-centre
|
||||
// and variable base point minimum decomposition triangles and
|
||||
// the cell centre. This has to be a positive number for tracking
|
||||
// to work. Set to very negative number (e.g. -1E30) to
|
||||
// disable.
|
||||
// <0 = inside out tet,
|
||||
// 0 = flat tet
|
||||
// 1 = regular tet
|
||||
minTetQuality 1e-30;
|
||||
|
||||
//- Minimum pyramid volume. Is absolute volume of cell pyramid.
|
||||
// Set to a sensible fraction of the smallest cell volume expected.
|
||||
// Set to very negative number (e.g. -1E30) to disable.
|
||||
minVol 1e-20;
|
||||
|
||||
//- Minimum face area. Set to <0 to disable.
|
||||
minArea -1;
|
||||
|
||||
//- Minimum face twist. Set to <-1 to disable. dot product of face normal
|
||||
//- and face centre triangles normal
|
||||
minTwist 0.001;
|
||||
|
||||
//- minimum normalised cell determinant
|
||||
//- 1 = hex, <= 0 = folded or flattened illegal cell
|
||||
minDeterminant 0.001;
|
||||
|
||||
//- minFaceWeight (0 -> 0.5)
|
||||
minFaceWeight 0.02;
|
||||
|
||||
//- minVolRatio (0 -> 1)
|
||||
minVolRatio 0.01;
|
||||
|
||||
//must be >0 for Fluent compatibility
|
||||
minTriangleTwist -1;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -47,23 +47,23 @@ defineTypeNameAndDebug(cellShapeControl, 0);
|
||||
Foam::cellShapeControl::cellShapeControl
|
||||
(
|
||||
const Time& runTime,
|
||||
const dictionary& motionDict,
|
||||
const cvControls& cvMeshControls,
|
||||
const searchableSurfaces& allGeometry,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
)
|
||||
:
|
||||
dictionary(motionDict),
|
||||
dictionary(cvMeshControls.cvMeshDict().subDict("motionControl")),
|
||||
runTime_(runTime),
|
||||
allGeometry_(allGeometry),
|
||||
geometryToConformTo_(geometryToConformTo),
|
||||
defaultCellSize_(readScalar(lookup("defaultCellSize"))),
|
||||
minimumCellSize_(readScalar(lookup("minimumCellSize"))),
|
||||
defaultCellSize_(cvMeshControls.defaultCellSize()),
|
||||
minimumCellSize_(cvMeshControls.minimumCellSize()),
|
||||
shapeControlMesh_(runTime),
|
||||
aspectRatio_(motionDict),
|
||||
aspectRatio_(*this),
|
||||
sizeAndAlignment_
|
||||
(
|
||||
runTime,
|
||||
motionDict.subDict("shapeControlFunctions"),
|
||||
subDict("shapeControlFunctions"),
|
||||
geometryToConformTo_,
|
||||
defaultCellSize_
|
||||
)
|
||||
|
||||
@ -48,6 +48,7 @@ SourceFiles
|
||||
#include "cellSizeAndAlignmentControls.H"
|
||||
#include "cellShapeControlMesh.H"
|
||||
#include "backgroundMeshDecomposition.H"
|
||||
#include "cvControls.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -104,7 +105,7 @@ public:
|
||||
cellShapeControl
|
||||
(
|
||||
const Time& runTime,
|
||||
const dictionary& cellShapeControlDict,
|
||||
const cvControls& cvMeshControls,
|
||||
const searchableSurfaces& allGeometry,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
);
|
||||
|
||||
@ -46,10 +46,12 @@ Foam::cellSizeAndAlignmentControl::cellSizeAndAlignmentControl
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
runTime_(runTime),
|
||||
defaultCellSize_(defaultCellSize),
|
||||
name_(name)
|
||||
{}
|
||||
|
||||
@ -62,7 +64,8 @@ Foam::cellSizeAndAlignmentControl::New
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
{
|
||||
word cellSizeAndAlignmentControlTypeName
|
||||
@ -70,7 +73,7 @@ Foam::cellSizeAndAlignmentControl::New
|
||||
controlFunctionDict.lookup("type")
|
||||
);
|
||||
|
||||
Info<< " Selecting cellSizeAndAlignmentControl "
|
||||
Info<< indent << "Selecting cellSizeAndAlignmentControl "
|
||||
<< cellSizeAndAlignmentControlTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
@ -99,7 +102,8 @@ Foam::cellSizeAndAlignmentControl::New
|
||||
runTime,
|
||||
name,
|
||||
controlFunctionDict,
|
||||
geometryToConformTo
|
||||
geometryToConformTo,
|
||||
defaultCellSize
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -57,6 +57,8 @@ protected:
|
||||
|
||||
const Time& runTime_;
|
||||
|
||||
const scalar& defaultCellSize_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -91,9 +93,16 @@ public:
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
),
|
||||
(runTime, name, controlFunctionDict, geometryToConformTo)
|
||||
(
|
||||
runTime,
|
||||
name,
|
||||
controlFunctionDict,
|
||||
geometryToConformTo,
|
||||
defaultCellSize
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -106,7 +115,8 @@ public:
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
@ -118,7 +128,8 @@ public:
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
@ -135,8 +146,6 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
virtual label priority() const = 0;
|
||||
|
||||
|
||||
// Query
|
||||
|
||||
|
||||
@ -63,43 +63,10 @@ bool Foam::cellSizeAndAlignmentControls::evalCellSizeFunctions
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "size function "
|
||||
<< sSC.name()
|
||||
<< " priority " << sSC.priority()
|
||||
<< endl;
|
||||
Info<< "size function " << sSC.name() << endl;
|
||||
}
|
||||
|
||||
if (sSC.priority() < previousPriority)
|
||||
{
|
||||
return minSize;
|
||||
}
|
||||
|
||||
scalar sizeI;
|
||||
|
||||
if (sSC.sizeFunction().cellSize(pt, sizeI))
|
||||
{
|
||||
anyFunctionFound = true;
|
||||
|
||||
if (sSC.priority() == previousPriority)
|
||||
{
|
||||
if (sizeI < minSize)
|
||||
{
|
||||
minSize = sizeI;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
minSize = sizeI;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "sizeI " << sizeI
|
||||
<<" minSize " << minSize << endl;
|
||||
}
|
||||
|
||||
previousPriority = sSC.priority();
|
||||
}
|
||||
anyFunctionFound = sSC.cellSize(pt, minSize, previousPriority);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,7 +82,7 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
|
||||
const Time& runTime,
|
||||
const dictionary& shapeControlDict,
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar defaultCellSize
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
shapeControlDict_(shapeControlDict),
|
||||
@ -135,6 +102,7 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
|
||||
);
|
||||
|
||||
Info<< nl << "Shape Control : " << shapeControlEntryName << endl;
|
||||
Info<< incrIndent;
|
||||
|
||||
controlFunctions_.set
|
||||
(
|
||||
@ -144,10 +112,13 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
|
||||
runTime,
|
||||
shapeControlEntryName,
|
||||
controlFunctionDict,
|
||||
geometryToConformTo
|
||||
geometryToConformTo_,
|
||||
defaultCellSize_
|
||||
)
|
||||
);
|
||||
|
||||
Info<< decrIndent;
|
||||
|
||||
functionI++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ class cellSizeAndAlignmentControls
|
||||
|
||||
PtrList<cellSizeAndAlignmentControl> controlFunctions_;
|
||||
|
||||
const scalar defaultCellSize_;
|
||||
const scalar& defaultCellSize_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -84,7 +84,7 @@ public:
|
||||
const Time& runTime,
|
||||
const dictionary& shapeControlDict,
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar defaultCellSize
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -58,7 +58,8 @@ Foam::fileControl::fileControl
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeAndAlignmentControl
|
||||
@ -66,14 +67,14 @@ Foam::fileControl::fileControl
|
||||
runTime,
|
||||
name,
|
||||
controlFunctionDict,
|
||||
geometryToConformTo
|
||||
geometryToConformTo,
|
||||
defaultCellSize
|
||||
),
|
||||
pointsFile_(controlFunctionDict.lookup("pointsFile")),
|
||||
sizesFile_(controlFunctionDict.lookup("sizesFile")),
|
||||
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile")),
|
||||
priority_(readLabel(controlFunctionDict.lookup("priority")))
|
||||
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile"))
|
||||
{
|
||||
Info<< indent << "Loading from file... " << nl
|
||||
Info<< indent << "Loading " << name << " from file:" << nl
|
||||
<< indent << " points : " << pointsFile_ << nl
|
||||
<< indent << " sizes : " << sizesFile_ << nl
|
||||
<< indent << " alignments : " << alignmentsFile_
|
||||
|
||||
@ -58,8 +58,6 @@ class fileControl
|
||||
|
||||
const fileName alignmentsFile_;
|
||||
|
||||
label priority_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -85,7 +83,8 @@ public:
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
@ -121,11 +120,6 @@ public:
|
||||
scalarField& sizes,
|
||||
triadField& alignments
|
||||
) const;
|
||||
|
||||
virtual label priority() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -158,7 +158,8 @@ Foam::searchableSurfaceControl::searchableSurfaceControl
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeAndAlignmentControl
|
||||
@ -166,174 +167,91 @@ Foam::searchableSurfaceControl::searchableSurfaceControl
|
||||
runTime,
|
||||
name,
|
||||
controlFunctionDict,
|
||||
geometryToConformTo
|
||||
geometryToConformTo,
|
||||
defaultCellSize
|
||||
),
|
||||
surfaceName_(controlFunctionDict.lookupOrDefault<word>("surface", name)),
|
||||
searchableSurface_(geometryToConformTo.geometry()[surfaceName_]),
|
||||
geometryToConformTo_(geometryToConformTo),
|
||||
cellSizeFunction_
|
||||
(
|
||||
cellSizeFunction::New(controlFunctionDict, searchableSurface_)
|
||||
)
|
||||
// geometryToConformTo_(geometryToConformTo),
|
||||
// surfaces_(),
|
||||
// cellSizeFunctions_(),
|
||||
// triangulatedMesh_()
|
||||
cellSizeFunctions_(1),
|
||||
maxPriority_(-1)
|
||||
{
|
||||
// const dictionary& surfacesDict = coeffDict();
|
||||
//
|
||||
// Info<< nl << "Reading cellSizeControlGeometry" << endl;
|
||||
//
|
||||
// surfaces_.setSize(surfacesDict.size());
|
||||
//
|
||||
// cellSizeFunctions_.setSize(surfacesDict.size());
|
||||
//
|
||||
// label surfI = 0;
|
||||
//
|
||||
// DynamicList<point> pointsToInsert;
|
||||
// DynamicList<scalar> sizesToInsert;
|
||||
// DynamicList<tensor> alignmentsToInsert;
|
||||
//
|
||||
// forAllConstIter(dictionary, surfacesDict, iter)
|
||||
// {
|
||||
// const dictionary& surfaceSubDict
|
||||
// (
|
||||
// surfacesDict.subDict(iter().keyword())
|
||||
// );
|
||||
//
|
||||
// // If the "surface" keyword is not found in the dictionary, assume
|
||||
// // the name of the dictionary is the surface. Distinction required to
|
||||
// // allow the same surface to be used multiple times to supply multiple
|
||||
// // cellSizeFunctions
|
||||
//
|
||||
// word surfaceName = surfaceSubDict.lookupOrDefault<word>
|
||||
// (
|
||||
// "surface",
|
||||
// iter().keyword()
|
||||
// );
|
||||
//
|
||||
// surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName);
|
||||
//
|
||||
// if (surfaces_[surfI] < 0)
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "Foam::surfaceControl::surfaceControl"
|
||||
// ) << "No surface " << surfaceName << " found. "
|
||||
// << "Valid geometry is " << nl << allGeometry_.names()
|
||||
// << exit(FatalError);
|
||||
// }
|
||||
//
|
||||
// const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||
//
|
||||
// Info<< nl << " " << iter().keyword() << nl
|
||||
// << " surface: " << surfaceName << nl
|
||||
// << " size : " << surface.size() << endl;
|
||||
//
|
||||
// cellSizeFunctions_.set
|
||||
// (
|
||||
// surfI,
|
||||
// cellSizeFunction::New
|
||||
// (
|
||||
// surfaceSubDict,
|
||||
// surface
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// surfI++;
|
||||
//
|
||||
// if (isA<triSurfaceMesh>(surface))
|
||||
// {
|
||||
// const triSurfaceMesh& tsm
|
||||
// = refCast<const triSurfaceMesh>(surface);
|
||||
//
|
||||
// const pointField& points = tsm.points();
|
||||
// const vectorField& faceNormals = tsm.faceNormals();
|
||||
// const labelListList& pointFaces = tsm.pointFaces();
|
||||
//
|
||||
// Info<< " Number of points: " << tsm.nPoints() << endl;
|
||||
//
|
||||
// forAll(points, pI)
|
||||
// {
|
||||
// const Foam::point& pt = points[pI];
|
||||
// const labelList& ptFaces = pointFaces[pI];
|
||||
//
|
||||
// vectorField pointNormals(ptFaces.size());
|
||||
//
|
||||
// forAll(pointNormals, pnI)
|
||||
// {
|
||||
// pointNormals[pnI] = faceNormals[ptFaces[pnI]];
|
||||
// }
|
||||
//
|
||||
// pointsToInsert.append(pt);
|
||||
//
|
||||
// // Get the value of the point from surfaceCellSizeFunction. If
|
||||
// // adding points internally then will need to interpolate.
|
||||
// scalar newSize = 0;
|
||||
//
|
||||
// cellSizeFunctions_[surfI - 1].cellSize(pt, newSize);
|
||||
// sizesToInsert.append(newSize);
|
||||
//
|
||||
// tensor newAlignment = requiredAlignment(pt, pointNormals);
|
||||
//
|
||||
// alignmentsToInsert.append(newAlignment);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Add the global bound box to ensure that all internal point queries
|
||||
// // will return sizes and alignments
|
||||
//// boundBox bb = allGeometry_.bounds();
|
||||
////
|
||||
//// pointField bbPoints = bb.points();
|
||||
////
|
||||
//// forAll(bbPoints, pI)
|
||||
//// {
|
||||
//// pointsToInsert.append(bbPoints[pI]);
|
||||
//// sizesToInsert.append(defaultCellSize());
|
||||
//// alignmentsToInsert.append(tensor(1,0,0,0,1,0,0,0,1));
|
||||
//// }
|
||||
//
|
||||
// triangulatedMesh_.set
|
||||
// (
|
||||
// new triangulatedMesh
|
||||
// (
|
||||
// runTime,
|
||||
// pointsToInsert,
|
||||
// sizesToInsert,
|
||||
// alignmentsToInsert,
|
||||
// defaultCellSize()
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// scalar factor = 1.0;
|
||||
// label maxIteration = cellShapeControlDict.lookupOrDefault<label>
|
||||
// (
|
||||
// "maxRefinementIterations", 1
|
||||
// );
|
||||
//
|
||||
//
|
||||
// for (label iteration = 0; iteration < maxIteration; ++iteration)
|
||||
// {
|
||||
// Info<< "Iteration : " << iteration << endl;
|
||||
//
|
||||
// label nRefined = triangulatedMesh_().refineTriangulation
|
||||
// (
|
||||
// factor,
|
||||
// allGeometry_,
|
||||
// geometryToConformTo_
|
||||
// );
|
||||
//
|
||||
// Info<< " Number of cells refined in refinement iteration : "
|
||||
// << nRefined << nl << endl;
|
||||
//
|
||||
// if (nRefined <= 0 && iteration != 0)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// factor *= 1.5;
|
||||
// }
|
||||
Info<< indent << "Master settings:" << endl;
|
||||
Info<< incrIndent;
|
||||
|
||||
cellSizeFunctions_.set
|
||||
(
|
||||
0,
|
||||
cellSizeFunction::New
|
||||
(
|
||||
controlFunctionDict,
|
||||
searchableSurface_,
|
||||
defaultCellSize_
|
||||
)
|
||||
);
|
||||
|
||||
Info<< decrIndent;
|
||||
|
||||
PtrList<cellSizeFunction> regionCellSizeFunctions
|
||||
(
|
||||
searchableSurface_.regions().size()
|
||||
);
|
||||
|
||||
label functionI = 0;
|
||||
|
||||
// Loop over regions - if any entry is not specified they should
|
||||
// inherit values from the parent surface.
|
||||
if (controlFunctionDict.found("regions"))
|
||||
{
|
||||
const dictionary& regionsDict = controlFunctionDict.subDict("regions");
|
||||
const wordList& regionNames = geometryToConformTo.patchNames();
|
||||
|
||||
forAll(regionNames, regionI)
|
||||
{
|
||||
const word& regionName = regionNames[regionI];
|
||||
|
||||
if (regionsDict.found(regionName))
|
||||
{
|
||||
// Get the dictionary for region
|
||||
const dictionary& regionDict = regionsDict.subDict(regionName);
|
||||
|
||||
Info<< indent << "Region " << regionName << " settings:"
|
||||
<< endl;
|
||||
Info<< incrIndent;
|
||||
|
||||
regionCellSizeFunctions.set
|
||||
(
|
||||
functionI,
|
||||
cellSizeFunction::New
|
||||
(
|
||||
regionDict,
|
||||
searchableSurface_,
|
||||
defaultCellSize_
|
||||
)
|
||||
);
|
||||
Info<< decrIndent;
|
||||
|
||||
functionI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
regionCellSizeFunctions.setSize(functionI);
|
||||
|
||||
if (functionI > 0)
|
||||
{
|
||||
cellSizeFunctions_.transfer(regionCellSizeFunctions);
|
||||
}
|
||||
|
||||
forAll(cellSizeFunctions_, funcI)
|
||||
{
|
||||
const label funcPriority = cellSizeFunctions_[funcI].priority();
|
||||
|
||||
if (funcPriority > maxPriority_)
|
||||
{
|
||||
maxPriority_ = funcPriority;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -345,219 +263,6 @@ Foam::searchableSurfaceControl::~searchableSurfaceControl()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//Foam::scalar Foam::surfaceControl::cellSize(const point& pt) const
|
||||
//{
|
||||
// scalarList bary;
|
||||
// Cell_handle ch;
|
||||
//
|
||||
// triangulatedMesh_().barycentricCoords(pt, bary, ch);
|
||||
//
|
||||
// scalar size = 0;
|
||||
// forAll(bary, pI)
|
||||
// {
|
||||
// size += bary[pI]*ch->vertex(pI)->size();
|
||||
// }
|
||||
//
|
||||
// return size;
|
||||
//}
|
||||
//
|
||||
//
|
||||
////- Return the cell alignment at the given location
|
||||
//Foam::tensor Foam::surfaceControl::cellAlignment(const point& pt) const
|
||||
//{
|
||||
// scalarList bary;
|
||||
// Cell_handle ch;
|
||||
//
|
||||
// triangulatedMesh_().barycentricCoords(pt, bary, ch);
|
||||
//
|
||||
//// vectorField cartesianDirections(3);
|
||||
////
|
||||
//// cartesianDirections[0] = vector(0,0,1);
|
||||
//// cartesianDirections[1] = vector(0,1,0);
|
||||
//// cartesianDirections[2] = vector(1,0,0);
|
||||
////
|
||||
//// // Rearrange each alignment tensor so that the x/y/z components are
|
||||
//// // in order of whichever makes the smallest angle with the global
|
||||
//// // coordinate system
|
||||
//// FixedList<tensor, 4> alignments;
|
||||
////
|
||||
//// forAll(alignments, aI)
|
||||
//// {
|
||||
//// tensor a = ch->vertex(aI)->alignment();
|
||||
////
|
||||
//// tensor tmpA = a;
|
||||
////
|
||||
////// Info<< nl << indent<< a << endl;
|
||||
////
|
||||
//// scalar minAngle = 0;
|
||||
////
|
||||
//// scalar axx = vectorTools::cosPhi(a.x(), cartesianDirections[0]);
|
||||
//// scalar axy = vectorTools::cosPhi(a.y(), cartesianDirections[0]);
|
||||
//// scalar axz = vectorTools::cosPhi(a.z(), cartesianDirections[0]);
|
||||
////
|
||||
//// scalar ayx = vectorTools::cosPhi(a.x(), cartesianDirections[1]);
|
||||
//// scalar ayy = vectorTools::cosPhi(a.y(), cartesianDirections[1]);
|
||||
//// scalar ayz = vectorTools::cosPhi(a.z(), cartesianDirections[1]);
|
||||
////
|
||||
//// scalar azx = vectorTools::cosPhi(a.x(), cartesianDirections[2]);
|
||||
//// scalar azy = vectorTools::cosPhi(a.y(), cartesianDirections[2]);
|
||||
//// scalar azz = vectorTools::cosPhi(a.z(), cartesianDirections[2]);
|
||||
////
|
||||
////// Info<< indent << axx << " " << axy << " " << axz << nl
|
||||
////// << indent << ayx << " " << ayy << " " << ayz << nl
|
||||
////// << indent << azx << " " << azy << " " << azz << endl;
|
||||
////
|
||||
//// if (mag(axx) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.xx() = mag(a.xx());
|
||||
//// tmpA.xy() = mag(a.xy());
|
||||
//// tmpA.xz() = mag(a.xz());
|
||||
//// minAngle = mag(axx);
|
||||
//// }
|
||||
//// if (mag(axy) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.xx() = mag(a.yx());
|
||||
//// tmpA.xy() = mag(a.yy());
|
||||
//// tmpA.xz() = mag(a.yz());
|
||||
//// minAngle = mag(axy);
|
||||
//// }
|
||||
//// if (mag(axz) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.xx() = mag(a.zx());
|
||||
//// tmpA.xy() = mag(a.zy());
|
||||
//// tmpA.xz() = mag(a.zz());
|
||||
//// }
|
||||
////
|
||||
//// minAngle = 0;
|
||||
////
|
||||
//// if (mag(ayx) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.yx() = mag(a.xx());
|
||||
//// tmpA.yy() = mag(a.xy());
|
||||
//// tmpA.yz() = mag(a.xz());
|
||||
//// minAngle = mag(ayx);
|
||||
//// }
|
||||
//// if (mag(ayy) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.yx() = mag(a.yx());
|
||||
//// tmpA.yy() = mag(a.yy());
|
||||
//// tmpA.yz() = mag(a.yz());
|
||||
//// minAngle = mag(ayy);
|
||||
//// }
|
||||
//// if (mag(ayz) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.yx() = mag(a.zx());
|
||||
//// tmpA.yy() = mag(a.zy());
|
||||
//// tmpA.yz() = mag(a.zz());
|
||||
//// }
|
||||
////
|
||||
//// minAngle = 0;
|
||||
////
|
||||
//// if (mag(azx) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.zx() = mag(a.xx());
|
||||
//// tmpA.zy() = mag(a.xy());
|
||||
//// tmpA.zz() = mag(a.xz());
|
||||
//// minAngle = mag(azx);
|
||||
//// }
|
||||
//// if (mag(azy) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.zx() = mag(a.yx());
|
||||
//// tmpA.zy() = mag(a.yy());
|
||||
//// tmpA.zz() = mag(a.yz());
|
||||
//// minAngle = mag(azy);
|
||||
//// }
|
||||
//// if (mag(azz) >= minAngle)
|
||||
//// {
|
||||
//// tmpA.zx() = mag(a.zx());
|
||||
//// tmpA.zy() = mag(a.zy());
|
||||
//// tmpA.zz() = mag(a.zz());
|
||||
//// }
|
||||
////
|
||||
//// alignments[aI] = tmpA;
|
||||
//// }
|
||||
//
|
||||
// scalar nearest = 0;
|
||||
//
|
||||
//// Info<< nl << "Point " << pt << endl;
|
||||
////
|
||||
//// FixedList<quaternion, 4> qAlignments;
|
||||
//// forAll(qAlignments, aI)
|
||||
//// {
|
||||
////// Info<< " Direction " << aI << endl;
|
||||
////// Info<< " Rot tensor" << alignments[aI] << endl;
|
||||
//// qAlignments[aI] = quaternion(alignments[aI]);
|
||||
//// qAlignments[aI].normalize();
|
||||
////// Info<< " Quaternion: " << qAlignments[aI] << endl;
|
||||
////// Info<< " Rot tensor from quat: " << qAlignments[aI].R()
|
||||
////// << endl;
|
||||
//// }
|
||||
//
|
||||
// tensor alignment = Foam::tensor::zero;
|
||||
// forAll(bary, pI)
|
||||
// {
|
||||
//// alignment += bary[pI]*ch->vertex(pI)->alignment();
|
||||
//
|
||||
//// alignment += bary[pI]*alignments[pI];
|
||||
//
|
||||
// // Try slerp with quaternions
|
||||
//
|
||||
// // Find nearest point
|
||||
// if (bary[pI] > nearest)
|
||||
// {
|
||||
// alignment = ch->vertex(pI)->alignment();
|
||||
// nearest = bary[pI];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//// quaternion alignment;
|
||||
//
|
||||
//// alignment = qAlignments[0]*bary[0]
|
||||
//// + qAlignments[1]*bary[1]
|
||||
//// + qAlignments[2]*bary[2]
|
||||
//// + qAlignments[3]*bary[3];
|
||||
//
|
||||
//// alignment =
|
||||
//// slerp(qAlignments[0], qAlignments[1], bary[0]+bary[1]+bary[2]);
|
||||
//// alignment = slerp(alignment, qAlignments[2], bary[0]+bary[1]+bary[2]);
|
||||
//// alignment = slerp(alignment, qAlignments[3], bary[0]+bary[1]+bary[2]);
|
||||
//// alignment =
|
||||
//// slerp(alignment, qAlignments[0], bary[0]/(bary[0]+bary[1]+bary[2]));
|
||||
//
|
||||
//// Info<< " Interp alignment : " << alignment << endl;
|
||||
//// Info<< " Interp rot tensor: " << alignment.R() << endl;
|
||||
//
|
||||
// return alignment;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void Foam::surfaceControl::cellSizeAndAlignment
|
||||
//(
|
||||
// const point& pt,
|
||||
// scalar& size,
|
||||
// tensor& alignment
|
||||
//) const
|
||||
//{
|
||||
// scalarList bary;
|
||||
// Cell_handle ch;
|
||||
//
|
||||
// triangulatedMesh_().barycentricCoords(pt, bary, ch);
|
||||
//
|
||||
// size = 0;
|
||||
// forAll(bary, pI)
|
||||
// {
|
||||
// size += bary[pI]*ch->vertex(pI)->size();
|
||||
// }
|
||||
//
|
||||
//// alignment = Foam::tensor::zero;
|
||||
//// forAll(bary, pI)
|
||||
//// {
|
||||
//// alignment += bary[pI]*ch->vertex(pI)->alignment();
|
||||
//// }
|
||||
//
|
||||
// alignment = cellAlignment(pt);
|
||||
//}
|
||||
|
||||
void Foam::searchableSurfaceControl::initialVertices
|
||||
(
|
||||
pointField& pts,
|
||||
@ -648,7 +353,8 @@ void Foam::searchableSurfaceControl::initialVertices
|
||||
}
|
||||
}
|
||||
|
||||
if (!cellSizeFunction_().cellSize(pts[pI], sizes[pI]))
|
||||
label priority = -1;
|
||||
if (!cellSize(pts[pI], sizes[pI], priority))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -663,4 +369,54 @@ void Foam::searchableSurfaceControl::initialVertices
|
||||
}
|
||||
|
||||
|
||||
bool Foam::searchableSurfaceControl::cellSize
|
||||
(
|
||||
const Foam::point& pt,
|
||||
scalar& cellSize,
|
||||
label& priority
|
||||
) const
|
||||
{
|
||||
bool anyFunctionFound = false;
|
||||
|
||||
forAll(sizeFunctions(), funcI)
|
||||
{
|
||||
const cellSizeFunction& sizeFunc = sizeFunctions()[funcI];
|
||||
|
||||
if (sizeFunc.priority() < priority)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
scalar sizeI = GREAT;
|
||||
|
||||
if (sizeFunc.cellSize(pt, sizeI))
|
||||
{
|
||||
anyFunctionFound = true;
|
||||
|
||||
if (sizeFunc.priority() == priority)
|
||||
{
|
||||
if (sizeI < cellSize)
|
||||
{
|
||||
cellSize = sizeI;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellSize = sizeI;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "sizeI " << sizeI
|
||||
<<" minSize " << cellSize << endl;
|
||||
}
|
||||
|
||||
priority = sizeFunc.priority();
|
||||
}
|
||||
}
|
||||
|
||||
return anyFunctionFound;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -61,7 +61,9 @@ class searchableSurfaceControl
|
||||
|
||||
const conformationSurfaces& geometryToConformTo_;
|
||||
|
||||
autoPtr<cellSizeFunction> cellSizeFunction_;
|
||||
PtrList<cellSizeFunction> cellSizeFunctions_;
|
||||
|
||||
label maxPriority_;
|
||||
|
||||
|
||||
// const conformationSurfaces& geometryToConformTo_;
|
||||
@ -106,7 +108,8 @@ public:
|
||||
const Time& runTime,
|
||||
const word& name,
|
||||
const dictionary& controlFunctionDict,
|
||||
const conformationSurfaces& geometryToConformTo
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
@ -147,16 +150,23 @@ public:
|
||||
triadField& alignments
|
||||
) const;
|
||||
|
||||
const cellSizeFunction& sizeFunction() const
|
||||
const PtrList<cellSizeFunction>& sizeFunctions() const
|
||||
{
|
||||
return cellSizeFunction_();
|
||||
return cellSizeFunctions_;
|
||||
}
|
||||
|
||||
virtual label priority() const
|
||||
virtual label maxPriority() const
|
||||
{
|
||||
return cellSizeFunction_().priority();
|
||||
return maxPriority_;
|
||||
}
|
||||
|
||||
bool cellSize
|
||||
(
|
||||
const Foam::point& pt,
|
||||
scalar& cellSize,
|
||||
label& priority
|
||||
) const;
|
||||
|
||||
// Edit
|
||||
|
||||
};
|
||||
|
||||
@ -42,7 +42,8 @@ Foam::cellSizeFunction::cellSizeFunction
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
dictionary(cellSizeFunctionDict),
|
||||
@ -52,14 +53,16 @@ Foam::cellSizeFunction::cellSizeFunction
|
||||
surfaceCellSizeFunction::New
|
||||
(
|
||||
cellSizeFunctionDict,
|
||||
surface
|
||||
surface,
|
||||
defaultCellSize
|
||||
)
|
||||
),
|
||||
coeffsDict_(subDict(type + "Coeffs")),
|
||||
defaultCellSize_(defaultCellSize),
|
||||
sideMode_(),
|
||||
priority_(readLabel(cellSizeFunctionDict.lookup("priority")))
|
||||
priority_(readLabel(cellSizeFunctionDict.lookup("priority", true)))
|
||||
{
|
||||
word mode = cellSizeFunctionDict.lookup("mode");
|
||||
word mode = cellSizeFunctionDict.lookup("mode", true);
|
||||
|
||||
if (surface_.hasVolumeType())
|
||||
{
|
||||
@ -102,7 +105,8 @@ Foam::cellSizeFunction::cellSizeFunction
|
||||
Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
{
|
||||
word cellSizeFunctionTypeName
|
||||
@ -110,7 +114,7 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
|
||||
cellSizeFunctionDict.lookup("cellSizeFunction")
|
||||
);
|
||||
|
||||
Info<< " Selecting cellSizeFunction " << cellSizeFunctionTypeName
|
||||
Info<< indent << "Selecting cellSizeFunction " << cellSizeFunctionTypeName
|
||||
<< endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
@ -132,7 +136,7 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
|
||||
|
||||
return autoPtr<cellSizeFunction>
|
||||
(
|
||||
cstrIter()(cellSizeFunctionDict, surface)
|
||||
cstrIter()(cellSizeFunctionDict, surface, defaultCellSize)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -94,6 +94,8 @@ protected:
|
||||
//- Method details dictionary
|
||||
dictionary coeffsDict_;
|
||||
|
||||
const scalar& defaultCellSize_;
|
||||
|
||||
//- Mode of size specification, i.e. inside, outside or bothSides
|
||||
sideMode sideMode_;
|
||||
|
||||
@ -122,9 +124,10 @@ public:
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
),
|
||||
(cellSizeFunctionDict, surface)
|
||||
(cellSizeFunctionDict, surface, defaultCellSize)
|
||||
);
|
||||
|
||||
|
||||
@ -135,7 +138,8 @@ public:
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
@ -145,7 +149,8 @@ public:
|
||||
static autoPtr<cellSizeFunction> New
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,12 +44,20 @@ addToRunTimeSelectionTable(cellSizeFunction, linearDistance, dictionary);
|
||||
linearDistance::linearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
||||
distance_(readScalar(coeffsDict().lookup("distance"))),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface, defaultCellSize),
|
||||
distanceCellSize_
|
||||
(
|
||||
readScalar(coeffsDict().lookup("distanceCellSizeCoeff"))
|
||||
*defaultCellSize_
|
||||
),
|
||||
distance_
|
||||
(
|
||||
readScalar(coeffsDict().lookup("distanceCoeff"))*defaultCellSize_
|
||||
),
|
||||
distanceSqr_(sqr(distance_))
|
||||
{}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -81,7 +81,8 @@ public:
|
||||
linearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,12 +42,17 @@ addToRunTimeSelectionTable(cellSizeFunction, linearSpatial, dictionary);
|
||||
linearSpatial::linearSpatial
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface, defaultCellSize),
|
||||
referencePoint_(coeffsDict().lookup("referencePoint")),
|
||||
referenceCellSize_(readScalar(coeffsDict().lookup("referenceCellSize"))),
|
||||
referenceCellSize_
|
||||
(
|
||||
readScalar(coeffsDict().lookup("referenceCellSizeCoeff"))
|
||||
*defaultCellSize_
|
||||
),
|
||||
direction_(coeffsDict().lookup("direction")),
|
||||
cellSizeGradient_(readScalar(coeffsDict().lookup("cellSizeGradient")))
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,7 +85,8 @@ public:
|
||||
linearSpatial
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,49 +46,60 @@ addToRunTimeSelectionTable
|
||||
surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
||||
surfaceOffset_(readScalar(coeffsDict().lookup("surfaceOffset"))),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface, defaultCellSize),
|
||||
distanceCellSize_
|
||||
(
|
||||
readScalar(coeffsDict().lookup("distanceCellSizeCoeff"))
|
||||
*defaultCellSize_
|
||||
),
|
||||
surfaceOffset_
|
||||
(
|
||||
readScalar(coeffsDict().lookup("surfaceOffsetCoeff"))*defaultCellSize_
|
||||
),
|
||||
totalDistance_(),
|
||||
totalDistanceSqr_()
|
||||
{
|
||||
if
|
||||
(
|
||||
coeffsDict().found("totalDistance")
|
||||
|| coeffsDict().found("linearDistance")
|
||||
coeffsDict().found("totalDistanceCoeff")
|
||||
|| coeffsDict().found("linearDistanceCoeff")
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
coeffsDict().found("totalDistance")
|
||||
&& coeffsDict().found("linearDistance")
|
||||
coeffsDict().found("totalDistanceCoeff")
|
||||
&& coeffsDict().found("linearDistanceCoeff")
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"surfaceOffsetLinearDistance::surfaceOffsetLinearDistance"
|
||||
"("
|
||||
"const dictionary& initialPointsDict, "
|
||||
"const conformalVoronoiMesh& cvMesh, "
|
||||
"const searchableSurface& surface"
|
||||
" const dictionary& initialPointsDict,"
|
||||
" const searchableSurface& surface,"
|
||||
" const scalar& defaultCellSize"
|
||||
")"
|
||||
)
|
||||
<< "totalDistance and linearDistance found, "
|
||||
<< "totalDistanceCoeff and linearDistanceCoeff found, "
|
||||
<< "specify one or other, not both."
|
||||
<< nl << exit(FatalError) << endl;
|
||||
}
|
||||
|
||||
if (coeffsDict().found("totalDistance"))
|
||||
if (coeffsDict().found("totalDistanceCoeff"))
|
||||
{
|
||||
totalDistance_ = readScalar(coeffsDict().lookup("totalDistance"));
|
||||
totalDistance_ =
|
||||
readScalar(coeffsDict().lookup("totalDistanceCoeff"))
|
||||
*defaultCellSize_;
|
||||
}
|
||||
else
|
||||
{
|
||||
totalDistance_ =
|
||||
readScalar(coeffsDict().lookup("linearDistance"))
|
||||
readScalar(coeffsDict().lookup("linearDistanceCoeff"))
|
||||
*defaultCellSize_
|
||||
+ surfaceOffset_;
|
||||
}
|
||||
}
|
||||
@ -98,12 +109,12 @@ surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
|
||||
(
|
||||
"surfaceOffsetLinearDistance::surfaceOffsetLinearDistance"
|
||||
"("
|
||||
"const dictionary& initialPointsDict, "
|
||||
"const conformalVoronoiMesh& cvMesh, "
|
||||
"const searchableSurface& surface"
|
||||
" const dictionary& initialPointsDict,"
|
||||
" const searchableSurface& surface,"
|
||||
" const scalar& defaultCellSize"
|
||||
")"
|
||||
)
|
||||
<< "totalDistance or linearDistance not found."
|
||||
<< "totalDistanceCoeff or linearDistanceCoeff not found."
|
||||
<< nl << exit(FatalError) << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,7 +85,8 @@ public:
|
||||
surfaceOffsetLinearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,10 +41,11 @@ addToRunTimeSelectionTable(cellSizeFunction, uniform, dictionary);
|
||||
uniform::uniform
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, surface)
|
||||
cellSizeFunction(typeName, initialPointsDict, surface, defaultCellSize)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -66,7 +66,8 @@ public:
|
||||
uniform
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,11 +42,15 @@ addToRunTimeSelectionTable(cellSizeFunction, uniformDistance, dictionary);
|
||||
uniformDistance::uniformDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
distance_(readScalar(coeffsDict().lookup("distance"))),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface, defaultCellSize),
|
||||
distance_
|
||||
(
|
||||
readScalar(coeffsDict().lookup("distanceCoeff"))*defaultCellSize_
|
||||
),
|
||||
distanceSqr_(sqr(distance_))
|
||||
{}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -72,7 +72,8 @@ public:
|
||||
uniformDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -95,10 +95,17 @@ void Foam::automatic::smoothField(triSurfaceScalarField& surf)
|
||||
Foam::automatic::automatic
|
||||
(
|
||||
const dictionary& cellSizeCalcTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeCalculationType(typeName, cellSizeCalcTypeDict, surface),
|
||||
cellSizeCalculationType
|
||||
(
|
||||
typeName,
|
||||
cellSizeCalcTypeDict,
|
||||
surface,
|
||||
defaultCellSize
|
||||
),
|
||||
coeffsDict_(cellSizeCalcTypeDict.subDict(typeName + "Coeffs")),
|
||||
surface_(surface),
|
||||
surfaceName_(surface.searchableSurface::name()),
|
||||
@ -108,13 +115,13 @@ Foam::automatic::automatic
|
||||
featureProximityFile_(coeffsDict_.lookup("featureProximityFile")),
|
||||
readInternalCloseness_(Switch(coeffsDict_.lookup("internalCloseness"))),
|
||||
internalClosenessFile_(coeffsDict_.lookup("internalClosenessFile")),
|
||||
curvatureCellSizeFactor_
|
||||
curvatureCellSizeCoeff_
|
||||
(
|
||||
readScalar(coeffsDict_.lookup("curvatureCellSizeFactor"))
|
||||
readScalar(coeffsDict_.lookup("curvatureCellSizeCoeff"))
|
||||
),
|
||||
maximumCellSize_
|
||||
(
|
||||
readScalar(coeffsDict_.lookup("maximumCellSize"))
|
||||
readScalar(coeffsDict_.lookup("maximumCellSizeCoeff"))*defaultCellSize_
|
||||
)
|
||||
{}
|
||||
|
||||
@ -186,7 +193,7 @@ Foam::triSurfaceScalarField Foam::automatic::load()
|
||||
1.0
|
||||
/max
|
||||
(
|
||||
(1.0/curvatureCellSizeFactor_)
|
||||
(1.0/curvatureCellSizeCoeff_)
|
||||
*interpolatedCurvatureToFace,
|
||||
1.0/maximumCellSize_
|
||||
),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -79,7 +79,7 @@ private:
|
||||
|
||||
//- The curvature values are multiplied by the inverse of this value to
|
||||
// get the cell size
|
||||
const scalar curvatureCellSizeFactor_;
|
||||
const scalar curvatureCellSizeCoeff_;
|
||||
|
||||
//- The maximum allowable sell size
|
||||
const scalar maximumCellSize_;
|
||||
@ -102,7 +102,8 @@ public:
|
||||
automatic
|
||||
(
|
||||
const dictionary& cellSizeCalcTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,10 +41,12 @@ Foam::cellSizeCalculationType::cellSizeCalculationType
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& cellSizeCalculationTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeCalculationTypeDict_(cellSizeCalculationTypeDict)
|
||||
cellSizeCalculationTypeDict_(cellSizeCalculationTypeDict),
|
||||
defaultCellSize_(defaultCellSize)
|
||||
{}
|
||||
|
||||
|
||||
@ -53,7 +55,8 @@ Foam::cellSizeCalculationType::cellSizeCalculationType
|
||||
Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
|
||||
(
|
||||
const dictionary& cellSizeCalculationTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
{
|
||||
word cellSizeCalculationTypeTypeName
|
||||
@ -61,7 +64,7 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
|
||||
cellSizeCalculationTypeDict.lookup("cellSizeCalculationType")
|
||||
);
|
||||
|
||||
Info<< " Selecting cellSizeCalculationType "
|
||||
Info<< indent << "Selecting cellSizeCalculationType "
|
||||
<< cellSizeCalculationTypeTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
@ -83,7 +86,7 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
|
||||
|
||||
return autoPtr<cellSizeCalculationType>
|
||||
(
|
||||
cstrIter()(cellSizeCalculationTypeDict, surface)
|
||||
cstrIter()(cellSizeCalculationTypeDict, surface, defaultCellSize)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -58,6 +58,8 @@ protected:
|
||||
|
||||
const dictionary& cellSizeCalculationTypeDict_;
|
||||
|
||||
const scalar& defaultCellSize_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -85,9 +87,10 @@ public:
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& cellSizeCalculationTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
),
|
||||
(cellSizeCalculationTypeDict, surface)
|
||||
(cellSizeCalculationTypeDict, surface, defaultCellSize)
|
||||
);
|
||||
|
||||
|
||||
@ -98,7 +101,8 @@ public:
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& cellSizeCalculationTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
@ -108,7 +112,8 @@ public:
|
||||
static autoPtr<cellSizeCalculationType> New
|
||||
(
|
||||
const dictionary& cellSizeCalculationTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,10 +47,17 @@ namespace Foam
|
||||
Foam::fieldFromFile::fieldFromFile
|
||||
(
|
||||
const dictionary& cellSizeCalcTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
cellSizeCalculationType(typeName, cellSizeCalcTypeDict, surface),
|
||||
cellSizeCalculationType
|
||||
(
|
||||
typeName,
|
||||
cellSizeCalcTypeDict,
|
||||
surface,
|
||||
defaultCellSize
|
||||
),
|
||||
surface_(surface),
|
||||
fileName_
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -78,7 +78,8 @@ public:
|
||||
fieldFromFile
|
||||
(
|
||||
const dictionary& cellSizeCalcTypeDict,
|
||||
const triSurfaceMesh& surface
|
||||
const triSurfaceMesh& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -48,10 +48,17 @@ namespace Foam
|
||||
Foam::nonUniformField::nonUniformField
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
surfaceCellSizeFunction(typeName, cellSizeFunctionDict, surface),
|
||||
surfaceCellSizeFunction
|
||||
(
|
||||
typeName,
|
||||
cellSizeFunctionDict,
|
||||
surface,
|
||||
defaultCellSize
|
||||
),
|
||||
surfaceTriMesh_(refCast<const triSurfaceMesh>(surface)),
|
||||
surfaceCellSize_
|
||||
(
|
||||
@ -70,17 +77,20 @@ Foam::nonUniformField::nonUniformField
|
||||
),
|
||||
cellSizeCalculationType_
|
||||
(
|
||||
cellSizeCalculationType::New(coeffsDict(), surfaceTriMesh_)
|
||||
cellSizeCalculationType::New
|
||||
(
|
||||
coeffsDict(),
|
||||
surfaceTriMesh_,
|
||||
defaultCellSize_
|
||||
)
|
||||
),
|
||||
pointCellSize_(),
|
||||
patch_()
|
||||
{
|
||||
Info<< incrIndent << incrIndent;
|
||||
Info<< incrIndent;
|
||||
|
||||
surfaceCellSize_ = cellSizeCalculationType_().load();
|
||||
|
||||
Info<< decrIndent;
|
||||
|
||||
Info<< indent << "Cell size field statistics:" << nl
|
||||
<< indent << " Minimum: " << min(surfaceCellSize_).value() << nl
|
||||
<< indent << " Average: " << average(surfaceCellSize_).value() << nl
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -91,7 +91,8 @@ public:
|
||||
nonUniformField
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,12 +40,14 @@ Foam::surfaceCellSizeFunction::surfaceCellSizeFunction
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& surfaceCellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
dictionary(surfaceCellSizeFunctionDict),
|
||||
surface_(surface),
|
||||
coeffsDict_(subDict(type + "Coeffs")),
|
||||
defaultCellSize_(defaultCellSize),
|
||||
refinementFactor_
|
||||
(
|
||||
lookupOrDefault<scalar>("refinementFactor", 1.0)
|
||||
@ -58,7 +60,8 @@ Foam::surfaceCellSizeFunction::surfaceCellSizeFunction
|
||||
Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
|
||||
(
|
||||
const dictionary& surfaceCellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
{
|
||||
word surfaceCellSizeFunctionTypeName
|
||||
@ -66,7 +69,7 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
|
||||
surfaceCellSizeFunctionDict.lookup("surfaceCellSizeFunction")
|
||||
);
|
||||
|
||||
Info<< " Selecting surfaceCellSizeFunction "
|
||||
Info<< indent << "Selecting surfaceCellSizeFunction "
|
||||
<< surfaceCellSizeFunctionTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
@ -88,7 +91,7 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
|
||||
|
||||
return autoPtr<surfaceCellSizeFunction>
|
||||
(
|
||||
cstrIter()(surfaceCellSizeFunctionDict, surface)
|
||||
cstrIter()(surfaceCellSizeFunctionDict, surface, defaultCellSize)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -64,6 +64,8 @@ protected:
|
||||
|
||||
const dictionary coeffsDict_;
|
||||
|
||||
const scalar& defaultCellSize_;
|
||||
|
||||
//- If cell resizing is allowed, this is the factor of the old cell size
|
||||
// to get the new cell size
|
||||
scalar refinementFactor_;
|
||||
@ -95,9 +97,10 @@ public:
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& surfaceCellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
),
|
||||
(surfaceCellSizeFunctionDict, surface)
|
||||
(surfaceCellSizeFunctionDict, surface, defaultCellSize)
|
||||
);
|
||||
|
||||
|
||||
@ -108,7 +111,8 @@ public:
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& surfaceCellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
@ -118,7 +122,8 @@ public:
|
||||
static autoPtr<surfaceCellSizeFunction> New
|
||||
(
|
||||
const dictionary& surfaceCellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,11 +45,21 @@ namespace Foam
|
||||
Foam::uniformValue::uniformValue
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
:
|
||||
surfaceCellSizeFunction(typeName, cellSizeFunctionDict, surface),
|
||||
surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize")))
|
||||
surfaceCellSizeFunction
|
||||
(
|
||||
typeName,
|
||||
cellSizeFunctionDict,
|
||||
surface,
|
||||
defaultCellSize
|
||||
),
|
||||
surfaceCellSize_
|
||||
(
|
||||
readScalar(coeffsDict().lookup("surfaceCellSizeCoeff"))*defaultCellSize_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,7 +69,8 @@ public:
|
||||
uniformValue
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const searchableSurface& surface
|
||||
const searchableSurface& surface,
|
||||
const scalar& defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -539,7 +539,7 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs
|
||||
|
||||
const Foam::point& surfacePt(surfaceHit.hitPoint());
|
||||
|
||||
if (geometryToConformTo_.isBaffle(featureIndex))
|
||||
if (geometryToConformTo_.isBaffle(featureIndex, surfaceHit))
|
||||
{
|
||||
createBafflePointPair
|
||||
(
|
||||
@ -1213,7 +1213,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
cellShapeControl_
|
||||
(
|
||||
runTime_,
|
||||
cvMeshDict.subDict("motionControl"),
|
||||
cvMeshControls_,
|
||||
allGeometry_,
|
||||
geometryToConformTo_
|
||||
),
|
||||
|
||||
@ -1823,12 +1823,23 @@ Foam::label Foam::conformalVoronoiMesh::createPatchInfo
|
||||
patchTypes.setSize(patchNames.size() + 1, wallPolyPatch::typeName);
|
||||
procNeighbours.setSize(patchNames.size() + 1, -1);
|
||||
|
||||
const PtrList<dictionary>& patchInfo = geometryToConformTo_.patchInfo();
|
||||
|
||||
forAll(patchNames, patchI)
|
||||
{
|
||||
if (patchInfo.set(patchI))
|
||||
{
|
||||
patchTypes[patchI] =
|
||||
patchInfo[patchI].lookupOrDefault<word>
|
||||
(
|
||||
"type",
|
||||
wallPolyPatch::typeName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
patchNames.setSize(patchNames.size() + 1);
|
||||
|
||||
label defaultPatchIndex = patchNames.size() - 1;
|
||||
|
||||
patchTypes[defaultPatchIndex] = wallPolyPatch::typeName;
|
||||
procNeighbours[defaultPatchIndex] = -1;
|
||||
patchNames[defaultPatchIndex] = "cvMesh_defaultPatch";
|
||||
|
||||
label nProcPatches = 0;
|
||||
|
||||
@ -27,6 +27,133 @@ License
|
||||
#include "conformalVoronoiMesh.H"
|
||||
#include "triSurface.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::conformationSurfaces::hasBoundedVolume
|
||||
(
|
||||
List<searchableSurface::volumeType>& referenceVolumeTypes
|
||||
) const
|
||||
{
|
||||
vector sum = vector::zero;
|
||||
label totalTriangles = 0;
|
||||
|
||||
Info<< baffleSurfaces_ << endl;
|
||||
Info<< surfaces_ << endl;
|
||||
Info<< regionOffset_ << endl;
|
||||
Info<< allGeometryToSurfaces_ << endl;
|
||||
|
||||
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if (surface.hasVolumeType())
|
||||
{
|
||||
pointField pts(1, locationInMesh_);
|
||||
|
||||
List<searchableSurface::volumeType> vTypes
|
||||
(
|
||||
pts.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
);
|
||||
|
||||
surface.getVolumeType(pts, vTypes);
|
||||
|
||||
referenceVolumeTypes[s] = vTypes[0];
|
||||
|
||||
Info<< " is "
|
||||
<< searchableSurface::volumeTypeNames[referenceVolumeTypes[s]]
|
||||
<< " surface " << surface.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (isA<triSurface>(surface))
|
||||
{
|
||||
const triSurface& triSurf = refCast<const triSurface>(surface);
|
||||
|
||||
const pointField& surfPts = triSurf.points();
|
||||
|
||||
forAll(triSurf, sI)
|
||||
{
|
||||
const label patchID =
|
||||
triSurf[sI].region()
|
||||
+ regionOffset_[allGeometryToSurfaces_[s]];
|
||||
|
||||
// Don't include baffle surfaces in the calculation
|
||||
if (!baffleSurfaces_[patchID])
|
||||
{
|
||||
sum += triSurf[sI].normal(surfPts);
|
||||
}
|
||||
}
|
||||
|
||||
totalTriangles += triSurf.size();
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " Sum of all the surface normals (if near zero, surface is"
|
||||
<< " probably closed):" << nl
|
||||
<< " Sum = " << sum/totalTriangles << nl
|
||||
<< " mag(Sum) = " << mag(sum)/totalTriangles
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformationSurfaces::readFeatures
|
||||
(
|
||||
const dictionary& featureDict,
|
||||
const word& surfaceName,
|
||||
label& featureIndex
|
||||
)
|
||||
{
|
||||
word featureMethod =
|
||||
featureDict.lookupOrDefault<word>("featureMethod", "none");
|
||||
|
||||
if (featureMethod == "extendedFeatureEdgeMesh")
|
||||
{
|
||||
fileName feMeshName(featureDict.lookup("extendedFeatureEdgeMesh"));
|
||||
|
||||
Info<< " features: " << feMeshName << endl;
|
||||
|
||||
features_.set
|
||||
(
|
||||
featureIndex++,
|
||||
new extendedFeatureEdgeMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
feMeshName,
|
||||
runTime_.time().constant(),
|
||||
"extendedFeatureEdgeMesh",
|
||||
runTime_.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (featureMethod == "extractFeatures")
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"Foam::conformationSurfaces::readFeatures, "
|
||||
"else if (featureMethod == \"extractFeatures\")"
|
||||
);
|
||||
}
|
||||
else if (featureMethod == "none")
|
||||
{
|
||||
// Currently nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::conformationSurfaces::readFeatures")
|
||||
<< "No valid featureMethod found for surface " << surfaceName
|
||||
<< nl << "Use \"extendedFeatureEdgeMesh\" "
|
||||
<< "or \"extractFeatures\"."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::conformationSurfaces::conformationSurfaces
|
||||
@ -45,8 +172,9 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
surfaces_(),
|
||||
allGeometryToSurfaces_(),
|
||||
baffleSurfaces_(),
|
||||
patchNames_(0),
|
||||
patchOffsets_(),
|
||||
patchNames_(),
|
||||
regionOffset_(),
|
||||
patchInfo_(),
|
||||
globalBounds_(),
|
||||
referenceVolumeTypes_(0)
|
||||
{
|
||||
@ -55,25 +183,34 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
surfaceConformationDict.subDict("geometryToConformTo")
|
||||
);
|
||||
|
||||
const label nSurf = surfacesDict.size();
|
||||
|
||||
const dictionary& additionalFeaturesDict
|
||||
(
|
||||
surfaceConformationDict.subDict("additionalFeatures")
|
||||
);
|
||||
|
||||
const label nAddFeat = additionalFeaturesDict.size();
|
||||
|
||||
Info<< nl << "Reading geometryToConformTo" << endl;
|
||||
|
||||
surfaces_.setSize(surfacesDict.size(), -1);
|
||||
surfaces_.setSize(nSurf, -1);
|
||||
|
||||
allGeometryToSurfaces_.setSize(allGeometry_.size(), -1);
|
||||
|
||||
baffleSurfaces_.setSize(surfacesDict.size(), false);
|
||||
baffleSurfaces_.setSize(nSurf, false);
|
||||
|
||||
// Features may be attached to host surfaces or independent
|
||||
features_.setSize(surfacesDict.size() + additionalFeaturesDict.size());
|
||||
features_.setSize(nSurf + nAddFeat);
|
||||
|
||||
label featureI = 0;
|
||||
|
||||
patchOffsets_.setSize(surfacesDict.size(), -1);
|
||||
regionOffset_.setSize(nSurf, 0);
|
||||
|
||||
PtrList<dictionary> globalPatchInfo(nSurf);
|
||||
List<Map<autoPtr<dictionary> > > regionPatchInfo(nSurf);
|
||||
boolList globalBaffleSurfaces(nSurf, false);
|
||||
List<Map<bool> > regionBaffleSurface(nSurf);
|
||||
|
||||
label surfI = 0;
|
||||
|
||||
@ -83,30 +220,31 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
|
||||
surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName);
|
||||
|
||||
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
|
||||
|
||||
if (surfaces_[surfI] < 0)
|
||||
{
|
||||
FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces")
|
||||
<< "No surface " << iter().keyword() << " found. "
|
||||
<< "No surface " << surfaceName << " found. "
|
||||
<< "Valid geometry is " << nl << allGeometry_.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Info<< nl << " " << iter().keyword() << endl;
|
||||
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
|
||||
|
||||
patchOffsets_[surfI] = patchNames_.size();
|
||||
Info<< nl << " " << surfaceName << endl;
|
||||
|
||||
patchNames_.append(allGeometry.regionNames()[surfaces_[surfI]]);
|
||||
const wordList& regionNames =
|
||||
allGeometry_.regionNames()[surfaces_[surfI]];
|
||||
|
||||
patchNames_.append(regionNames);
|
||||
|
||||
const dictionary& surfaceSubDict(surfacesDict.subDict(surfaceName));
|
||||
|
||||
baffleSurfaces_[surfI] = Switch
|
||||
globalBaffleSurfaces[surfI] = Switch
|
||||
(
|
||||
surfaceSubDict.lookupOrDefault("baffleSurface", false)
|
||||
);
|
||||
|
||||
if (!baffleSurfaces_[surfI])
|
||||
if (!globalBaffleSurfaces[surfI])
|
||||
{
|
||||
if (!allGeometry_[surfaces_[surfI]].hasVolumeType())
|
||||
{
|
||||
@ -118,58 +256,119 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
}
|
||||
}
|
||||
|
||||
word featureMethod = surfaceSubDict.lookup("featureMethod");
|
||||
|
||||
if (featureMethod == "extendedFeatureEdgeMesh")
|
||||
// Load patch info
|
||||
if (surfaceSubDict.found("patchInfo"))
|
||||
{
|
||||
fileName feMeshName
|
||||
globalPatchInfo.set
|
||||
(
|
||||
surfaceSubDict.lookup("extendedFeatureEdgeMesh")
|
||||
surfI,
|
||||
surfaceSubDict.subDict("patchInfo").clone()
|
||||
);
|
||||
}
|
||||
|
||||
Info<< " features: " << feMeshName<< endl;
|
||||
readFeatures(surfaceSubDict, surfaceName, featureI);
|
||||
|
||||
features_.set
|
||||
(
|
||||
featureI++,
|
||||
new extendedFeatureEdgeMesh
|
||||
(
|
||||
IOobject
|
||||
if (surfaceSubDict.found("regions"))
|
||||
{
|
||||
const dictionary& regionsDict = surfaceSubDict.subDict("regions");
|
||||
|
||||
forAll(regionNames, regionI)
|
||||
{
|
||||
const word& regionName = regionNames[regionI];
|
||||
|
||||
if (regionsDict.found(regionName))
|
||||
{
|
||||
Info<< " region " << regionName << endl;
|
||||
|
||||
// Get the dictionary for region
|
||||
const dictionary& regionDict = regionsDict.subDict
|
||||
(
|
||||
feMeshName,
|
||||
runTime_.time().constant(),
|
||||
"extendedFeatureEdgeMesh",
|
||||
runTime_.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (featureMethod == "extractFeatures")
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"conformationSurfaces::conformationSurfaces, "
|
||||
"else if (featureMethod == \"extractFeatures\")"
|
||||
);
|
||||
}
|
||||
else if (featureMethod == "none")
|
||||
{
|
||||
// Currently nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces")
|
||||
<< "No valid featureMethod found for surface " << surfaceName
|
||||
<< nl << "Use \"extendedFeatureEdgeMesh\" "
|
||||
<< "or \"extractFeatures\"."
|
||||
<< exit(FatalError);
|
||||
regionName
|
||||
);
|
||||
|
||||
if (regionDict.found("patchInfo"))
|
||||
{
|
||||
regionPatchInfo[surfI].insert
|
||||
(
|
||||
regionI,
|
||||
regionDict.subDict("patchInfo").clone()
|
||||
);
|
||||
|
||||
// Info<< " patchInfo: "
|
||||
// << regionPatchInfo[surfI][regionI] << endl;
|
||||
}
|
||||
|
||||
if (regionDict.found("baffleSurface"))
|
||||
{
|
||||
regionBaffleSurface[surfI].insert
|
||||
(
|
||||
regionI,
|
||||
regionDict.lookup("baffleSurface")
|
||||
);
|
||||
|
||||
// Info<< " baffle: "
|
||||
// << regionBaffleSurface[surfI][regionI] << endl;
|
||||
}
|
||||
|
||||
readFeatures(regionDict, regionName, featureI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surfI++;
|
||||
}
|
||||
|
||||
// Calculate local to global region offset
|
||||
label nRegions = 0;
|
||||
|
||||
forAll(surfaces_, surfI)
|
||||
{
|
||||
regionOffset_[surfI] = nRegions;
|
||||
nRegions += allGeometry_[surfaces_[surfI]].regions().size();
|
||||
}
|
||||
|
||||
// Rework surface specific information into information per global region
|
||||
patchInfo_.setSize(nRegions);
|
||||
baffleSurfaces_.setSize(nRegions, false);
|
||||
|
||||
forAll(surfaces_, surfI)
|
||||
{
|
||||
label nRegions = allGeometry_[surfaces_[surfI]].regions().size();
|
||||
|
||||
// Initialise to global (i.e. per surface)
|
||||
for (label i = 0; i < nRegions; i++)
|
||||
{
|
||||
label globalRegionI = regionOffset_[surfI] + i;
|
||||
baffleSurfaces_[globalRegionI] = globalBaffleSurfaces[surfI];
|
||||
if (globalPatchInfo.set(surfI))
|
||||
{
|
||||
patchInfo_.set
|
||||
(
|
||||
globalRegionI,
|
||||
globalPatchInfo[surfI].clone()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIter(Map<bool>, regionBaffleSurface[surfI], iter)
|
||||
{
|
||||
label globalRegionI = regionOffset_[surfI] + iter.key();
|
||||
|
||||
baffleSurfaces_[globalRegionI] =
|
||||
regionBaffleSurface[surfI][iter.key()];
|
||||
}
|
||||
|
||||
const Map<autoPtr<dictionary> >& localInfo = regionPatchInfo[surfI];
|
||||
forAllConstIter(Map<autoPtr<dictionary> >, localInfo, iter)
|
||||
{
|
||||
label globalRegionI = regionOffset_[surfI] + iter.key();
|
||||
|
||||
patchInfo_.set(globalRegionI, iter()().clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!additionalFeaturesDict.empty())
|
||||
{
|
||||
Info<< nl << "Reading additionalFeatures" << endl;
|
||||
@ -186,38 +385,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
additionalFeaturesDict.subDict(featureName)
|
||||
);
|
||||
|
||||
word featureMethod = featureSubDict.lookupOrDefault
|
||||
(
|
||||
"featureMethod",
|
||||
word("none")
|
||||
);
|
||||
|
||||
if (featureMethod == "extendedFeatureEdgeMesh")
|
||||
{
|
||||
fileName feMeshName
|
||||
(
|
||||
featureSubDict.lookup("extendedFeatureEdgeMesh")
|
||||
);
|
||||
|
||||
Info<< " features: " << feMeshName << endl;
|
||||
|
||||
features_.set
|
||||
(
|
||||
featureI++,
|
||||
new extendedFeatureEdgeMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
feMeshName,
|
||||
runTime_.time().constant(),
|
||||
"extendedFeatureEdgeMesh",
|
||||
runTime_.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
readFeatures(featureSubDict, featureName, featureI);
|
||||
}
|
||||
|
||||
// Remove unnecessary space from the features list
|
||||
@ -251,53 +419,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
Info<< endl
|
||||
<< "Testing for locationInMesh " << locationInMesh_ << endl;
|
||||
|
||||
vector sum = vector::zero;
|
||||
label totalTriangles = 0;
|
||||
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if (surface.hasVolumeType())
|
||||
{
|
||||
pointField pts(1, locationInMesh_);
|
||||
|
||||
List<searchableSurface::volumeType> vTypes
|
||||
(
|
||||
pts.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
);
|
||||
|
||||
surface.getVolumeType(pts, vTypes);
|
||||
|
||||
referenceVolumeTypes_[s] = vTypes[0];
|
||||
|
||||
Info<< " is "
|
||||
<< searchableSurface::volumeTypeNames[referenceVolumeTypes_[s]]
|
||||
<< " surface " << surface.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (isA<triSurface>(surface))
|
||||
{
|
||||
const triSurface& triSurf = refCast<const triSurface>(surface);
|
||||
|
||||
const pointField& surfPts = triSurf.points();
|
||||
|
||||
forAll(triSurf, sI)
|
||||
{
|
||||
sum += triSurf[sI].normal(surfPts);
|
||||
}
|
||||
|
||||
totalTriangles += triSurf.size();
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " Sum of all the surface normals (if near zero, surface is"
|
||||
<< " probably closed):" << nl
|
||||
<< " Sum = " << sum/totalTriangles << nl
|
||||
<< " mag(Sum) = " << mag(sum)/totalTriangles
|
||||
<< endl;
|
||||
hasBoundedVolume(referenceVolumeTypes_);
|
||||
}
|
||||
|
||||
|
||||
@ -867,21 +989,7 @@ Foam::label Foam::conformationSurfaces::findPatch
|
||||
|
||||
findSurfaceAnyIntersection(ptA, ptB, surfHit, hitSurface);
|
||||
|
||||
if (!surfHit.hit())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
labelList surfLocalRegion;
|
||||
|
||||
allGeometry_[hitSurface].getRegion
|
||||
(
|
||||
List<pointIndexHit>(1, surfHit),
|
||||
surfLocalRegion
|
||||
);
|
||||
|
||||
return
|
||||
surfLocalRegion[0] + patchOffsets_[allGeometryToSurfaces_[hitSurface]];
|
||||
return getPatchID(hitSurface, surfHit);
|
||||
}
|
||||
|
||||
|
||||
@ -898,6 +1006,16 @@ Foam::label Foam::conformationSurfaces::findPatch(const point& pt) const
|
||||
hitSurface
|
||||
);
|
||||
|
||||
return getPatchID(hitSurface, surfHit);
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::conformationSurfaces::getPatchID
|
||||
(
|
||||
const label hitSurface,
|
||||
const pointIndexHit& surfHit
|
||||
) const
|
||||
{
|
||||
if (!surfHit.hit())
|
||||
{
|
||||
return -1;
|
||||
@ -911,8 +1029,28 @@ Foam::label Foam::conformationSurfaces::findPatch(const point& pt) const
|
||||
surfLocalRegion
|
||||
);
|
||||
|
||||
return
|
||||
surfLocalRegion[0] + patchOffsets_[allGeometryToSurfaces_[hitSurface]];
|
||||
const label patchID =
|
||||
surfLocalRegion[0]
|
||||
+ regionOffset_[allGeometryToSurfaces_[hitSurface]];
|
||||
|
||||
return patchID;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::conformationSurfaces::isBaffle
|
||||
(
|
||||
const label hitSurface,
|
||||
const pointIndexHit& surfHit
|
||||
) const
|
||||
{
|
||||
const label patchID = getPatchID(hitSurface, surfHit);
|
||||
|
||||
if (patchID == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return baffleSurfaces_[patchID];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,7 +85,10 @@ class conformationSurfaces
|
||||
|
||||
//- The offset between the patch indices of the individual surface and
|
||||
// the entry in the overall patch list
|
||||
labelList patchOffsets_;
|
||||
labelList regionOffset_;
|
||||
|
||||
//- From global region number to patchType
|
||||
PtrList<dictionary> patchInfo_;
|
||||
|
||||
//- The overall boundBox of all of the surfaces to be conformed to
|
||||
treeBoundBox globalBounds_;
|
||||
@ -97,6 +100,19 @@ class conformationSurfaces
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void hasBoundedVolume
|
||||
(
|
||||
List<searchableSurface::volumeType>& referenceVolumeTypes
|
||||
) const;
|
||||
|
||||
//- Read into features_ from a dictionary
|
||||
void readFeatures
|
||||
(
|
||||
const dictionary& featureDict,
|
||||
const word& surfaceName,
|
||||
label& featureIndex
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
conformationSurfaces(const conformationSurfaces&);
|
||||
|
||||
@ -142,6 +158,9 @@ public:
|
||||
//- Return the patch names
|
||||
inline const List<word>& patchNames() const;
|
||||
|
||||
//- Return the patch info
|
||||
inline const PtrList<dictionary>& patchInfo() const;
|
||||
|
||||
//- Return the global bounds
|
||||
inline const treeBoundBox& globalBounds() const;
|
||||
|
||||
@ -293,6 +312,13 @@ public:
|
||||
List<label>& featuresHit
|
||||
) const;
|
||||
|
||||
//- Get the region number of a hit surface
|
||||
label getPatchID
|
||||
(
|
||||
const label hitSurface,
|
||||
const pointIndexHit& surfHit
|
||||
) const;
|
||||
|
||||
//- Find which patch is intersected by the line from one point to
|
||||
// another
|
||||
label findPatch(const point& ptA, const point& ptB) const;
|
||||
@ -300,8 +326,12 @@ public:
|
||||
//- Find which patch is closest to the point
|
||||
label findPatch(const point& pt) const;
|
||||
|
||||
//- Is the surface a baffle
|
||||
inline bool isBaffle(const label index) const;
|
||||
//- Is the surface a baffle.
|
||||
bool isBaffle
|
||||
(
|
||||
const label hitSurface,
|
||||
const pointIndexHit& surfHit
|
||||
) const;
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,16 +56,17 @@ const Foam::List<Foam::word>& Foam::conformationSurfaces::patchNames() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::PtrList<Foam::dictionary>&
|
||||
Foam::conformationSurfaces::patchInfo() const
|
||||
{
|
||||
return patchInfo_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::treeBoundBox& Foam::conformationSurfaces::globalBounds() const
|
||||
{
|
||||
return globalBounds_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::conformationSurfaces::isBaffle(const label index) const
|
||||
{
|
||||
return baffleSurfaces_[index];
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -127,7 +127,8 @@ Foam::cvControls::cvControls
|
||||
|
||||
defaultCellSize_ = readScalar(motionDict.lookup("defaultCellSize"));
|
||||
|
||||
minimumCellSize_ = readScalar(motionDict.lookup("minimumCellSize"));
|
||||
minimumCellSize_ =
|
||||
readScalar(motionDict.lookup("minimumCellSizeCoeff"))*defaultCellSize_;
|
||||
|
||||
objOutput_ = Switch(motionDict.lookupOrDefault<Switch>("objOutput", false));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user