mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated mesh-to-mesh interpolation
This commit is contained in:
@ -191,7 +191,10 @@ void Foam::fv::option::setCellSet()
|
||||
(
|
||||
mesh_,
|
||||
nbrMesh,
|
||||
readBool(dict_.lookup("consistentMeshes"))
|
||||
meshToMeshNew::interpolationMethodNames_.read
|
||||
(
|
||||
dict_.lookup("interpolationMethod")
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ Class
|
||||
Description
|
||||
mesh to mesh interpolation class.
|
||||
|
||||
Note
|
||||
This class is due to be deprecated in favour of meshToMeshNew
|
||||
|
||||
SourceFiles
|
||||
meshToMesh.C
|
||||
calculateMeshToMeshAddressing.C
|
||||
|
||||
@ -39,6 +39,20 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(meshToMeshNew, 0);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::meshToMeshNew::interpolationMethod,
|
||||
2
|
||||
>::names[] =
|
||||
{
|
||||
"map",
|
||||
"cellVolumeWeight"
|
||||
};
|
||||
|
||||
const NamedEnum<meshToMeshNew::interpolationMethod, 2>
|
||||
meshToMeshNew::interpolationMethodNames_;
|
||||
}
|
||||
|
||||
Foam::scalar Foam::meshToMeshNew::tolerance_ = 1e-6;
|
||||
@ -707,22 +721,40 @@ void Foam::meshToMeshNew::calcAddressing
|
||||
}
|
||||
|
||||
|
||||
if (directMapping_)
|
||||
switch (method_)
|
||||
{
|
||||
calcDirect(src, tgt, srcSeedI, tgtSeedI);
|
||||
}
|
||||
else
|
||||
{
|
||||
calcIndirect
|
||||
(
|
||||
src,
|
||||
tgt,
|
||||
srcSeedI,
|
||||
tgtSeedI,
|
||||
srcCellIDs,
|
||||
mapFlag,
|
||||
startSeedI
|
||||
);
|
||||
case imMap:
|
||||
{
|
||||
calcDirect(src, tgt, srcSeedI, tgtSeedI);
|
||||
break;
|
||||
}
|
||||
case imCellVolumeWeight:
|
||||
{
|
||||
calcIndirect
|
||||
(
|
||||
src,
|
||||
tgt,
|
||||
srcSeedI,
|
||||
tgtSeedI,
|
||||
srcCellIDs,
|
||||
mapFlag,
|
||||
startSeedI
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::meshToMeshNew::calcAddressing"
|
||||
"("
|
||||
"const polyMesh&, "
|
||||
"const polyMesh&"
|
||||
")"
|
||||
)
|
||||
<< "Unknown interpolation method"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -739,7 +771,7 @@ Foam::meshToMeshNew::meshToMeshNew
|
||||
(
|
||||
const polyMesh& src,
|
||||
const polyMesh& tgt,
|
||||
const bool directMapping
|
||||
const interpolationMethod& method
|
||||
)
|
||||
:
|
||||
srcRegionName_(src.name()),
|
||||
@ -748,11 +780,11 @@ Foam::meshToMeshNew::meshToMeshNew
|
||||
tgtToSrcCellAddr_(),
|
||||
srcToTgtCellWght_(),
|
||||
tgtToSrcCellWght_(),
|
||||
method_(method),
|
||||
V_(0.0),
|
||||
singleMeshProc_(-1),
|
||||
srcMapPtr_(NULL),
|
||||
tgtMapPtr_(NULL),
|
||||
directMapping_(directMapping)
|
||||
tgtMapPtr_(NULL)
|
||||
{
|
||||
Info<< "Creating mesh-to-mesh addressing for " << src.name()
|
||||
<< " and " << tgt.name() << " regions" << endl;
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#include "boundBox.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -52,6 +53,22 @@ namespace Foam
|
||||
|
||||
class meshToMeshNew
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
//- Enumeration specifying required accuracy
|
||||
enum interpolationMethod
|
||||
{
|
||||
imMap,
|
||||
imCellVolumeWeight
|
||||
};
|
||||
|
||||
static const NamedEnum<interpolationMethod, 2>
|
||||
interpolationMethodNames_;
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of source mesh region
|
||||
@ -72,6 +89,9 @@ class meshToMeshNew
|
||||
//- Target to source cell interpolation weights
|
||||
scalarListList tgtToSrcCellWght_;
|
||||
|
||||
//- Interpolation method
|
||||
interpolationMethod method_;
|
||||
|
||||
//- Cell total volume in overlap region [m3]
|
||||
scalar V_;
|
||||
|
||||
@ -85,9 +105,6 @@ class meshToMeshNew
|
||||
//- Target map pointer - parallel running only
|
||||
autoPtr<mapDistribute> tgtMapPtr_;
|
||||
|
||||
//- Flag to indicate that direct (one-to-one) mapping should be applied
|
||||
bool directMapping_;
|
||||
|
||||
//- Tolerance used in volume overlap calculations
|
||||
static scalar tolerance_;
|
||||
|
||||
@ -289,7 +306,7 @@ public:
|
||||
(
|
||||
const polyMesh& src,
|
||||
const polyMesh& tgt,
|
||||
const bool directMapping
|
||||
const interpolationMethod& method
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -395,28 +395,33 @@ void Foam::meshToMeshNew::interpolate
|
||||
|
||||
if (interpPatches)
|
||||
{
|
||||
if (directMapping_)
|
||||
switch (method_)
|
||||
{
|
||||
result.boundaryField() == field.boundaryField();
|
||||
}
|
||||
else
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"void Foam::meshToMeshNew::interpolate"
|
||||
"("
|
||||
"const GeometricField<Type, fvPatchField, volMesh>&, "
|
||||
"const CombineOp&, "
|
||||
"GeometricField<Type, fvPatchField, volMesh>&, "
|
||||
"const bool"
|
||||
") const - non-conformal patches"
|
||||
)
|
||||
case imMap:
|
||||
{
|
||||
result.boundaryField() == field.boundaryField();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"void Foam::meshToMeshNew::interpolate"
|
||||
"("
|
||||
"const GeometricField<Type, fvPatchField, volMesh>&, "
|
||||
"const CombineOp&, "
|
||||
"GeometricField<Type, fvPatchField, volMesh>&, "
|
||||
"const bool"
|
||||
") const - non-conformal patches"
|
||||
)
|
||||
|
||||
// do something...
|
||||
// do something...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||
Foam::meshToMeshNew::interpolate
|
||||
|
||||
Reference in New Issue
Block a user