diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C index 6c3f66c121d524c7b670dc7283069b1cf924d637..7c6435f1e424cba6338ecc46f94ce734bc2aae68 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C @@ -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 = diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C index 3a13ad4c5e3a939589eeb3f7e37363191e44205b..51d558a1fb9ae57423cead0c32bf0344fc4632d3 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C @@ -47,6 +47,7 @@ License #include "gravityMeshObject.H" #include "turbulentTransportModel.H" #include "demandDrivenData.H" +#include "unitConversion.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/functionObjects/field/mapFields/mapFields.C b/src/functionObjects/field/mapFields/mapFields.C index 66fa2370379f46ab1f23db806b93330c2ed7f876..02170a93c84b1ab56f38ed32262f150198c764a8 100644 --- a/src/functionObjects/field/mapFields/mapFields.C +++ b/src/functionObjects/field/mapFields/mapFields.C @@ -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)) diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index 42138a46b11dabb3090c740b13d1c4a5ef0c3d2e..6588607fbb283331e8d2bac294543a6a665ecb7b 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -31,6 +31,7 @@ License #include "treeDataCell.H" #include "cubicEqn.H" #include "registerSwitch.H" +#include "indexedOctree.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index a88173d6bce6befe9fdbbef70ebb264b1f9b46a3..cef6859a6f9d70181524113f896a5bb342e86f47 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -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_ ) diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H index 93e8c7c7de87a4aeb12a7c84ac88a60df3ad6edb..dc507b64e6c4c5e8cb411eb7958e89a368c8aff5 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H @@ -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_; } diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 0885dd53f6fa50c9dfaf5ebd1cc4ef4fca664b73..d92a4521725ea60801fe915138df9f7cbe0c26a6 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -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]; diff --git a/src/sampling/meshToMesh/meshToMesh.C b/src/sampling/meshToMesh/meshToMesh.C index 2a19e45f245cffade7a36ef2e105a0b5caa16d38..90d7b8b4d5279f8e197fc8a554e693992957a947 100644 --- a/src/sampling/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMesh/meshToMesh.C @@ -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 diff --git a/src/sampling/meshToMesh/meshToMesh.H b/src/sampling/meshToMesh/meshToMesh.H index f3c64fa647f9065dcb8e87bb5641113617abb871..877259617de75a1ab10d4395109b0aee5f65aaf7 100644 --- a/src/sampling/meshToMesh/meshToMesh.H +++ b/src/sampling/meshToMesh/meshToMesh.H @@ -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 );