mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added calculation of overlap volume to meshToMesh interpolation
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,6 +43,9 @@ void Foam::meshToMesh::calculateInverseDistanceWeights() const
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Initialise overlap volume to zero
|
||||||
|
V_ = 0.0;
|
||||||
|
|
||||||
inverseDistanceWeightsPtr_ = new scalarListList(toMesh_.nCells());
|
inverseDistanceWeightsPtr_ = new scalarListList(toMesh_.nCells());
|
||||||
scalarListList& invDistCoeffs = *inverseDistanceWeightsPtr_;
|
scalarListList& invDistCoeffs = *inverseDistanceWeightsPtr_;
|
||||||
|
|
||||||
@ -70,6 +73,7 @@ void Foam::meshToMesh::calculateInverseDistanceWeights() const
|
|||||||
{
|
{
|
||||||
invDistCoeffs[celli].setSize(1);
|
invDistCoeffs[celli].setSize(1);
|
||||||
invDistCoeffs[celli][0] = 1.0;
|
invDistCoeffs[celli][0] = 1.0;
|
||||||
|
V_ += fromMesh_.V()[cellAddressing_[celli]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -94,6 +98,16 @@ void Foam::meshToMesh::calculateInverseDistanceWeights() const
|
|||||||
{
|
{
|
||||||
invDistCoeffs[celli][i] /= sumInvDist;
|
invDistCoeffs[celli][i] /= sumInvDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
V_ +=
|
||||||
|
invDistCoeffs[celli][0]
|
||||||
|
*fromMesh_.V()[cellAddressing_[celli]];
|
||||||
|
for (label i = 1; i < invDistCoeffs[celli].size(); i++)
|
||||||
|
{
|
||||||
|
V_ +=
|
||||||
|
invDistCoeffs[celli][i]*fromMesh_.V()[neighbours[i-1]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,6 +129,9 @@ void Foam::meshToMesh::calculateInverseVolumeWeights() const
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Initialise overlap volume to zero
|
||||||
|
V_ = 0.0;
|
||||||
|
|
||||||
inverseVolumeWeightsPtr_ = new scalarListList(toMesh_.nCells());
|
inverseVolumeWeightsPtr_ = new scalarListList(toMesh_.nCells());
|
||||||
scalarListList& invVolCoeffs = *inverseVolumeWeightsPtr_;
|
scalarListList& invVolCoeffs = *inverseVolumeWeightsPtr_;
|
||||||
|
|
||||||
@ -152,6 +169,8 @@ void Foam::meshToMesh::calculateInverseVolumeWeights() const
|
|||||||
bbFromMesh
|
bbFromMesh
|
||||||
);
|
);
|
||||||
invVolCoeffs[celli][j] = v/toMesh_.V()[celli];
|
invVolCoeffs[celli][j] = v/toMesh_.V()[celli];
|
||||||
|
|
||||||
|
V_ += v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,6 +192,9 @@ void Foam::meshToMesh::calculateCellToCellAddressing() const
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Initialise overlap volume to zero
|
||||||
|
V_ = 0.0;
|
||||||
|
|
||||||
tetOverlapVolume overlapEngine;
|
tetOverlapVolume overlapEngine;
|
||||||
|
|
||||||
cellToCellAddressingPtr_ = new labelListList(toMesh_.nCells());
|
cellToCellAddressingPtr_ = new labelListList(toMesh_.nCells());
|
||||||
@ -192,6 +214,7 @@ void Foam::meshToMesh::calculateCellToCellAddressing() const
|
|||||||
forAll(overLapCells, j)
|
forAll(overLapCells, j)
|
||||||
{
|
{
|
||||||
cellToCell[iTo][j] = overLapCells[j];
|
cellToCell[iTo][j] = overLapCells[j];
|
||||||
|
V_ += fromMesh_.V()[overLapCells[j]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,6 +243,7 @@ const Foam::scalarListList& Foam::meshToMesh::inverseVolumeWeights() const
|
|||||||
return *inverseVolumeWeightsPtr_;
|
return *inverseVolumeWeightsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::labelListList& Foam::meshToMesh::cellToCellAddressing() const
|
const Foam::labelListList& Foam::meshToMesh::cellToCellAddressing() const
|
||||||
{
|
{
|
||||||
if (!cellToCellAddressingPtr_)
|
if (!cellToCellAddressingPtr_)
|
||||||
@ -230,4 +254,5 @@ const Foam::labelListList& Foam::meshToMesh::cellToCellAddressing() const
|
|||||||
return *cellToCellAddressingPtr_;
|
return *cellToCellAddressingPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -54,7 +54,8 @@ Foam::meshToMesh::meshToMesh
|
|||||||
boundaryAddressing_(toMesh_.boundaryMesh().size()),
|
boundaryAddressing_(toMesh_.boundaryMesh().size()),
|
||||||
inverseDistanceWeightsPtr_(NULL),
|
inverseDistanceWeightsPtr_(NULL),
|
||||||
inverseVolumeWeightsPtr_(NULL),
|
inverseVolumeWeightsPtr_(NULL),
|
||||||
cellToCellAddressingPtr_(NULL)
|
cellToCellAddressingPtr_(NULL),
|
||||||
|
V_(0.0)
|
||||||
{
|
{
|
||||||
forAll(fromMesh_.boundaryMesh(), patchi)
|
forAll(fromMesh_.boundaryMesh(), patchi)
|
||||||
{
|
{
|
||||||
@ -126,7 +127,8 @@ Foam::meshToMesh::meshToMesh
|
|||||||
boundaryAddressing_(toMesh_.boundaryMesh().size()),
|
boundaryAddressing_(toMesh_.boundaryMesh().size()),
|
||||||
inverseDistanceWeightsPtr_(NULL),
|
inverseDistanceWeightsPtr_(NULL),
|
||||||
inverseVolumeWeightsPtr_(NULL),
|
inverseVolumeWeightsPtr_(NULL),
|
||||||
cellToCellAddressingPtr_(NULL)
|
cellToCellAddressingPtr_(NULL),
|
||||||
|
V_(0.0)
|
||||||
{
|
{
|
||||||
// check whether both meshes have got the same number
|
// check whether both meshes have got the same number
|
||||||
// of boundary patches
|
// of boundary patches
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -94,6 +94,9 @@ class meshToMesh
|
|||||||
//- Cell to cell overlap addressing
|
//- Cell to cell overlap addressing
|
||||||
mutable labelListList* cellToCellAddressingPtr_;
|
mutable labelListList* cellToCellAddressingPtr_;
|
||||||
|
|
||||||
|
//- Overlap volume
|
||||||
|
mutable scalar V_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -231,6 +234,13 @@ public:
|
|||||||
return cellAddressing_;
|
return cellAddressing_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Overlap volume
|
||||||
|
scalar V() const
|
||||||
|
{
|
||||||
|
return V_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Interpolation
|
// Interpolation
|
||||||
|
|
||||||
//- Map field
|
//- Map field
|
||||||
|
|||||||
Reference in New Issue
Block a user