ENH: overset: allow use in non-dynamicMesh applications

This is to avoid overset interpolation in the calculation of the stencil
itself since this triggers a loop.
This commit is contained in:
mattijs
2019-05-16 10:30:55 +01:00
committed by Andrew Heather
parent 0adcd1ec47
commit e6a2083281
5 changed files with 59 additions and 19 deletions

View File

@ -35,6 +35,7 @@ License
#include "oversetFvPatch.H"
#include "zeroGradientFvPatchFields.H"
#include "syncTools.H"
#include "dynamicOversetFvMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1116,7 +1117,12 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
{
patchTypes[cellI] = allPatchTypes[cellI];
}
patchTypes.correctBoundaryConditions();
//patchTypes.correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(patchTypes.boundaryFieldRef(), false);
patchTypes.write();
}
if (debug)
@ -1141,7 +1147,12 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
{
volTypes[cellI] = allCellTypes[cellI];
}
volTypes.correctBoundaryConditions();
//volTypes.correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(volTypes.boundaryFieldRef(), false);
volTypes.write();
}
@ -1185,7 +1196,12 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
cellStencil_.transfer(allStencil);
cellInterpolationWeights_.transfer(allWeights);
cellInterpolationWeight_.transfer(allWeight);
cellInterpolationWeight_.correctBoundaryConditions();
//cellInterpolationWeight_.correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(cellInterpolationWeight_.boundaryFieldRef(), false);
DynamicList<label> interpolationCells;
forAll(cellStencil_, cellI)

View File

@ -37,6 +37,7 @@ License
#include "waveMethod.H"
#include "regionSplit.H"
#include "dynamicOversetFvMesh.H"
//#include "minData.H"
//#include "FaceCellWave.H"
@ -2152,7 +2153,11 @@ bool Foam::cellCellStencils::inverseDistance::update()
new mapDistribute(globalCells, cellStencil_, compactMap)
);
cellInterpolationWeight_.transfer(allWeight);
cellInterpolationWeight_.correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(cellInterpolationWeight_.boundaryFieldRef(), false);
if (debug&2)
@ -2226,7 +2231,11 @@ bool Foam::cellCellStencils::inverseDistance::update()
(
createField(mesh_, "maxMagWeight", maxMagWeight)
);
tfld.ref().correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(tfld.ref().boundaryFieldRef(), false);
tfld().write();
}
@ -2236,7 +2245,12 @@ bool Foam::cellCellStencils::inverseDistance::update()
(
createField(mesh_, "cellTypes", cellTypes_)
);
tfld.ref().correctBoundaryConditions();
//tfld.ref().correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(tfld.ref().boundaryFieldRef(), false);
tfld().write();
}

View File

@ -34,6 +34,7 @@ License
#include "syncTools.H"
#include "treeBoundBoxList.H"
#include "voxelMeshSearch.H"
#include "dynamicOversetFvMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -961,7 +962,12 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
)
);
cellInterpolationWeight_.transfer(allWeight);
cellInterpolationWeight_.correctBoundaryConditions();
//cellInterpolationWeight_.correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(cellInterpolationWeight_.boundaryFieldRef(), false);
if (debug & 2)
@ -1024,7 +1030,12 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
{
volTypes[celli] = cellTypes_[celli];
}
volTypes.correctBoundaryConditions();
//volTypes.correctBoundaryConditions();
dynamicOversetFvMesh::correctBoundaryConditions
<
volScalarField,
oversetFvPatchField<scalar>
>(volTypes.boundaryFieldRef(), false);
volTypes.write();
// Dump stencil

View File

@ -128,15 +128,6 @@ protected:
//template<class GeoField, class PatchType>
//lduInterfaceFieldPtrsList scalarInterfaces(const GeoField& psi) const;
//- Correct boundary conditions of certain type (typeOnly = true)
// or explicitly not of the type (typeOnly = false)
template<class GeoField, class PatchType>
static void correctBoundaryConditions
(
typename GeoField::Boundary& bfld,
const bool typeOnly
);
//- Determine normalisation for interpolation. This equals the
// original diagonal except stabilised for zero diagonals (possible
// in hole cells)
@ -358,6 +349,15 @@ public:
//- Debug: check halo swap is ok
template<class GeoField>
static void checkCoupledBC(const GeoField& fld);
//- Correct boundary conditions of certain type (typeOnly = true)
// or explicitly not of the type (typeOnly = false)
template<class GeoField, class PatchType>
static void correctBoundaryConditions
(
typename GeoField::Boundary& bfld,
const bool typeOnly
);
};

View File

@ -155,11 +155,10 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation
tmp<scalarField> tnorm(tmp<scalarField>::New(m.diag()));
scalarField& norm = tnorm.ref();
// Add boundary coeffs to duplicate behaviour of fvMatrix
// Add boundary coeffs to duplicate behaviour of fvMatrix::addBoundaryDiag
const FieldField<Field, Type>& internalCoeffs = m.internalCoeffs();
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
//m.addBoundaryDiag(norm, cmpt);
forAll(internalCoeffs, patchi)
{
const labelUList& fc = lduAddr().patchAddr(patchi);