mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cyclicAMI: handle FaceCellWave (e.g. wall distance)
This commit is contained in:
@ -577,9 +577,6 @@ $(interpolations)/interpolationTable/tableReaders/tableReaders.C
|
|||||||
$(interpolations)/interpolationTable/tableReaders/openFoam/openFoamTableReaders.C
|
$(interpolations)/interpolationTable/tableReaders/openFoam/openFoamTableReaders.C
|
||||||
$(interpolations)/interpolationTable/tableReaders/csv/csvTableReaders.C
|
$(interpolations)/interpolationTable/tableReaders/csv/csvTableReaders.C
|
||||||
|
|
||||||
algorithms/MeshWave/MeshWaveName.C
|
|
||||||
algorithms/MeshWave/FaceCellWaveName.C
|
|
||||||
|
|
||||||
algorithms/indexedOctree/indexedOctreeName.C
|
algorithms/indexedOctree/indexedOctreeName.C
|
||||||
algorithms/indexedOctree/treeDataCell.C
|
algorithms/indexedOctree/treeDataCell.C
|
||||||
|
|
||||||
|
|||||||
@ -300,7 +300,7 @@ public:
|
|||||||
|
|
||||||
//- Slice list to patch
|
//- Slice list to patch
|
||||||
template<class T>
|
template<class T>
|
||||||
const typename List<T>::subList patchSlice(const List<T>& l) const
|
const typename List<T>::subList patchSlice(const UList<T>& l) const
|
||||||
{
|
{
|
||||||
return typename List<T>::subList(l, this->size(), start_);
|
return typename List<T>::subList(l, this->size(), start_);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,37 @@ License
|
|||||||
#include "mergePoints.H"
|
#include "mergePoints.H"
|
||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
//- Combine operator for interpolateToSource/Target
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
class combineBinaryOp
|
||||||
|
{
|
||||||
|
const BinaryOp& bop_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
combineBinaryOp(const BinaryOp& bop)
|
||||||
|
:
|
||||||
|
bop_(bop)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void operator()
|
||||||
|
(
|
||||||
|
Type& x,
|
||||||
|
const label faceI,
|
||||||
|
const Type& y,
|
||||||
|
const scalar weight
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
x = bop_(x, weight*y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
@ -1773,94 +1804,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
template<class Type, class BinaryOp>
|
template<class Type, class CombineOp>
|
||||||
Foam::tmp<Foam::Field<Type> >
|
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
||||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
|
||||||
(
|
(
|
||||||
const Field<Type>& fld,
|
const UList<Type>& fld,
|
||||||
const BinaryOp& bop
|
const CombineOp& bop,
|
||||||
) const
|
List<Type>& result
|
||||||
{
|
|
||||||
if (fld.size() != tgtAddress_.size())
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"AMIInterpolation::interpolateToSource(const Field<Type>) const"
|
|
||||||
) << "Supplied field size is not equal to target patch size" << nl
|
|
||||||
<< " source patch = " << srcAddress_.size() << nl
|
|
||||||
<< " target patch = " << tgtAddress_.size() << nl
|
|
||||||
<< " supplied field = " << fld.size()
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp<Field<Type> > tresult
|
|
||||||
(
|
|
||||||
new Field<Type>
|
|
||||||
(
|
|
||||||
srcAddress_.size(),
|
|
||||||
pTraits<Type>::zero
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
Field<Type>& result = tresult();
|
|
||||||
|
|
||||||
if (singlePatchProc_ == -1)
|
|
||||||
{
|
|
||||||
const mapDistribute& map = tgtMapPtr_();
|
|
||||||
|
|
||||||
Field<Type> work(fld);
|
|
||||||
map.distribute(work);
|
|
||||||
|
|
||||||
forAll(result, faceI)
|
|
||||||
{
|
|
||||||
const labelList& faces = srcAddress_[faceI];
|
|
||||||
const scalarList& weights = srcWeights_[faceI];
|
|
||||||
|
|
||||||
forAll(faces, i)
|
|
||||||
{
|
|
||||||
result[faceI] = bop(result[faceI], work[faces[i]]*weights[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(result, faceI)
|
|
||||||
{
|
|
||||||
const labelList& faces = srcAddress_[faceI];
|
|
||||||
const scalarList& weights = srcWeights_[faceI];
|
|
||||||
|
|
||||||
forAll(faces, i)
|
|
||||||
{
|
|
||||||
result[faceI] = bop(result[faceI], fld[faces[i]]*weights[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tresult;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
|
||||||
template<class Type, class BinaryOp>
|
|
||||||
Foam::tmp<Foam::Field<Type> >
|
|
||||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
|
||||||
(
|
|
||||||
const tmp<Field<Type> >& tFld,
|
|
||||||
const BinaryOp& bop
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return interpolateToSource(tFld(), bop);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
|
||||||
template<class Type, class BinaryOp>
|
|
||||||
Foam::tmp<Foam::Field<Type> >
|
|
||||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|
||||||
(
|
|
||||||
const Field<Type>& fld,
|
|
||||||
const BinaryOp& bop
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (fld.size() != srcAddress_.size())
|
if (fld.size() != srcAddress_.size())
|
||||||
@ -1875,22 +1824,13 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<Field<Type> > tresult
|
result.setSize(tgtAddress_.size());
|
||||||
(
|
|
||||||
new Field<Type>
|
|
||||||
(
|
|
||||||
tgtAddress_.size(),
|
|
||||||
pTraits<Type>::zero
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
Field<Type>& result = tresult();
|
|
||||||
|
|
||||||
if (singlePatchProc_ == -1)
|
if (singlePatchProc_ == -1)
|
||||||
{
|
{
|
||||||
const mapDistribute& map = srcMapPtr_();
|
const mapDistribute& map = srcMapPtr_();
|
||||||
|
|
||||||
Field<Type> work(fld);
|
List<Type> work(fld);
|
||||||
map.distribute(work);
|
map.distribute(work);
|
||||||
|
|
||||||
forAll(result, faceI)
|
forAll(result, faceI)
|
||||||
@ -1900,7 +1840,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
|
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
result[faceI] = bop(result[faceI], work[faces[i]]*weights[i]);
|
bop(result[faceI], faceI, work[faces[i]], weights[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1913,10 +1853,126 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
|
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
result[faceI] = bop(result[faceI], fld[faces[i]]*weights[i]);
|
bop(result[faceI], faceI, fld[faces[i]], weights[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type, class CombineOp>
|
||||||
|
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||||
|
(
|
||||||
|
const UList<Type>& fld,
|
||||||
|
const CombineOp& bop,
|
||||||
|
List<Type>& result
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (fld.size() != tgtAddress_.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"AMIInterpolation::interpolateToSource(const Field<Type>) const"
|
||||||
|
) << "Supplied field size is not equal to target patch size" << nl
|
||||||
|
<< " source patch = " << srcAddress_.size() << nl
|
||||||
|
<< " target patch = " << tgtAddress_.size() << nl
|
||||||
|
<< " supplied field = " << fld.size()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setSize(srcAddress_.size());
|
||||||
|
|
||||||
|
if (singlePatchProc_ == -1)
|
||||||
|
{
|
||||||
|
const mapDistribute& map = tgtMapPtr_();
|
||||||
|
|
||||||
|
List<Type> work(fld);
|
||||||
|
map.distribute(work);
|
||||||
|
|
||||||
|
forAll(result, faceI)
|
||||||
|
{
|
||||||
|
const labelList& faces = srcAddress_[faceI];
|
||||||
|
const scalarList& weights = srcWeights_[faceI];
|
||||||
|
|
||||||
|
forAll(faces, i)
|
||||||
|
{
|
||||||
|
bop(result[faceI], faceI, work[faces[i]], weights[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(result, faceI)
|
||||||
|
{
|
||||||
|
const labelList& faces = srcAddress_[faceI];
|
||||||
|
const scalarList& weights = srcWeights_[faceI];
|
||||||
|
|
||||||
|
forAll(faces, i)
|
||||||
|
{
|
||||||
|
bop(result[faceI], faceI, fld[faces[i]], weights[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||||
|
(
|
||||||
|
const Field<Type>& fld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<Field<Type> > tresult
|
||||||
|
(
|
||||||
|
new Field<Type>
|
||||||
|
(
|
||||||
|
srcAddress_.size(),
|
||||||
|
pTraits<Type>::zero
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
interpolateToSource(fld, combineBinaryOp<Type, BinaryOp>(bop), tresult());
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return interpolateToSource(tFld, bop);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
||||||
|
(
|
||||||
|
const Field<Type>& fld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<Field<Type> > tresult
|
||||||
|
(
|
||||||
|
new Field<Type>
|
||||||
|
(
|
||||||
|
tgtAddress_.size(),
|
||||||
|
pTraits<Type>::zero
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
interpolateToTarget(fld, combineBinaryOp<Type, BinaryOp>(bop), tresult());
|
||||||
|
|
||||||
return tresult;
|
return tresult;
|
||||||
}
|
}
|
||||||
@ -1931,7 +1987,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
const BinaryOp& bop
|
const BinaryOp& bop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return interpolateToTarget(tFld(), bop);
|
return interpolateToTarget(tFld, bop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -404,7 +404,30 @@ public:
|
|||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//- Interpolate from target to source with supplied op
|
// Low-level
|
||||||
|
|
||||||
|
//- Interpolate from target to source with supplied op
|
||||||
|
// to combine existing value with remote value and weight
|
||||||
|
template<class Type, class CombineOp>
|
||||||
|
void interpolateToSource
|
||||||
|
(
|
||||||
|
const UList<Type>& fld,
|
||||||
|
const CombineOp& bop,
|
||||||
|
List<Type>& result
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate from source to target with supplied op
|
||||||
|
// to combine existing value with remote value and weight
|
||||||
|
template<class Type, class CombineOp>
|
||||||
|
void interpolateToTarget
|
||||||
|
(
|
||||||
|
const UList<Type>& fld,
|
||||||
|
const CombineOp& bop,
|
||||||
|
List<Type>& result
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Interpolate from target to source with supplied binary op
|
||||||
template<class Type, class BinaryOp>
|
template<class Type, class BinaryOp>
|
||||||
tmp<Field<Type> > interpolateToSource
|
tmp<Field<Type> > interpolateToSource
|
||||||
(
|
(
|
||||||
@ -412,7 +435,8 @@ public:
|
|||||||
const BinaryOp& bop
|
const BinaryOp& bop
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Interpolate from target tmp field to source with supplied op
|
//- Interpolate from target tmp field to source with supplied
|
||||||
|
// binary op
|
||||||
template<class Type, class BinaryOp>
|
template<class Type, class BinaryOp>
|
||||||
tmp<Field<Type> > interpolateToSource
|
tmp<Field<Type> > interpolateToSource
|
||||||
(
|
(
|
||||||
@ -464,7 +488,6 @@ public:
|
|||||||
const tmp<Field<Type> >& tFld
|
const tmp<Field<Type> >& tFld
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Checks
|
// Checks
|
||||||
|
|
||||||
//- Write face connectivity as OBJ file
|
//- Write face connectivity as OBJ file
|
||||||
|
|||||||
@ -318,6 +318,15 @@ public:
|
|||||||
const tmp<Field<Type> >& tFld
|
const tmp<Field<Type> >& tFld
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Low-level interpolate List
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
void interpolate
|
||||||
|
(
|
||||||
|
const UList<Type>& fld,
|
||||||
|
const BinaryOp& bop,
|
||||||
|
List<Type>& result
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Calculate the patch geometry
|
//- Calculate the patch geometry
|
||||||
virtual void calcGeometry
|
virtual void calcGeometry
|
||||||
|
|||||||
@ -59,4 +59,23 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicAMIPolyPatch::interpolate
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
void Foam::cyclicAMIPolyPatch::interpolate
|
||||||
|
(
|
||||||
|
const UList<Type>& fld,
|
||||||
|
const BinaryOp& bop,
|
||||||
|
List<Type>& result
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (owner())
|
||||||
|
{
|
||||||
|
AMIPtr_->interpolateToSource(fld, bop, result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
neighbPatch().AMIPtr_->interpolateToTarget(fld, bop, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -30,14 +30,21 @@ meshSearch/meshSearch.C
|
|||||||
|
|
||||||
meshTools/meshTools.C
|
meshTools/meshTools.C
|
||||||
|
|
||||||
pWave = PointEdgeWave
|
algorithms = algorithms
|
||||||
|
|
||||||
|
pWave = $(algorithms)/PointEdgeWave
|
||||||
$(pWave)/PointEdgeWaveName.C
|
$(pWave)/PointEdgeWaveName.C
|
||||||
$(pWave)/pointEdgePoint.C
|
$(pWave)/pointEdgePoint.C
|
||||||
|
|
||||||
patchWave = PatchEdgeFaceWave
|
patchWave = $(algorithms)/PatchEdgeFaceWave
|
||||||
$(patchWave)/PatchEdgeFaceWaveName.C
|
$(patchWave)/PatchEdgeFaceWaveName.C
|
||||||
$(patchWave)/patchEdgeFaceInfo.C
|
$(patchWave)/patchEdgeFaceInfo.C
|
||||||
|
|
||||||
|
meshWave = $(algorithms)/MeshWave
|
||||||
|
$(meshWave)/MeshWaveName.C
|
||||||
|
$(meshWave)/FaceCellWaveName.C
|
||||||
|
|
||||||
|
|
||||||
regionSplit/regionSplit.C
|
regionSplit/regionSplit.C
|
||||||
|
|
||||||
indexedOctree/treeDataEdge.C
|
indexedOctree/treeDataEdge.C
|
||||||
|
|||||||
@ -27,11 +27,14 @@ License
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
#include "cyclicPolyPatch.H"
|
#include "cyclicPolyPatch.H"
|
||||||
|
#include "cyclicAMIPolyPatch.H"
|
||||||
#include "OPstream.H"
|
#include "OPstream.H"
|
||||||
#include "IPstream.H"
|
#include "IPstream.H"
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "debug.H"
|
#include "debug.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
|
#include "SubField.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -44,6 +47,53 @@ Foam::scalar Foam::FaceCellWave<Type, TrackingData>::propagationTol_ = 0.01;
|
|||||||
template <class Type, class TrackingData>
|
template <class Type, class TrackingData>
|
||||||
Foam::label Foam::FaceCellWave<Type, TrackingData>::dummyTrackData_ = 12345;
|
Foam::label Foam::FaceCellWave<Type, TrackingData>::dummyTrackData_ = 12345;
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
//- Combine operator for AMIInterpolation
|
||||||
|
template<class Type, class TrackingData>
|
||||||
|
class combine
|
||||||
|
{
|
||||||
|
FaceCellWave<Type, TrackingData>& solver_;
|
||||||
|
|
||||||
|
const polyPatch& patch_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
combine
|
||||||
|
(
|
||||||
|
FaceCellWave<Type, TrackingData>& solver,
|
||||||
|
const polyPatch& patch
|
||||||
|
)
|
||||||
|
:
|
||||||
|
solver_(solver),
|
||||||
|
patch_(patch)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void operator()
|
||||||
|
(
|
||||||
|
Type& x,
|
||||||
|
const label faceI,
|
||||||
|
const Type& y,
|
||||||
|
const scalar weight
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (y.valid(solver_.data()))
|
||||||
|
{
|
||||||
|
x.updateFace
|
||||||
|
(
|
||||||
|
solver_.mesh(),
|
||||||
|
patch_.start() + faceI,
|
||||||
|
y,
|
||||||
|
solver_.propagationTol(),
|
||||||
|
solver_.data()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -244,11 +294,12 @@ void Foam::FaceCellWave<Type, TrackingData>::checkCyclic
|
|||||||
|
|
||||||
// Check if has cyclic patches
|
// Check if has cyclic patches
|
||||||
template <class Type, class TrackingData>
|
template <class Type, class TrackingData>
|
||||||
bool Foam::FaceCellWave<Type, TrackingData>::hasCyclicPatch() const
|
template <class PatchType>
|
||||||
|
bool Foam::FaceCellWave<Type, TrackingData>::hasPatch() const
|
||||||
{
|
{
|
||||||
forAll(mesh_.boundaryMesh(), patchI)
|
forAll(mesh_.boundaryMesh(), patchI)
|
||||||
{
|
{
|
||||||
if (isA<cyclicPolyPatch>(mesh_.boundaryMesh()[patchI]))
|
if (isA<PatchType>(mesh_.boundaryMesh()[patchI]))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -446,119 +497,117 @@ void Foam::FaceCellWave<Type, TrackingData>::offset
|
|||||||
template <class Type, class TrackingData>
|
template <class Type, class TrackingData>
|
||||||
void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||||
{
|
{
|
||||||
|
const globalMeshData& pData = mesh_.globalData();
|
||||||
|
|
||||||
|
// Which patches are processor patches
|
||||||
|
const labelList& procPatches = pData.processorPatches();
|
||||||
|
|
||||||
// Send all
|
// Send all
|
||||||
|
|
||||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||||
|
|
||||||
forAll(mesh_.boundaryMesh(), patchI)
|
forAll(procPatches, i)
|
||||||
{
|
{
|
||||||
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
label patchI = procPatches[i];
|
||||||
|
|
||||||
if (isA<processorPolyPatch>(patch))
|
const processorPolyPatch& procPatch =
|
||||||
|
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
|
||||||
|
|
||||||
|
// Allocate buffers
|
||||||
|
label nSendFaces;
|
||||||
|
labelList sendFaces(procPatch.size());
|
||||||
|
List<Type> sendFacesInfo(procPatch.size());
|
||||||
|
|
||||||
|
// Determine which faces changed on current patch
|
||||||
|
nSendFaces = getChangedPatchFaces
|
||||||
|
(
|
||||||
|
procPatch,
|
||||||
|
0,
|
||||||
|
procPatch.size(),
|
||||||
|
sendFaces,
|
||||||
|
sendFacesInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
// Adapt wallInfo for leaving domain
|
||||||
|
leaveDomain
|
||||||
|
(
|
||||||
|
procPatch,
|
||||||
|
nSendFaces,
|
||||||
|
sendFaces,
|
||||||
|
sendFacesInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
{
|
{
|
||||||
// Allocate buffers
|
Pout<< " Processor patch " << patchI << ' ' << procPatch.name()
|
||||||
label nSendFaces;
|
<< " communicating with " << procPatch.neighbProcNo()
|
||||||
labelList sendFaces(patch.size());
|
<< " Sending:" << nSendFaces
|
||||||
List<Type> sendFacesInfo(patch.size());
|
<< endl;
|
||||||
|
|
||||||
// Determine which faces changed on current patch
|
|
||||||
nSendFaces = getChangedPatchFaces
|
|
||||||
(
|
|
||||||
patch,
|
|
||||||
0,
|
|
||||||
patch.size(),
|
|
||||||
sendFaces,
|
|
||||||
sendFacesInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
// Adapt wallInfo for leaving domain
|
|
||||||
leaveDomain
|
|
||||||
(
|
|
||||||
patch,
|
|
||||||
nSendFaces,
|
|
||||||
sendFaces,
|
|
||||||
sendFacesInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
const processorPolyPatch& procPatch =
|
|
||||||
refCast<const processorPolyPatch>(patch);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Pout<< " Processor patch " << patchI << ' ' << patch.name()
|
|
||||||
<< " communicating with " << procPatch.neighbProcNo()
|
|
||||||
<< " Sending:" << nSendFaces
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
|
|
||||||
//writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour);
|
|
||||||
toNeighbour
|
|
||||||
<< SubList<label>(sendFaces, nSendFaces)
|
|
||||||
<< SubList<Type>(sendFacesInfo, nSendFaces);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||||
|
//writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour);
|
||||||
|
toNeighbour
|
||||||
|
<< SubList<label>(sendFaces, nSendFaces)
|
||||||
|
<< SubList<Type>(sendFacesInfo, nSendFaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
|
|
||||||
// Receive all
|
// Receive all
|
||||||
|
|
||||||
forAll(mesh_.boundaryMesh(), patchI)
|
forAll(procPatches, i)
|
||||||
{
|
{
|
||||||
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
label patchI = procPatches[i];
|
||||||
|
|
||||||
|
const processorPolyPatch& procPatch =
|
||||||
|
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
|
||||||
|
|
||||||
|
// Allocate buffers
|
||||||
|
labelList receiveFaces;
|
||||||
|
List<Type> receiveFacesInfo;
|
||||||
|
|
||||||
if (isA<processorPolyPatch>(patch))
|
|
||||||
{
|
{
|
||||||
const processorPolyPatch& procPatch =
|
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||||
refCast<const processorPolyPatch>(patch);
|
fromNeighbour >> receiveFaces >> receiveFacesInfo;
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate buffers
|
if (debug)
|
||||||
labelList receiveFaces;
|
{
|
||||||
List<Type> receiveFacesInfo;
|
Pout<< " Processor patch " << patchI << ' ' << procPatch.name()
|
||||||
|
<< " communicating with " << procPatch.neighbProcNo()
|
||||||
|
<< " Receiving:" << receiveFaces.size()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
// Apply transform to received data for non-parallel planes
|
||||||
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
if (!procPatch.parallel())
|
||||||
fromNeighbour >> receiveFaces >> receiveFacesInfo;
|
{
|
||||||
}
|
transform
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Pout<< " Processor patch " << patchI << ' ' << patch.name()
|
|
||||||
<< " communicating with " << procPatch.neighbProcNo()
|
|
||||||
<< " Receiving:" << receiveFaces.size()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply transform to received data for non-parallel planes
|
|
||||||
if (!procPatch.parallel())
|
|
||||||
{
|
|
||||||
transform
|
|
||||||
(
|
|
||||||
procPatch.forwardT(),
|
|
||||||
receiveFaces.size(),
|
|
||||||
receiveFacesInfo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adapt wallInfo for entering domain
|
|
||||||
enterDomain
|
|
||||||
(
|
(
|
||||||
patch,
|
procPatch.forwardT(),
|
||||||
receiveFaces.size(),
|
receiveFaces.size(),
|
||||||
receiveFaces,
|
|
||||||
receiveFacesInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
// Merge received info
|
|
||||||
mergeFaceInfo
|
|
||||||
(
|
|
||||||
patch,
|
|
||||||
receiveFaces.size(),
|
|
||||||
receiveFaces,
|
|
||||||
receiveFacesInfo
|
receiveFacesInfo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adapt wallInfo for entering domain
|
||||||
|
enterDomain
|
||||||
|
(
|
||||||
|
procPatch,
|
||||||
|
receiveFaces.size(),
|
||||||
|
receiveFaces,
|
||||||
|
receiveFacesInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
// Merge received info
|
||||||
|
mergeFaceInfo
|
||||||
|
(
|
||||||
|
procPatch,
|
||||||
|
receiveFaces.size(),
|
||||||
|
receiveFaces,
|
||||||
|
receiveFacesInfo
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,6 +697,93 @@ void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Transfer information across cyclic halves.
|
||||||
|
template <class Type, class TrackingData>
|
||||||
|
void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
|
||||||
|
{
|
||||||
|
forAll(mesh_.boundaryMesh(), patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
||||||
|
|
||||||
|
if (isA<cyclicAMIPolyPatch>(patch))
|
||||||
|
{
|
||||||
|
const cyclicAMIPolyPatch& cycPatch =
|
||||||
|
refCast<const cyclicAMIPolyPatch>(patch);
|
||||||
|
|
||||||
|
List<Type> receiveInfo;
|
||||||
|
|
||||||
|
{
|
||||||
|
const cyclicAMIPolyPatch& nbrPatch =
|
||||||
|
refCast<const cyclicAMIPolyPatch>(patch).neighbPatch();
|
||||||
|
|
||||||
|
// Get nbrPatch data (so not just changed faces)
|
||||||
|
typename List<Type>::subList sendInfo
|
||||||
|
(
|
||||||
|
nbrPatch.patchSlice
|
||||||
|
(
|
||||||
|
allFaceInfo_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Adapt sendInfo for leaving domain
|
||||||
|
const vectorField::subField fc = nbrPatch.faceCentres();
|
||||||
|
forAll(sendInfo, i)
|
||||||
|
{
|
||||||
|
sendInfo[i].leaveDomain(mesh_, nbrPatch, i, fc[i], td_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Transfer sendInfo to cycPatch
|
||||||
|
combine<Type, TrackingData> cmb(*this, cycPatch);
|
||||||
|
|
||||||
|
cycPatch.interpolate(sendInfo, cmb, receiveInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply transform to received data for non-parallel planes
|
||||||
|
if (!cycPatch.parallel())
|
||||||
|
{
|
||||||
|
transform
|
||||||
|
(
|
||||||
|
cycPatch.forwardT(),
|
||||||
|
receiveInfo.size(),
|
||||||
|
receiveInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adapt receiveInfo for entering domain
|
||||||
|
const vectorField::subField fc = cycPatch.faceCentres();
|
||||||
|
forAll(receiveInfo, i)
|
||||||
|
{
|
||||||
|
receiveInfo[i].enterDomain(mesh_, cycPatch, i, fc[i], td_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge into global storage
|
||||||
|
forAll(receiveInfo, i)
|
||||||
|
{
|
||||||
|
label meshFaceI = cycPatch.start()+i;
|
||||||
|
|
||||||
|
Type& currentWallInfo = allFaceInfo_[meshFaceI];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
receiveInfo[i].valid(td_)
|
||||||
|
&& !currentWallInfo.equal(receiveInfo[i], td_)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
updateFace
|
||||||
|
(
|
||||||
|
meshFaceI,
|
||||||
|
receiveInfo[i],
|
||||||
|
propagationTol_,
|
||||||
|
currentWallInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Set up only. Use setFaceInfo and iterate() to do actual calculation.
|
// Set up only. Use setFaceInfo and iterate() to do actual calculation.
|
||||||
@ -670,7 +806,11 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
|||||||
changedCell_(mesh_.nCells(), false),
|
changedCell_(mesh_.nCells(), false),
|
||||||
changedCells_(mesh_.nCells()),
|
changedCells_(mesh_.nCells()),
|
||||||
nChangedCells_(0),
|
nChangedCells_(0),
|
||||||
hasCyclicPatches_(hasCyclicPatch()),
|
hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
|
||||||
|
hasCyclicAMIPatches_
|
||||||
|
(
|
||||||
|
returnReduce(hasPatch<cyclicAMIPolyPatch>(), orOp<bool>())
|
||||||
|
),
|
||||||
nEvals_(0),
|
nEvals_(0),
|
||||||
nUnvisitedCells_(mesh_.nCells()),
|
nUnvisitedCells_(mesh_.nCells()),
|
||||||
nUnvisitedFaces_(mesh_.nFaces())
|
nUnvisitedFaces_(mesh_.nFaces())
|
||||||
@ -701,7 +841,11 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
|||||||
changedCell_(mesh_.nCells(), false),
|
changedCell_(mesh_.nCells(), false),
|
||||||
changedCells_(mesh_.nCells()),
|
changedCells_(mesh_.nCells()),
|
||||||
nChangedCells_(0),
|
nChangedCells_(0),
|
||||||
hasCyclicPatches_(hasCyclicPatch()),
|
hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
|
||||||
|
hasCyclicAMIPatches_
|
||||||
|
(
|
||||||
|
returnReduce(hasPatch<cyclicAMIPolyPatch>(), orOp<bool>())
|
||||||
|
),
|
||||||
nEvals_(0),
|
nEvals_(0),
|
||||||
nUnvisitedCells_(mesh_.nCells()),
|
nUnvisitedCells_(mesh_.nCells()),
|
||||||
nUnvisitedFaces_(mesh_.nFaces())
|
nUnvisitedFaces_(mesh_.nFaces())
|
||||||
@ -888,6 +1032,12 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::cellToFace()
|
|||||||
// Transfer changed faces across cyclic halves
|
// Transfer changed faces across cyclic halves
|
||||||
handleCyclicPatches();
|
handleCyclicPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasCyclicAMIPatches_)
|
||||||
|
{
|
||||||
|
handleAMICyclicPatches();
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Transfer changed faces from neighbouring processors.
|
// Transfer changed faces from neighbouring processors.
|
||||||
@ -917,6 +1067,12 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::iterate(const label maxIter)
|
|||||||
// Transfer changed faces across cyclic halves
|
// Transfer changed faces across cyclic halves
|
||||||
handleCyclicPatches();
|
handleCyclicPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasCyclicAMIPatches_)
|
||||||
|
{
|
||||||
|
handleAMICyclicPatches();
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Transfer changed faces from neighbouring processors.
|
// Transfer changed faces from neighbouring processors.
|
||||||
@ -105,7 +105,10 @@ class FaceCellWave
|
|||||||
label nChangedCells_;
|
label nChangedCells_;
|
||||||
|
|
||||||
//- Contains cyclics
|
//- Contains cyclics
|
||||||
bool hasCyclicPatches_;
|
const bool hasCyclicPatches_;
|
||||||
|
|
||||||
|
//- Contains cyclicAMI
|
||||||
|
const bool hasCyclicAMIPatches_;
|
||||||
|
|
||||||
//- Number of evaluations
|
//- Number of evaluations
|
||||||
label nEvals_;
|
label nEvals_;
|
||||||
@ -163,7 +166,8 @@ class FaceCellWave
|
|||||||
void checkCyclic(const polyPatch& pPatch) const;
|
void checkCyclic(const polyPatch& pPatch) const;
|
||||||
|
|
||||||
//- Has cyclic patch?
|
//- Has cyclic patch?
|
||||||
bool hasCyclicPatch() const;
|
template <class PatchType>
|
||||||
|
bool hasPatch() const;
|
||||||
|
|
||||||
//- Merge received patch data into global data
|
//- Merge received patch data into global data
|
||||||
void mergeFaceInfo
|
void mergeFaceInfo
|
||||||
@ -225,6 +229,9 @@ class FaceCellWave
|
|||||||
//- Merge data from across cyclics
|
//- Merge data from across cyclics
|
||||||
void handleCyclicPatches();
|
void handleCyclicPatches();
|
||||||
|
|
||||||
|
//- Merge data from across AMI cyclics
|
||||||
|
void handleAMICyclicPatches();
|
||||||
|
|
||||||
|
|
||||||
// Private static data
|
// Private static data
|
||||||
|
|
||||||
Reference in New Issue
Block a user