mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -19,13 +19,18 @@ FoamFile
|
|||||||
// - or converting boundary faces into a boundary face
|
// - or converting boundary faces into a boundary face
|
||||||
// (internalFacesOnly=false)(though should use really createPatch
|
// (internalFacesOnly=false)(though should use really createPatch
|
||||||
// to do this)
|
// to do this)
|
||||||
// - can also create duplicate (overlapping) sets of baffles:
|
// - specification in one of two modes:
|
||||||
// - internalFacesOnly = false
|
// - patchPairs : create two patches of same type, same input
|
||||||
// - have 4 entries in patches:
|
// - patches : create patches separately, full control over what
|
||||||
// - master
|
// to create on what side
|
||||||
// - slave
|
// (this mode can also create duplicate (overlapping)
|
||||||
// - additional master
|
// sets of baffles:
|
||||||
// - additional slave
|
// - internalFacesOnly = false
|
||||||
|
// - have 4 entries in patches:
|
||||||
|
// - master
|
||||||
|
// - slave
|
||||||
|
// - additional master
|
||||||
|
// - additional slave)
|
||||||
|
|
||||||
|
|
||||||
// Whether to convert internal faces only (so leave boundary faces intact).
|
// Whether to convert internal faces only (so leave boundary faces intact).
|
||||||
|
|||||||
@ -56,12 +56,12 @@ public:
|
|||||||
//- The output control options
|
//- The output control options
|
||||||
enum outputControls
|
enum outputControls
|
||||||
{
|
{
|
||||||
ocTimeStep, /*!< execution is coupled to the time-step */
|
ocTimeStep, /*!< execution is coupled to the time-step */
|
||||||
ocOutputTime, /*!< execution is coupled to the output-time */
|
ocOutputTime, /*!< execution is coupled to the output-time */
|
||||||
ocAdjustableTime, /*!< Adjust time step for dumping */
|
ocAdjustableTime, /*!< Adjust time step for dumping */
|
||||||
ocRunTime, /*!< run time for dumping */
|
ocRunTime, /*!< run time for dumping */
|
||||||
ocClockTime, /*!< clock time for dumping */
|
ocClockTime, /*!< clock time for dumping */
|
||||||
ocCpuTime /*!< cpu time for dumping */
|
ocCpuTime /*!< cpu time for dumping */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ private:
|
|||||||
// a value <= 1 means execute at every time step
|
// a value <= 1 means execute at every time step
|
||||||
label outputInterval_;
|
label outputInterval_;
|
||||||
|
|
||||||
//- Dumping counter for ocOutputTime
|
//- Dumping counter for ocOutputTime or index dump for ocAdjustableTime
|
||||||
label outputTimeLastDump_;
|
label outputTimeLastDump_;
|
||||||
|
|
||||||
//- Dump each deltaT (adjust Ttime)
|
//- Dump each deltaT (adjust Ttime)
|
||||||
@ -123,19 +123,19 @@ public:
|
|||||||
bool output();
|
bool output();
|
||||||
|
|
||||||
//- Return outputControl
|
//- Return outputControl
|
||||||
outputControls outputControl()
|
outputControls outputControl() const
|
||||||
{
|
{
|
||||||
return outputControl_;
|
return outputControl_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return writeInterval
|
//- Return writeInterval
|
||||||
scalar writeInterval()
|
scalar writeInterval() const
|
||||||
{
|
{
|
||||||
return writeInterval_;
|
return writeInterval_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return outputTimeLastDump
|
//- Return outputTimeLastDump
|
||||||
label outputTimeLastDump()
|
label outputTimeLastDump() const
|
||||||
{
|
{
|
||||||
return outputTimeLastDump_;
|
return outputTimeLastDump_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1378,15 +1378,16 @@ bool Foam::polyMesh::pointInCell
|
|||||||
nextPointI = f[fp];
|
nextPointI = f[fp];
|
||||||
}
|
}
|
||||||
|
|
||||||
const point& p0 = points()[pointI];
|
triPointRef faceTri
|
||||||
const point& p1 = points()[nextPointI];
|
(
|
||||||
const point& p2 = fc;
|
points()[pointI],
|
||||||
|
points()[nextPointI],
|
||||||
|
fc
|
||||||
|
);
|
||||||
|
|
||||||
vector twoFaceArea = (p1 - p0)^(p2 - p0);
|
vector proj = p - faceTri.centre();
|
||||||
point centre = (p0 + p1 + p2)/3.0;
|
|
||||||
vector proj = p - centre;
|
|
||||||
|
|
||||||
if ((twoFaceArea & proj) > 0)
|
if ((faceTri.normal() & proj) > 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
@ -34,7 +34,7 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Istream& is(dict.lookup(entryName));
|
Istream& is(dict.lookup(entryName, false));
|
||||||
|
|
||||||
token firstToken(is);
|
token firstToken(is);
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,9 @@ polyMeshAdder/polyMeshAdder.C
|
|||||||
fvMeshTools/fvMeshTools.C
|
fvMeshTools/fvMeshTools.C
|
||||||
|
|
||||||
motionSmoother/motionSmoother.C
|
motionSmoother/motionSmoother.C
|
||||||
motionSmoother/motionSmootherCheck.C
|
motionSmoother/motionSmootherAlgo.C
|
||||||
|
motionSmoother/motionSmootherAlgoCheck.C
|
||||||
|
motionSmoother/motionSmootherData.C
|
||||||
motionSmoother/polyMeshGeometry/polyMeshGeometry.C
|
motionSmoother/polyMeshGeometry/polyMeshGeometry.C
|
||||||
motionSmoother/badQualityToCell/badQualityToCell.C
|
motionSmoother/badQualityToCell/badQualityToCell.C
|
||||||
motionSmoother/badQualityToFace/badQualityToFace.C
|
motionSmoother/badQualityToFace/badQualityToFace.C
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -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-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -69,246 +69,32 @@ Note
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
motionSmoother.C
|
motionSmoother.C
|
||||||
motionSmootherTemplates.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef motionSmoother_H
|
#ifndef motionSmoother_H
|
||||||
#define motionSmoother_H
|
#define motionSmoother_H
|
||||||
|
|
||||||
#include "pointFields.H"
|
#include "motionSmootherData.H"
|
||||||
#include "HashSet.H"
|
#include "motionSmootherAlgo.H"
|
||||||
#include "PackedBoolList.H"
|
|
||||||
#include "indirectPrimitivePatch.H"
|
|
||||||
#include "className.H"
|
|
||||||
#include "twoDPointCorrector.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
class polyMeshGeometry;
|
|
||||||
class faceSet;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class motionSmoother Declaration
|
Class motionSmoother Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class motionSmoother
|
class motionSmoother
|
||||||
|
:
|
||||||
|
public motionSmootherData,
|
||||||
|
public motionSmootherAlgo
|
||||||
|
|
||||||
{
|
{
|
||||||
// Private class
|
// Private class
|
||||||
|
|
||||||
//- To synchronise displacements. We want max displacement since
|
|
||||||
// this is what is specified on pp and internal mesh will have
|
|
||||||
// zero displacement.
|
|
||||||
class maxMagEqOp
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
void operator()(vector& x, const vector& y) const
|
|
||||||
{
|
|
||||||
for (direction i = 0; i < vector::nComponents; i++)
|
|
||||||
{
|
|
||||||
scalar magX = mag(x[i]);
|
|
||||||
scalar magY = mag(y[i]);
|
|
||||||
|
|
||||||
if (magX < magY)
|
|
||||||
{
|
|
||||||
x[i] = y[i];
|
|
||||||
}
|
|
||||||
else if (magX == magY)
|
|
||||||
{
|
|
||||||
if (y[i] > x[i])
|
|
||||||
{
|
|
||||||
x[i] = y[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Reference to polyMesh. Non-const since we move mesh.
|
|
||||||
polyMesh& mesh_;
|
|
||||||
|
|
||||||
//- Reference to pointMesh
|
|
||||||
pointMesh& pMesh_;
|
|
||||||
|
|
||||||
//- Reference to face subset of all adaptPatchIDs
|
|
||||||
indirectPrimitivePatch& pp_;
|
|
||||||
|
|
||||||
//- Indices of fixedValue patches that we're allowed to modify the
|
|
||||||
// displacement on.
|
|
||||||
const labelList adaptPatchIDs_;
|
|
||||||
|
|
||||||
|
|
||||||
// Smoothing and checking parameters
|
|
||||||
dictionary paramDict_;
|
|
||||||
|
|
||||||
// Internal data
|
|
||||||
|
|
||||||
//- Displacement field
|
|
||||||
pointVectorField displacement_;
|
|
||||||
|
|
||||||
//- Scale factor for displacement
|
|
||||||
pointScalarField scale_;
|
|
||||||
|
|
||||||
//- Starting mesh position
|
|
||||||
pointField oldPoints_;
|
|
||||||
|
|
||||||
//- Is mesh point on boundary or not
|
|
||||||
PackedBoolList isInternalPoint_;
|
|
||||||
|
|
||||||
//- Is edge master (always except if on coupled boundary and on
|
|
||||||
// lower processor)
|
|
||||||
PackedBoolList isMasterEdge_;
|
|
||||||
|
|
||||||
//- 2-D motion corrector
|
|
||||||
twoDPointCorrector twoDCorrector_;
|
|
||||||
|
|
||||||
// Muli-patch constraints (from pointPatchInterpolation)
|
|
||||||
|
|
||||||
labelList patchPatchPointConstraintPoints_;
|
|
||||||
tensorField patchPatchPointConstraintTensors_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Average of connected points.
|
|
||||||
template<class Type>
|
|
||||||
tmp<GeometricField<Type, pointPatchField, pointMesh> > avg
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
|
||||||
const scalarField& edgeWeight
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Average postion of connected points.
|
|
||||||
template<class Type>
|
|
||||||
tmp<GeometricField<Type, pointPatchField, pointMesh> > avgPositions
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
|
||||||
const scalarField& edgeWeight
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Check constraints
|
|
||||||
template<class Type>
|
|
||||||
static void checkConstraints
|
|
||||||
(
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Multi-patch constraints
|
|
||||||
template<class Type>
|
|
||||||
void applyCornerConstraints
|
|
||||||
(
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh>&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Test synchronisation of generic field (not positions!) on points
|
|
||||||
template<class Type, class CombineOp>
|
|
||||||
void testSyncField
|
|
||||||
(
|
|
||||||
const Field<Type>&,
|
|
||||||
const CombineOp& cop,
|
|
||||||
const Type& zero,
|
|
||||||
const scalar maxMag
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Test synchronisation of points
|
|
||||||
void testSyncPositions(const pointField&, const scalar maxMag) const;
|
|
||||||
|
|
||||||
//- Assemble tensors for multi-patch constraints
|
|
||||||
void makePatchPatchAddressing();
|
|
||||||
|
|
||||||
static void checkFld(const pointScalarField&);
|
|
||||||
|
|
||||||
//- Get points used by given faces
|
|
||||||
labelHashSet getPoints(const labelHashSet&) const;
|
|
||||||
|
|
||||||
//- Calculate per-edge weight
|
|
||||||
tmp<scalarField> calcEdgeWeights(const pointField&) const;
|
|
||||||
|
|
||||||
//- explicit smoothing and min on all affected internal points
|
|
||||||
void minSmooth
|
|
||||||
(
|
|
||||||
const scalarField& edgeWeights,
|
|
||||||
const PackedBoolList& isAffectedPoint,
|
|
||||||
const pointScalarField& fld,
|
|
||||||
pointScalarField& newFld
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- same but only on selected points (usually patch points)
|
|
||||||
void minSmooth
|
|
||||||
(
|
|
||||||
const scalarField& edgeWeights,
|
|
||||||
const PackedBoolList& isAffectedPoint,
|
|
||||||
const labelList& meshPoints,
|
|
||||||
const pointScalarField& fld,
|
|
||||||
pointScalarField& newFld
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Scale certain (internal) points of a field
|
|
||||||
void scaleField
|
|
||||||
(
|
|
||||||
const labelHashSet& pointLabels,
|
|
||||||
const scalar scale,
|
|
||||||
pointScalarField&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- As above but points have to be in meshPoints as well
|
|
||||||
// (usually to scale patch points)
|
|
||||||
void scaleField
|
|
||||||
(
|
|
||||||
const labelList& meshPoints,
|
|
||||||
const labelHashSet& pointLabels,
|
|
||||||
const scalar scale,
|
|
||||||
pointScalarField&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Lower on internal points
|
|
||||||
void subtractField
|
|
||||||
(
|
|
||||||
const labelHashSet& pointLabels,
|
|
||||||
const scalar f,
|
|
||||||
pointScalarField&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- As above but points have to be in meshPoints as well
|
|
||||||
// (usually to scale patch points)
|
|
||||||
void subtractField
|
|
||||||
(
|
|
||||||
const labelList& meshPoints,
|
|
||||||
const labelHashSet& pointLabels,
|
|
||||||
const scalar scale,
|
|
||||||
pointScalarField&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Helper function. Is point internal?
|
|
||||||
bool isInternalPoint(const label pointI) const;
|
|
||||||
|
|
||||||
//- Given a set of faces that cause smoothing and a number of
|
|
||||||
// iterations determine the maximum set of points who are affected
|
|
||||||
// and the accordingly affected faces.
|
|
||||||
void getAffectedFacesAndPoints
|
|
||||||
(
|
|
||||||
const label nPointIter,
|
|
||||||
const faceSet& wrongFaces,
|
|
||||||
|
|
||||||
labelList& affectedFaces,
|
|
||||||
PackedBoolList& isAffectedPoint
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
motionSmoother(const motionSmoother&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const motionSmoother&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ClassName("motionSmoother");
|
ClassName("motionSmoother");
|
||||||
@ -337,212 +123,15 @@ public:
|
|||||||
const dictionary& paramDict
|
const dictionary& paramDict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
~motionSmoother();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Reference to mesh
|
|
||||||
const polyMesh& mesh() const;
|
|
||||||
|
|
||||||
//- Reference to pointMesh
|
|
||||||
const pointMesh& pMesh() const;
|
|
||||||
|
|
||||||
//- Reference to patch
|
|
||||||
const indirectPrimitivePatch& patch() const;
|
|
||||||
|
|
||||||
//- Patch labels that are being adapted
|
|
||||||
const labelList& adaptPatchIDs() const;
|
|
||||||
|
|
||||||
const dictionary& paramDict() const;
|
|
||||||
|
|
||||||
//- Reference to displacement field
|
|
||||||
pointVectorField& displacement();
|
|
||||||
|
|
||||||
//- Reference to displacement field
|
|
||||||
const pointVectorField& displacement() const;
|
|
||||||
|
|
||||||
//- Reference to scale field
|
|
||||||
const pointScalarField& scale() const;
|
|
||||||
|
|
||||||
//- Starting mesh position
|
|
||||||
const pointField& oldPoints() const;
|
|
||||||
|
|
||||||
//- Return reference to 2D point motion correction
|
|
||||||
twoDPointCorrector& twoDCorrector()
|
|
||||||
{
|
|
||||||
return twoDCorrector_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
|
||||||
//- Take over existing mesh position.
|
|
||||||
void correct();
|
|
||||||
|
|
||||||
//- Set patch fields on displacement to be consistent with
|
|
||||||
// internal values.
|
|
||||||
void setDisplacementPatchFields();
|
|
||||||
|
|
||||||
//- Set displacement field from displacement on patch points.
|
|
||||||
// Modify provided displacement to be consistent with actual
|
|
||||||
// boundary conditions on displacement. Note: resets the
|
|
||||||
// displacement to be 0 on coupled patches beforehand
|
|
||||||
// to make sure shared points
|
|
||||||
// partially on pp (on some processors) and partially not
|
|
||||||
// (on other processors) get the value from pp.
|
|
||||||
void setDisplacement(pointField& patchDisp);
|
|
||||||
|
|
||||||
//- Special correctBoundaryConditions which evaluates fixedValue
|
|
||||||
// patches first so they get overwritten with any constraint
|
|
||||||
// bc's.
|
|
||||||
void correctBoundaryConditions(pointVectorField&) const;
|
|
||||||
|
|
||||||
//- Move mesh. Does 2D correction (modifies passed pointField) and
|
|
||||||
// polyMesh::movePoints. Returns swept volumes.
|
|
||||||
tmp<scalarField> movePoints(pointField&);
|
|
||||||
|
|
||||||
//- Set the errorReduction (by how much to scale the displacement
|
|
||||||
// at error locations) parameter. Returns the old value.
|
|
||||||
// Set to 0 (so revert to old mesh) grows out one cell layer
|
|
||||||
// from error faces.
|
|
||||||
scalar setErrorReduction(const scalar);
|
|
||||||
|
|
||||||
//- Move mesh with given scale. Return true if mesh ok or has
|
|
||||||
// less than nAllow errors, false
|
|
||||||
// otherwise and locally update scale. Smoothmesh=false means only
|
|
||||||
// patch points get moved.
|
|
||||||
// Parallel ok (as long as displacement field is consistent
|
|
||||||
// across patches)
|
|
||||||
bool scaleMesh
|
|
||||||
(
|
|
||||||
labelList& checkFaces,
|
|
||||||
const bool smoothMesh = true,
|
|
||||||
const label nAllow = 0
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Move mesh (with baffles) with given scale.
|
|
||||||
bool scaleMesh
|
|
||||||
(
|
|
||||||
labelList& checkFaces,
|
|
||||||
const List<labelPair>& baffles,
|
|
||||||
const bool smoothMesh = true,
|
|
||||||
const label nAllow = 0
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Move mesh with externally provided mesh constraints
|
|
||||||
bool scaleMesh
|
|
||||||
(
|
|
||||||
labelList& checkFaces,
|
|
||||||
const List<labelPair>& baffles,
|
|
||||||
const dictionary& paramDict,
|
|
||||||
const dictionary& meshQualityDict,
|
|
||||||
const bool smoothMesh = true,
|
|
||||||
const label nAllow = 0
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Update topology
|
|
||||||
void updateMesh();
|
|
||||||
|
|
||||||
//- Check mesh with mesh settings in dict. Collects incorrect faces
|
|
||||||
// in set. Returns true if one or more faces in error.
|
|
||||||
// Parallel ok.
|
|
||||||
static bool checkMesh
|
|
||||||
(
|
|
||||||
const bool report,
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const dictionary& dict,
|
|
||||||
labelHashSet& wrongFaces
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Check (subset of mesh) with mesh settings in dict.
|
|
||||||
// Collects incorrect faces in set. Returns true if one
|
|
||||||
// or more faces in error. Parallel ok.
|
|
||||||
static bool checkMesh
|
|
||||||
(
|
|
||||||
const bool report,
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const dictionary& dict,
|
|
||||||
const labelList& checkFaces,
|
|
||||||
labelHashSet& wrongFaces
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Check (subset of mesh including baffles) with mesh settings
|
|
||||||
// in dict. Collects incorrect faces in set. Returns true if one
|
|
||||||
// or more faces in error. Parallel ok.
|
|
||||||
static bool checkMesh
|
|
||||||
(
|
|
||||||
const bool report,
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const dictionary& dict,
|
|
||||||
const labelList& checkFaces,
|
|
||||||
const List<labelPair>& baffles,
|
|
||||||
labelHashSet& wrongFaces
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Check part of mesh with mesh settings in dict.
|
|
||||||
// Collects incorrect faces in set. Returns true if one or
|
|
||||||
// more faces in error. Parallel ok.
|
|
||||||
static bool checkMesh
|
|
||||||
(
|
|
||||||
const bool report,
|
|
||||||
const dictionary& dict,
|
|
||||||
const polyMeshGeometry&,
|
|
||||||
const labelList& checkFaces,
|
|
||||||
labelHashSet& wrongFaces
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Check part of mesh including baffles with mesh settings in dict.
|
|
||||||
// Collects incorrect faces in set. Returns true if one or
|
|
||||||
// more faces in error. Parallel ok.
|
|
||||||
static bool checkMesh
|
|
||||||
(
|
|
||||||
const bool report,
|
|
||||||
const dictionary& dict,
|
|
||||||
const polyMeshGeometry&,
|
|
||||||
const labelList& checkFaces,
|
|
||||||
const List<labelPair>& baffles,
|
|
||||||
labelHashSet& wrongFaces
|
|
||||||
);
|
|
||||||
|
|
||||||
// Helper functions to manipulate displacement vector.
|
|
||||||
|
|
||||||
//- Fully explicit smoothing of fields (not positions)
|
|
||||||
// of internal points with varying diffusivity.
|
|
||||||
template<class Type>
|
|
||||||
void smooth
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
|
||||||
const scalarField& edgeWeight,
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh>& newFld
|
|
||||||
) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void motionSmoother::applyCornerConstraints<scalar>
|
|
||||||
(
|
|
||||||
GeometricField<scalar, pointPatchField, pointMesh>& pf
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "motionSmootherTemplates.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
1247
src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
Normal file
1247
src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
Normal file
File diff suppressed because it is too large
Load Diff
534
src/dynamicMesh/motionSmoother/motionSmootherAlgo.H
Normal file
534
src/dynamicMesh/motionSmoother/motionSmootherAlgo.H
Normal file
@ -0,0 +1,534 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::motionSmootherAlgo
|
||||||
|
|
||||||
|
Description
|
||||||
|
Given a displacement moves the mesh by scaling the displacement back
|
||||||
|
until there are no more mesh errors.
|
||||||
|
|
||||||
|
Holds displacement field (read upon construction since need boundary
|
||||||
|
conditions) and scaling factor and optional patch number on which to
|
||||||
|
scale back displacement.
|
||||||
|
|
||||||
|
E.g.
|
||||||
|
\verbatim
|
||||||
|
// Construct iterative mesh mover.
|
||||||
|
motionSmoother meshMover(mesh, labelList(1, patchI));
|
||||||
|
|
||||||
|
// Set desired displacement:
|
||||||
|
meshMover.displacement() = ..
|
||||||
|
|
||||||
|
for (label iter = 0; iter < maxIter; iter++)
|
||||||
|
{
|
||||||
|
if (meshMover.scaleMesh(true))
|
||||||
|
{
|
||||||
|
Info<< "Successfully moved mesh" << endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Note
|
||||||
|
- Shared points (parallel): a processor can have points which are part of
|
||||||
|
pp on another processor but have no pp itself (i.e. it has points
|
||||||
|
and/or edges but no faces of pp). Hence we have to be careful when e.g.
|
||||||
|
synchronising displacements that the value from the processor which has
|
||||||
|
faces of pp get priority. This is currently handled in setDisplacement
|
||||||
|
by resetting the internal displacement to zero before doing anything
|
||||||
|
else. The combine operator used will give preference to non-zero
|
||||||
|
values.
|
||||||
|
|
||||||
|
- Various routines take baffles. These are sets of boundary faces that
|
||||||
|
are treated as a single internal face. This is a hack used to apply
|
||||||
|
movement to internal faces.
|
||||||
|
|
||||||
|
- Mesh constraints are looked up from the supplied dictionary. (uses
|
||||||
|
recursive lookup)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
motionSmootherAlgo.C
|
||||||
|
motionSmootherAlgoTemplates.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef motionSmootherAlgo_H
|
||||||
|
#define motionSmootherAlgo_H
|
||||||
|
|
||||||
|
#include "pointFields.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
#include "PackedBoolList.H"
|
||||||
|
#include "indirectPrimitivePatch.H"
|
||||||
|
#include "className.H"
|
||||||
|
#include "twoDPointCorrector.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class polyMeshGeometry;
|
||||||
|
class faceSet;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class motionSmootherAlgo Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class motionSmootherAlgo
|
||||||
|
{
|
||||||
|
// Private class
|
||||||
|
|
||||||
|
//- To synchronise displacements. We want max displacement since
|
||||||
|
// this is what is specified on pp and internal mesh will have
|
||||||
|
// zero displacement.
|
||||||
|
class maxMagEqOp
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void operator()(vector& x, const vector& y) const
|
||||||
|
{
|
||||||
|
for (direction i = 0; i < vector::nComponents; i++)
|
||||||
|
{
|
||||||
|
scalar magX = mag(x[i]);
|
||||||
|
scalar magY = mag(y[i]);
|
||||||
|
|
||||||
|
if (magX < magY)
|
||||||
|
{
|
||||||
|
x[i] = y[i];
|
||||||
|
}
|
||||||
|
else if (magX == magY)
|
||||||
|
{
|
||||||
|
if (y[i] > x[i])
|
||||||
|
{
|
||||||
|
x[i] = y[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to polyMesh. Non-const since we move mesh.
|
||||||
|
polyMesh& mesh_;
|
||||||
|
|
||||||
|
//- Reference to pointMesh
|
||||||
|
pointMesh& pMesh_;
|
||||||
|
|
||||||
|
//- Reference to face subset of all adaptPatchIDs
|
||||||
|
indirectPrimitivePatch& pp_;
|
||||||
|
|
||||||
|
//- Displacement field
|
||||||
|
pointVectorField& displacement_;
|
||||||
|
|
||||||
|
//- Scale factor for displacement
|
||||||
|
pointScalarField& scale_;
|
||||||
|
|
||||||
|
//- Starting mesh position
|
||||||
|
pointField& oldPoints_;
|
||||||
|
|
||||||
|
|
||||||
|
// Internal data
|
||||||
|
|
||||||
|
//- Indices of fixedValue patches that we're allowed to modify the
|
||||||
|
// displacement on.
|
||||||
|
const labelList adaptPatchIDs_;
|
||||||
|
|
||||||
|
// Smoothing and checking parameters
|
||||||
|
dictionary paramDict_;
|
||||||
|
|
||||||
|
//- Is mesh point on boundary or not
|
||||||
|
PackedBoolList isInternalPoint_;
|
||||||
|
|
||||||
|
//- Is edge master (always except if on coupled boundary and on
|
||||||
|
// lower processor)
|
||||||
|
PackedBoolList isMasterEdge_;
|
||||||
|
|
||||||
|
//- 2-D motion corrector
|
||||||
|
twoDPointCorrector twoDCorrector_;
|
||||||
|
|
||||||
|
// Muli-patch constraints (from pointPatchInterpolation)
|
||||||
|
|
||||||
|
labelList patchPatchPointConstraintPoints_;
|
||||||
|
tensorField patchPatchPointConstraintTensors_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Average of connected points.
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, pointPatchField, pointMesh> > avg
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||||
|
const scalarField& edgeWeight
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Average postion of connected points.
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, pointPatchField, pointMesh> > avgPositions
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||||
|
const scalarField& edgeWeight
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Check constraints
|
||||||
|
template<class Type>
|
||||||
|
static void checkConstraints
|
||||||
|
(
|
||||||
|
GeometricField<Type, pointPatchField, pointMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Multi-patch constraints
|
||||||
|
template<class Type>
|
||||||
|
void applyCornerConstraints
|
||||||
|
(
|
||||||
|
GeometricField<Type, pointPatchField, pointMesh>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Test synchronisation of generic field (not positions!) on points
|
||||||
|
template<class Type, class CombineOp>
|
||||||
|
void testSyncField
|
||||||
|
(
|
||||||
|
const Field<Type>&,
|
||||||
|
const CombineOp& cop,
|
||||||
|
const Type& zero,
|
||||||
|
const scalar maxMag
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Test synchronisation of points
|
||||||
|
void testSyncPositions(const pointField&, const scalar maxMag) const;
|
||||||
|
|
||||||
|
//- Assemble tensors for multi-patch constraints
|
||||||
|
void makePatchPatchAddressing();
|
||||||
|
|
||||||
|
static void checkFld(const pointScalarField&);
|
||||||
|
|
||||||
|
//- Get points used by given faces
|
||||||
|
labelHashSet getPoints(const labelHashSet&) const;
|
||||||
|
|
||||||
|
//- Calculate per-edge weight
|
||||||
|
tmp<scalarField> calcEdgeWeights(const pointField&) const;
|
||||||
|
|
||||||
|
//- explicit smoothing and min on all affected internal points
|
||||||
|
void minSmooth
|
||||||
|
(
|
||||||
|
const scalarField& edgeWeights,
|
||||||
|
const PackedBoolList& isAffectedPoint,
|
||||||
|
const pointScalarField& fld,
|
||||||
|
pointScalarField& newFld
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- same but only on selected points (usually patch points)
|
||||||
|
void minSmooth
|
||||||
|
(
|
||||||
|
const scalarField& edgeWeights,
|
||||||
|
const PackedBoolList& isAffectedPoint,
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const pointScalarField& fld,
|
||||||
|
pointScalarField& newFld
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Scale certain (internal) points of a field
|
||||||
|
void scaleField
|
||||||
|
(
|
||||||
|
const labelHashSet& pointLabels,
|
||||||
|
const scalar scale,
|
||||||
|
pointScalarField&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- As above but points have to be in meshPoints as well
|
||||||
|
// (usually to scale patch points)
|
||||||
|
void scaleField
|
||||||
|
(
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const labelHashSet& pointLabels,
|
||||||
|
const scalar scale,
|
||||||
|
pointScalarField&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Lower on internal points
|
||||||
|
void subtractField
|
||||||
|
(
|
||||||
|
const labelHashSet& pointLabels,
|
||||||
|
const scalar f,
|
||||||
|
pointScalarField&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- As above but points have to be in meshPoints as well
|
||||||
|
// (usually to scale patch points)
|
||||||
|
void subtractField
|
||||||
|
(
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const labelHashSet& pointLabels,
|
||||||
|
const scalar scale,
|
||||||
|
pointScalarField&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Helper function. Is point internal?
|
||||||
|
bool isInternalPoint(const label pointI) const;
|
||||||
|
|
||||||
|
//- Given a set of faces that cause smoothing and a number of
|
||||||
|
// iterations determine the maximum set of points who are affected
|
||||||
|
// and the accordingly affected faces.
|
||||||
|
void getAffectedFacesAndPoints
|
||||||
|
(
|
||||||
|
const label nPointIter,
|
||||||
|
const faceSet& wrongFaces,
|
||||||
|
|
||||||
|
labelList& affectedFaces,
|
||||||
|
PackedBoolList& isAffectedPoint
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
motionSmootherAlgo(const motionSmootherAlgo&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const motionSmootherAlgo&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ClassName("motionSmootherAlgo");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh, patches to work on and smoothing parameters.
|
||||||
|
motionSmootherAlgo
|
||||||
|
(
|
||||||
|
polyMesh&,
|
||||||
|
pointMesh&,
|
||||||
|
indirectPrimitivePatch& pp, // 'outside' points
|
||||||
|
pointVectorField& displacement,
|
||||||
|
pointScalarField& scale,
|
||||||
|
pointField& oldPoints,
|
||||||
|
const labelList& adaptPatchIDs, // patches forming 'outside'
|
||||||
|
const dictionary& paramDict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~motionSmootherAlgo();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Reference to mesh
|
||||||
|
const polyMesh& mesh() const;
|
||||||
|
|
||||||
|
//- Reference to pointMesh
|
||||||
|
const pointMesh& pMesh() const;
|
||||||
|
|
||||||
|
//- Reference to patch
|
||||||
|
const indirectPrimitivePatch& patch() const;
|
||||||
|
|
||||||
|
//- Patch labels that are being adapted
|
||||||
|
const labelList& adaptPatchIDs() const;
|
||||||
|
|
||||||
|
const dictionary& paramDict() const;
|
||||||
|
|
||||||
|
//- Return reference to 2D point motion correction
|
||||||
|
twoDPointCorrector& twoDCorrector()
|
||||||
|
{
|
||||||
|
return twoDCorrector_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Take over existing mesh position.
|
||||||
|
void correct();
|
||||||
|
|
||||||
|
//- Set patch fields on displacement to be consistent with
|
||||||
|
// internal values.
|
||||||
|
void setDisplacementPatchFields();
|
||||||
|
|
||||||
|
//- Set displacement field from displacement on patch points.
|
||||||
|
// Modify provided displacement to be consistent with actual
|
||||||
|
// boundary conditions on displacement. Note: resets the
|
||||||
|
// displacement to be 0 on coupled patches beforehand
|
||||||
|
// to make sure shared points
|
||||||
|
// partially on pp (on some processors) and partially not
|
||||||
|
// (on other processors) get the value from pp.
|
||||||
|
void setDisplacement(pointField& patchDisp);
|
||||||
|
|
||||||
|
//- Special correctBoundaryConditions which evaluates fixedValue
|
||||||
|
// patches first so they get overwritten with any constraint
|
||||||
|
// bc's.
|
||||||
|
void correctBoundaryConditions(pointVectorField&) const;
|
||||||
|
|
||||||
|
//- Apply optional point constraint (2d correction)
|
||||||
|
void modifyMotionPoints(pointField& newPoints) const;
|
||||||
|
|
||||||
|
//- Get the current points (oldPoints+scale*displacement)
|
||||||
|
tmp<pointField> curPoints() const;
|
||||||
|
|
||||||
|
//- Set the errorReduction (by how much to scale the displacement
|
||||||
|
// at error locations) parameter. Returns the old value.
|
||||||
|
// Set to 0 (so revert to old mesh) grows out one cell layer
|
||||||
|
// from error faces.
|
||||||
|
scalar setErrorReduction(const scalar);
|
||||||
|
|
||||||
|
//- Move mesh with given scale. Return true if mesh ok or has
|
||||||
|
// less than nAllow errors, false
|
||||||
|
// otherwise and locally update scale. Smoothmesh=false means only
|
||||||
|
// patch points get moved.
|
||||||
|
// Parallel ok (as long as displacement field is consistent
|
||||||
|
// across patches)
|
||||||
|
bool scaleMesh
|
||||||
|
(
|
||||||
|
labelList& checkFaces,
|
||||||
|
const bool smoothMesh = true,
|
||||||
|
const label nAllow = 0
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Move mesh (with baffles) with given scale.
|
||||||
|
bool scaleMesh
|
||||||
|
(
|
||||||
|
labelList& checkFaces,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
const bool smoothMesh = true,
|
||||||
|
const label nAllow = 0
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Move mesh with externally provided mesh constraints
|
||||||
|
bool scaleMesh
|
||||||
|
(
|
||||||
|
labelList& checkFaces,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
const dictionary& paramDict,
|
||||||
|
const dictionary& meshQualityDict,
|
||||||
|
const bool smoothMesh = true,
|
||||||
|
const label nAllow = 0
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Update for new mesh geometry
|
||||||
|
void movePoints();
|
||||||
|
|
||||||
|
//- Update for new mesh topology
|
||||||
|
void updateMesh();
|
||||||
|
|
||||||
|
|
||||||
|
//- Check mesh with mesh settings in dict. Collects incorrect faces
|
||||||
|
// in set. Returns true if one or more faces in error.
|
||||||
|
// Parallel ok.
|
||||||
|
static bool checkMesh
|
||||||
|
(
|
||||||
|
const bool report,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const dictionary& dict,
|
||||||
|
labelHashSet& wrongFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Check (subset of mesh) with mesh settings in dict.
|
||||||
|
// Collects incorrect faces in set. Returns true if one
|
||||||
|
// or more faces in error. Parallel ok.
|
||||||
|
static bool checkMesh
|
||||||
|
(
|
||||||
|
const bool report,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const dictionary& dict,
|
||||||
|
const labelList& checkFaces,
|
||||||
|
labelHashSet& wrongFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Check (subset of mesh including baffles) with mesh settings
|
||||||
|
// in dict. Collects incorrect faces in set. Returns true if one
|
||||||
|
// or more faces in error. Parallel ok.
|
||||||
|
static bool checkMesh
|
||||||
|
(
|
||||||
|
const bool report,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const dictionary& dict,
|
||||||
|
const labelList& checkFaces,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
labelHashSet& wrongFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Check part of mesh with mesh settings in dict.
|
||||||
|
// Collects incorrect faces in set. Returns true if one or
|
||||||
|
// more faces in error. Parallel ok.
|
||||||
|
static bool checkMesh
|
||||||
|
(
|
||||||
|
const bool report,
|
||||||
|
const dictionary& dict,
|
||||||
|
const polyMeshGeometry&,
|
||||||
|
const labelList& checkFaces,
|
||||||
|
labelHashSet& wrongFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Check part of mesh including baffles with mesh settings in dict.
|
||||||
|
// Collects incorrect faces in set. Returns true if one or
|
||||||
|
// more faces in error. Parallel ok.
|
||||||
|
static bool checkMesh
|
||||||
|
(
|
||||||
|
const bool report,
|
||||||
|
const dictionary& dict,
|
||||||
|
const polyMeshGeometry&,
|
||||||
|
const labelList& checkFaces,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
labelHashSet& wrongFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
// Helper functions to manipulate displacement vector.
|
||||||
|
|
||||||
|
//- Fully explicit smoothing of fields (not positions)
|
||||||
|
// of internal points with varying diffusivity.
|
||||||
|
template<class Type>
|
||||||
|
void smooth
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||||
|
const scalarField& edgeWeight,
|
||||||
|
GeometricField<Type, pointPatchField, pointMesh>& newFld
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void motionSmootherAlgo::applyCornerConstraints<scalar>
|
||||||
|
(
|
||||||
|
GeometricField<scalar, pointPatchField, pointMesh>& pf
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "motionSmootherAlgoTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -23,13 +23,13 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "motionSmoother.H"
|
#include "motionSmootherAlgo.H"
|
||||||
#include "polyMeshGeometry.H"
|
#include "polyMeshGeometry.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -50,7 +50,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -411,7 +411,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -429,7 +429,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
@ -452,7 +452,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "motionSmoother.H"
|
#include "motionSmootherAlgo.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "processorPointPatchFields.H"
|
#include "processorPointPatchFields.H"
|
||||||
#include "pointConstraint.H"
|
#include "pointConstraint.H"
|
||||||
@ -32,7 +32,7 @@ License
|
|||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::motionSmoother::checkConstraints
|
void Foam::motionSmootherAlgo::checkConstraints
|
||||||
(
|
(
|
||||||
GeometricField<Type, pointPatchField, pointMesh>& pf
|
GeometricField<Type, pointPatchField, pointMesh>& pf
|
||||||
)
|
)
|
||||||
@ -119,7 +119,7 @@ void Foam::motionSmoother::checkConstraints
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"motionSmoother::checkConstraints"
|
"motionSmootherAlgo::checkConstraints"
|
||||||
"(GeometricField<Type, pointPatchField, pointMesh>&)"
|
"(GeometricField<Type, pointPatchField, pointMesh>&)"
|
||||||
) << "Patch fields are not consistent on mesh point "
|
) << "Patch fields are not consistent on mesh point "
|
||||||
<< ppp << " coordinate " << mesh.points()[ppp]
|
<< ppp << " coordinate " << mesh.points()[ppp]
|
||||||
@ -136,7 +136,7 @@ void Foam::motionSmoother::checkConstraints
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::motionSmoother::applyCornerConstraints
|
void Foam::motionSmootherAlgo::applyCornerConstraints
|
||||||
(
|
(
|
||||||
GeometricField<Type, pointPatchField, pointMesh>& pf
|
GeometricField<Type, pointPatchField, pointMesh>& pf
|
||||||
) const
|
) const
|
||||||
@ -155,7 +155,7 @@ void Foam::motionSmoother::applyCornerConstraints
|
|||||||
// Average of connected points.
|
// Average of connected points.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
|
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
|
||||||
Foam::motionSmoother::avg
|
Foam::motionSmootherAlgo::avg
|
||||||
(
|
(
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||||
const scalarField& edgeWeight
|
const scalarField& edgeWeight
|
||||||
@ -253,7 +253,7 @@ Foam::motionSmoother::avg
|
|||||||
|
|
||||||
// smooth field (point-jacobi)
|
// smooth field (point-jacobi)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::motionSmoother::smooth
|
void Foam::motionSmootherAlgo::smooth
|
||||||
(
|
(
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||||
const scalarField& edgeWeight,
|
const scalarField& edgeWeight,
|
||||||
@ -278,7 +278,7 @@ void Foam::motionSmoother::smooth
|
|||||||
|
|
||||||
//- Test synchronisation of generic field (not positions!) on points
|
//- Test synchronisation of generic field (not positions!) on points
|
||||||
template<class Type, class CombineOp>
|
template<class Type, class CombineOp>
|
||||||
void Foam::motionSmoother::testSyncField
|
void Foam::motionSmootherAlgo::testSyncField
|
||||||
(
|
(
|
||||||
const Field<Type>& fld,
|
const Field<Type>& fld,
|
||||||
const CombineOp& cop,
|
const CombineOp& cop,
|
||||||
@ -308,7 +308,7 @@ void Foam::motionSmoother::testSyncField
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"motionSmoother::testSyncField"
|
"motionSmootherAlgo::testSyncField"
|
||||||
"(const Field<Type>&, const CombineOp&"
|
"(const Field<Type>&, const CombineOp&"
|
||||||
", const Type&, const bool)"
|
", const Type&, const bool)"
|
||||||
) << "On element " << i << " value:" << fld[i]
|
) << "On element " << i << " value:" << fld[i]
|
||||||
124
src/dynamicMesh/motionSmoother/motionSmootherData.C
Normal file
124
src/dynamicMesh/motionSmoother/motionSmootherData.C
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "motionSmootherData.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::motionSmootherData::motionSmootherData
|
||||||
|
(
|
||||||
|
const pointMesh& pMesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
displacement_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"displacement",
|
||||||
|
pMesh.time().timeName(),
|
||||||
|
pMesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
pMesh
|
||||||
|
),
|
||||||
|
scale_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
pMesh.time().timeName(),
|
||||||
|
pMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
pMesh,
|
||||||
|
dimensionedScalar("scale", dimless, 1.0)
|
||||||
|
),
|
||||||
|
oldPoints_(pMesh().points())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::motionSmootherData::motionSmootherData
|
||||||
|
(
|
||||||
|
const pointVectorField& displacement
|
||||||
|
)
|
||||||
|
:
|
||||||
|
displacement_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"displacement",
|
||||||
|
displacement.time().timeName(),
|
||||||
|
displacement.mesh()(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
displacement
|
||||||
|
),
|
||||||
|
scale_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
displacement.time().timeName(),
|
||||||
|
displacement.mesh()(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
displacement.mesh(),
|
||||||
|
dimensionedScalar("scale", dimless, 1.0)
|
||||||
|
),
|
||||||
|
oldPoints_(displacement.mesh()().points())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::pointVectorField& Foam::motionSmootherData::displacement()
|
||||||
|
{
|
||||||
|
return displacement_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::pointVectorField& Foam::motionSmootherData::displacement() const
|
||||||
|
{
|
||||||
|
return displacement_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::pointScalarField& Foam::motionSmootherData::scale() const
|
||||||
|
{
|
||||||
|
return scale_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::pointField& Foam::motionSmootherData::oldPoints() const
|
||||||
|
{
|
||||||
|
return oldPoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
106
src/dynamicMesh/motionSmoother/motionSmootherData.H
Normal file
106
src/dynamicMesh/motionSmoother/motionSmootherData.H
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::motionSmootherData
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
motionSmootherData.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef motionSmootherData_H
|
||||||
|
#define motionSmootherData_H
|
||||||
|
|
||||||
|
#include "pointFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class motionSmootherData Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class motionSmootherData
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Displacement field
|
||||||
|
pointVectorField displacement_;
|
||||||
|
|
||||||
|
//- Scale factor for displacement
|
||||||
|
pointScalarField scale_;
|
||||||
|
|
||||||
|
//- Starting mesh position
|
||||||
|
pointField oldPoints_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct read
|
||||||
|
motionSmootherData
|
||||||
|
(
|
||||||
|
const pointMesh&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from pointDisplacement
|
||||||
|
motionSmootherData
|
||||||
|
(
|
||||||
|
const pointVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Reference to displacement field
|
||||||
|
pointVectorField& displacement();
|
||||||
|
|
||||||
|
//- Reference to displacement field
|
||||||
|
const pointVectorField& displacement() const;
|
||||||
|
|
||||||
|
//- Reference to scale field
|
||||||
|
const pointScalarField& scale() const;
|
||||||
|
|
||||||
|
//- Starting mesh position
|
||||||
|
const pointField& oldPoints() const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -120,7 +120,11 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateCoeffs();
|
// Note: we use evaluate() here to trigger updateCoeffs followed
|
||||||
|
// by re-setting of fvatchfield::updated_ flag. This is
|
||||||
|
// so if first use is in the next time step it retriggers
|
||||||
|
// a new update.
|
||||||
|
this->evaluate(Pstream::blocking);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,22 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
endAverage_(pTraits<Type>::zero)
|
endAverage_(pTraits<Type>::zero)
|
||||||
{
|
{
|
||||||
dict.readIfPresent("fieldTableName", fieldTableName_);
|
dict.readIfPresent("fieldTableName", fieldTableName_);
|
||||||
updateCoeffs();
|
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fixedValuePointPatchField<Type>::operator==
|
||||||
|
(
|
||||||
|
Field<Type>("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Note: use evaluate to do updateCoeffs followed by a reset
|
||||||
|
// of the pointPatchField::updated_ flag. This is
|
||||||
|
// so if first use is in the next time step it retriggers
|
||||||
|
// a new update.
|
||||||
|
pointPatchField<Type>::evaluate(Pstream::blocking);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,5 +26,11 @@ $(autoHexMesh)/shellSurfaces/shellSurfaces.C
|
|||||||
$(autoHexMesh)/trackedParticle/trackedParticle.C
|
$(autoHexMesh)/trackedParticle/trackedParticle.C
|
||||||
$(autoHexMesh)/trackedParticle/trackedParticleCloud.C
|
$(autoHexMesh)/trackedParticle/trackedParticleCloud.C
|
||||||
|
|
||||||
|
meshMover = $(autoHexMesh)/externalDisplacementMeshMover
|
||||||
|
$(meshMover)/displacementMeshMoverMotionSolver.C
|
||||||
|
$(meshMover)/externalDisplacementMeshMover.C
|
||||||
|
$(meshMover)/medialAxisMeshMover.C
|
||||||
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libautoMesh
|
LIB = $(FOAM_LIBBIN)/libautoMesh
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ Description
|
|||||||
#include "calculatedPointPatchFields.H"
|
#include "calculatedPointPatchFields.H"
|
||||||
#include "cyclicSlipPointPatchFields.H"
|
#include "cyclicSlipPointPatchFields.H"
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "localPointRegion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -833,7 +834,7 @@ Foam::autoLayerDriver::makeLayerDisplacementField
|
|||||||
|
|
||||||
forAll(numLayers, patchI)
|
forAll(numLayers, patchI)
|
||||||
{
|
{
|
||||||
// 0 layers: do not allow lslip so fixedValue 0
|
// 0 layers: do not allow slip so fixedValue 0
|
||||||
// >0 layers: fixedValue which gets adapted
|
// >0 layers: fixedValue which gets adapted
|
||||||
if (numLayers[patchI] >= 0)
|
if (numLayers[patchI] >= 0)
|
||||||
{
|
{
|
||||||
@ -2809,14 +2810,7 @@ void Foam::autoLayerDriver::mergePatchFacesUndo
|
|||||||
|
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
List<labelPair> couples
|
List<labelPair> couples(localPointRegion::findDuplicateFacePairs(mesh));
|
||||||
(
|
|
||||||
meshRefiner_.getDuplicateFaces // get all baffles
|
|
||||||
(
|
|
||||||
identity(mesh.nFaces()-mesh.nInternalFaces())
|
|
||||||
+ mesh.nInternalFaces()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
labelList duplicateFace(mesh.nFaces(), -1);
|
labelList duplicateFace(mesh.nFaces(), -1);
|
||||||
forAll(couples, i)
|
forAll(couples, i)
|
||||||
@ -3522,7 +3516,9 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset mesh points and start again
|
// Reset mesh points and start again
|
||||||
meshMover().movePoints(oldPoints);
|
mesh.movePoints(oldPoints);
|
||||||
|
// Update meshmover for change of mesh geometry
|
||||||
|
meshMover().movePoints();
|
||||||
meshMover().correct();
|
meshMover().correct();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,9 @@ class layerParameters;
|
|||||||
|
|
||||||
class autoLayerDriver
|
class autoLayerDriver
|
||||||
{
|
{
|
||||||
// Static data members
|
public:
|
||||||
|
|
||||||
|
// Public data types
|
||||||
|
|
||||||
//- Extrusion controls
|
//- Extrusion controls
|
||||||
enum extrudeMode
|
enum extrudeMode
|
||||||
@ -69,6 +71,7 @@ class autoLayerDriver
|
|||||||
/*!< faces locally */
|
/*!< faces locally */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
// Private classes
|
// Private classes
|
||||||
|
|
||||||
|
|||||||
@ -1756,19 +1756,10 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
|
|||||||
Info<< "Writing wanted-displacement mesh (possibly illegal) to "
|
Info<< "Writing wanted-displacement mesh (possibly illegal) to "
|
||||||
<< meshRefiner_.timeName() << endl;
|
<< meshRefiner_.timeName() << endl;
|
||||||
pointField oldPoints(mesh.points());
|
pointField oldPoints(mesh.points());
|
||||||
vectorField totalDisp
|
|
||||||
(
|
meshRefiner_.mesh().movePoints(meshMover.curPoints());
|
||||||
meshMover.scale().internalField()
|
// Warn meshMover for changed geometry
|
||||||
* displacement.internalField()
|
meshMover.movePoints();
|
||||||
);
|
|
||||||
syncTools::syncPointList
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
totalDisp,
|
|
||||||
minMagSqrEqOp<point>(),
|
|
||||||
vector(GREAT, GREAT, GREAT)
|
|
||||||
);
|
|
||||||
meshMover.movePoints((mesh.points()+totalDisp)());
|
|
||||||
|
|
||||||
// Above move will have changed the instance only on the points (which
|
// Above move will have changed the instance only on the points (which
|
||||||
// is correct).
|
// is correct).
|
||||||
@ -1791,7 +1782,11 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
|
|||||||
dispVec.write();
|
dispVec.write();
|
||||||
medialDist.write();
|
medialDist.write();
|
||||||
medialRatio.write();
|
medialRatio.write();
|
||||||
meshMover.movePoints(oldPoints);
|
|
||||||
|
// Move mesh back
|
||||||
|
meshRefiner_.mesh().movePoints(oldPoints);
|
||||||
|
// Warn meshMover for changed geometry
|
||||||
|
meshMover.movePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ License
|
|||||||
#include "mapDistributePolyMesh.H"
|
#include "mapDistributePolyMesh.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
#include "snapParameters.H"
|
#include "snapParameters.H"
|
||||||
|
#include "localPointRegion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1036,19 +1037,11 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
|
|||||||
|
|
||||||
|
|
||||||
// Merge all baffles that are still remaining after duplicating points.
|
// Merge all baffles that are still remaining after duplicating points.
|
||||||
List<labelPair> couples
|
List<labelPair> couples(localPointRegion::findDuplicateFacePairs(mesh));
|
||||||
(
|
|
||||||
meshRefiner_.getDuplicateFaces // get all baffles
|
|
||||||
(
|
|
||||||
identity(mesh.nFaces()-mesh.nInternalFaces())
|
|
||||||
+ mesh.nInternalFaces()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label nCouples = returnReduce(couples.size(), sumOp<label>());
|
label nCouples = returnReduce(couples.size(), sumOp<label>());
|
||||||
|
|
||||||
Info<< "Detected unsplittable baffles : "
|
Info<< "Detected unsplittable baffles : " << nCouples << endl;
|
||||||
<< nCouples << endl;
|
|
||||||
|
|
||||||
if (nCouples > 0)
|
if (nCouples > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,136 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "displacementMeshMoverMotionSolver.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "localPointRegion.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(displacementMeshMoverMotionSolver, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
motionSolver,
|
||||||
|
displacementMeshMoverMotionSolver,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::displacementMeshMoverMotionSolver::displacementMeshMoverMotionSolver
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const IOdictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
displacementMotionSolver(mesh, dict, typeName) // read pointDisplacement
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::displacementMeshMoverMotionSolver::
|
||||||
|
~displacementMeshMoverMotionSolver()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
Foam::externalDisplacementMeshMover&
|
||||||
|
Foam::displacementMeshMoverMotionSolver::meshMover() const
|
||||||
|
{
|
||||||
|
if (!meshMoverPtr_.valid())
|
||||||
|
{
|
||||||
|
const word moverType(coeffDict().lookup("meshMover"));
|
||||||
|
|
||||||
|
meshMoverPtr_ = externalDisplacementMeshMover::New
|
||||||
|
(
|
||||||
|
moverType,
|
||||||
|
coeffDict().subDict(moverType + "Coeffs"),
|
||||||
|
localPointRegion::findDuplicateFacePairs(mesh()),
|
||||||
|
pointDisplacement_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return meshMoverPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::pointField>
|
||||||
|
Foam::displacementMeshMoverMotionSolver::curPoints() const
|
||||||
|
{
|
||||||
|
// Return actual points. Cannot do a reference since complains about
|
||||||
|
// assignment to self in polyMesh::movePoints
|
||||||
|
return tmp<pointField>(new pointField(mesh().points()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::displacementMeshMoverMotionSolver::solve()
|
||||||
|
{
|
||||||
|
// The points have moved so before calculation update
|
||||||
|
// the mesh and motionSolver accordingly
|
||||||
|
movePoints(mesh().points());
|
||||||
|
|
||||||
|
// Update any point motion bcs (e.g. timevarying)
|
||||||
|
pointDisplacement().boundaryField().updateCoeffs();
|
||||||
|
|
||||||
|
label nAllowableErrors = 0;
|
||||||
|
meshMover().move(nAllowableErrors);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::displacementMeshMoverMotionSolver::movePoints(const pointField& p)
|
||||||
|
{
|
||||||
|
displacementMotionSolver::movePoints(p);
|
||||||
|
|
||||||
|
// Update meshMover for new geometry
|
||||||
|
if (meshMoverPtr_.valid())
|
||||||
|
{
|
||||||
|
meshMover().movePoints(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::displacementMeshMoverMotionSolver::updateMesh
|
||||||
|
(
|
||||||
|
const mapPolyMesh& map
|
||||||
|
)
|
||||||
|
{
|
||||||
|
displacementMotionSolver::updateMesh(map);
|
||||||
|
|
||||||
|
// Update meshMover for new topology
|
||||||
|
meshMoverPtr_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,114 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::displacementMeshMoverMotionSolver
|
||||||
|
|
||||||
|
Description
|
||||||
|
Mesh motion solver for an fvMesh. Based on solving the cell-centre
|
||||||
|
Laplacian for the motion displacement.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
displacementMeshMoverMotionSolver.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef displacementMeshMoverMotionSolver_H
|
||||||
|
#define displacementMeshMoverMotionSolver_H
|
||||||
|
|
||||||
|
#include "displacementMotionSolver.H"
|
||||||
|
#include "externalDisplacementMeshMover.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class displacementMeshMoverMotionSolver Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class displacementMeshMoverMotionSolver
|
||||||
|
:
|
||||||
|
public displacementMotionSolver
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
mutable autoPtr<externalDisplacementMeshMover> meshMoverPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
displacementMeshMoverMotionSolver
|
||||||
|
(
|
||||||
|
const displacementMeshMoverMotionSolver&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const displacementMeshMoverMotionSolver&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("displacementMeshMover");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from polyMesh and IOdictionary
|
||||||
|
displacementMeshMoverMotionSolver(const polyMesh&, const IOdictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~displacementMeshMoverMotionSolver();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
externalDisplacementMeshMover& meshMover() const;
|
||||||
|
|
||||||
|
//- Return point location obtained from the current motion field
|
||||||
|
virtual tmp<pointField> curPoints() const;
|
||||||
|
|
||||||
|
//- Solve for motion
|
||||||
|
virtual void solve();
|
||||||
|
|
||||||
|
//- Update local data for geometry changes
|
||||||
|
virtual void movePoints(const pointField&);
|
||||||
|
|
||||||
|
//- Update topology
|
||||||
|
virtual void updateMesh(const mapPolyMesh&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "externalDisplacementMeshMover.H"
|
||||||
|
#include "mapPolyMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(externalDisplacementMeshMover, 0);
|
||||||
|
defineRunTimeSelectionTable(externalDisplacementMeshMover, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::externalDisplacementMeshMover::externalDisplacementMeshMover
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
pointVectorField& pointDisplacement
|
||||||
|
)
|
||||||
|
:
|
||||||
|
dict_(dict),
|
||||||
|
baffles_(baffles),
|
||||||
|
pointDisplacement_(pointDisplacement)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::externalDisplacementMeshMover>
|
||||||
|
Foam::externalDisplacementMeshMover::New
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& dict,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
pointVectorField& pointDisplacement
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< "Selecting externalDisplacementMeshMover " << type << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(type);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"externalDisplacementMeshMover::New(const word&"
|
||||||
|
", pointVectorField&, const List<labelPair>&"
|
||||||
|
", const dictionary&)"
|
||||||
|
) << "Unknown externalDisplacementMeshMover type "
|
||||||
|
<< type << nl << nl
|
||||||
|
<< "Valid externalDisplacementMeshMover types:" << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<externalDisplacementMeshMover>
|
||||||
|
(
|
||||||
|
cstrIter()(dict, baffles, pointDisplacement)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::externalDisplacementMeshMover::~externalDisplacementMeshMover()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::externalDisplacementMeshMover::movePoints(const pointField&)
|
||||||
|
{
|
||||||
|
// No local data to update
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::externalDisplacementMeshMover::updateMesh(const mapPolyMesh& mpm)
|
||||||
|
{
|
||||||
|
// Renumber baffles
|
||||||
|
DynamicList<labelPair> newBaffles(baffles_.size());
|
||||||
|
forAll(baffles_, i)
|
||||||
|
{
|
||||||
|
label f0 = mpm.reverseFaceMap()[baffles_[i].first()];
|
||||||
|
label f1 = mpm.reverseFaceMap()[baffles_[i].second()];
|
||||||
|
|
||||||
|
if (f0 >= 0 && f1 >= 0)
|
||||||
|
{
|
||||||
|
newBaffles.append(labelPair(f0, f1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newBaffles.shrink();
|
||||||
|
baffles_.transfer(newBaffles);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,180 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::externalDisplacementMeshMover
|
||||||
|
|
||||||
|
Description
|
||||||
|
Virtual base class for mesh movers with externally provided displacement
|
||||||
|
field giving the boundary conditions. Move the mesh from the current
|
||||||
|
location to a new location (so modify the mesh; v.s. motionSolver that
|
||||||
|
only returns the new location)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
externalDisplacementMeshMover.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef externalDisplacementMeshMover_H
|
||||||
|
#define externalDisplacementMeshMover_H
|
||||||
|
|
||||||
|
#include "pointFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class mapPolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class externalDisplacementMeshMover Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class externalDisplacementMeshMover
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Settings
|
||||||
|
dictionary dict_;
|
||||||
|
|
||||||
|
//- Baffles in the mesh
|
||||||
|
List<labelPair> baffles_;
|
||||||
|
|
||||||
|
//- Reference to point motion field
|
||||||
|
pointVectorField& pointDisplacement_;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
externalDisplacementMeshMover
|
||||||
|
(
|
||||||
|
const externalDisplacementMeshMover&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const externalDisplacementMeshMover&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("externalDisplacementMeshMover");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time New selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
externalDisplacementMeshMover,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
pointVectorField& pointDisplacement
|
||||||
|
),
|
||||||
|
(dict, baffles, pointDisplacement)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary and displacement field
|
||||||
|
externalDisplacementMeshMover
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
pointVectorField& pointDisplacement
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected meshMover model
|
||||||
|
static autoPtr<externalDisplacementMeshMover> New
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& dict,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
pointVectorField& pointDisplacement
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~externalDisplacementMeshMover();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return reference to the point motion displacement field
|
||||||
|
pointVectorField& pointDisplacement()
|
||||||
|
{
|
||||||
|
return pointDisplacement_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return const reference to the point motion displacement field
|
||||||
|
const pointVectorField& pointDisplacement() const
|
||||||
|
{
|
||||||
|
return pointDisplacement_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pointMesh& pMesh() const
|
||||||
|
{
|
||||||
|
return pointDisplacement_.mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
const polyMesh& mesh() const
|
||||||
|
{
|
||||||
|
return pMesh()();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mesh mover
|
||||||
|
|
||||||
|
//- Move mesh. Return true if succesful
|
||||||
|
virtual bool move(const label nAllowableErrors) = 0;
|
||||||
|
|
||||||
|
//- Update local data for geometry changes
|
||||||
|
virtual void movePoints(const pointField&);
|
||||||
|
|
||||||
|
//- Update local data for topology changes
|
||||||
|
virtual void updateMesh(const mapPolyMesh&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,355 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::medialAxisMeshMover
|
||||||
|
|
||||||
|
Description
|
||||||
|
Mesh motion solver that uses a medial axis algorithm to work
|
||||||
|
out a fraction between the (nearest point on a) moving surface
|
||||||
|
and the (nearest point on a) fixed surface.
|
||||||
|
This fraction is then used to scale the motion.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
medialAxisMeshMover.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef medialAxisMeshMover_H
|
||||||
|
#define medialAxisMeshMover_H
|
||||||
|
|
||||||
|
#include "externalDisplacementMeshMover.H"
|
||||||
|
#include "motionSmootherAlgo.H"
|
||||||
|
#include "autoLayerDriver.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class pointData;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class medialAxisMeshMover Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class medialAxisMeshMover
|
||||||
|
:
|
||||||
|
public externalDisplacementMeshMover
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
const labelList adaptPatchIDs_;
|
||||||
|
|
||||||
|
autoPtr<indirectPrimitivePatch> adaptPatchPtr_;
|
||||||
|
|
||||||
|
//- Scale factor for displacement
|
||||||
|
pointScalarField scale_;
|
||||||
|
|
||||||
|
//- Starting mesh position
|
||||||
|
pointField oldPoints_;
|
||||||
|
|
||||||
|
//- Mesh mover algorithm
|
||||||
|
motionSmootherAlgo meshMover_;
|
||||||
|
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
|
||||||
|
//- Smoothing wanted patch thickness
|
||||||
|
label nSmoothPatchThickness_;
|
||||||
|
|
||||||
|
//- (lambda-mu) smoothing of internal displacement
|
||||||
|
label nSmoothDisplacement_;
|
||||||
|
|
||||||
|
//- Layer thickness too big
|
||||||
|
scalar maxThicknessToMedialRatio_;
|
||||||
|
|
||||||
|
//- Feature angle when to stop adding layers
|
||||||
|
scalar featureAngle_;
|
||||||
|
|
||||||
|
//- Stop layer growth where mesh wraps around sharp edge
|
||||||
|
scalar minCosLayerTermination_;
|
||||||
|
|
||||||
|
//- Smooth internal normals
|
||||||
|
label nSmoothNormals_;
|
||||||
|
|
||||||
|
//- Smooth surface normals
|
||||||
|
label nSmoothSurfaceNormals_;
|
||||||
|
|
||||||
|
//- When is medial axis
|
||||||
|
scalar minMedianAxisAngleCos_;
|
||||||
|
|
||||||
|
//- When to slip along wall
|
||||||
|
scalar slipFeatureAngle_;
|
||||||
|
|
||||||
|
//- Number of attempts shrinking the mesh
|
||||||
|
label nSnap_;
|
||||||
|
|
||||||
|
|
||||||
|
// Pre-calculated medial axis information
|
||||||
|
|
||||||
|
//- normal of nearest wall. Where this normal changes direction
|
||||||
|
// defines the medial axis
|
||||||
|
pointVectorField dispVec_;
|
||||||
|
|
||||||
|
//- ratio of medial distance to wall distance.
|
||||||
|
// (1 at wall, 0 at medial axis)
|
||||||
|
pointScalarField medialRatio_;
|
||||||
|
|
||||||
|
//- Distance to nearest medial axis point
|
||||||
|
pointScalarField medialDist_;
|
||||||
|
|
||||||
|
//- Location on nearest medial axis point
|
||||||
|
pointVectorField medialVec_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
const dictionary& coeffDict() const;
|
||||||
|
|
||||||
|
const dictionary& meshQualityDict() const;
|
||||||
|
|
||||||
|
//- Read model coefficients
|
||||||
|
void read();
|
||||||
|
|
||||||
|
//- Extract fixed-value patchfields
|
||||||
|
static labelList getFixedValueBCs(const pointVectorField&);
|
||||||
|
|
||||||
|
//- Extract bc types. Replace fixedValue derivatives with fixedValue
|
||||||
|
wordList getPatchFieldTypes(const pointVectorField& fld);
|
||||||
|
|
||||||
|
//- Construct patch on selected patches
|
||||||
|
static autoPtr<indirectPrimitivePatch> getPatch
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Weighted sum (over all subset of mesh points) by
|
||||||
|
// summing contribution from (master) edges
|
||||||
|
template<class Type>
|
||||||
|
static void weightedSum
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
const labelList& meshEdges,
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const edgeList& edges,
|
||||||
|
const scalarField& edgeWeights,
|
||||||
|
const Field<Type>& data,
|
||||||
|
Field<Type>& sum
|
||||||
|
);
|
||||||
|
|
||||||
|
void calculateEdgeWeights
|
||||||
|
(
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
const labelList& meshEdges,
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const edgeList& edges,
|
||||||
|
scalarField& edgeWeights,
|
||||||
|
scalarField& invSumWeight
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Calculation of medial axis information
|
||||||
|
|
||||||
|
//- Smooth normals on patch
|
||||||
|
void smoothPatchNormals
|
||||||
|
(
|
||||||
|
const label nSmoothDisp,
|
||||||
|
const PackedBoolList& isMasterPoint,
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
const labelList& meshEdges,
|
||||||
|
pointField& normals
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Smooth normals on interior
|
||||||
|
void smoothNormals
|
||||||
|
(
|
||||||
|
const label nSmoothDisp,
|
||||||
|
const PackedBoolList& isMasterPoint,
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
const labelList& fixedPoints,
|
||||||
|
pointVectorField& normals
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Is mesh edge on a cusp of displacement
|
||||||
|
bool isMaxEdge
|
||||||
|
(
|
||||||
|
const List<pointData>& pointWallDist,
|
||||||
|
const label edgeI,
|
||||||
|
const scalar minCos
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Initialise medial axis
|
||||||
|
void update();
|
||||||
|
|
||||||
|
|
||||||
|
// Calculation of mesh movement
|
||||||
|
|
||||||
|
//- Unmark extrusion at given point
|
||||||
|
static bool unmarkExtrusion
|
||||||
|
(
|
||||||
|
const label patchPointI,
|
||||||
|
pointField& patchDisp,
|
||||||
|
List<autoLayerDriver::extrudeMode>& extrudeStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Synchronise extrusion
|
||||||
|
void syncPatchDisplacement
|
||||||
|
(
|
||||||
|
const scalarField& minThickness,
|
||||||
|
pointField& patchDisp,
|
||||||
|
List<autoLayerDriver::extrudeMode>& extrudeStatus
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void smoothLambdaMuDisplacement
|
||||||
|
(
|
||||||
|
const label nSmoothDisp,
|
||||||
|
const PackedBoolList& isMasterPoint,
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
vectorField& displacement
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void minSmoothField
|
||||||
|
(
|
||||||
|
const label nSmoothDisp,
|
||||||
|
const PackedBoolList& isMasterPoint,
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
const labelList& meshEdges,
|
||||||
|
const scalarField& fieldMin,
|
||||||
|
scalarField& field
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Stop layer growth at feature edges
|
||||||
|
void handleFeatureAngleLayerTerminations
|
||||||
|
(
|
||||||
|
const scalar minCos,
|
||||||
|
const PackedBoolList& isMasterPoint,
|
||||||
|
const labelList& meshEdges,
|
||||||
|
List<autoLayerDriver::extrudeMode>& extrudeStatus,
|
||||||
|
pointField& patchDisp,
|
||||||
|
label& nPointCounter
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Find isolated islands (points, edges and faces and layer
|
||||||
|
// terminations) in the layer mesh and stop any layer growth
|
||||||
|
// at these points
|
||||||
|
void findIsolatedRegions
|
||||||
|
(
|
||||||
|
const scalar minCosLayerTermination,
|
||||||
|
const PackedBoolList& isMasterPoint,
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
const labelList& meshEdges,
|
||||||
|
const scalarField& minThickness,
|
||||||
|
List<autoLayerDriver::extrudeMode>& extrudeStatus,
|
||||||
|
pointField& patchDisp
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Calculate desired displacement. Modifies per-patch displacement
|
||||||
|
// and calculates displacement for whole mesh
|
||||||
|
// (in pointDisplacement)
|
||||||
|
void calculateDisplacement
|
||||||
|
(
|
||||||
|
const scalarField& minThickness,
|
||||||
|
List<autoLayerDriver::extrudeMode>& extrudeStatus,
|
||||||
|
pointField& patchDisp
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Move mesh according to calculated displacement
|
||||||
|
bool shrinkMesh
|
||||||
|
(
|
||||||
|
const dictionary& meshQualityDict,
|
||||||
|
const label nAllowableErrors
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
medialAxisMeshMover
|
||||||
|
(
|
||||||
|
const medialAxisMeshMover&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const medialAxisMeshMover&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("displacementMedialAxis");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary and displacement field
|
||||||
|
medialAxisMeshMover
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const List<labelPair>& baffles,
|
||||||
|
pointVectorField& pointDisplacement
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~medialAxisMeshMover();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Move mesh. Return true if succesful
|
||||||
|
virtual bool move(const label nAllowableErrors);
|
||||||
|
|
||||||
|
//- Update local data for geometry changes
|
||||||
|
virtual void movePoints(const pointField&);
|
||||||
|
|
||||||
|
//- Update local data for topology changes
|
||||||
|
virtual void updateMesh(const mapPolyMesh&)
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"medialAxisMeshMover::updateMesh"
|
||||||
|
"(const mapPolyMesh&)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "medialAxisMeshMoverTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "medialAxisMeshMover.H"
|
||||||
|
#include "syncTools.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::medialAxisMeshMover::weightedSum
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const PackedBoolList& isMasterEdge,
|
||||||
|
const labelList& meshEdges,
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const edgeList& edges,
|
||||||
|
const scalarField& edgeWeights,
|
||||||
|
const Field<Type>& pointData,
|
||||||
|
Field<Type>& sum
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
mesh.nEdges() != isMasterEdge.size()
|
||||||
|
|| edges.size() != meshEdges.size()
|
||||||
|
|| edges.size() != edgeWeights.size()
|
||||||
|
|| meshPoints.size() != pointData.size()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn("medialAxisMeshMover::weightedSum(..)")
|
||||||
|
<< "Inconsistent sizes for edge or point data:"
|
||||||
|
<< " meshEdges:" << meshEdges.size()
|
||||||
|
<< " isMasterEdge:" << isMasterEdge.size()
|
||||||
|
<< " edgeWeights:" << edgeWeights.size()
|
||||||
|
<< " edges:" << edges.size()
|
||||||
|
<< " pointData:" << pointData.size()
|
||||||
|
<< " meshPoints:" << meshPoints.size()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
sum.setSize(meshPoints.size());
|
||||||
|
sum = pTraits<Type>::zero;
|
||||||
|
|
||||||
|
forAll(edges, edgeI)
|
||||||
|
{
|
||||||
|
if (isMasterEdge.get(meshEdges[edgeI]) == 1)
|
||||||
|
{
|
||||||
|
const edge& e = edges[edgeI];
|
||||||
|
|
||||||
|
scalar eWeight = edgeWeights[edgeI];
|
||||||
|
|
||||||
|
label v0 = e[0];
|
||||||
|
label v1 = e[1];
|
||||||
|
|
||||||
|
sum[v0] += eWeight*pointData[v1];
|
||||||
|
sum[v1] += eWeight*pointData[v0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
syncTools::syncPointList
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
meshPoints,
|
||||||
|
sum,
|
||||||
|
plusEqOp<Type>(),
|
||||||
|
pTraits<Type>::zero // null value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1519,10 +1519,9 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
|
|||||||
labelList coupledFace(mesh_.nFaces(), -1);
|
labelList coupledFace(mesh_.nFaces(), -1);
|
||||||
{
|
{
|
||||||
// Get boundary baffles that need to stay together
|
// Get boundary baffles that need to stay together
|
||||||
List<labelPair> allCouples = getDuplicateFaces
|
List<labelPair> allCouples
|
||||||
(
|
(
|
||||||
identity(nBnd)
|
localPointRegion::findDuplicateFacePairs(mesh_)
|
||||||
+mesh_.nInternalFaces()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Merge with any couples from
|
// Merge with any couples from
|
||||||
@ -2229,6 +2228,36 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::meshRefinement::findRegion
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& cellToRegion,
|
||||||
|
const vector& perturbVec,
|
||||||
|
const point& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label regionI = -1;
|
||||||
|
label cellI = mesh.findCell(p);
|
||||||
|
if (cellI != -1)
|
||||||
|
{
|
||||||
|
regionI = cellToRegion[cellI];
|
||||||
|
}
|
||||||
|
reduce(regionI, maxOp<label>());
|
||||||
|
|
||||||
|
if (regionI == -1)
|
||||||
|
{
|
||||||
|
// See if we can perturb a bit
|
||||||
|
cellI = mesh.findCell(p+perturbVec);
|
||||||
|
if (cellI != -1)
|
||||||
|
{
|
||||||
|
regionI = cellToRegion[cellI];
|
||||||
|
}
|
||||||
|
reduce(regionI, maxOp<label>());
|
||||||
|
}
|
||||||
|
return regionI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
||||||
(
|
(
|
||||||
const labelList& globalToMasterPatch,
|
const labelList& globalToMasterPatch,
|
||||||
@ -2247,16 +2276,13 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
|||||||
|
|
||||||
regionSplit cellRegion(mesh_, blockedFace);
|
regionSplit cellRegion(mesh_, blockedFace);
|
||||||
|
|
||||||
label regionI = -1;
|
label regionI = findRegion
|
||||||
|
(
|
||||||
label cellI = mesh_.findCell(keepPoint);
|
mesh_,
|
||||||
|
cellRegion,
|
||||||
if (cellI != -1)
|
mergeDistance_*vector(1,1,1), // note:1,1,1 should really be normalised
|
||||||
{
|
keepPoint
|
||||||
regionI = cellRegion[cellI];
|
);
|
||||||
}
|
|
||||||
|
|
||||||
reduce(regionI, maxOp<label>());
|
|
||||||
|
|
||||||
if (regionI == -1)
|
if (regionI == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -853,10 +853,6 @@ public:
|
|||||||
List<labelPair>&
|
List<labelPair>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return a list of coupled face pairs, i.e. faces that
|
|
||||||
// use the same vertices.
|
|
||||||
List<labelPair> getDuplicateFaces(const labelList& testFaces) const;
|
|
||||||
|
|
||||||
//- Merge baffles. Gets pairs of faces.
|
//- Merge baffles. Gets pairs of faces.
|
||||||
autoPtr<mapPolyMesh> mergeBaffles(const List<labelPair>&);
|
autoPtr<mapPolyMesh> mergeBaffles(const List<labelPair>&);
|
||||||
|
|
||||||
@ -894,6 +890,15 @@ public:
|
|||||||
//- Select coupled faces that are not collocated
|
//- Select coupled faces that are not collocated
|
||||||
void selectSeparatedCoupledFaces(boolList&) const;
|
void selectSeparatedCoupledFaces(boolList&) const;
|
||||||
|
|
||||||
|
//- Find region cell is in. Uses optional perturbation to re-test.
|
||||||
|
static label findRegion
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const labelList& cellRegion,
|
||||||
|
const vector& perturbVec,
|
||||||
|
const point& p
|
||||||
|
);
|
||||||
|
|
||||||
//- Split mesh. Keep part containing point.
|
//- Split mesh. Keep part containing point.
|
||||||
autoPtr<mapPolyMesh> splitMeshRegions
|
autoPtr<mapPolyMesh> splitMeshRegions
|
||||||
(
|
(
|
||||||
|
|||||||
@ -621,89 +621,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Return a list of coupled face pairs, i.e. faces that use the same vertices.
|
|
||||||
// (this information is recalculated instead of maintained since would be too
|
|
||||||
// hard across splitMeshRegions).
|
|
||||||
Foam::List<Foam::labelPair> Foam::meshRefinement::getDuplicateFaces
|
|
||||||
(
|
|
||||||
const labelList& testFaces
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
labelList duplicateFace
|
|
||||||
(
|
|
||||||
localPointRegion::findDuplicateFaces
|
|
||||||
(
|
|
||||||
mesh_,
|
|
||||||
testFaces
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
|
||||||
|
|
||||||
// Convert into list of coupled face pairs (mesh face labels).
|
|
||||||
List<labelPair> duplicateFaces(testFaces.size());
|
|
||||||
label dupI = 0;
|
|
||||||
|
|
||||||
forAll(duplicateFace, i)
|
|
||||||
{
|
|
||||||
label otherFaceI = duplicateFace[i];
|
|
||||||
|
|
||||||
if (otherFaceI != -1 && i < otherFaceI)
|
|
||||||
{
|
|
||||||
label meshFace0 = testFaces[i];
|
|
||||||
label patch0 = patches.whichPatch(meshFace0);
|
|
||||||
label meshFace1 = testFaces[otherFaceI];
|
|
||||||
label patch1 = patches.whichPatch(meshFace1);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(patch0 != -1 && isA<processorPolyPatch>(patches[patch0]))
|
|
||||||
|| (patch1 != -1 && isA<processorPolyPatch>(patches[patch1]))
|
|
||||||
)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"meshRefinement::getDuplicateFaces"
|
|
||||||
"(const bool, const labelList&)"
|
|
||||||
) << "One of two duplicate faces is on"
|
|
||||||
<< " processorPolyPatch."
|
|
||||||
<< "This is not allowed." << nl
|
|
||||||
<< "Face:" << meshFace0
|
|
||||||
<< " is on patch:" << patches[patch0].name()
|
|
||||||
<< nl
|
|
||||||
<< "Face:" << meshFace1
|
|
||||||
<< " is on patch:" << patches[patch1].name()
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
duplicateFaces[dupI++] = labelPair(meshFace0, meshFace1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
duplicateFaces.setSize(dupI);
|
|
||||||
|
|
||||||
Info<< "getDuplicateFaces : found " << returnReduce(dupI, sumOp<label>())
|
|
||||||
<< " pairs of duplicate faces." << nl << endl;
|
|
||||||
|
|
||||||
|
|
||||||
if (debug&MESH)
|
|
||||||
{
|
|
||||||
faceSet duplicateFaceSet(mesh_, "duplicateFaces", 2*dupI);
|
|
||||||
|
|
||||||
forAll(duplicateFaces, i)
|
|
||||||
{
|
|
||||||
duplicateFaceSet.insert(duplicateFaces[i][0]);
|
|
||||||
duplicateFaceSet.insert(duplicateFaces[i][1]);
|
|
||||||
}
|
|
||||||
Pout<< "Writing duplicate faces (baffles) to faceSet "
|
|
||||||
<< duplicateFaceSet.name() << nl << endl;
|
|
||||||
duplicateFaceSet.instance() = timeName();
|
|
||||||
duplicateFaceSet.write();
|
|
||||||
}
|
|
||||||
|
|
||||||
return duplicateFaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
||||||
(
|
(
|
||||||
const labelList& globalToMasterPatch,
|
const labelList& globalToMasterPatch,
|
||||||
@ -1464,18 +1381,16 @@ void Foam::meshRefinement::findCellZoneInsideWalk
|
|||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Find the region containing the insidePoint
|
// Find the region containing the insidePoint
|
||||||
label keepRegionI = -1;
|
label keepRegionI = findRegion
|
||||||
|
(
|
||||||
label cellI = mesh_.findCell(insidePoint);
|
mesh_,
|
||||||
|
cellRegion,
|
||||||
if (cellI != -1)
|
mergeDistance_*vector(1,1,1),
|
||||||
{
|
insidePoint
|
||||||
keepRegionI = cellRegion[cellI];
|
);
|
||||||
}
|
|
||||||
reduce(keepRegionI, maxOp<label>());
|
|
||||||
|
|
||||||
Info<< "For surface " << surfaces_.names()[surfI]
|
Info<< "For surface " << surfaces_.names()[surfI]
|
||||||
<< " found point " << insidePoint << " in cell " << cellI
|
<< " found point " << insidePoint
|
||||||
<< " in global region " << keepRegionI
|
<< " in global region " << keepRegionI
|
||||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||||
|
|
||||||
@ -1631,19 +1546,16 @@ void Foam::meshRefinement::findCellZoneTopo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Find the region containing the keepPoint
|
// Find the region containing the keepPoint
|
||||||
label keepRegionI = -1;
|
label keepRegionI = findRegion
|
||||||
|
(
|
||||||
|
mesh_,
|
||||||
|
cellRegion,
|
||||||
|
mergeDistance_*vector(1,1,1),
|
||||||
|
keepPoint
|
||||||
|
);
|
||||||
|
|
||||||
label cellI = mesh_.findCell(keepPoint);
|
Info<< "Found point " << keepPoint
|
||||||
|
|
||||||
if (cellI != -1)
|
|
||||||
{
|
|
||||||
keepRegionI = cellRegion[cellI];
|
|
||||||
}
|
|
||||||
reduce(keepRegionI, maxOp<label>());
|
|
||||||
|
|
||||||
Info<< "Found point " << keepPoint << " in cell " << cellI
|
|
||||||
<< " in global region " << keepRegionI
|
<< " in global region " << keepRegionI
|
||||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||||
|
|
||||||
@ -2621,11 +2533,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
(
|
(
|
||||||
freeStandingBaffles // filter out freestanding baffles
|
freeStandingBaffles // filter out freestanding baffles
|
||||||
(
|
(
|
||||||
getDuplicateFaces // get all baffles
|
localPointRegion::findDuplicateFacePairs(mesh_),
|
||||||
(
|
|
||||||
identity(mesh_.nFaces()-mesh_.nInternalFaces())
|
|
||||||
+mesh_.nInternalFaces()
|
|
||||||
),
|
|
||||||
planarAngle
|
planarAngle
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -2713,17 +2621,15 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
|||||||
blockedFace.clear();
|
blockedFace.clear();
|
||||||
|
|
||||||
// Find the region containing the keepPoint
|
// Find the region containing the keepPoint
|
||||||
label keepRegionI = -1;
|
label keepRegionI = findRegion
|
||||||
|
(
|
||||||
|
mesh_,
|
||||||
|
cellRegion,
|
||||||
|
mergeDistance_*vector(1,1,1),
|
||||||
|
keepPoint
|
||||||
|
);
|
||||||
|
|
||||||
label cellI = mesh_.findCell(keepPoint);
|
Info<< "Found point " << keepPoint
|
||||||
|
|
||||||
if (cellI != -1)
|
|
||||||
{
|
|
||||||
keepRegionI = cellRegion[cellI];
|
|
||||||
}
|
|
||||||
reduce(keepRegionI, maxOp<label>());
|
|
||||||
|
|
||||||
Info<< "Found point " << keepPoint << " in cell " << cellI
|
|
||||||
<< " in global region " << keepRegionI
|
<< " in global region " << keepRegionI
|
||||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||||
|
|
||||||
|
|||||||
@ -1204,6 +1204,7 @@ Foam::label Foam::meshRefinement::markSurfaceCurvatureRefinement
|
|||||||
|
|
||||||
|
|
||||||
// Bit of statistics
|
// Bit of statistics
|
||||||
|
if (debug)
|
||||||
{
|
{
|
||||||
label nSet = 0;
|
label nSet = 0;
|
||||||
label nNormals = 9;
|
label nNormals = 9;
|
||||||
|
|||||||
@ -585,6 +585,65 @@ Foam::labelList Foam::localPointRegion::findDuplicateFaces
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::List<Foam::labelPair> Foam::localPointRegion::findDuplicateFacePairs
|
||||||
|
(
|
||||||
|
const polyMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
// Faces to test: all boundary faces
|
||||||
|
labelList testFaces
|
||||||
|
(
|
||||||
|
identity(mesh.nFaces()-mesh.nInternalFaces())
|
||||||
|
+ mesh.nInternalFaces()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Find correspondencing baffle face (or -1)
|
||||||
|
const labelList duplicateFace(findDuplicateFaces(mesh, testFaces));
|
||||||
|
|
||||||
|
// Convert into list of coupled face pairs (mesh face labels).
|
||||||
|
DynamicList<labelPair> baffles(testFaces.size());
|
||||||
|
|
||||||
|
forAll(duplicateFace, i)
|
||||||
|
{
|
||||||
|
label otherFaceI = duplicateFace[i];
|
||||||
|
|
||||||
|
if (otherFaceI != -1 && i < otherFaceI)
|
||||||
|
{
|
||||||
|
label meshFace0 = testFaces[i];
|
||||||
|
label patch0 = patches.whichPatch(meshFace0);
|
||||||
|
label meshFace1 = testFaces[otherFaceI];
|
||||||
|
label patch1 = patches.whichPatch(meshFace1);
|
||||||
|
|
||||||
|
// Check for illegal topology. Should normally not happen!
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(patch0 != -1 && isA<processorPolyPatch>(patches[patch0]))
|
||||||
|
|| (patch1 != -1 && isA<processorPolyPatch>(patches[patch1]))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"localPointRegion::findDuplicateFacePairs(const polyMesh&)"
|
||||||
|
) << "One of two duplicate faces is on"
|
||||||
|
<< " processorPolyPatch."
|
||||||
|
<< "This is not allowed." << nl
|
||||||
|
<< "Face:" << meshFace0
|
||||||
|
<< " is on patch:" << patches[patch0].name()
|
||||||
|
<< nl
|
||||||
|
<< "Face:" << meshFace1
|
||||||
|
<< " is on patch:" << patches[patch1].name()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
baffles.append(labelPair(meshFace0, meshFace1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return baffles.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
|
void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|||||||
@ -48,6 +48,7 @@ SourceFiles
|
|||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
#include "faceList.H"
|
#include "faceList.H"
|
||||||
#include "boolList.H"
|
#include "boolList.H"
|
||||||
|
#include "labelPair.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -149,6 +150,9 @@ public:
|
|||||||
const labelList&
|
const labelList&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Helper routine to find all baffles (two boundary faces
|
||||||
|
// using the same points but in reverse order)
|
||||||
|
static labelPairList findDuplicateFacePairs(const polyMesh&);
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
|||||||
@ -209,6 +209,38 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
|
|||||||
nearestVertex_,
|
nearestVertex_,
|
||||||
nearestVertexWeight_
|
nearestVertexWeight_
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//if (debug)
|
||||||
|
//{
|
||||||
|
// forAll(sourcePoints, i)
|
||||||
|
// {
|
||||||
|
// Pout<< "source:" << i << " at:" << sourcePoints[i]
|
||||||
|
// << " 2d:" << localVertices[i]
|
||||||
|
// << endl;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// forAll(destPoints, i)
|
||||||
|
// {
|
||||||
|
// label v0 = nearestVertex_[i][0];
|
||||||
|
// label v1 = nearestVertex_[i][1];
|
||||||
|
// label v2 = nearestVertex_[i][2];
|
||||||
|
//
|
||||||
|
// Pout<< "For location " << destPoints[i]
|
||||||
|
// << " 2d:" << localFaceCentres[i]
|
||||||
|
// << " sampling vertices" << nl
|
||||||
|
// << " " << v0
|
||||||
|
// << " at:" << sourcePoints[v0]
|
||||||
|
// << " weight:" << nearestVertexWeight_[i][0] << nl
|
||||||
|
// << " " << v1
|
||||||
|
// << " at:" << sourcePoints[v1]
|
||||||
|
// << " weight:" << nearestVertexWeight_[i][1] << nl
|
||||||
|
// << " " << v2
|
||||||
|
// << " at:" << sourcePoints[v2]
|
||||||
|
// << " weight:" << nearestVertexWeight_[i][2] << nl
|
||||||
|
// << endl;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
@ -2745,6 +2745,12 @@ void Foam::triSurfaceTools::calcInterpolationWeights
|
|||||||
|
|
||||||
calcInterpolationWeights(tri, nearest.rawPoint(), weights);
|
calcInterpolationWeights(tri, nearest.rawPoint(), weights);
|
||||||
|
|
||||||
|
//Pout<< "calcScalingFactors : samplePt:" << samplePt
|
||||||
|
// << " distance:" << nearest.distance()
|
||||||
|
// << " to verts:" << verts
|
||||||
|
// << " weights:" << weights
|
||||||
|
// << endl;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1103,75 +1103,12 @@ void Foam::decompositionMethod::setConstraints
|
|||||||
<< "Keeping owner of faces in baffles "
|
<< "Keeping owner of faces in baffles "
|
||||||
<< " on same processor." << endl;
|
<< " on same processor." << endl;
|
||||||
|
|
||||||
// Faces to test: all boundary faces
|
explicitConnections = localPointRegion::findDuplicateFacePairs(mesh);
|
||||||
labelList testFaces
|
forAll(explicitConnections, i)
|
||||||
(
|
|
||||||
identity(mesh.nFaces()-mesh.nInternalFaces())
|
|
||||||
+ mesh.nInternalFaces()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Find correspondencing baffle face (or -1)
|
|
||||||
labelList duplicateFace
|
|
||||||
(
|
|
||||||
localPointRegion::findDuplicateFaces
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
testFaces
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
// Convert into list of coupled face pairs (mesh face labels).
|
|
||||||
explicitConnections.setSize(testFaces.size());
|
|
||||||
label dupI = 0;
|
|
||||||
|
|
||||||
forAll(duplicateFace, i)
|
|
||||||
{
|
{
|
||||||
label otherFaceI = duplicateFace[i];
|
blockedFace[explicitConnections[i].first()] = false;
|
||||||
|
blockedFace[explicitConnections[i].second()] = false;
|
||||||
if (otherFaceI != -1 && i < otherFaceI)
|
|
||||||
{
|
|
||||||
label meshFace0 = testFaces[i];
|
|
||||||
label patch0 = patches.whichPatch(meshFace0);
|
|
||||||
label meshFace1 = testFaces[otherFaceI];
|
|
||||||
label patch1 = patches.whichPatch(meshFace1);
|
|
||||||
|
|
||||||
// Check for illegal topology. Should normally not happen!
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(patch0 != -1 && isA<processorPolyPatch>(patches[patch0]))
|
|
||||||
|| (patch1 != -1 && isA<processorPolyPatch>(patches[patch1]))
|
|
||||||
)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"decompositionMethod::decompose(const polyMesh&)"
|
|
||||||
) << "One of two duplicate faces is on"
|
|
||||||
<< " processorPolyPatch."
|
|
||||||
<< "This is not allowed." << nl
|
|
||||||
<< "Face:" << meshFace0
|
|
||||||
<< " is on patch:" << patches[patch0].name()
|
|
||||||
<< nl
|
|
||||||
<< "Face:" << meshFace1
|
|
||||||
<< " is on patch:" << patches[patch1].name()
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
explicitConnections[dupI++] = labelPair(meshFace0, meshFace1);
|
|
||||||
if (blockedFace[meshFace0])
|
|
||||||
{
|
|
||||||
blockedFace[meshFace0] = false;
|
|
||||||
//nUnblocked++;
|
|
||||||
}
|
|
||||||
if (blockedFace[meshFace1])
|
|
||||||
{
|
|
||||||
blockedFace[meshFace1] = false;
|
|
||||||
//nUnblocked++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
explicitConnections.setSize(dupI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
if
|
||||||
@ -1256,161 +1193,6 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
const scalarField& cellWeights
|
const scalarField& cellWeights
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//labelHashSet sameProcFaces;
|
|
||||||
//
|
|
||||||
//if (decompositionDict_.found("preservePatches"))
|
|
||||||
//{
|
|
||||||
// wordList pNames(decompositionDict_.lookup("preservePatches"));
|
|
||||||
//
|
|
||||||
// Info<< nl
|
|
||||||
// << "Keeping owner of faces in patches " << pNames
|
|
||||||
// << " on same processor. This only makes sense for cyclics."
|
|
||||||
// << endl;
|
|
||||||
//
|
|
||||||
// const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
//
|
|
||||||
// forAll(pNames, i)
|
|
||||||
// {
|
|
||||||
// const label patchI = patches.findPatchID(pNames[i]);
|
|
||||||
//
|
|
||||||
// if (patchI == -1)
|
|
||||||
// {
|
|
||||||
// FatalErrorIn
|
|
||||||
// (
|
|
||||||
// "decompositionMethod::decompose(const polyMesh&)")
|
|
||||||
// << "Unknown preservePatch " << pNames[i]
|
|
||||||
// << endl << "Valid patches are " << patches.names()
|
|
||||||
// << exit(FatalError);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// const polyPatch& pp = patches[patchI];
|
|
||||||
//
|
|
||||||
// forAll(pp, i)
|
|
||||||
// {
|
|
||||||
// sameProcFaces.insert(pp.start() + i);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//if (decompositionDict_.found("preserveFaceZones"))
|
|
||||||
//{
|
|
||||||
// wordList zNames(decompositionDict_.lookup("preserveFaceZones"));
|
|
||||||
//
|
|
||||||
// Info<< nl
|
|
||||||
// << "Keeping owner and neighbour of faces in zones " << zNames
|
|
||||||
// << " on same processor" << endl;
|
|
||||||
//
|
|
||||||
// const faceZoneMesh& fZones = mesh.faceZones();
|
|
||||||
//
|
|
||||||
// forAll(zNames, i)
|
|
||||||
// {
|
|
||||||
// label zoneI = fZones.findZoneID(zNames[i]);
|
|
||||||
//
|
|
||||||
// if (zoneI == -1)
|
|
||||||
// {
|
|
||||||
// FatalErrorIn
|
|
||||||
// ("decompositionMethod::decompose(const polyMesh&)")
|
|
||||||
// << "Unknown preserveFaceZone " << zNames[i]
|
|
||||||
// << endl << "Valid faceZones are " << fZones.names()
|
|
||||||
// << exit(FatalError);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// const faceZone& fz = fZones[zoneI];
|
|
||||||
//
|
|
||||||
// forAll(fz, i)
|
|
||||||
// {
|
|
||||||
// sameProcFaces.insert(fz[i]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//// Specified processor for group of cells connected to faces
|
|
||||||
//
|
|
||||||
////- Sets of faces to move together
|
|
||||||
//PtrList<labelList> specifiedProcessorFaces;
|
|
||||||
////- Destination processor
|
|
||||||
//labelList specifiedProcessor;
|
|
||||||
//
|
|
||||||
//label nProcSets = 0;
|
|
||||||
//if (decompositionDict_.found("singleProcessorFaceSets"))
|
|
||||||
//{
|
|
||||||
// List<Tuple2<word, label> > zNameAndProcs
|
|
||||||
// (
|
|
||||||
// decompositionDict_.lookup("singleProcessorFaceSets")
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// specifiedProcessorFaces.setSize(zNameAndProcs.size());
|
|
||||||
// specifiedProcessor.setSize(zNameAndProcs.size());
|
|
||||||
//
|
|
||||||
// forAll(zNameAndProcs, setI)
|
|
||||||
// {
|
|
||||||
// Info<< "Keeping all cells connected to faceSet "
|
|
||||||
// << zNameAndProcs[setI].first()
|
|
||||||
// << " on processor " << zNameAndProcs[setI].second() << endl;
|
|
||||||
//
|
|
||||||
// // Read faceSet
|
|
||||||
// faceSet fz(mesh, zNameAndProcs[setI].first());
|
|
||||||
//
|
|
||||||
// specifiedProcessorFaces.set(setI, new labelList(fz.sortedToc()));
|
|
||||||
// specifiedProcessor[setI] = zNameAndProcs[setI].second();
|
|
||||||
// nProcSets += fz.size();
|
|
||||||
// }
|
|
||||||
// reduce(nProcSets, sumOp<label>());
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//label nUnblocked = returnReduce(sameProcFaces.size(), sumOp<label>());
|
|
||||||
//
|
|
||||||
//if (nProcSets+nUnblocked > 0)
|
|
||||||
//{
|
|
||||||
// Info<< "Constrained decomposition:" << endl
|
|
||||||
// << " faces with same owner and neighbour processor : "
|
|
||||||
// << nUnblocked << endl
|
|
||||||
// << " faces all on same processor : "
|
|
||||||
// << nProcSets << endl << endl;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//// Faces where owner and neighbour are not 'connected' (= all except
|
|
||||||
//// sameProcFaces)
|
|
||||||
//boolList blockedFace(mesh.nFaces(), true);
|
|
||||||
//{
|
|
||||||
// forAllConstIter(labelHashSet, sameProcFaces, iter)
|
|
||||||
// {
|
|
||||||
// blockedFace[iter.key()] = false;
|
|
||||||
// }
|
|
||||||
// syncTools::syncFaceList(mesh, blockedFace, andEqOp<bool>());
|
|
||||||
//
|
|
||||||
// // Add all point connected faces
|
|
||||||
// boolList procFacePoint(mesh.nPoints(), false);
|
|
||||||
// forAll(specifiedProcessorFaces, setI)
|
|
||||||
// {
|
|
||||||
// const labelList& set = specifiedProcessorFaces[setI];
|
|
||||||
// forAll(set, fI)
|
|
||||||
// {
|
|
||||||
// const face& f = mesh.faces()[set[fI]];
|
|
||||||
// forAll(f, fp)
|
|
||||||
// {
|
|
||||||
// procFacePoint[f[fp]] = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// syncTools::syncPointList(mesh, procFacePoint, orEqOp<bool>(), false);
|
|
||||||
//
|
|
||||||
// forAll(procFacePoint, pointI)
|
|
||||||
// {
|
|
||||||
// if (procFacePoint[pointI])
|
|
||||||
// {
|
|
||||||
// const labelList& pFaces = mesh.pointFaces()[pointI];
|
|
||||||
// forAll(pFaces, i)
|
|
||||||
// {
|
|
||||||
// blockedFace[pFaces[i]] = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// syncTools::syncFaceList(mesh, blockedFace, andEqOp<bool>());
|
|
||||||
//}
|
|
||||||
|
|
||||||
boolList blockedFace;
|
boolList blockedFace;
|
||||||
PtrList<labelList> specifiedProcessorFaces;
|
PtrList<labelList> specifiedProcessorFaces;
|
||||||
labelList specifiedProcessor;
|
labelList specifiedProcessor;
|
||||||
|
|||||||
@ -36,4 +36,6 @@ yPlusLES/yPlusLESFunctionObject.C
|
|||||||
yPlusRAS/yPlusRAS.C
|
yPlusRAS/yPlusRAS.C
|
||||||
yPlusRAS/yPlusRASFunctionObject.C
|
yPlusRAS/yPlusRASFunctionObject.C
|
||||||
|
|
||||||
|
setTimeStep/setTimeStepFunctionObject.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
||||||
|
|||||||
@ -0,0 +1,152 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "setTimeStepFunctionObject.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(setTimeStepFunctionObject, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
setTimeStepFunctionObject,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::setTimeStepFunctionObject::setTimeStepFunctionObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
functionObject(name),
|
||||||
|
time_(runTime),
|
||||||
|
enabled_(true)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::setTimeStepFunctionObject::on()
|
||||||
|
{
|
||||||
|
enabled_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::setTimeStepFunctionObject::off()
|
||||||
|
{
|
||||||
|
enabled_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::setTimeStepFunctionObject::start()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::setTimeStepFunctionObject::execute(const bool forceWrite)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::setTimeStepFunctionObject::end()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::setTimeStepFunctionObject::timeSet()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::setTimeStepFunctionObject::adjustTimeStep()
|
||||||
|
{
|
||||||
|
if (enabled())
|
||||||
|
{
|
||||||
|
// Wanted timestep
|
||||||
|
scalar newDeltaT = timeStepPtr_().value(time_.timeOutputValue());
|
||||||
|
|
||||||
|
const_cast<Time&>(time()).setDeltaT(newDeltaT, false);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::setTimeStepFunctionObject::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
enabled_ = dict.lookupOrDefault("enabled", true);
|
||||||
|
|
||||||
|
if (enabled_)
|
||||||
|
{
|
||||||
|
timeStepPtr_ = DataEntry<scalar>::New("deltaT", dict);
|
||||||
|
|
||||||
|
// Check that time has adjustTimeStep
|
||||||
|
const dictionary& controlDict = time_.controlDict();
|
||||||
|
|
||||||
|
Switch adjust;
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!controlDict.readIfPresent<Switch>("adjustTimeStep", adjust)
|
||||||
|
|| !adjust
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalIOErrorIn("setTimeStep::read(const dictionary&)", dict)
|
||||||
|
<< "Need to have 'adjustTimeStep' true to enable external"
|
||||||
|
<< " timestep control" << exit(FatalIOError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::setTimeStepFunctionObject::updateMesh(const mapPolyMesh& mpm)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::setTimeStepFunctionObject::movePoints(const polyMesh& mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,159 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::setTimeStepFunctionObject
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpUtilitiesFunctionObjects
|
||||||
|
|
||||||
|
Description
|
||||||
|
Overrides the timeStep. Can only be used with
|
||||||
|
solvers with adjustTimeStep control (e.g. pimpleFoam). Makes no attempt
|
||||||
|
to cooperate with other timeStep 'controllers' (maxCo, other
|
||||||
|
functionObjects). Supports 'enabled' flag but none of othe other ones
|
||||||
|
'timeStart', 'timeEnd', 'outputControl' etc.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
setTimeStepFunctionObject.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef setTimeStepFunctionObject_H
|
||||||
|
#define setTimeStepFunctionObject_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class setTimeStepFunctionObject Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class setTimeStepFunctionObject
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to the time database
|
||||||
|
const Time& time_;
|
||||||
|
|
||||||
|
|
||||||
|
// Optional user inputs
|
||||||
|
|
||||||
|
//- Switch for the execution - defaults to 'yes/on'
|
||||||
|
bool enabled_;
|
||||||
|
|
||||||
|
//- Time step
|
||||||
|
autoPtr<DataEntry<scalar> > timeStepPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
setTimeStepFunctionObject(const setTimeStepFunctionObject&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const setTimeStepFunctionObject&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("setTimeStep");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
setTimeStepFunctionObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return time database
|
||||||
|
virtual const Time& time() const
|
||||||
|
{
|
||||||
|
return time_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the enabled flag
|
||||||
|
virtual bool enabled() const
|
||||||
|
{
|
||||||
|
return enabled_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Function object control
|
||||||
|
|
||||||
|
//- Switch the function object on
|
||||||
|
virtual void on();
|
||||||
|
|
||||||
|
//- Switch the function object off
|
||||||
|
virtual void off();
|
||||||
|
|
||||||
|
|
||||||
|
//- Called at the start of the time-loop
|
||||||
|
virtual bool start();
|
||||||
|
|
||||||
|
//- Called at each ++ or += of the time-loop
|
||||||
|
virtual bool execute(const bool forceWrite);
|
||||||
|
|
||||||
|
//- Called when Time::run() determines that the time-loop exits
|
||||||
|
virtual bool end();
|
||||||
|
|
||||||
|
//- Called when time was set at the end of the Time::operator++
|
||||||
|
virtual bool timeSet();
|
||||||
|
|
||||||
|
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||||
|
virtual bool adjustTimeStep();
|
||||||
|
|
||||||
|
//- Read and set the function object if its data have changed
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void movePoints(const polyMesh& mesh);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -231,15 +231,15 @@ baffleThickness() const
|
|||||||
{
|
{
|
||||||
if (thickness_.size() != patch().size())
|
if (thickness_.size() != patch().size())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
" template<class solidType>"
|
" template<class solidType>"
|
||||||
" tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>"
|
" tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>"
|
||||||
" baffleThickness() const"
|
" baffleThickness() const",
|
||||||
|
solidDict_
|
||||||
)<< " Field thickness has not been specified "
|
)<< " Field thickness has not been specified "
|
||||||
<< " for patch " << this->patch().name()
|
<< " for patch " << this->patch().name()
|
||||||
<< " in dictionary " << solidDict_
|
<< exit(FatalIOError);
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return thickness_;
|
return thickness_;
|
||||||
@ -302,10 +302,15 @@ void thermalBaffle1DFvPatchScalarField<solidType>::autoMap
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
mixedFvPatchScalarField::autoMap(m);
|
mixedFvPatchScalarField::autoMap(m);
|
||||||
thickness_.autoMap(m);
|
|
||||||
Qs_.autoMap(m);
|
if (this->owner())
|
||||||
|
{
|
||||||
|
thickness_.autoMap(m);
|
||||||
|
Qs_.autoMap(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class solidType>
|
template<class solidType>
|
||||||
void thermalBaffle1DFvPatchScalarField<solidType>::rmap
|
void thermalBaffle1DFvPatchScalarField<solidType>::rmap
|
||||||
(
|
(
|
||||||
|
|||||||
@ -159,7 +159,7 @@ castellatedMeshControls
|
|||||||
// section reachable from the locationInMesh is kept.
|
// section reachable from the locationInMesh is kept.
|
||||||
// NOTE: This point should never be on a face, always inside a cell, even
|
// NOTE: This point should never be on a face, always inside a cell, even
|
||||||
// after refinement.
|
// after refinement.
|
||||||
locationInMesh (3 3 0.43);
|
locationInMesh (3.0001 3.0001 0.43);
|
||||||
|
|
||||||
|
|
||||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||||
@ -311,12 +311,11 @@ meshQualityControls
|
|||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
|
|
||||||
// Flags for optional output
|
// Write flags
|
||||||
// 0 : only write final meshes
|
writeFlags
|
||||||
// 1 : write intermediate meshes
|
(
|
||||||
// 2 : write volScalarField with cellLevel for postprocessing
|
layerFields // write volScalarField for layer coverage
|
||||||
// 4 : write current intersections as .obj files
|
);
|
||||||
debug 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||||
|
|||||||
Reference in New Issue
Block a user