ENH: Updated AMI dependent code

This commit is contained in:
Andrew Heather
2020-06-03 14:45:01 +01:00
committed by Andrew Heather
parent 66d270b924
commit 7c1c9fee0c
9 changed files with 41 additions and 55 deletions

View File

@ -252,11 +252,7 @@ int main(int argc, char *argv[])
meshToMesh::interpolationMethod method = meshToMesh::interpolationMethod method =
meshToMesh::interpolationMethodNames_[mapMethod]; meshToMesh::interpolationMethodNames_[mapMethod];
patchMapMethod = patchMapMethod = meshToMesh::interpolationMethodAMI(method);
AMIPatchToPatchInterpolation::interpolationMethodNames_
[
meshToMesh::interpolationMethodAMI(method)
];
} }
word procMapMethod = word procMapMethod =

View File

@ -47,6 +47,7 @@ License
#include "gravityMeshObject.H" #include "gravityMeshObject.H"
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -86,11 +86,7 @@ void Foam::functionObjects::mapFields::createInterpolation
); );
// Lookup corresponding AMI method // Lookup corresponding AMI method
word patchMapMethodName = word patchMapMethodName = meshToMesh::interpolationMethodAMI(mapMethod);
AMIPatchToPatchInterpolation::interpolationMethodNames_
[
meshToMesh::interpolationMethodAMI(mapMethod)
];
// Optionally override // Optionally override
if (dict.readIfPresent("patchMapMethod", patchMapMethodName)) if (dict.readIfPresent("patchMapMethod", patchMapMethodName))

View File

@ -31,6 +31,7 @@ License
#include "treeDataCell.H" #include "treeDataCell.H"
#include "cubicEqn.H" #include "cubicEqn.H"
#include "registerSwitch.H" #include "registerSwitch.H"
#include "indexedOctree.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -794,9 +794,11 @@ void Foam::mappedPatchBase::calcAMI() const
{ {
if (AMIPtr_->upToDate()) if (AMIPtr_->upToDate())
{ {
WarningInFunction DebugInFunction
<< "AMI already up-to-date" << "AMI already up-to-date"
<< endl; << endl;
return;
} }
const polyPatch& nbr = samplePolyPatch(); const polyPatch& nbr = samplePolyPatch();
@ -1040,7 +1042,7 @@ Foam::mappedPatchBase::mappedPatchBase
( (
AMIInterpolation::New AMIInterpolation::New
( (
dict.lookupOrDefault("AMIMethod", faceAreaWeightAMI::typeName), dict.getOrDefault("AMIMethod", faceAreaWeightAMI::typeName),
dict, dict,
AMIReverse_ AMIReverse_
) )

View File

@ -172,13 +172,10 @@ inline const Foam::AMIPatchToPatchInterpolation& Foam::mappedPatchBase::AMI
if (topoChange || forceUpdate) if (topoChange || forceUpdate)
{ {
AMIPtr_.clear(); AMIPtr_->upToDate() = false;
} }
if (AMIPtr_.empty()) calcAMI();
{
calcAMI();
}
return *AMIPtr_; return *AMIPtr_;
} }

View File

@ -31,6 +31,7 @@ License
#include "Time.H" #include "Time.H"
#include "mappedWallPolyPatch.H" #include "mappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "faceAreaWeightAMI.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -209,18 +210,16 @@ Foam::regionModels::regionModel::interRegionAMI
interRegionAMI_[nbrRegionID].set interRegionAMI_[nbrRegionID].set
( (
regionPatchi, regionPatchi,
new AMIPatchToPatchInterpolation AMIInterpolation::New
( (
p, faceAreaWeightAMI::typeName,
nbrP, true, // requireMatch
faceAreaIntersect::tmMesh,
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
-1,
flip flip
) )
); );
interRegionAMI_[nbrRegionID][regionPatchi].calculate(p, nbrP);
UPstream::msgType() = oldTag; UPstream::msgType() = oldTag;
} }
@ -252,18 +251,16 @@ Foam::regionModels::regionModel::interRegionAMI
interRegionAMI_[nbrRegionID].set interRegionAMI_[nbrRegionID].set
( (
regionPatchi, regionPatchi,
new AMIPatchToPatchInterpolation AMIInterpolation::New
( (
p, faceAreaWeightAMI::typeName,
nbrP, true, // requireMatch
faceAreaIntersect::tmMesh, flip // reverse
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
-1,
flip
) )
); );
interRegionAMI_[nbrRegionID][regionPatchi].calculate(p, nbrP);
UPstream::msgType() = oldTag; UPstream::msgType() = oldTag;
return interRegionAMI_[nbrRegionID][regionPatchi]; return interRegionAMI_[nbrRegionID][regionPatchi];

