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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,9 @@ void Foam::meshToMesh::calculateInverseDistanceWeights() const
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
//- Initialise overlap volume to zero
|
||||
V_ = 0.0;
|
||||
|
||||
inverseDistanceWeightsPtr_ = new scalarListList(toMesh_.nCells());
|
||||
scalarListList& invDistCoeffs = *inverseDistanceWeightsPtr_;
|
||||
|
||||
@ -70,6 +73,7 @@ void Foam::meshToMesh::calculateInverseDistanceWeights() const
|
||||
{
|
||||
invDistCoeffs[celli].setSize(1);
|
||||
invDistCoeffs[celli][0] = 1.0;
|
||||
V_ += fromMesh_.V()[cellAddressing_[celli]];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -94,6 +98,16 @@ void Foam::meshToMesh::calculateInverseDistanceWeights() const
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
//- Initialise overlap volume to zero
|
||||
V_ = 0.0;
|
||||
|
||||
inverseVolumeWeightsPtr_ = new scalarListList(toMesh_.nCells());
|
||||
scalarListList& invVolCoeffs = *inverseVolumeWeightsPtr_;
|
||||
|
||||
@ -152,6 +169,8 @@ void Foam::meshToMesh::calculateInverseVolumeWeights() const
|
||||
bbFromMesh
|
||||
);
|
||||
invVolCoeffs[celli][j] = v/toMesh_.V()[celli];
|
||||
|
||||
V_ += v;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -173,6 +192,9 @@ void Foam::meshToMesh::calculateCellToCellAddressing() const
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
//- Initialise overlap volume to zero
|
||||
V_ = 0.0;
|
||||
|
||||
tetOverlapVolume overlapEngine;
|
||||
|
||||
cellToCellAddressingPtr_ = new labelListList(toMesh_.nCells());
|
||||
@ -192,6 +214,7 @@ void Foam::meshToMesh::calculateCellToCellAddressing() const
|
||||
forAll(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_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::meshToMesh::cellToCellAddressing() const
|
||||
{
|
||||
if (!cellToCellAddressingPtr_)
|
||||
@ -230,4 +254,5 @@ const Foam::labelListList& Foam::meshToMesh::cellToCellAddressing() const
|
||||
return *cellToCellAddressingPtr_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,7 +54,8 @@ Foam::meshToMesh::meshToMesh
|
||||
boundaryAddressing_(toMesh_.boundaryMesh().size()),
|
||||
inverseDistanceWeightsPtr_(NULL),
|
||||
inverseVolumeWeightsPtr_(NULL),
|
||||
cellToCellAddressingPtr_(NULL)
|
||||
cellToCellAddressingPtr_(NULL),
|
||||
V_(0.0)
|
||||
{
|
||||
forAll(fromMesh_.boundaryMesh(), patchi)
|
||||
{
|
||||
@ -126,7 +127,8 @@ Foam::meshToMesh::meshToMesh
|
||||
boundaryAddressing_(toMesh_.boundaryMesh().size()),
|
||||
inverseDistanceWeightsPtr_(NULL),
|
||||
inverseVolumeWeightsPtr_(NULL),
|
||||
cellToCellAddressingPtr_(NULL)
|
||||
cellToCellAddressingPtr_(NULL),
|
||||
V_(0.0)
|
||||
{
|
||||
// check whether both meshes have got the same number
|
||||
// of boundary patches
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -94,6 +94,9 @@ class meshToMesh
|
||||
//- Cell to cell overlap addressing
|
||||
mutable labelListList* cellToCellAddressingPtr_;
|
||||
|
||||
//- Overlap volume
|
||||
mutable scalar V_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -231,6 +234,13 @@ public:
|
||||
return cellAddressing_;
|
||||
}
|
||||
|
||||
//- Overlap volume
|
||||
scalar V() const
|
||||
{
|
||||
return V_;
|
||||
}
|
||||
|
||||
|
||||
// Interpolation
|
||||
|
||||
//- Map field
|
||||
@ -275,7 +285,7 @@ public:
|
||||
const labelList& adr,
|
||||
const vectorField& centres,
|
||||
const CombineOp& cop
|
||||
) const;
|
||||
)const;
|
||||
|
||||
|
||||
//- Interpolate internal volume field
|
||||
|
||||
Reference in New Issue
Block a user