mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updates to AMI and tutorial
This commit is contained in:
@ -275,8 +275,6 @@ distributeAndMergePatches
|
|||||||
|
|
||||||
tgtFaces.setSize(nFaces);
|
tgtFaces.setSize(nFaces);
|
||||||
tgtPoints.setSize(nPoints);
|
tgtPoints.setSize(nPoints);
|
||||||
|
|
||||||
//reduce(nFaces, sumOp<label>());
|
|
||||||
tgtFaceIDs.setSize(nFaces);
|
tgtFaceIDs.setSize(nFaces);
|
||||||
|
|
||||||
nFaces = 0;
|
nFaces = 0;
|
||||||
@ -754,7 +752,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::setNextFaces
|
|||||||
"const primitivePatch&, "
|
"const primitivePatch&, "
|
||||||
"const primitivePatch&, "
|
"const primitivePatch&, "
|
||||||
"const boolList&, "
|
"const boolList&, "
|
||||||
"const labelList&, "
|
"labelList&, "
|
||||||
"const DynamicList<label>&"
|
"const DynamicList<label>&"
|
||||||
") const"
|
") const"
|
||||||
) << "Unable to set source and target faces" << abort(FatalError);
|
) << "Unable to set source and target faces" << abort(FatalError);
|
||||||
@ -1052,9 +1050,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
|
|||||||
{
|
{
|
||||||
scalar s = sum(wght[faceI]);
|
scalar s = sum(wght[faceI]);
|
||||||
wghtSum[faceI] = s;
|
wghtSum[faceI] = s;
|
||||||
|
|
||||||
scalar t = 1; // s/patch[faceI].mag(patch.localPoints());
|
|
||||||
|
|
||||||
|
scalar t = s/patch[faceI].mag(patch.points());
|
||||||
if (t < minBound)
|
if (t < minBound)
|
||||||
{
|
{
|
||||||
minBound = t;
|
minBound = t;
|
||||||
@ -1096,7 +1093,6 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
|
|||||||
srcWeights_(),
|
srcWeights_(),
|
||||||
tgtAddress_(),
|
tgtAddress_(),
|
||||||
tgtWeights_(),
|
tgtWeights_(),
|
||||||
tgtPatchSize_(tgtPatch.size()),
|
|
||||||
startSeedI_(0),
|
startSeedI_(0),
|
||||||
triMode_(triMode),
|
triMode_(triMode),
|
||||||
projectPoints_(projectPoints),
|
projectPoints_(projectPoints),
|
||||||
@ -1146,8 +1142,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
globalIndex globalTgtFaces(tgtPatch.size());
|
globalIndex globalTgtFaces(tgtPatch.size());
|
||||||
|
|
||||||
// Create processor map of overlapping faces. This map gets
|
// Create processor map of overlapping faces. This map gets
|
||||||
// (possibly remote) faces from the tgtPatch such that they together
|
// (possibly remote) faces from the tgtPatch such that they (together)
|
||||||
// cover all of the srcPatch.
|
// cover all of the srcPatch
|
||||||
autoPtr<mapDistribute> mapPtr = calcProcMap(srcPatch, tgtPatch);
|
autoPtr<mapDistribute> mapPtr = calcProcMap(srcPatch, tgtPatch);
|
||||||
const mapDistribute& map = mapPtr();
|
const mapDistribute& map = mapPtr();
|
||||||
|
|
||||||
@ -1161,7 +1157,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
labelList tgtFaceIDs;
|
labelList tgtFaceIDs;
|
||||||
distributeAndMergePatches
|
distributeAndMergePatches
|
||||||
(
|
(
|
||||||
map, tgtPatch, globalTgtFaces, newTgtFaces, newTgtPoints, tgtFaceIDs
|
map,
|
||||||
|
tgtPatch,
|
||||||
|
globalTgtFaces,
|
||||||
|
newTgtFaces,
|
||||||
|
newTgtPoints,
|
||||||
|
tgtFaceIDs
|
||||||
);
|
);
|
||||||
|
|
||||||
primitivePatch
|
primitivePatch
|
||||||
@ -1178,7 +1179,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
checkPatches(srcPatch, newTgtPatch);
|
checkPatches(srcPatch, newTgtPatch);
|
||||||
|
|
||||||
|
|
||||||
// calculate AMI interpolation.
|
// calculate AMI interpolation
|
||||||
calcAddressing(srcPatch, newTgtPatch, surf);
|
calcAddressing(srcPatch, newTgtPatch, surf);
|
||||||
|
|
||||||
// Now
|
// Now
|
||||||
@ -1212,7 +1213,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send data back to originating procs. Note that contributions
|
// send data back to originating procs. Note that contributions
|
||||||
// from different processors get added (ListPlusEqOp).
|
// from different processors get added (ListPlusEqOp)
|
||||||
|
|
||||||
mapDistribute::distribute
|
mapDistribute::distribute
|
||||||
(
|
(
|
||||||
@ -1239,8 +1240,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
);
|
);
|
||||||
|
|
||||||
// weights normalisation
|
// weights normalisation
|
||||||
normaliseWeights(srcPatch, "source", srcAddress_, srcWeights_, true);
|
normaliseWeights(tgtPatch, "source", srcAddress_, srcWeights_, true);
|
||||||
normaliseWeights(tgtPatch, "target", tgtAddress_, tgtWeights_, true);
|
normaliseWeights(srcPatch, "target", tgtAddress_, tgtWeights_, true);
|
||||||
|
|
||||||
// cache maps and reset addresses
|
// cache maps and reset addresses
|
||||||
List<Map<label> > cMap;
|
List<Map<label> > cMap;
|
||||||
@ -1267,8 +1268,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
writeWeights(tgtWeights_, tgtPatch, "VTK", "target");
|
writeWeights(tgtWeights_, tgtPatch, "VTK", "target");
|
||||||
}
|
}
|
||||||
|
|
||||||
normaliseWeights(srcPatch, "source", srcAddress_, srcWeights_, true);
|
normaliseWeights(tgtPatch, "source", srcAddress_, srcWeights_, true);
|
||||||
normaliseWeights(tgtPatch, "target", tgtAddress_, tgtWeights_, true);
|
normaliseWeights(srcPatch, "target", tgtAddress_, tgtWeights_, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
patchI++;
|
patchI++;
|
||||||
@ -1283,13 +1284,13 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
|||||||
const Field<Type>& fld
|
const Field<Type>& fld
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (fld.size() != tgtPatchSize_)
|
if (fld.size() != tgtAddress_.size())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"AMIInterpolation::interpolateToSource(const Field<Type>) const"
|
"AMIInterpolation::interpolateToSource(const Field<Type>) const"
|
||||||
) << "Supplied field size is not equal to target patch size. "
|
) << "Supplied field size is not equal to target patch size. "
|
||||||
<< "Target patch = " << tgtPatchSize_ << ", supplied field = "
|
<< "Target patch = " << tgtAddress_.size() << ", supplied field = "
|
||||||
<< fld.size() << abort(FatalError);
|
<< fld.size() << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1375,7 +1376,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
(
|
(
|
||||||
new Field<Type>
|
new Field<Type>
|
||||||
(
|
(
|
||||||
tgtPatchSize_,
|
tgtAddress_.size(),
|
||||||
pTraits<Type>::zero
|
pTraits<Type>::zero
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -122,10 +122,6 @@ class AMIInterpolation
|
|||||||
//- Weights of wource faces per target face
|
//- Weights of wource faces per target face
|
||||||
scalarListList tgtWeights_;
|
scalarListList tgtWeights_;
|
||||||
|
|
||||||
//- Cache local size of target patch
|
|
||||||
// Note: size could be manipulated in parallel
|
|
||||||
label tgtPatchSize_;
|
|
||||||
|
|
||||||
|
|
||||||
//- Starting face seed index
|
//- Starting face seed index
|
||||||
label startSeedI_;
|
label startSeedI_;
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object decomposeParDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
/*
|
||||||
|
preservePatches
|
||||||
|
(
|
||||||
|
AMI1
|
||||||
|
AMI2
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
numberOfSubdomains 4;
|
||||||
|
|
||||||
|
method simple;
|
||||||
|
|
||||||
|
simpleCoeffs
|
||||||
|
{
|
||||||
|
n ( 2 2 1 );
|
||||||
|
delta 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
distributed no;
|
||||||
|
|
||||||
|
roots ( );
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -24,7 +24,6 @@ gradSchemes
|
|||||||
{
|
{
|
||||||
default Gauss linear;
|
default Gauss linear;
|
||||||
grad(p) Gauss linear;
|
grad(p) Gauss linear;
|
||||||
// grad(U) cellLimited Gauss linear 1;
|
|
||||||
grad(U) Gauss linear 1;
|
grad(U) Gauss linear 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,8 +36,7 @@ divSchemes
|
|||||||
|
|
||||||
laplacianSchemes
|
laplacianSchemes
|
||||||
{
|
{
|
||||||
// default Gauss linear corrected;
|
default Gauss linear corrected;
|
||||||
default Gauss linear uncorrected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interpolationSchemes
|
interpolationSchemes
|
||||||
@ -49,8 +47,7 @@ interpolationSchemes
|
|||||||
|
|
||||||
snGradSchemes
|
snGradSchemes
|
||||||
{
|
{
|
||||||
// default corrected;
|
default corrected;
|
||||||
default uncorrected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fluxRequired
|
fluxRequired
|
||||||
|
|||||||
Reference in New Issue
Block a user