View File

@ -30,6 +30,8 @@ License
#include "Time.H" #include "Time.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "meshToMeshMethod.H" #include "meshToMeshMethod.H"
#include "nearestFaceAMI.H"
#include "faceAreaWeightAMI.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -633,25 +635,27 @@ void Foam::meshToMesh::calculate(const word& methodName, const bool normalise)
} }
Foam::AMIPatchToPatchInterpolation::interpolationMethod Foam::word Foam::meshToMesh::interpolationMethodAMI
Foam::meshToMesh::interpolationMethodAMI(const interpolationMethod method) (
const interpolationMethod method
)
{ {
switch (method) switch (method)
{ {
case interpolationMethod::imDirect: case interpolationMethod::imDirect:
{ {
return AMIPatchToPatchInterpolation::imNearestFace; return nearestFaceAMI::typeName;
break; break;
} }
case interpolationMethod::imMapNearest: case interpolationMethod::imMapNearest:
{ {
return AMIPatchToPatchInterpolation::imNearestFace; return nearestFaceAMI::typeName;
break; break;
} }
case interpolationMethod::imCellVolumeWeight: case interpolationMethod::imCellVolumeWeight:
case interpolationMethod::imCorrectedCellVolumeWeight: case interpolationMethod::imCorrectedCellVolumeWeight:
{ {
return AMIPatchToPatchInterpolation::imFaceAreaWeight; return faceAreaWeightAMI::typeName;
break; break;
} }
default: default:
@ -662,7 +666,7 @@ Foam::meshToMesh::interpolationMethodAMI(const interpolationMethod method)
} }
} }
return AMIPatchToPatchInterpolation::imNearestFace; return nearestFaceAMI::typeName;
} }
@ -695,18 +699,17 @@ void Foam::meshToMesh::calculatePatchAMIs(const word& AMIMethodName)
patchAMIs_.set patchAMIs_.set
( (
i, i,
new AMIPatchToPatchInterpolation AMIInterpolation::New
( (
srcPP,
tgtPP,
faceAreaIntersect::tmMesh,
false,
AMIMethodName, AMIMethodName,
-1, false, // requireMatch
true // flip target patch since patch normals are aligned true, // flip target patch since patch normals are aligned
-1 // low weight correction
) )
); );
patchAMIs_[i].calculate(srcPP, tgtPP);
Info<< decrIndent; Info<< decrIndent;
} }
} }
@ -862,10 +865,7 @@ Foam::meshToMesh::meshToMesh
constructNoCuttingPatches constructNoCuttingPatches
( (
interpolationMethodNames_[method], interpolationMethodNames_[method],
AMIPatchToPatchInterpolation::interpolationMethodNames_ interpolationMethodAMI(method),
[
interpolationMethodAMI(method)
],
interpAllPatches interpAllPatches
); );
} }
@ -933,10 +933,7 @@ Foam::meshToMesh::meshToMesh
constructFromCuttingPatches constructFromCuttingPatches
( (
interpolationMethodNames_[method], interpolationMethodNames_[method],
AMIPatchToPatchInterpolation::interpolationMethodNames_ interpolationMethodAMI(method),
[
interpolationMethodAMI(method)
],
patchMap, patchMap,
cuttingPatches, cuttingPatches,
normalise normalise

View File

@ -394,8 +394,7 @@ public:
inline scalar V() const; inline scalar V() const;
//- Conversion between mesh and patch interpolation methods //- Conversion between mesh and patch interpolation methods
static AMIPatchToPatchInterpolation::interpolationMethod static word interpolationMethodAMI
interpolationMethodAMI
( (
const interpolationMethod method const interpolationMethod method
); );