mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into feature/cvMesh
This commit is contained in:
@ -56,6 +56,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolationMethodToWord
|
||||
method = "faceAreaWeightAMI";
|
||||
break;
|
||||
}
|
||||
case imPartialFaceAreaWeight:
|
||||
{
|
||||
method = "partialFaceAreaWeightAMI";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
@ -87,7 +92,15 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::wordTointerpolationMethod
|
||||
|
||||
wordList methods
|
||||
(
|
||||
IStringStream("(directAMI mapNearestAMI faceAreaWeightAMI)")()
|
||||
IStringStream
|
||||
(
|
||||
"("
|
||||
"directAMI "
|
||||
"mapNearestAMI "
|
||||
"faceAreaWeightAMI "
|
||||
"partialFaceAreaWeightAMI"
|
||||
")"
|
||||
)()
|
||||
);
|
||||
|
||||
if (im == "directAMI")
|
||||
@ -102,6 +115,10 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::wordTointerpolationMethod
|
||||
{
|
||||
method = imFaceAreaWeight;
|
||||
}
|
||||
else if (im == "partialFaceAreaWeightAMI")
|
||||
{
|
||||
method = imPartialFaceAreaWeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
@ -183,6 +200,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
|
||||
const labelListList& addr,
|
||||
scalarListList& wght,
|
||||
scalarField& wghtSum,
|
||||
const bool conformal,
|
||||
const bool output
|
||||
)
|
||||
{
|
||||
@ -191,12 +209,19 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
|
||||
forAll(wght, faceI)
|
||||
{
|
||||
scalarList& w = wght[faceI];
|
||||
scalar denom = patchAreas[faceI];
|
||||
|
||||
scalar s = sum(w);
|
||||
scalar t = s/patchAreas[faceI];
|
||||
scalar t = s/denom;
|
||||
|
||||
if (conformal)
|
||||
{
|
||||
denom = s;
|
||||
}
|
||||
|
||||
forAll(w, i)
|
||||
{
|
||||
w[i] /= s;
|
||||
w[i] /= denom;
|
||||
}
|
||||
|
||||
wghtSum[faceI] = t;
|
||||
@ -476,6 +501,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
|
||||
srcAddress,
|
||||
srcWeights,
|
||||
srcWeightsSum,
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
@ -749,7 +775,6 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
tgtMagSf_[faceI] = tgtPatch[faceI].mag(tgtPatch.points());
|
||||
}
|
||||
|
||||
|
||||
// Calculate if patches present on multiple processors
|
||||
singlePatchProc_ = calcDistribution(srcPatch, tgtPatch);
|
||||
|
||||
@ -794,32 +819,28 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
newTgtPoints
|
||||
);
|
||||
|
||||
|
||||
// calculate AMI interpolation
|
||||
{
|
||||
autoPtr<AMIMethod<SourcePatch, TargetPatch> > AMIPtr
|
||||
autoPtr<AMIMethod<SourcePatch, TargetPatch> > AMIPtr
|
||||
(
|
||||
AMIMethod<SourcePatch, TargetPatch>::New
|
||||
(
|
||||
AMIMethod<SourcePatch, TargetPatch>::New
|
||||
(
|
||||
interpolationMethodToWord(method_),
|
||||
srcPatch,
|
||||
newTgtPatch,
|
||||
srcMagSf_,
|
||||
tgtMagSf_,
|
||||
triMode_,
|
||||
reverseTarget_
|
||||
)
|
||||
);
|
||||
|
||||
AMIPtr->calculate
|
||||
(
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
tgtAddress_,
|
||||
tgtWeights_
|
||||
);
|
||||
}
|
||||
interpolationMethodToWord(method_),
|
||||
srcPatch,
|
||||
newTgtPatch,
|
||||
srcMagSf_,
|
||||
tgtMagSf_,
|
||||
triMode_,
|
||||
reverseTarget_
|
||||
)
|
||||
);
|
||||
|
||||
AMIPtr->calculate
|
||||
(
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
tgtAddress_,
|
||||
tgtWeights_
|
||||
);
|
||||
|
||||
// Now
|
||||
// ~~~
|
||||
@ -886,6 +907,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
srcWeightsSum_,
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
normaliseWeights
|
||||
@ -895,6 +917,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
tgtAddress_,
|
||||
tgtWeights_,
|
||||
tgtWeightsSum_,
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
|
||||
@ -903,7 +926,6 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
srcMapPtr_.reset(new mapDistribute(globalSrcFaces, tgtAddress_, cMap));
|
||||
tgtMapPtr_.reset(new mapDistribute(globalTgtFaces, srcAddress_, cMap));
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
writeFaceConnectivity(srcPatch, newTgtPatch, srcAddress_);
|
||||
@ -913,29 +935,27 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
{
|
||||
|
||||
// calculate AMI interpolation
|
||||
{
|
||||
autoPtr<AMIMethod<SourcePatch, TargetPatch> > AMIPtr
|
||||
autoPtr<AMIMethod<SourcePatch, TargetPatch> > AMIPtr
|
||||
(
|
||||
AMIMethod<SourcePatch, TargetPatch>::New
|
||||
(
|
||||
AMIMethod<SourcePatch, TargetPatch>::New
|
||||
(
|
||||
interpolationMethodToWord(method_),
|
||||
srcPatch,
|
||||
tgtPatch,
|
||||
srcMagSf_,
|
||||
tgtMagSf_,
|
||||
triMode_,
|
||||
reverseTarget_
|
||||
)
|
||||
);
|
||||
interpolationMethodToWord(method_),
|
||||
srcPatch,
|
||||
tgtPatch,
|
||||
srcMagSf_,
|
||||
tgtMagSf_,
|
||||
triMode_,
|
||||
reverseTarget_
|
||||
)
|
||||
);
|
||||
|
||||
AMIPtr->calculate
|
||||
(
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
tgtAddress_,
|
||||
tgtWeights_
|
||||
);
|
||||
}
|
||||
AMIPtr->calculate
|
||||
(
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
tgtAddress_,
|
||||
tgtWeights_
|
||||
);
|
||||
|
||||
normaliseWeights
|
||||
(
|
||||
@ -944,6 +964,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
srcWeightsSum_,
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
normaliseWeights
|
||||
@ -953,6 +974,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
tgtAddress_,
|
||||
tgtWeights_,
|
||||
tgtWeightsSum_,
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -88,7 +88,8 @@ public:
|
||||
{
|
||||
imDirect,
|
||||
imMapNearest,
|
||||
imFaceAreaWeight
|
||||
imFaceAreaWeight,
|
||||
imPartialFaceAreaWeight
|
||||
};
|
||||
|
||||
//- Convert interpolationMethod to word representation
|
||||
@ -236,6 +237,7 @@ private:
|
||||
const labelListList& addr,
|
||||
scalarListList& wght,
|
||||
scalarField& wghtSum,
|
||||
const bool conformal,
|
||||
const bool output
|
||||
);
|
||||
|
||||
|
||||
@ -41,24 +41,28 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::checkPatches() const
|
||||
}
|
||||
|
||||
|
||||
const scalar maxBoundsError = 0.05;
|
||||
|
||||
// check bounds of source and target
|
||||
boundBox bbSrc(srcPatch_.points(), srcPatch_.meshPoints(), true);
|
||||
boundBox bbTgt(tgtPatch_.points(), tgtPatch_.meshPoints(), true);
|
||||
|
||||
boundBox bbTgtInf(bbTgt);
|
||||
bbTgtInf.inflate(maxBoundsError);
|
||||
|
||||
if (!bbTgtInf.contains(bbSrc))
|
||||
if (conformal())
|
||||
{
|
||||
WarningIn("AMIMethod<SourcePatch, TargetPatch>::checkPatches()")
|
||||
<< "Source and target patch bounding boxes are not similar" << nl
|
||||
<< " source box span : " << bbSrc.span() << nl
|
||||
<< " target box span : " << bbTgt.span() << nl
|
||||
<< " source box : " << bbSrc << nl
|
||||
<< " target box : " << bbTgt << nl
|
||||
<< " inflated target box : " << bbTgtInf << endl;
|
||||
const scalar maxBoundsError = 0.05;
|
||||
|
||||
// check bounds of source and target
|
||||
boundBox bbSrc(srcPatch_.points(), srcPatch_.meshPoints(), true);
|
||||
boundBox bbTgt(tgtPatch_.points(), tgtPatch_.meshPoints(), true);
|
||||
|
||||
boundBox bbTgtInf(bbTgt);
|
||||
bbTgtInf.inflate(maxBoundsError);
|
||||
|
||||
if (!bbTgtInf.contains(bbSrc))
|
||||
{
|
||||
WarningIn("AMIMethod<SourcePatch, TargetPatch>::checkPatches()")
|
||||
<< "Source and target patch bounding boxes are not similar"
|
||||
<< nl
|
||||
<< " source box span : " << bbSrc.span() << nl
|
||||
<< " target box span : " << bbTgt.span() << nl
|
||||
<< " source box : " << bbSrc << nl
|
||||
<< " target box : " << bbTgt << nl
|
||||
<< " inflated target box : " << bbTgtInf << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,6 +78,8 @@ bool Foam::AMIMethod<SourcePatch, TargetPatch>::initialise
|
||||
label& tgtFaceI
|
||||
)
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
// set initial sizes for weights and addressing - must be done even if
|
||||
// returns false below
|
||||
srcAddress.setSize(srcPatch_.size());
|
||||
@ -241,17 +247,16 @@ Foam::label Foam::AMIMethod<SourcePatch, TargetPatch>::findTargetFace
|
||||
|
||||
pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea);
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Source point = " << srcPt << ", Sample point = "
|
||||
<< sample.hitPoint() << ", Sample index = " << sample.index()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (sample.hit())
|
||||
{
|
||||
targetFaceI = sample.index();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Source point = " << srcPt << ", Sample point = "
|
||||
<< sample.hitPoint() << ", Sample index = " << sample.index()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
return targetFaceI;
|
||||
@ -334,8 +339,6 @@ Foam::AMIMethod<SourcePatch, TargetPatch>::AMIMethod
|
||||
srcNonOverlap_(),
|
||||
triMode_(triMode)
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
label srcSize = returnReduce(srcPatch_.size(), sumOp<label>());
|
||||
label tgtSize = returnReduce(tgtPatch_.size(), sumOp<label>());
|
||||
|
||||
@ -352,4 +355,13 @@ Foam::AMIMethod<SourcePatch, TargetPatch>::~AMIMethod()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
bool Foam::AMIMethod<SourcePatch, TargetPatch>::conformal() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -207,6 +207,9 @@ public:
|
||||
// Note: this should be empty for correct functioning
|
||||
inline const labelList& srcNonOverlap() const;
|
||||
|
||||
//- Flag to indicate that interpolation patches are conformal
|
||||
virtual bool conformal() const;
|
||||
|
||||
|
||||
// Manipulation
|
||||
|
||||
|
||||
@ -25,7 +25,85 @@ License
|
||||
|
||||
#include "faceAreaWeightAMI.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
|
||||
(
|
||||
List<DynamicList<label> >& srcAddr,
|
||||
List<DynamicList<scalar> >& srcWght,
|
||||
List<DynamicList<label> >& tgtAddr,
|
||||
List<DynamicList<scalar> >& tgtWght,
|
||||
label srcFaceI,
|
||||
label tgtFaceI
|
||||
)
|
||||
{
|
||||
// construct weights and addressing
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label nFacesRemaining = srcAddr.size();
|
||||
|
||||
// list of tgt face neighbour faces
|
||||
DynamicList<label> nbrFaces(10);
|
||||
|
||||
// list of faces currently visited for srcFaceI to avoid multiple hits
|
||||
DynamicList<label> visitedFaces(10);
|
||||
|
||||
// list to keep track of tgt faces used to seed src faces
|
||||
labelList seedFaces(nFacesRemaining, -1);
|
||||
seedFaces[srcFaceI] = tgtFaceI;
|
||||
|
||||
// list to keep track of whether src face can be mapped
|
||||
boolList mapFlag(nFacesRemaining, true);
|
||||
|
||||
// reset starting seed
|
||||
label startSeedI = 0;
|
||||
|
||||
DynamicList<label> nonOverlapFaces;
|
||||
do
|
||||
{
|
||||
// Do advancing front starting from srcFaceI,tgtFaceI
|
||||
bool faceProcessed = processSourceFace
|
||||
(
|
||||
srcFaceI,
|
||||
tgtFaceI,
|
||||
|
||||
nbrFaces,
|
||||
visitedFaces,
|
||||
|
||||
srcAddr,
|
||||
srcWght,
|
||||
tgtAddr,
|
||||
tgtWght
|
||||
);
|
||||
|
||||
mapFlag[srcFaceI] = false;
|
||||
|
||||
nFacesRemaining--;
|
||||
|
||||
if (!faceProcessed)
|
||||
{
|
||||
nonOverlapFaces.append(srcFaceI);
|
||||
}
|
||||
|
||||
// choose new src face from current src face neighbour
|
||||
if (nFacesRemaining > 0)
|
||||
{
|
||||
setNextFaces
|
||||
(
|
||||
startSeedI,
|
||||
srcFaceI,
|
||||
tgtFaceI,
|
||||
mapFlag,
|
||||
seedFaces,
|
||||
visitedFaces
|
||||
);
|
||||
}
|
||||
} while (nFacesRemaining > 0);
|
||||
|
||||
this->srcNonOverlap_.transfer(nonOverlapFaces);
|
||||
}
|
||||
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
|
||||
@ -45,6 +123,11 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
|
||||
List<DynamicList<scalar> >& tgtWght
|
||||
)
|
||||
{
|
||||
if (tgtStartFaceI == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nbrFaces.clear();
|
||||
visitedFaces.clear();
|
||||
|
||||
@ -101,11 +184,15 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
|
||||
label& tgtFaceI,
|
||||
const boolList& mapFlag,
|
||||
labelList& seedFaces,
|
||||
const DynamicList<label>& visitedFaces
|
||||
const DynamicList<label>& visitedFaces,
|
||||
bool errorOnNotFound
|
||||
) const
|
||||
{
|
||||
const labelList& srcNbrFaces = this->srcPatch_.faceFaces()[srcFaceI];
|
||||
|
||||
// initialise tgtFaceI
|
||||
tgtFaceI = -1;
|
||||
|
||||
// set possible seeds for later use
|
||||
bool valuesSet = false;
|
||||
forAll(srcNbrFaces, i)
|
||||
@ -195,19 +282,23 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::"
|
||||
"setNextFaces"
|
||||
"("
|
||||
"label&, "
|
||||
"label&, "
|
||||
"label&, "
|
||||
"const boolList&, "
|
||||
"labelList&, "
|
||||
"const DynamicList<label>&"
|
||||
") const"
|
||||
) << "Unable to set source and target faces" << abort(FatalError);
|
||||
if (errorOnNotFound)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::"
|
||||
"setNextFaces"
|
||||
"("
|
||||
"label&, "
|
||||
"label&, "
|
||||
"label&, "
|
||||
"const boolList&, "
|
||||
"labelList&, "
|
||||
"const DynamicList<label>&, "
|
||||
"bool"
|
||||
") const"
|
||||
) << "Unable to set source and target faces" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,77 +538,21 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
|
||||
List<DynamicList<label> > tgtAddr(this->tgtPatch_.size());
|
||||
List<DynamicList<scalar> > tgtWght(tgtAddr.size());
|
||||
|
||||
calcAddressing
|
||||
(
|
||||
srcAddr,
|
||||
srcWght,
|
||||
tgtAddr,
|
||||
tgtWght,
|
||||
srcFaceI,
|
||||
tgtFaceI
|
||||
);
|
||||
|
||||
// construct weights and addressing
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label nFacesRemaining = srcAddr.size();
|
||||
|
||||
// list of tgt face neighbour faces
|
||||
DynamicList<label> nbrFaces(10);
|
||||
|
||||
// list of faces currently visited for srcFaceI to avoid multiple hits
|
||||
DynamicList<label> visitedFaces(10);
|
||||
|
||||
// list to keep track of tgt faces used to seed src faces
|
||||
labelList seedFaces(nFacesRemaining, -1);
|
||||
seedFaces[srcFaceI] = tgtFaceI;
|
||||
|
||||
// list to keep track of whether src face can be mapped
|
||||
boolList mapFlag(nFacesRemaining, true);
|
||||
|
||||
// reset starting seed
|
||||
label startSeedI = 0;
|
||||
|
||||
DynamicList<label> nonOverlapFaces;
|
||||
do
|
||||
if (this->srcNonOverlap_.size() != 0)
|
||||
{
|
||||
// Do advancing front starting from srcFaceI,tgtFaceI
|
||||
bool faceProcessed = processSourceFace
|
||||
(
|
||||
srcFaceI,
|
||||
tgtFaceI,
|
||||
|
||||
nbrFaces,
|
||||
visitedFaces,
|
||||
|
||||
srcAddr,
|
||||
srcWght,
|
||||
tgtAddr,
|
||||
tgtWght
|
||||
);
|
||||
|
||||
mapFlag[srcFaceI] = false;
|
||||
|
||||
nFacesRemaining--;
|
||||
|
||||
if (!faceProcessed)
|
||||
{
|
||||
nonOverlapFaces.append(srcFaceI);
|
||||
}
|
||||
|
||||
// choose new src face from current src face neighbour
|
||||
if (nFacesRemaining > 0)
|
||||
{
|
||||
setNextFaces
|
||||
(
|
||||
startSeedI,
|
||||
srcFaceI,
|
||||
tgtFaceI,
|
||||
mapFlag,
|
||||
seedFaces,
|
||||
visitedFaces
|
||||
);
|
||||
}
|
||||
} while (nFacesRemaining > 0);
|
||||
|
||||
if (nonOverlapFaces.size() != 0)
|
||||
{
|
||||
Pout<< " AMI: " << nonOverlapFaces.size()
|
||||
Pout<< " AMI: " << this->srcNonOverlap_.size()
|
||||
<< " non-overlap faces identified"
|
||||
<< endl;
|
||||
|
||||
this->srcNonOverlap_.transfer(nonOverlapFaces);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,9 +52,9 @@ class faceAreaWeightAMI
|
||||
public AMIMethod<SourcePatch, TargetPatch>
|
||||
{
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
// Private Member Functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faceAreaWeightAMI(const faceAreaWeightAMI&);
|
||||
@ -64,8 +64,19 @@ private:
|
||||
|
||||
// Marching front
|
||||
|
||||
//- Calculate addressing and weights using temporary storage
|
||||
virtual void calcAddressing
|
||||
(
|
||||
List<DynamicList<label> >& srcAddress,
|
||||
List<DynamicList<scalar> >& srcWeights,
|
||||
List<DynamicList<label> >& tgtAddress,
|
||||
List<DynamicList<scalar> >& tgtWeights,
|
||||
label srcFaceI,
|
||||
label tgtFaceI
|
||||
);
|
||||
|
||||
//- Determine overlap contributions for source face srcFaceI
|
||||
bool processSourceFace
|
||||
virtual bool processSourceFace
|
||||
(
|
||||
const label srcFaceI,
|
||||
const label tgtStartFaceI,
|
||||
@ -78,7 +89,7 @@ private:
|
||||
);
|
||||
|
||||
//- Attempt to re-evaluate source faces that have not been included
|
||||
void restartUncoveredSourceFace
|
||||
virtual void restartUncoveredSourceFace
|
||||
(
|
||||
List<DynamicList<label> >& srcAddr,
|
||||
List<DynamicList<scalar> >& srcWght,
|
||||
@ -87,21 +98,22 @@ private:
|
||||
);
|
||||
|
||||
//- Set the source and target seed faces
|
||||
void setNextFaces
|
||||
virtual void setNextFaces
|
||||
(
|
||||
label& startSeedI,
|
||||
label& srcFaceI,
|
||||
label& tgtFaceI,
|
||||
const boolList& mapFlag,
|
||||
labelList& seedFaces,
|
||||
const DynamicList<label>& visitedFaces
|
||||
const DynamicList<label>& visitedFaces,
|
||||
bool errorOnNotFound = true
|
||||
) const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Area of intersection between source and target faces
|
||||
scalar interArea
|
||||
virtual scalar interArea
|
||||
(
|
||||
const label srcFaceI,
|
||||
const label tgtFaceI
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "partialFaceAreaWeightAMI.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
|
||||
(
|
||||
label& startSeedI,
|
||||
label& srcFaceI,
|
||||
label& tgtFaceI,
|
||||
const boolList& mapFlag,
|
||||
labelList& seedFaces,
|
||||
const DynamicList<label>& visitedFaces,
|
||||
const bool errorOnNotFound
|
||||
) const
|
||||
{
|
||||
faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
|
||||
(
|
||||
startSeedI,
|
||||
srcFaceI,
|
||||
tgtFaceI,
|
||||
mapFlag,
|
||||
seedFaces,
|
||||
visitedFaces,
|
||||
false // no error on not found
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::
|
||||
partialFaceAreaWeightAMI
|
||||
(
|
||||
const SourcePatch& srcPatch,
|
||||
const TargetPatch& tgtPatch,
|
||||
const scalarField& srcMagSf,
|
||||
const scalarField& tgtMagSf,
|
||||
const faceAreaIntersect::triangulationMode& triMode,
|
||||
const bool reverseTarget
|
||||
)
|
||||
:
|
||||
faceAreaWeightAMI<SourcePatch, TargetPatch>
|
||||
(
|
||||
srcPatch,
|
||||
tgtPatch,
|
||||
srcMagSf,
|
||||
tgtMagSf,
|
||||
triMode,
|
||||
reverseTarget
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::
|
||||
~partialFaceAreaWeightAMI()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
bool Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::conformal() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
|
||||
(
|
||||
labelListList& srcAddress,
|
||||
scalarListList& srcWeights,
|
||||
labelListList& tgtAddress,
|
||||
scalarListList& tgtWeights,
|
||||
label srcFaceI,
|
||||
label tgtFaceI
|
||||
)
|
||||
{
|
||||
bool ok =
|
||||
this->initialise
|
||||
(
|
||||
srcAddress,
|
||||
srcWeights,
|
||||
tgtAddress,
|
||||
tgtWeights,
|
||||
srcFaceI,
|
||||
tgtFaceI
|
||||
);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// temporary storage for addressing and weights
|
||||
List<DynamicList<label> > srcAddr(this->srcPatch_.size());
|
||||
List<DynamicList<scalar> > srcWght(srcAddr.size());
|
||||
List<DynamicList<label> > tgtAddr(this->tgtPatch_.size());
|
||||
List<DynamicList<scalar> > tgtWght(tgtAddr.size());
|
||||
|
||||
faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
|
||||
(
|
||||
srcAddr,
|
||||
srcWght,
|
||||
tgtAddr,
|
||||
tgtWght,
|
||||
srcFaceI,
|
||||
tgtFaceI
|
||||
);
|
||||
|
||||
// transfer data to persistent storage
|
||||
forAll(srcAddr, i)
|
||||
{
|
||||
srcAddress[i].transfer(srcAddr[i]);
|
||||
srcWeights[i].transfer(srcWght[i]);
|
||||
}
|
||||
forAll(tgtAddr, i)
|
||||
{
|
||||
tgtAddress[i].transfer(tgtAddr[i]);
|
||||
tgtWeights[i].transfer(tgtWght[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,141 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::partialFaceAreaWeightAMI
|
||||
|
||||
Description
|
||||
Partial face area weighted Arbitrary Mesh Interface (AMI) method
|
||||
|
||||
SourceFiles
|
||||
partialFaceAreaWeightAMI.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef partialFaceAreaWeightAMI_H
|
||||
#define partialFaceAreaWeightAMI_H
|
||||
|
||||
#include "faceAreaWeightAMI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class partialFaceAreaWeightAMI Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
class partialFaceAreaWeightAMI
|
||||
:
|
||||
public faceAreaWeightAMI<SourcePatch, TargetPatch>
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
partialFaceAreaWeightAMI(const partialFaceAreaWeightAMI&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const partialFaceAreaWeightAMI&);
|
||||
|
||||
// Marching front
|
||||
|
||||
//- Set the source and target seed faces
|
||||
virtual void setNextFaces
|
||||
(
|
||||
label& startSeedI,
|
||||
label& srcFaceI,
|
||||
label& tgtFaceI,
|
||||
const boolList& mapFlag,
|
||||
labelList& seedFaces,
|
||||
const DynamicList<label>& visitedFaces,
|
||||
bool errorOnNotFound = true
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("partialFaceAreaWeightAMI");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
partialFaceAreaWeightAMI
|
||||
(
|
||||
const SourcePatch& srcPatch,
|
||||
const TargetPatch& tgtPatch,
|
||||
const scalarField& srcMagSf,
|
||||
const scalarField& tgtMagSf,
|
||||
const faceAreaIntersect::triangulationMode& triMode,
|
||||
const bool reverseTarget = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~partialFaceAreaWeightAMI();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Flag to indicate that interpolation patches are conformal
|
||||
virtual bool conformal() const;
|
||||
|
||||
|
||||
// Manipulation
|
||||
|
||||
//- Update addressing and weights
|
||||
virtual void calculate
|
||||
(
|
||||
labelListList& srcAddress,
|
||||
scalarListList& srcWeights,
|
||||
labelListList& tgtAddress,
|
||||
scalarListList& tgtWeights,
|
||||
label srcFaceI = -1,
|
||||
label tgtFaceI = -1
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "partialFaceAreaWeightAMI.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "directAMI.H"
|
||||
#include "mapNearestAMI.H"
|
||||
#include "faceAreaWeightAMI.H"
|
||||
#include "partialFaceAreaWeightAMI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,6 +39,7 @@ namespace Foam
|
||||
makeAMIMethodType(AMIPatchToPatchInterpolation, directAMI);
|
||||
makeAMIMethodType(AMIPatchToPatchInterpolation, mapNearestAMI);
|
||||
makeAMIMethodType(AMIPatchToPatchInterpolation, faceAreaWeightAMI);
|
||||
makeAMIMethodType(AMIPatchToPatchInterpolation, partialFaceAreaWeightAMI);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cyclicACMIGAMGInterfaceField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "lduMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cyclicACMIGAMGInterfaceField, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
GAMGInterfaceField,
|
||||
cyclicACMIGAMGInterfaceField,
|
||||
lduInterface
|
||||
);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
GAMGInterfaceField,
|
||||
cyclicACMIGAMGInterfaceField,
|
||||
lduInterfaceField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIGAMGInterfaceField::cyclicACMIGAMGInterfaceField
|
||||
(
|
||||
const GAMGInterface& GAMGCp,
|
||||
const lduInterfaceField& fineInterface
|
||||
)
|
||||
:
|
||||
GAMGInterfaceField(GAMGCp, fineInterface),
|
||||
cyclicACMIInterface_(refCast<const cyclicACMIGAMGInterface>(GAMGCp)),
|
||||
doTransform_(false),
|
||||
rank_(0)
|
||||
{
|
||||
const cyclicAMILduInterfaceField& p =
|
||||
refCast<const cyclicAMILduInterfaceField>(fineInterface);
|
||||
|
||||
doTransform_ = p.doTransform();
|
||||
rank_ = p.rank();
|
||||
}
|
||||
|
||||
|
||||
Foam::cyclicACMIGAMGInterfaceField::cyclicACMIGAMGInterfaceField
|
||||
(
|
||||
const GAMGInterface& GAMGCp,
|
||||
const bool doTransform,
|
||||
const int rank
|
||||
)
|
||||
:
|
||||
GAMGInterfaceField(GAMGCp, doTransform, rank),
|
||||
cyclicACMIInterface_(refCast<const cyclicACMIGAMGInterface>(GAMGCp)),
|
||||
doTransform_(doTransform),
|
||||
rank_(rank)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIGAMGInterfaceField::~cyclicACMIGAMGInterfaceField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicACMIGAMGInterfaceField::updateInterfaceMatrix
|
||||
(
|
||||
scalarField& result,
|
||||
const scalarField& psiInternal,
|
||||
const scalarField& coeffs,
|
||||
const direction cmpt,
|
||||
const Pstream::commsTypes
|
||||
) const
|
||||
{
|
||||
// Get neighbouring field
|
||||
scalarField pnf
|
||||
(
|
||||
cyclicACMIInterface_.neighbPatch().interfaceInternalField(psiInternal)
|
||||
);
|
||||
|
||||
// Transform according to the transformation tensors
|
||||
transformCoupleField(pnf, cmpt);
|
||||
|
||||
if (cyclicACMIInterface_.owner())
|
||||
{
|
||||
pnf = cyclicACMIInterface_.AMI().interpolateToSource(pnf);
|
||||
}
|
||||
else
|
||||
{
|
||||
pnf = cyclicACMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf);
|
||||
}
|
||||
|
||||
const labelUList& faceCells = cyclicACMIInterface_.faceCells();
|
||||
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,166 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cyclicACMIGAMGInterfaceField
|
||||
|
||||
Description
|
||||
GAMG agglomerated cyclic interface for Arbitrarily Coupled Mesh Interface
|
||||
(ACMI) fields.
|
||||
|
||||
SourceFiles
|
||||
cyclicACMIGAMGInterfaceField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMIGAMGInterfaceField_H
|
||||
#define cyclicACMIGAMGInterfaceField_H
|
||||
|
||||
#include "GAMGInterfaceField.H"
|
||||
#include "cyclicACMIGAMGInterface.H"
|
||||
#include "cyclicACMILduInterfaceField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicACMIGAMGInterfaceField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cyclicACMIGAMGInterfaceField
|
||||
:
|
||||
public GAMGInterfaceField,
|
||||
virtual public cyclicACMILduInterfaceField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference cast into the cyclic interface
|
||||
const cyclicACMIGAMGInterface& cyclicACMIInterface_;
|
||||
|
||||
//- Is the transform required
|
||||
bool doTransform_;
|
||||
|
||||
//- Rank of component for transformation
|
||||
int rank_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
cyclicACMIGAMGInterfaceField(const cyclicACMIGAMGInterfaceField&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const cyclicACMIGAMGInterfaceField&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclicACMI");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from GAMG interface and fine level interface field
|
||||
cyclicACMIGAMGInterfaceField
|
||||
(
|
||||
const GAMGInterface& GAMGCp,
|
||||
const lduInterfaceField& fineInterfaceField
|
||||
);
|
||||
|
||||
//- Construct from GAMG interface and fine level interface field
|
||||
cyclicACMIGAMGInterfaceField
|
||||
(
|
||||
const GAMGInterface& GAMGCp,
|
||||
const bool doTransform,
|
||||
const int rank
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicACMIGAMGInterfaceField();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return size
|
||||
label size() const
|
||||
{
|
||||
return cyclicACMIInterface_.size();
|
||||
}
|
||||
|
||||
|
||||
// Interface matrix update
|
||||
|
||||
//- Update result field based on interface functionality
|
||||
virtual void updateInterfaceMatrix
|
||||
(
|
||||
scalarField& result,
|
||||
const scalarField& psiInternal,
|
||||
const scalarField& coeffs,
|
||||
const direction cmpt,
|
||||
const Pstream::commsTypes commsType
|
||||
) const;
|
||||
|
||||
|
||||
//- Cyclic interface functions
|
||||
|
||||
//- Does the interface field perform the transfromation
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return doTransform_;
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return cyclicACMIInterface_.forwardT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
virtual const tensorField& reverseT() const
|
||||
{
|
||||
return cyclicACMIInterface_.reverseT();
|
||||
}
|
||||
|
||||
//- Return rank of component for transform
|
||||
virtual int rank() const
|
||||
{
|
||||
return rank_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,198 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "AMIInterpolation.H"
|
||||
#include "cyclicACMIGAMGInterface.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Map.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cyclicACMIGAMGInterface, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
GAMGInterface,
|
||||
cyclicACMIGAMGInterface,
|
||||
lduInterface
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIGAMGInterface::cyclicACMIGAMGInterface
|
||||
(
|
||||
const label index,
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex,
|
||||
const label coarseComm
|
||||
)
|
||||
:
|
||||
GAMGInterface
|
||||
(
|
||||
index,
|
||||
coarseInterfaces
|
||||
),
|
||||
fineCyclicACMIInterface_
|
||||
(
|
||||
refCast<const cyclicACMILduInterface>(fineInterface)
|
||||
)
|
||||
{
|
||||
// Construct face agglomeration from cell agglomeration
|
||||
{
|
||||
// From coarse face to cell
|
||||
DynamicList<label> dynFaceCells(localRestrictAddressing.size());
|
||||
|
||||
// From face to coarse face
|
||||
DynamicList<label> dynFaceRestrictAddressing
|
||||
(
|
||||
localRestrictAddressing.size()
|
||||
);
|
||||
|
||||
Map<label> masterToCoarseFace(localRestrictAddressing.size());
|
||||
|
||||
forAll(localRestrictAddressing, ffi)
|
||||
{
|
||||
label curMaster = localRestrictAddressing[ffi];
|
||||
|
||||
Map<label>::const_iterator fnd = masterToCoarseFace.find
|
||||
(
|
||||
curMaster
|
||||
);
|
||||
|
||||
if (fnd == masterToCoarseFace.end())
|
||||
{
|
||||
// New coarse face
|
||||
label coarseI = dynFaceCells.size();
|
||||
dynFaceRestrictAddressing.append(coarseI);
|
||||
dynFaceCells.append(curMaster);
|
||||
masterToCoarseFace.insert(curMaster, coarseI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Already have coarse face
|
||||
dynFaceRestrictAddressing.append(fnd());
|
||||
}
|
||||
}
|
||||
|
||||
faceCells_.transfer(dynFaceCells);
|
||||
faceRestrictAddressing_.transfer(dynFaceRestrictAddressing);
|
||||
}
|
||||
|
||||
|
||||
// On the owner side construct the AMI
|
||||
|
||||
if (fineCyclicACMIInterface_.owner())
|
||||
{
|
||||
// Construct the neighbour side agglomeration (as the neighbour would
|
||||
// do it so it the exact loop above using neighbourRestrictAddressing
|
||||
// instead of localRestrictAddressing)
|
||||
|
||||
labelList nbrFaceRestrictAddressing;
|
||||
{
|
||||
// From face to coarse face
|
||||
DynamicList<label> dynNbrFaceRestrictAddressing
|
||||
(
|
||||
neighbourRestrictAddressing.size()
|
||||
);
|
||||
|
||||
Map<label> masterToCoarseFace(neighbourRestrictAddressing.size());
|
||||
|
||||
forAll(neighbourRestrictAddressing, ffi)
|
||||
{
|
||||
label curMaster = neighbourRestrictAddressing[ffi];
|
||||
|
||||
Map<label>::const_iterator fnd = masterToCoarseFace.find
|
||||
(
|
||||
curMaster
|
||||
);
|
||||
|
||||
if (fnd == masterToCoarseFace.end())
|
||||
{
|
||||
// New coarse face
|
||||
label coarseI = masterToCoarseFace.size();
|
||||
dynNbrFaceRestrictAddressing.append(coarseI);
|
||||
masterToCoarseFace.insert(curMaster, coarseI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Already have coarse face
|
||||
dynNbrFaceRestrictAddressing.append(fnd());
|
||||
}
|
||||
}
|
||||
|
||||
nbrFaceRestrictAddressing.transfer(dynNbrFaceRestrictAddressing);
|
||||
}
|
||||
|
||||
amiPtr_.reset
|
||||
(
|
||||
new AMIPatchToPatchInterpolation
|
||||
(
|
||||
fineCyclicACMIInterface_.AMI(),
|
||||
faceRestrictAddressing_,
|
||||
nbrFaceRestrictAddressing
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIGAMGInterface::~cyclicACMIGAMGInterface()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::labelField>
|
||||
Foam::cyclicACMIGAMGInterface::internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes,
|
||||
const labelUList& iF
|
||||
) const
|
||||
{
|
||||
const cyclicACMIGAMGInterface& nbr =
|
||||
dynamic_cast<const cyclicACMIGAMGInterface&>(neighbPatch());
|
||||
const labelUList& nbrFaceCells = nbr.faceCells();
|
||||
|
||||
tmp<labelField> tpnf(new labelField(nbrFaceCells.size()));
|
||||
labelField& pnf = tpnf();
|
||||
|
||||
forAll(pnf, facei)
|
||||
{
|
||||
pnf[facei] = iF[nbrFaceCells[facei]];
|
||||
}
|
||||
|
||||
return tpnf;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,174 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cyclicACMIGAMGInterface
|
||||
|
||||
Description
|
||||
GAMG agglomerated cyclic ACMI interface.
|
||||
|
||||
SourceFiles
|
||||
cyclicACMIGAMGInterface.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMIGAMGInterface_H
|
||||
#define cyclicACMIGAMGInterface_H
|
||||
|
||||
#include "GAMGInterface.H"
|
||||
#include "cyclicACMILduInterface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicACMIGAMGInterface Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cyclicACMIGAMGInterface
|
||||
:
|
||||
public GAMGInterface,
|
||||
virtual public cyclicACMILduInterface
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference for the cyclicLduInterface from which this is
|
||||
// agglomerated
|
||||
const cyclicACMILduInterface& fineCyclicACMIInterface_;
|
||||
|
||||
//- AMI interface
|
||||
autoPtr<AMIPatchToPatchInterpolation> amiPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
cyclicACMIGAMGInterface(const cyclicACMIGAMGInterface&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const cyclicACMIGAMGInterface&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclicACMI");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from fine level interface,
|
||||
// local and neighbour restrict addressing
|
||||
cyclicACMIGAMGInterface
|
||||
(
|
||||
const label index,
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& restrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex,
|
||||
const label coarseComm
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicACMIGAMGInterface();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Interface transfer functions
|
||||
|
||||
//- Transfer and return internal field adjacent to the interface
|
||||
virtual tmp<labelField> internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& iF
|
||||
) const;
|
||||
|
||||
|
||||
//- Cyclic interface functions
|
||||
|
||||
//- Return neigbour processor number
|
||||
virtual label neighbPatchID() const
|
||||
{
|
||||
return fineCyclicACMIInterface_.neighbPatchID();
|
||||
}
|
||||
|
||||
virtual bool owner() const
|
||||
{
|
||||
return fineCyclicACMIInterface_.owner();
|
||||
}
|
||||
|
||||
virtual const cyclicACMIGAMGInterface& neighbPatch() const
|
||||
{
|
||||
return dynamic_cast<const cyclicACMIGAMGInterface&>
|
||||
(
|
||||
coarseInterfaces_[neighbPatchID()]
|
||||
);
|
||||
}
|
||||
|
||||
virtual const AMIPatchToPatchInterpolation& AMI() const
|
||||
{
|
||||
return amiPtr_();
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return fineCyclicACMIInterface_.forwardT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
virtual const tensorField& reverseT() const
|
||||
{
|
||||
return fineCyclicACMIInterface_.reverseT();
|
||||
}
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
//- Write to stream
|
||||
virtual void write(Ostream&) const
|
||||
{
|
||||
//TBD. How to serialise the AMI such that we can stream
|
||||
// cyclicACMIGAMGInterface.
|
||||
notImplemented
|
||||
(
|
||||
"cyclicACMIGAMGInterface::write(Ostream&) const"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cyclicACMILduInterface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cyclicACMILduInterface, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMILduInterface::~cyclicACMILduInterface()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cyclicACMILduInterface
|
||||
|
||||
Description
|
||||
An abstract base class for cyclic ACMI coupled interfaces
|
||||
|
||||
SourceFiles
|
||||
cyclicACMILduInterface.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMILduInterface_H
|
||||
#define cyclicACMILduInterface_H
|
||||
|
||||
#include "cyclicAMILduInterface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicACMILduInterface Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cyclicACMILduInterface
|
||||
:
|
||||
public cyclicAMILduInterface
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclicACMILduInterface");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
cyclicACMILduInterface()
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicACMILduInterface();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,55 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cyclicACMILduInterfaceField.H"
|
||||
#include "diagTensorField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cyclicACMILduInterfaceField, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMILduInterfaceField::~cyclicACMILduInterfaceField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicACMILduInterfaceField::transformCoupleField
|
||||
(
|
||||
scalarField& f,
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
cyclicAMILduInterfaceField::transformCoupleField(f, cmpt);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,108 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cyclicACMILduInterfaceField
|
||||
|
||||
Description
|
||||
Abstract base class for cyclic ACMI coupled interfaces
|
||||
|
||||
SourceFiles
|
||||
cyclicACMILduInterfaceField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMILduInterfaceField_H
|
||||
#define cyclicACMILduInterfaceField_H
|
||||
|
||||
#include "cyclicAMILduInterfaceField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicACMILduInterfaceField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cyclicACMILduInterfaceField
|
||||
:
|
||||
public cyclicAMILduInterfaceField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclicACMILduInterfaceField");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
cyclicACMILduInterfaceField()
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicACMILduInterfaceField();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Transform given patch field
|
||||
template<class Type>
|
||||
void transformCoupleField(Field<Type>& f) const;
|
||||
|
||||
//- Transform given patch internal field
|
||||
void transformCoupleField
|
||||
(
|
||||
scalarField& psiInternal,
|
||||
const direction cmpt
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "tensorField.H"
|
||||
|
||||
template<class Type>
|
||||
void Foam::cyclicACMILduInterfaceField::transformCoupleField
|
||||
(
|
||||
Field<Type>& f
|
||||
) const
|
||||
{
|
||||
cyclicAMILduInterfaceField::transformCoupleField(f);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cyclicACMIPointPatch.H"
|
||||
#include "pointBoundaryMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cyclicACMIPointPatch, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
facePointPatch,
|
||||
cyclicACMIPointPatch,
|
||||
polyPatch
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicACMIPointPatch::initGeometry(PstreamBuffers&)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPointPatch::calcGeometry(PstreamBuffers&)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPointPatch::initMovePoints
|
||||
(
|
||||
PstreamBuffers&,
|
||||
const pointField&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPointPatch::movePoints(PstreamBuffers&, const pointField&)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||
{
|
||||
facePointPatch::initUpdateMesh(pBufs);
|
||||
// cyclicACMIPointPatch::initGeometry(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPointPatch::updateMesh(PstreamBuffers& pBufs)
|
||||
{
|
||||
facePointPatch::updateMesh(pBufs);
|
||||
// cyclicACMIPointPatch::calcGeometry(pBufs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIPointPatch::cyclicACMIPointPatch
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const pointBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
coupledFacePointPatch(patch, bm),
|
||||
cyclicACMIPolyPatch_(refCast<const cyclicACMIPolyPatch>(patch))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIPointPatch::~cyclicACMIPointPatch()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,170 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cyclicACMIPointPatch
|
||||
|
||||
Description
|
||||
Cyclic AMI point patch - place holder only
|
||||
|
||||
SourceFiles
|
||||
cyclicACMIPointPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMIPointPatch_H
|
||||
#define cyclicACMIPointPatch_H
|
||||
|
||||
#include "coupledFacePointPatch.H"
|
||||
#include "cyclicACMIPolyPatch.H"
|
||||
#include "pointBoundaryMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicACMIPointPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cyclicACMIPointPatch
|
||||
:
|
||||
public coupledFacePointPatch
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference cast into the cyclic AMI patch
|
||||
const cyclicACMIPolyPatch& cyclicACMIPolyPatch_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default construct as copy
|
||||
cyclicACMIPointPatch(const cyclicACMIPointPatch&);
|
||||
|
||||
//- Disallow default assignment
|
||||
void operator=(const cyclicACMIPointPatch&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry(PstreamBuffers&);
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry(PstreamBuffers&);
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
virtual void initMovePoints(PstreamBuffers&, const pointField&);
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints(PstreamBuffers&, const pointField&);
|
||||
|
||||
//- Initialise the update of the patch topology
|
||||
virtual void initUpdateMesh(PstreamBuffers&);
|
||||
|
||||
//- Update of the patch topology
|
||||
virtual void updateMesh(PstreamBuffers&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(cyclicACMIPolyPatch::typeName_());
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
cyclicACMIPointPatch
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const pointBoundaryMesh& bm
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicACMIPointPatch();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Is patch 'coupled'. Note that on AMI the geometry is not
|
||||
// coupled but the fields are!
|
||||
virtual bool coupled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Return the constraint type this pointPatch implements.
|
||||
virtual const word& constraintType() const
|
||||
{
|
||||
return type();
|
||||
}
|
||||
|
||||
//- Return the underlying cyclicAMIPolyPatch
|
||||
const cyclicACMIPolyPatch& cyclicACMIPatch() const
|
||||
{
|
||||
return cyclicACMIPolyPatch_;
|
||||
}
|
||||
|
||||
//- Return neighbour point patch
|
||||
const cyclicACMIPointPatch& neighbPatch() const
|
||||
{
|
||||
label patchI = cyclicACMIPolyPatch_.neighbPatchID();
|
||||
const pointPatch& pp = this->boundaryMesh()[patchI];
|
||||
return refCast<const cyclicACMIPointPatch>(pp);
|
||||
}
|
||||
|
||||
//- Are the cyclic planes parallel
|
||||
bool parallel() const
|
||||
{
|
||||
return cyclicACMIPolyPatch_.parallel();
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
const tensorField& forwardT() const
|
||||
{
|
||||
return cyclicACMIPolyPatch_.forwardT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensorField& reverseT() const
|
||||
{
|
||||
return cyclicACMIPolyPatch_.reverseT();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,210 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cyclicACMIPointPatchField.H"
|
||||
#include "Swap.H"
|
||||
#include "transformField.H"
|
||||
#include "pointFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(p, iF),
|
||||
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
|
||||
ppiPtr_(NULL),
|
||||
nbrPpiPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<Type, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(p, iF, dict),
|
||||
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
|
||||
ppiPtr_(NULL),
|
||||
nbrPpiPtr_(NULL)
|
||||
{
|
||||
if (!isType<cyclicACMIPointPatch>(p))
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField\n"
|
||||
"(\n"
|
||||
" const pointPatch&,\n"
|
||||
" const DimensionedField<Type, pointMesh>&,\n"
|
||||
" const dictionary&\n"
|
||||
")\n",
|
||||
dict
|
||||
) << "patch " << this->patch().index() << " not cyclicACMI type. "
|
||||
<< "Patch type = " << p.type()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
|
||||
(
|
||||
const cyclicACMIPointPatchField<Type>& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<Type, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(ptf, p, iF, mapper),
|
||||
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
|
||||
ppiPtr_(NULL),
|
||||
nbrPpiPtr_(NULL)
|
||||
{
|
||||
if (!isType<cyclicACMIPointPatch>(this->patch()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField\n"
|
||||
"(\n"
|
||||
" const cyclicACMIPointPatchField<Type>&,\n"
|
||||
" const pointPatch&,\n"
|
||||
" const DimensionedField<Type, pointMesh>&,\n"
|
||||
" const pointPatchFieldMapper&\n"
|
||||
")\n"
|
||||
) << "Field type does not correspond to patch type for patch "
|
||||
<< this->patch().index() << "." << endl
|
||||
<< "Field type: " << typeName << endl
|
||||
<< "Patch type: " << this->patch().type()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
|
||||
(
|
||||
const cyclicACMIPointPatchField<Type>& ptf,
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(ptf, iF),
|
||||
cyclicACMIPatch_(ptf.cyclicACMIPatch_),
|
||||
ppiPtr_(NULL),
|
||||
nbrPpiPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::cyclicACMIPointPatchField<Type>::swapAddSeparated
|
||||
(
|
||||
const Pstream::commsTypes,
|
||||
Field<Type>& pField
|
||||
) const
|
||||
{
|
||||
if (cyclicACMIPatch_.cyclicACMIPatch().owner())
|
||||
{
|
||||
// We inplace modify pField. To prevent the other side (which gets
|
||||
// evaluated at a later date) using already changed values we do
|
||||
// all swaps on the side that gets evaluated first.
|
||||
|
||||
// Get neighbouring pointPatch
|
||||
const cyclicACMIPointPatch& nbrPatch = cyclicACMIPatch_.neighbPatch();
|
||||
|
||||
// Get neighbouring pointPatchField
|
||||
const GeometricField<Type, pointPatchField, pointMesh>& fld =
|
||||
refCast<const GeometricField<Type, pointPatchField, pointMesh> >
|
||||
(
|
||||
this->dimensionedInternalField()
|
||||
);
|
||||
|
||||
const cyclicACMIPointPatchField<Type>& nbr =
|
||||
refCast<const cyclicACMIPointPatchField<Type> >
|
||||
(
|
||||
fld.boundaryField()[nbrPatch.index()]
|
||||
);
|
||||
|
||||
|
||||
Field<Type> ptFld(this->patchInternalField(pField));
|
||||
Field<Type> nbrPtFld(nbr.patchInternalField(pField));
|
||||
|
||||
|
||||
if (doTransform())
|
||||
{
|
||||
const tensor& forwardT = this->forwardT()[0];
|
||||
const tensor& reverseT = this->reverseT()[0];
|
||||
|
||||
transform(ptFld, reverseT, ptFld);
|
||||
transform(nbrPtFld, forwardT, nbrPtFld);
|
||||
}
|
||||
|
||||
// convert point field to face field, AMI interpolate, then
|
||||
// face back to point
|
||||
{
|
||||
// add neighbour side contribution to owner
|
||||
Field<Type> nbrFcFld(nbrPpi().pointToFaceInterpolate(nbrPtFld));
|
||||
|
||||
const cyclicAMIPolyPatch& cami = cyclicACMIPatch_.cyclicACMIPatch();
|
||||
|
||||
// interpolate to owner
|
||||
nbrFcFld = cami.interpolate(nbrFcFld);
|
||||
|
||||
// add to internal field
|
||||
this->addToInternalField
|
||||
(
|
||||
pField,
|
||||
ppi().faceToPointInterpolate(nbrFcFld)()
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
// add owner side contribution to neighbour
|
||||
Field<Type> fcFld(ppi().pointToFaceInterpolate(ptFld));
|
||||
|
||||
const cyclicAMIPolyPatch& cami = cyclicACMIPatch_.cyclicACMIPatch();
|
||||
|
||||
// interpolate to neighbour
|
||||
fcFld = cami.neighbPatch().cyclicAMIPolyPatch::interpolate(fcFld);
|
||||
|
||||
// add to internal field
|
||||
nbr.addToInternalField
|
||||
(
|
||||
pField,
|
||||
nbrPpi().faceToPointInterpolate(fcFld)()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,241 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cyclicACMIPointPatchField
|
||||
|
||||
Description
|
||||
Cyclic ACMI front and back plane patch field
|
||||
|
||||
SourceFiles
|
||||
cyclicACMIPointPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMIPointPatchField_H
|
||||
#define cyclicACMIPointPatchField_H
|
||||
|
||||
#include "coupledPointPatchField.H"
|
||||
#include "cyclicACMIPointPatch.H"
|
||||
#include "PrimitivePatchInterpolation.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicACMIPointPatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class cyclicACMIPointPatchField
|
||||
:
|
||||
public coupledPointPatchField<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference cast into the cyclicACMI patch
|
||||
const cyclicACMIPointPatch& cyclicACMIPatch_;
|
||||
|
||||
//- Owner side patch interpolation pointer
|
||||
mutable autoPtr<PrimitivePatchInterpolation<primitivePatch> > ppiPtr_;
|
||||
|
||||
//- Neighbour side patch interpolation pointer
|
||||
mutable autoPtr<PrimitivePatchInterpolation<primitivePatch> >
|
||||
nbrPpiPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Owner side patch interpolation
|
||||
const PrimitivePatchInterpolation<primitivePatch>& ppi() const
|
||||
{
|
||||
if (!ppiPtr_.valid())
|
||||
{
|
||||
ppiPtr_.reset
|
||||
(
|
||||
new PrimitivePatchInterpolation<primitivePatch>
|
||||
(
|
||||
cyclicACMIPatch_.cyclicACMIPatch()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return ppiPtr_();
|
||||
}
|
||||
|
||||
//- Neighbour side patch interpolation
|
||||
const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const
|
||||
{
|
||||
if (!nbrPpiPtr_.valid())
|
||||
{
|
||||
nbrPpiPtr_.reset
|
||||
(
|
||||
new PrimitivePatchInterpolation<primitivePatch>
|
||||
(
|
||||
cyclicACMIPatch_.cyclicACMIPatch().neighbPatch()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return nbrPpiPtr_();
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(cyclicACMIPointPatch::typeName_());
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
cyclicACMIPointPatchField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
cyclicACMIPointPatchField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<Type, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<Type> onto a new patch
|
||||
cyclicACMIPointPatchField
|
||||
(
|
||||
const cyclicACMIPointPatchField<Type>&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<Type, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type> > clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type> >
|
||||
(
|
||||
new cyclicACMIPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
cyclicACMIPointPatchField
|
||||
(
|
||||
const cyclicACMIPointPatchField<Type>&,
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type> >
|
||||
(
|
||||
new cyclicACMIPointPatchField<Type>
|
||||
(
|
||||
*this, iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Constraint handling
|
||||
|
||||
//- Return the constraint type this pointPatchField implements
|
||||
virtual const word& constraintType() const
|
||||
{
|
||||
return cyclicACMIPointPatch::typeName;
|
||||
}
|
||||
|
||||
|
||||
// Cyclic AMI coupled interface functions
|
||||
|
||||
//- Does the patch field perform the transfromation
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return
|
||||
!(
|
||||
cyclicACMIPatch_.parallel()
|
||||
|| pTraits<Type>::rank == 0
|
||||
);
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return cyclicACMIPatch_.forwardT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
virtual const tensorField& reverseT() const
|
||||
{
|
||||
return cyclicACMIPatch_.reverseT();
|
||||
}
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
)
|
||||
{}
|
||||
|
||||
//- Complete swap of patch point values and add to local values
|
||||
virtual void swapAddSeparated
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
Field<Type>&
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "cyclicACMIPointPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,43 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cyclicACMIPointPatchFields.H"
|
||||
#include "pointPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchFields(cyclicACMI);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMIPointPatchFields_H
|
||||
#define cyclicACMIPointPatchFields_H
|
||||
|
||||
#include "cyclicACMIPointPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchFieldTypedefs(cyclicACMI);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,441 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cyclicACMIPolyPatch.H"
|
||||
#include "transformField.H"
|
||||
#include "SubField.H"
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
#include "faceAreaIntersect.H"
|
||||
#include "ops.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cyclicACMIPolyPatch, 0);
|
||||
|
||||
addToRunTimeSelectionTable(polyPatch, cyclicACMIPolyPatch, word);
|
||||
addToRunTimeSelectionTable(polyPatch, cyclicACMIPolyPatch, dictionary);
|
||||
}
|
||||
|
||||
const Foam::scalar Foam::cyclicACMIPolyPatch::tolerance_ = 1e-6;
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
|
||||
{
|
||||
if (!empty() && faceAreas0_.empty())
|
||||
{
|
||||
faceAreas0_ = faceAreas();
|
||||
}
|
||||
|
||||
const cyclicACMIPolyPatch& nbrACMI =
|
||||
refCast<const cyclicACMIPolyPatch>(this->neighbPatch());
|
||||
|
||||
if (!nbrACMI.empty() && nbrACMI.faceAreas0().empty())
|
||||
{
|
||||
nbrACMI.initPatchFaceAreas();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::resetAMI
|
||||
(
|
||||
const AMIPatchToPatchInterpolation::interpolationMethod&
|
||||
) const
|
||||
{
|
||||
if (owner())
|
||||
{
|
||||
const polyPatch& nonOverlapPatch = this->nonOverlapPatch();
|
||||
|
||||
initPatchFaceAreas();
|
||||
|
||||
// reset patch face areas based on original patch for AMI calculation
|
||||
vectorField::subField Sf = faceAreas();
|
||||
vectorField::subField noSf = nonOverlapPatch.faceAreas();
|
||||
|
||||
forAll(Sf, faceI)
|
||||
{
|
||||
Sf[faceI] = faceAreas0_[faceI];
|
||||
noSf[faceI] = faceAreas0_[faceI];
|
||||
}
|
||||
|
||||
// calculate the AMI using partial face-area-weighted
|
||||
cyclicAMIPolyPatch::resetAMI
|
||||
(
|
||||
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight
|
||||
);
|
||||
|
||||
const scalarField& srcWeightSum = AMI().srcWeightsSum();
|
||||
|
||||
// set patch face areas based on sum of AMI weights per face
|
||||
forAll(Sf, faceI)
|
||||
{
|
||||
scalar w = srcWeightSum[faceI];
|
||||
w = min(1.0 - tolerance_, max(tolerance_, w));
|
||||
|
||||
Sf[faceI] *= w;
|
||||
noSf[faceI] *= 1.0 - w;
|
||||
}
|
||||
|
||||
setNeighbourFaceAreas();
|
||||
|
||||
// set the updated flag
|
||||
updated_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const
|
||||
{
|
||||
const cyclicACMIPolyPatch& cp =
|
||||
refCast<const cyclicACMIPolyPatch>(this->neighbPatch());
|
||||
const polyPatch& pp = cp.nonOverlapPatch();
|
||||
|
||||
const scalarField& tgtWeightSum = AMI().tgtWeightsSum();
|
||||
|
||||
const vectorField& faceAreas0 = cp.faceAreas0();
|
||||
|
||||
vectorField::subField Sf = cp.faceAreas();
|
||||
vectorField::subField noSf = pp.faceAreas();
|
||||
|
||||
forAll(Sf, faceI)
|
||||
{
|
||||
scalar w = tgtWeightSum[faceI];
|
||||
w = min(1.0 - tolerance_, max(tolerance_, w));
|
||||
|
||||
Sf[faceI] = w*faceAreas0[faceI];
|
||||
noSf[faceI] = (1.0 - w)*faceAreas0[faceI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
cyclicAMIPolyPatch::initGeometry(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
cyclicAMIPolyPatch::calcGeometry(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::initMovePoints
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const pointField& p
|
||||
)
|
||||
{
|
||||
cyclicAMIPolyPatch::initMovePoints(pBufs, p);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::movePoints
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const pointField& p
|
||||
)
|
||||
{
|
||||
cyclicAMIPolyPatch::movePoints(pBufs, p);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||
{
|
||||
cyclicAMIPolyPatch::initUpdateMesh(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::updateMesh(PstreamBuffers& pBufs)
|
||||
{
|
||||
cyclicAMIPolyPatch::updateMesh(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::clearGeom()
|
||||
{
|
||||
cyclicAMIPolyPatch::clearGeom();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform
|
||||
)
|
||||
:
|
||||
cyclicAMIPolyPatch(name, size, start, index, bm, patchType, transform),
|
||||
faceAreas0_(),
|
||||
nonOverlapPatchName_(word::null),
|
||||
nonOverlapPatchID_(-1),
|
||||
updated_(false)
|
||||
{
|
||||
// Non-overlapping patch might not be valid yet so cannot determine
|
||||
// associated patchID
|
||||
}
|
||||
|
||||
|
||||
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
cyclicAMIPolyPatch(name, dict, index, bm, patchType),
|
||||
faceAreas0_(),
|
||||
nonOverlapPatchName_(dict.lookup("nonOverlapPatch")),
|
||||
nonOverlapPatchID_(-1),
|
||||
updated_(false)
|
||||
{
|
||||
if (nonOverlapPatchName_ == name)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"cyclicACMIPolyPatch::cyclicACMIPolyPatch"
|
||||
"("
|
||||
"const word&, "
|
||||
"const dictionary&, "
|
||||
"const label, "
|
||||
"const polyBoundaryMesh&, "
|
||||
"const word&"
|
||||
")",
|
||||
dict
|
||||
) << "Non-overlapping patch name " << nonOverlapPatchName_
|
||||
<< " cannot be the same as this patch " << name
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Non-overlapping patch might not be valid yet so cannot determine
|
||||
// associated patchID
|
||||
}
|
||||
|
||||
|
||||
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
(
|
||||
const cyclicACMIPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
cyclicAMIPolyPatch(pp, bm),
|
||||
faceAreas0_(),
|
||||
nonOverlapPatchName_(pp.nonOverlapPatchName_),
|
||||
nonOverlapPatchID_(-1),
|
||||
updated_(false)
|
||||
{
|
||||
// Non-overlapping patch might not be valid yet so cannot determine
|
||||
// associated patchID
|
||||
}
|
||||
|
||||
|
||||
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
(
|
||||
const cyclicACMIPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const word& nbrPatchName,
|
||||
const word& nonOverlapPatchName
|
||||
)
|
||||
:
|
||||
cyclicAMIPolyPatch(pp, bm, index, newSize, newStart, nbrPatchName),
|
||||
faceAreas0_(),
|
||||
nonOverlapPatchName_(nonOverlapPatchName),
|
||||
nonOverlapPatchID_(-1),
|
||||
updated_(false)
|
||||
{
|
||||
if (nonOverlapPatchName_ == name())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const cyclicACMIPolyPatch& "
|
||||
"const polyBoundaryMesh&, "
|
||||
"const label, "
|
||||
"const label, "
|
||||
"const label, "
|
||||
"const word&, "
|
||||
"const word&"
|
||||
) << "Non-overlapping patch name " << nonOverlapPatchName_
|
||||
<< " cannot be the same as this patch " << name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Non-overlapping patch might not be valid yet so cannot determine
|
||||
// associated patchID
|
||||
}
|
||||
|
||||
|
||||
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
(
|
||||
const cyclicACMIPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
)
|
||||
:
|
||||
cyclicAMIPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||
faceAreas0_(),
|
||||
nonOverlapPatchName_(pp.nonOverlapPatchName_),
|
||||
nonOverlapPatchID_(-1),
|
||||
updated_(false)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::cyclicACMIPolyPatch::nonOverlapPatchID() const
|
||||
{
|
||||
if (nonOverlapPatchID_ == -1)
|
||||
{
|
||||
nonOverlapPatchID_ =
|
||||
this->boundaryMesh().findPatchID(nonOverlapPatchName_);
|
||||
|
||||
if (nonOverlapPatchID_ == -1)
|
||||
{
|
||||
FatalErrorIn("cyclicPolyAMIPatch::neighbPatchID() const")
|
||||
<< "Illegal non-overlapping patch name " << nonOverlapPatchName_
|
||||
<< nl << "Valid patch names are "
|
||||
<< this->boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const polyPatch& noPp = this->boundaryMesh()[nonOverlapPatchID_];
|
||||
|
||||
bool ok = true;
|
||||
|
||||
if (size() == noPp.size())
|
||||
{
|
||||
const scalarField magSf(mag(faceAreas()));
|
||||
const scalarField noMagSf(mag(noPp.faceAreas()));
|
||||
|
||||
forAll(magSf, faceI)
|
||||
{
|
||||
scalar ratio = mag(magSf[faceI]/(noMagSf[faceI] + ROOTVSMALL));
|
||||
|
||||
if (ratio - 1 > tolerance_)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::label "
|
||||
"Foam::cyclicACMIPolyPatch::nonOverlapPatchID() const"
|
||||
) << "Inconsistent ACMI patches " << name() << " and "
|
||||
<< noPp.name() << ". Patches should have identical topology"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return nonOverlapPatchID_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::calcGeometry
|
||||
(
|
||||
const primitivePatch& referPatch,
|
||||
const pointField& thisCtrs,
|
||||
const vectorField& thisAreas,
|
||||
const pointField& thisCc,
|
||||
const pointField& nbrCtrs,
|
||||
const vectorField& nbrAreas,
|
||||
const pointField& nbrCc
|
||||
)
|
||||
{
|
||||
cyclicAMIPolyPatch::calcGeometry
|
||||
(
|
||||
referPatch,
|
||||
thisCtrs,
|
||||
thisAreas,
|
||||
thisCc,
|
||||
nbrCtrs,
|
||||
nbrAreas,
|
||||
nbrCc
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::initOrder
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const primitivePatch& pp
|
||||
) const
|
||||
{
|
||||
cyclicAMIPolyPatch::initOrder(pBufs, pp);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::cyclicACMIPolyPatch::order
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const primitivePatch& pp,
|
||||
labelList& faceMap,
|
||||
labelList& rotation
|
||||
) const
|
||||
{
|
||||
return cyclicAMIPolyPatch::order(pBufs, pp, faceMap, rotation);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicACMIPolyPatch::write(Ostream& os) const
|
||||
{
|
||||
cyclicAMIPolyPatch::write(os);
|
||||
|
||||
os.writeKeyword("nonOverlapPatch") << nonOverlapPatchName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,349 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cyclicACMIPolyPatch
|
||||
|
||||
Description
|
||||
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
|
||||
|
||||
SourceFiles
|
||||
cyclicACMIPolyPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicACMIPolyPatch_H
|
||||
#define cyclicACMIPolyPatch_H
|
||||
|
||||
#include "cyclicAMIPolyPatch.H"
|
||||
#include "AMIPatchToPatchInterpolation.H"
|
||||
#include "polyBoundaryMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicACMIPolyPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cyclicACMIPolyPatch
|
||||
:
|
||||
public cyclicAMIPolyPatch
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Copy of the original patch face areas
|
||||
mutable vectorField faceAreas0_;
|
||||
|
||||
//- Name of non-overlapping patch
|
||||
const word nonOverlapPatchName_;
|
||||
|
||||
//- Index of non-overlapping patch
|
||||
mutable label nonOverlapPatchID_;
|
||||
|
||||
//- Flag to indicate that AMI has been updated
|
||||
mutable bool updated_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
static const scalar tolerance_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Initialise patch face areas
|
||||
virtual void initPatchFaceAreas() const;
|
||||
|
||||
//- Reset the AMI interpolator
|
||||
virtual void resetAMI
|
||||
(
|
||||
const AMIPatchToPatchInterpolation::interpolationMethod& AMIMethod =
|
||||
AMIPatchToPatchInterpolation::imFaceAreaWeight
|
||||
) const;
|
||||
|
||||
//- Set neighbour ACMI patch areas
|
||||
virtual void setNeighbourFaceAreas() const;
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry(PstreamBuffers&);
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry(PstreamBuffers&);
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
|
||||
|
||||
//- Initialise the update of the patch topology
|
||||
virtual void initUpdateMesh(PstreamBuffers&);
|
||||
|
||||
//- Update of the patch topology
|
||||
virtual void updateMesh(PstreamBuffers&);
|
||||
|
||||
//- Clear geometry
|
||||
virtual void clearGeom();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclicACMI");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from (base couped patch) components
|
||||
cyclicACMIPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType,
|
||||
const transformType transform = UNKNOWN
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
cyclicACMIPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
cyclicACMIPolyPatch
|
||||
(
|
||||
const cyclicACMIPolyPatch&,
|
||||
const polyBoundaryMesh&
|
||||
);
|
||||
|
||||
//- Construct given the original patch and resetting the
|
||||
// face list and boundary mesh information
|
||||
cyclicACMIPolyPatch
|
||||
(
|
||||
const cyclicACMIPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const word& nbrPatchName,
|
||||
const word& nonOverlapPatchName
|
||||
);
|
||||
|
||||
//- Construct given the original patch and a map
|
||||
cyclicACMIPolyPatch
|
||||
(
|
||||
const cyclicACMIPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
);
|
||||
|
||||
|
||||
//- Construct and return a clone, resetting the boundary mesh
|
||||
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
|
||||
{
|
||||
return autoPtr<polyPatch>(new cyclicACMIPolyPatch(*this, bm));
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the face list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<polyPatch> clone
|
||||
(
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new cyclicACMIPolyPatch
|
||||
(
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
newSize,
|
||||
newStart,
|
||||
neighbPatchName(),
|
||||
nonOverlapPatchName_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the face list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<polyPatch> clone
|
||||
(
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new cyclicACMIPolyPatch
|
||||
(
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
mapAddressing,
|
||||
newStart
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicACMIPolyPatch();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Reset the updated flag
|
||||
inline void setUpdated(bool flag) const;
|
||||
|
||||
//- Return access to the updated flag
|
||||
inline bool updated() const;
|
||||
|
||||
//- Return access to the original patch face areas
|
||||
inline const vectorField& faceAreas0() const;
|
||||
|
||||
//- Non-overlapping patch name
|
||||
inline const word& nonOverlapPatchName() const;
|
||||
|
||||
//- Non-overlapping patch ID
|
||||
virtual label nonOverlapPatchID() const;
|
||||
|
||||
//- Return a const reference to the non-overlapping patch
|
||||
inline const polyPatch& nonOverlapPatch() const;
|
||||
|
||||
//- Return a reference to the non-overlapping patch
|
||||
inline polyPatch& nonOverlapPatch();
|
||||
|
||||
//- Mask field where 1 = overlap, 0 = no-overlap
|
||||
inline const scalarField& mask() const;
|
||||
|
||||
|
||||
// Interpolations
|
||||
|
||||
//- Interpolate field
|
||||
template<class Type>
|
||||
tmp<Field<Type> > interpolate
|
||||
(
|
||||
const Field<Type>& fldCouple,
|
||||
const Field<Type>& fldNonOverlap
|
||||
) const;
|
||||
|
||||
//- Interpolate tmp field
|
||||
template<class Type>
|
||||
tmp<Field<Type> > interpolate
|
||||
(
|
||||
const tmp<Field<Type> >& tFldCouple,
|
||||
const tmp<Field<Type> >& tFldNonOverlap
|
||||
) const;
|
||||
|
||||
//- Low-level interpolate List
|
||||
template<class Type, class CombineOp>
|
||||
void interpolate
|
||||
(
|
||||
const UList<Type>& fldCouple,
|
||||
const UList<Type>& fldNonOverlap,
|
||||
const CombineOp& cop,
|
||||
List<Type>& result
|
||||
) const;
|
||||
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry
|
||||
(
|
||||
const primitivePatch& referPatch,
|
||||
const pointField& thisCtrs,
|
||||
const vectorField& thisAreas,
|
||||
const pointField& thisCc,
|
||||
const pointField& nbrCtrs,
|
||||
const vectorField& nbrAreas,
|
||||
const pointField& nbrCc
|
||||
);
|
||||
|
||||
//- Initialize ordering for primitivePatch. Does not
|
||||
// refer to *this (except for name() and type() etc.)
|
||||
virtual void initOrder
|
||||
(
|
||||
PstreamBuffers&,
|
||||
const primitivePatch&
|
||||
) const;
|
||||
|
||||
//- Return new ordering for primitivePatch.
|
||||
// Ordering is -faceMap: for every face
|
||||
// index of the new face -rotation:for every new face the clockwise
|
||||
// shift of the original face. Return false if nothing changes
|
||||
// (faceMap is identity, rotation is 0), true otherwise.
|
||||
virtual bool order
|
||||
(
|
||||
PstreamBuffers&,
|
||||
const primitivePatch&,
|
||||
labelList& faceMap,
|
||||
labelList& rotation
|
||||
) const;
|
||||
|
||||
//- Write the polyPatch data as a dictionary
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "cyclicACMIPolyPatchI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "cyclicACMIPolyPatchTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,83 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline void Foam::cyclicACMIPolyPatch::setUpdated(const bool flag) const
|
||||
{
|
||||
updated_ = flag;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::cyclicACMIPolyPatch::updated() const
|
||||
{
|
||||
return updated_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vectorField& Foam::cyclicACMIPolyPatch::faceAreas0() const
|
||||
{
|
||||
return faceAreas0_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::cyclicACMIPolyPatch::nonOverlapPatchName() const
|
||||
{
|
||||
return nonOverlapPatchName_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::polyPatch& Foam::cyclicACMIPolyPatch::nonOverlapPatch() const
|
||||
{
|
||||
// note: use nonOverlapPatchID() as opposed to patch name to initialise
|
||||
// demand-driven data
|
||||
|
||||
return this->boundaryMesh()[nonOverlapPatchID()];
|
||||
}
|
||||
|
||||
|
||||
inline Foam::polyPatch& Foam::cyclicACMIPolyPatch::nonOverlapPatch()
|
||||
{
|
||||
// note: use nonOverlapPatchID() as opposed to patch name to initialise
|
||||
// demand-driven data
|
||||
|
||||
return const_cast<polyPatch&>(this->boundaryMesh()[nonOverlapPatchID()]);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::scalarField& Foam::cyclicACMIPolyPatch::mask() const
|
||||
{
|
||||
if (owner())
|
||||
{
|
||||
return AMI().srcWeightsSum();
|
||||
}
|
||||
else
|
||||
{
|
||||
return neighbPatch().AMI().tgtWeightsSum();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,91 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate
|
||||
(
|
||||
const Field<Type>& fldCouple,
|
||||
const Field<Type>& fldNonOverlap
|
||||
) const
|
||||
{
|
||||
if (owner())
|
||||
{
|
||||
const scalarField& w = AMI().srcWeightsSum();
|
||||
|
||||
return
|
||||
w*AMI().interpolateToSource(fldCouple)
|
||||
+ (1.0 - w)*fldNonOverlap;
|
||||
}
|
||||
else
|
||||
{
|
||||
const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
|
||||
|
||||
return
|
||||
w*neighbPatch().AMI().interpolateToTarget(fldCouple)
|
||||
+ (1.0 - w)*fldNonOverlap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate
|
||||
(
|
||||
const tmp<Field<Type> >& tFldCouple,
|
||||
const tmp<Field<Type> >& tFldNonOverlap
|
||||
) const
|
||||
{
|
||||
return interpolate(tFldCouple(), tFldNonOverlap());
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::cyclicACMIPolyPatch::interpolate
|
||||
(
|
||||
const UList<Type>& fldCouple,
|
||||
const UList<Type>& fldNonOverlap,
|
||||
const CombineOp& cop,
|
||||
List<Type>& result
|
||||
) const
|
||||
{
|
||||
if (owner())
|
||||
{
|
||||
const scalarField& w = AMI().srcWeightsSum();
|
||||
|
||||
AMI().interpolateToSource(fldCouple, cop, result);
|
||||
result = w*result + (1.0 - w)*fldNonOverlap;
|
||||
}
|
||||
else
|
||||
{
|
||||
const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
|
||||
|
||||
neighbPatch().AMI().interpolateToTarget(fldCouple, cop, result);
|
||||
result = w*result + (1.0 - w)*fldNonOverlap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -232,7 +232,12 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicAMIPolyPatch::resetAMI() const
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicAMIPolyPatch::resetAMI
|
||||
(
|
||||
const AMIPatchToPatchInterpolation::interpolationMethod& AMIMethod
|
||||
) const
|
||||
{
|
||||
if (owner())
|
||||
{
|
||||
@ -283,7 +288,7 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
|
||||
nbrPatch0,
|
||||
surfPtr(),
|
||||
faceAreaIntersect::tmMesh,
|
||||
AMIPatchToPatchInterpolation::imFaceAreaWeight,
|
||||
AMIMethod,
|
||||
AMIReverse_
|
||||
)
|
||||
);
|
||||
@ -301,8 +306,6 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
polyPatch::initGeometry(pBufs);
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -108,14 +108,18 @@ private:
|
||||
const vectorField& half1Areas
|
||||
);
|
||||
|
||||
//- Reset the AMI interpolator
|
||||
void resetAMI() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Reset the AMI interpolator
|
||||
virtual void resetAMI
|
||||
(
|
||||
const AMIPatchToPatchInterpolation::interpolationMethod& AMIMethod =
|
||||
AMIPatchToPatchInterpolation::imFaceAreaWeight
|
||||
) const;
|
||||
|
||||
//- Recalculate the transformation tensors
|
||||
virtual void calcTransforms();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,9 @@ patchWave = $(algorithms)/PatchEdgeFaceWave
|
||||
$(patchWave)/PatchEdgeFaceWaveName.C
|
||||
$(patchWave)/patchEdgeFaceInfo.C
|
||||
$(patchWave)/patchPatchDist.C
|
||||
$(patchWave)/patchEdgeFaceRegion.C
|
||||
$(patchWave)/patchEdgeFaceRegions.C
|
||||
|
||||
|
||||
meshWave = $(algorithms)/MeshWave
|
||||
$(meshWave)/MeshWaveName.C
|
||||
@ -113,7 +116,6 @@ $(faceSources)/boundaryToFace/boundaryToFace.C
|
||||
$(faceSources)/zoneToFace/zoneToFace.C
|
||||
$(faceSources)/boxToFace/boxToFace.C
|
||||
$(faceSources)/regionToFace/regionToFace.C
|
||||
$(faceSources)/regionToFace/patchEdgeFaceRegion.C
|
||||
|
||||
pointSources = sets/pointSources
|
||||
$(pointSources)/labelToPoint/labelToPoint.C
|
||||
@ -175,14 +177,23 @@ $(AMI)/AMIInterpolation/AMIPatchToPatchInterpolation.C
|
||||
$(AMI)/faceAreaIntersect/faceAreaIntersect.C
|
||||
$(AMI)/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
|
||||
$(AMI)/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C
|
||||
$(AMI)/GAMG/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.C
|
||||
$(AMI)/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C
|
||||
|
||||
AMICycPatches=$(AMI)/patches/cyclic
|
||||
AMICycPatches=$(AMI)/patches/cyclicAMI
|
||||
$(AMICycPatches)/cyclicAMILduInterfaceField/cyclicAMILduInterface.C
|
||||
$(AMICycPatches)/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C
|
||||
$(AMICycPatches)/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
|
||||
$(AMICycPatches)/cyclicAMIPointPatch/cyclicAMIPointPatch.C
|
||||
$(AMICycPatches)/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C
|
||||
|
||||
ACMICycPatches=$(AMI)/patches/cyclicACMI
|
||||
$(ACMICycPatches)/cyclicACMILduInterfaceField/cyclicACMILduInterface.C
|
||||
$(ACMICycPatches)/cyclicACMILduInterfaceField/cyclicACMILduInterfaceField.C
|
||||
$(ACMICycPatches)/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
|
||||
$(ACMICycPatches)/cyclicACMIPointPatch/cyclicACMIPointPatch.C
|
||||
$(ACMICycPatches)/cyclicACMIPointPatchField/cyclicACMIPointPatchFields.C
|
||||
|
||||
mappedPatches/mappedPolyPatch/mappedPatchBase.C
|
||||
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
|
||||
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-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 "patchEdgeFaceRegions.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const Foam::patchEdgeFaceRegions& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.regions_;
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Foam::Istream& is,
|
||||
Foam::patchEdgeFaceRegions& wDist
|
||||
)
|
||||
{
|
||||
return is >> wDist.regions_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::patchEdgeFaceRegions
|
||||
|
||||
Description
|
||||
Transport of regions for use in PatchEdgeFaceWave.
|
||||
|
||||
Set element to -1 to denote blocked.
|
||||
|
||||
SourceFiles
|
||||
patchEdgeFaceRegionsI.H
|
||||
patchEdgeFaceRegions.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef patchEdgeFaceRegions_H
|
||||
#define patchEdgeFaceRegions_H
|
||||
|
||||
#include "labelList.H"
|
||||
#include "scalar.H"
|
||||
#include "tensor.H"
|
||||
#include "labelPair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class polyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class patchEdgeFaceRegions Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class patchEdgeFaceRegions
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- region per point
|
||||
labelList regions_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline patchEdgeFaceRegions();
|
||||
|
||||
//- Construct from regions
|
||||
inline patchEdgeFaceRegions(const labelList&);
|
||||
|
||||
//- Construct from regions (on edge)
|
||||
inline patchEdgeFaceRegions(const labelPair&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
inline const labelList& regions() const;
|
||||
|
||||
|
||||
// Needed by meshWave
|
||||
|
||||
//- Check whether origin has been changed at all or
|
||||
// still contains original (invalid) value.
|
||||
template<class TrackingData>
|
||||
inline bool valid(TrackingData& td) const;
|
||||
|
||||
//- Apply rotation matrix
|
||||
template<class Patch, class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const tensor& rotTensor,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of face on edge
|
||||
template<class Patch, class TrackingData>
|
||||
inline bool updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const label edgeI,
|
||||
const label faceI,
|
||||
const patchEdgeFaceRegions& faceInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- New information for edge (from e.g. coupled edge)
|
||||
template<class Patch, class TrackingData>
|
||||
inline bool updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const patchEdgeFaceRegions& edgeInfo,
|
||||
const bool sameOrientation,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of edge on face.
|
||||
template<class Patch, class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const label faceI,
|
||||
const label edgeI,
|
||||
const patchEdgeFaceRegions& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Same (like operator==)
|
||||
template<class TrackingData>
|
||||
inline bool equal(const patchEdgeFaceRegions&, TrackingData&) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Needed for List IO
|
||||
inline bool operator==(const patchEdgeFaceRegions&) const;
|
||||
inline bool operator!=(const patchEdgeFaceRegions&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const patchEdgeFaceRegions&);
|
||||
friend Istream& operator>>(Istream&, patchEdgeFaceRegions&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "patchEdgeFaceRegionsI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,282 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions
|
||||
(
|
||||
const labelList& regions
|
||||
)
|
||||
:
|
||||
regions_(regions)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions
|
||||
(
|
||||
const labelPair& regions
|
||||
)
|
||||
:
|
||||
regions_(2)
|
||||
{
|
||||
regions_[0] = regions[0];
|
||||
regions_[1] = regions[1];
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::labelList& Foam::patchEdgeFaceRegions::regions() const
|
||||
{
|
||||
return regions_;
|
||||
}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchEdgeFaceRegions::valid(TrackingData& td) const
|
||||
{
|
||||
return regions_.size() && (findIndex(regions_, labelMax) == -1);
|
||||
}
|
||||
|
||||
|
||||
template<class Patch, class TrackingData>
|
||||
inline void Foam::patchEdgeFaceRegions::transform
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const tensor& rotTensor,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
template<class Patch, class TrackingData>
|
||||
inline bool Foam::patchEdgeFaceRegions::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const label edgeI,
|
||||
const label faceI,
|
||||
const patchEdgeFaceRegions& faceInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
const edge& e = patch.edges()[edgeI];
|
||||
|
||||
label index = findIndex(patch.faceEdges()[faceI], edgeI);
|
||||
bool sameOrientation = (f[index] == e.start());
|
||||
|
||||
// Get information in edge-order
|
||||
edge orientedInfo
|
||||
(
|
||||
faceInfo.regions_[index],
|
||||
faceInfo.regions_[f.fcIndex(index)]
|
||||
);
|
||||
if (!sameOrientation)
|
||||
{
|
||||
orientedInfo.flip();
|
||||
}
|
||||
|
||||
if (!faceInfo.valid(td))
|
||||
{
|
||||
FatalErrorIn("patchEdgeFaceRegions::updateEdge(..)")
|
||||
<< "problem." << abort(FatalError);
|
||||
}
|
||||
|
||||
if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
|
||||
{
|
||||
// Blocked edge/face
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool changed = false;
|
||||
|
||||
regions_.setSize(orientedInfo.size(), labelMax);
|
||||
forAll(orientedInfo, i)
|
||||
{
|
||||
if (orientedInfo[i] != -1 && orientedInfo[i] < regions_[i])
|
||||
{
|
||||
regions_[i] = orientedInfo[i];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
template<class Patch, class TrackingData>
|
||||
inline bool Foam::patchEdgeFaceRegions::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const patchEdgeFaceRegions& edgeInfo,
|
||||
const bool sameOrientation,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
// Get information in edge-order
|
||||
edge orientedInfo(edgeInfo.regions_[0], edgeInfo.regions_[1]);
|
||||
if (!sameOrientation)
|
||||
{
|
||||
orientedInfo.flip();
|
||||
}
|
||||
|
||||
|
||||
if (!edgeInfo.valid(td))
|
||||
{
|
||||
FatalErrorIn("patchEdgeFaceRegions::updateEdge(..)")
|
||||
<< "problem." << abort(FatalError);
|
||||
}
|
||||
|
||||
if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
|
||||
{
|
||||
// Blocked edge/face
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool changed = false;
|
||||
|
||||
regions_.setSize(orientedInfo.size(), labelMax);
|
||||
forAll(orientedInfo, i)
|
||||
{
|
||||
if (orientedInfo[i] != -1 && orientedInfo[i] < regions_[i])
|
||||
{
|
||||
regions_[i] = orientedInfo[i];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
template<class Patch, class TrackingData>
|
||||
inline bool Foam::patchEdgeFaceRegions::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Patch& patch,
|
||||
const label faceI,
|
||||
const label edgeI,
|
||||
const patchEdgeFaceRegions& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
const edge& e = patch.edges()[edgeI];
|
||||
|
||||
// Find starting point of edge on face.
|
||||
label index0 = findIndex(patch.faceEdges()[faceI], edgeI);
|
||||
label index1 = f.fcIndex(index0);
|
||||
bool sameOrientation = (f[index0] == e.start());
|
||||
|
||||
|
||||
// Get information in face-order
|
||||
edge orientedInfo
|
||||
(
|
||||
edgeInfo.regions_[0],
|
||||
edgeInfo.regions_[1]
|
||||
);
|
||||
if (!sameOrientation)
|
||||
{
|
||||
orientedInfo.flip();
|
||||
}
|
||||
|
||||
if (!edgeInfo.valid(td))
|
||||
{
|
||||
FatalErrorIn("patchEdgeFaceRegions::updateFace(..)")
|
||||
<< "problem." << abort(FatalError);
|
||||
}
|
||||
|
||||
if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
|
||||
{
|
||||
// Blocked edge/face
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool changed = false;
|
||||
|
||||
// Scale if needed
|
||||
regions_.setSize(f.size(), labelMax);
|
||||
|
||||
if (orientedInfo[0] < regions_[index0])
|
||||
{
|
||||
regions_[index0] = orientedInfo[0];
|
||||
changed = true;
|
||||
}
|
||||
if (orientedInfo[1] < regions_[index1])
|
||||
{
|
||||
regions_[index1] = orientedInfo[1];
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchEdgeFaceRegions::equal
|
||||
(
|
||||
const patchEdgeFaceRegions& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return operator==(rhs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::patchEdgeFaceRegions::operator==
|
||||
(
|
||||
const Foam::patchEdgeFaceRegions& rhs
|
||||
) const
|
||||
{
|
||||
return regions() == rhs.regions();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::patchEdgeFaceRegions::operator!=
|
||||
(
|
||||
const Foam::patchEdgeFaceRegions& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -433,24 +433,28 @@ Foam::triSurfaceMesh::edgeTree() const
|
||||
+ nInternalEdges()
|
||||
);
|
||||
|
||||
treeBoundBox bb;
|
||||
label nPoints;
|
||||
PatchTools::calcBounds
|
||||
(
|
||||
static_cast<const triSurface&>(*this),
|
||||
bb,
|
||||
nPoints
|
||||
);
|
||||
treeBoundBox bb(vector::zero, vector::zero);
|
||||
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
if (bEdges.size())
|
||||
{
|
||||
label nPoints;
|
||||
PatchTools::calcBounds
|
||||
(
|
||||
static_cast<const triSurface&>(*this),
|
||||
bb,
|
||||
nPoints
|
||||
);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
bb = bb.extend(rndGen, 1e-4);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
|
||||
bb = bb.extend(rndGen, 1e-4);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
}
|
||||
|
||||
scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
|
||||
indexedOctree<treeDataEdge>::perturbTol() = tolerance();
|
||||
|
||||
@ -121,33 +121,40 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
|
||||
);
|
||||
|
||||
// Calculate bb without constructing local point numbering.
|
||||
treeBoundBox bb;
|
||||
label nPoints;
|
||||
PatchTools::calcBounds
|
||||
(
|
||||
indirectRegionPatches_[regionI],
|
||||
bb,
|
||||
nPoints
|
||||
);
|
||||
treeBoundBox bb(vector::zero, vector::zero);
|
||||
|
||||
// if (nPoints != surface().points().size())
|
||||
// {
|
||||
// WarningIn("triSurfaceRegionSearch::treeByRegion() const")
|
||||
// << "Surface does not have compact point numbering. "
|
||||
// << "Of " << surface().points().size()
|
||||
// << " only " << nPoints
|
||||
// << " are used. This might give problems in some routines."
|
||||
// << endl;
|
||||
// }
|
||||
if (indirectRegionPatches_[regionI].size())
|
||||
{
|
||||
label nPoints;
|
||||
PatchTools::calcBounds
|
||||
(
|
||||
indirectRegionPatches_[regionI],
|
||||
bb,
|
||||
nPoints
|
||||
);
|
||||
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
// if (nPoints != surface().points().size())
|
||||
// {
|
||||
// WarningIn("triSurfaceRegionSearch::treeByRegion() const")
|
||||
// << "Surface does not have compact point numbering. "
|
||||
// << "Of " << surface().points().size()
|
||||
// << " only " << nPoints
|
||||
// << " are used."
|
||||
// << " This might give problems in some routines."
|
||||
// << endl;
|
||||
// }
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are fewer face/edge aligned items.
|
||||
bb = bb.extend(rndGen, 1e-4);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
// Random number generator. Bit dodgy since not exactly
|
||||
// random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so
|
||||
// on symmetric geometry there are fewer face/edge
|
||||
// aligned items.
|
||||
bb = bb.extend(rndGen, 1e-4);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
}
|
||||
|
||||
treeByRegion_.set
|
||||
(
|
||||
|
||||
@ -200,28 +200,33 @@ Foam::triSurfaceSearch::tree() const
|
||||
if (treePtr_.empty())
|
||||
{
|
||||
// Calculate bb without constructing local point numbering.
|
||||
treeBoundBox bb;
|
||||
label nPoints;
|
||||
PatchTools::calcBounds(surface(), bb, nPoints);
|
||||
treeBoundBox bb(vector::zero, vector::zero);
|
||||
|
||||
if (nPoints != surface().points().size())
|
||||
if (surface().size())
|
||||
{
|
||||
WarningIn("triSurfaceSearch::tree() const")
|
||||
<< "Surface does not have compact point numbering."
|
||||
<< " Of " << surface().points().size() << " only " << nPoints
|
||||
<< " are used. This might give problems in some routines."
|
||||
<< endl;
|
||||
label nPoints;
|
||||
PatchTools::calcBounds(surface(), bb, nPoints);
|
||||
|
||||
if (nPoints != surface().points().size())
|
||||
{
|
||||
WarningIn("triSurfaceSearch::tree() const")
|
||||
<< "Surface does not have compact point numbering."
|
||||
<< " Of " << surface().points().size()
|
||||
<< " only " << nPoints
|
||||
<< " are used. This might give problems in some routines."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
bb = bb.extend(rndGen, 1e-4);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
}
|
||||
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
bb = bb.extend(rndGen, 1e-4);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user