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