Commit 7c1c9fee authored by Andrew Heather's avatar Andrew Heather Committed by Andrew Heather
Browse files

ENH: Updated AMI dependent code

parent 66d270b9
......@@ -252,11 +252,7 @@ int main(int argc, char *argv[])
meshToMesh::interpolationMethod method =
meshToMesh::interpolationMethodNames_[mapMethod];
patchMapMethod =
AMIPatchToPatchInterpolation::interpolationMethodNames_
[
meshToMesh::interpolationMethodAMI(method)
];
patchMapMethod = meshToMesh::interpolationMethodAMI(method);
}
word procMapMethod =
......
......@@ -47,6 +47,7 @@ License
#include "gravityMeshObject.H"
#include "turbulentTransportModel.H"
#include "demandDrivenData.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......
......@@ -86,11 +86,7 @@ void Foam::functionObjects::mapFields::createInterpolation
);
// Lookup corresponding AMI method
word patchMapMethodName =
AMIPatchToPatchInterpolation::interpolationMethodNames_
[
meshToMesh::interpolationMethodAMI(mapMethod)
];
word patchMapMethodName = meshToMesh::interpolationMethodAMI(mapMethod);
// Optionally override
if (dict.readIfPresent("patchMapMethod", patchMapMethodName))
......
......@@ -31,6 +31,7 @@ License
#include "treeDataCell.H"
#include "cubicEqn.H"
#include "registerSwitch.H"
#include "indexedOctree.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......
......@@ -794,9 +794,11 @@ void Foam::mappedPatchBase::calcAMI() const
{
if (AMIPtr_->upToDate())
{
WarningInFunction
DebugInFunction
<< "AMI already up-to-date"
<< endl;
return;
}
const polyPatch& nbr = samplePolyPatch();
......@@ -1040,7 +1042,7 @@ Foam::mappedPatchBase::mappedPatchBase
(
AMIInterpolation::New
(
dict.lookupOrDefault("AMIMethod", faceAreaWeightAMI::typeName),
dict.getOrDefault("AMIMethod", faceAreaWeightAMI::typeName),
dict,
AMIReverse_
)
......
......@@ -172,13 +172,10 @@ inline const Foam::AMIPatchToPatchInterpolation& Foam::mappedPatchBase::AMI
if (topoChange || forceUpdate)
{
AMIPtr_.clear();
AMIPtr_->upToDate() = false;
}
if (AMIPtr_.empty())
{
calcAMI();
}
calcAMI();
return *AMIPtr_;
}
......
......@@ -31,6 +31,7 @@ License
#include "Time.H"
#include "mappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
#include "faceAreaWeightAMI.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -209,18 +210,16 @@ Foam::regionModels::regionModel::interRegionAMI
interRegionAMI_[nbrRegionID].set
(
regionPatchi,
new AMIPatchToPatchInterpolation
AMIInterpolation::New
(
p,
nbrP,
faceAreaIntersect::tmMesh,
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
-1,
faceAreaWeightAMI::typeName,
true, // requireMatch
flip
)
);
interRegionAMI_[nbrRegionID][regionPatchi].calculate(p, nbrP);
UPstream::msgType() = oldTag;
}
......@@ -252,18 +251,16 @@ Foam::regionModels::regionModel::interRegionAMI
interRegionAMI_[nbrRegionID].set
(
regionPatchi,
new AMIPatchToPatchInterpolation
AMIInterpolation::New
(
p,
nbrP,
faceAreaIntersect::tmMesh,
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
-1,
flip
faceAreaWeightAMI::typeName,
true, // requireMatch
flip // reverse
)
);
interRegionAMI_[nbrRegionID][regionPatchi].calculate(p, nbrP);
UPstream::msgType() = oldTag;
return interRegionAMI_[nbrRegionID][regionPatchi];
......
......@@ -30,6 +30,8 @@ License
#include "Time.H"
#include "globalIndex.H"
#include "meshToMeshMethod.H"
#include "nearestFaceAMI.H"
#include "faceAreaWeightAMI.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -633,25 +635,27 @@ void Foam::meshToMesh::calculate(const word& methodName, const bool normalise)
}
Foam::AMIPatchToPatchInterpolation::interpolationMethod
Foam::meshToMesh::interpolationMethodAMI(const interpolationMethod method)
Foam::word Foam::meshToMesh::interpolationMethodAMI
(
const interpolationMethod method
)
{
switch (method)
{
case interpolationMethod::imDirect:
{
return AMIPatchToPatchInterpolation::imNearestFace;
return nearestFaceAMI::typeName;
break;
}
case interpolationMethod::imMapNearest:
{
return AMIPatchToPatchInterpolation::imNearestFace;
return nearestFaceAMI::typeName;
break;
}
case interpolationMethod::imCellVolumeWeight:
case interpolationMethod::imCorrectedCellVolumeWeight:
{
return AMIPatchToPatchInterpolation::imFaceAreaWeight;
return faceAreaWeightAMI::typeName;
break;
}
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
(
i,
new AMIPatchToPatchInterpolation
AMIInterpolation::New
(
srcPP,
tgtPP,
faceAreaIntersect::tmMesh,
false,
AMIMethodName,
-1,
true // flip target patch since patch normals are aligned
false, // requireMatch
true, // flip target patch since patch normals are aligned
-1 // low weight correction
)
);
patchAMIs_[i].calculate(srcPP, tgtPP);
Info<< decrIndent;
}
}
......@@ -862,10 +865,7 @@ Foam::meshToMesh::meshToMesh
constructNoCuttingPatches
(
interpolationMethodNames_[method],
AMIPatchToPatchInterpolation::interpolationMethodNames_
[
interpolationMethodAMI(method)
],
interpolationMethodAMI(method),
interpAllPatches
);
}
......@@ -933,10 +933,7 @@ Foam::meshToMesh::meshToMesh
constructFromCuttingPatches
(
interpolationMethodNames_[method],
AMIPatchToPatchInterpolation::interpolationMethodNames_
[
interpolationMethodAMI(method)
],
interpolationMethodAMI(method),
patchMap,
cuttingPatches,
normalise
......
......@@ -394,8 +394,7 @@ public:
inline scalar V() const;
//- Conversion between mesh and patch interpolation methods
static AMIPatchToPatchInterpolation::interpolationMethod
interpolationMethodAMI
static word interpolationMethodAMI
(
const interpolationMethod method
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment