Commit 998a1ca7 authored by mattijs's avatar mattijs

BUG: overset: use correct normalisation. Fixes #1437.

parent 8d3b2a64
......@@ -330,7 +330,6 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
<< " lower:" << addr.lowerAddr().size()
<< " upper:" << addr.upperAddr().size() << endl;
lduInterfacePtrsList iFaces = this->interfaces();
// Using lduAddressing::patch
forAll(patchAddr, patchI)
{
......@@ -340,17 +339,16 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
}
// Using interfaces
Pout<< "iFaces:" << iFaces.size() << endl;
const lduInterfacePtrsList& iFaces = allInterfaces_;
Pout<< "Adapted interFaces:" << iFaces.size() << endl;
forAll(iFaces, patchI)
{
if (iFaces.set(patchI))
{
Pout<< " " << patchI << "\tiFace:" << iFaces[patchI].type()
<< endl;
Pout<< " " << patchI << "\tinterface:"
<< iFaces[patchI].type() << endl;
}
}
Pout<< "end of printing." << endl;
}
return true;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2014-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -149,14 +149,14 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation
const fvMatrix<Type>& m
) const
{
// Determine normalisation. This is normally the original diagonal.
// This needs to be stabilised for hole cells
// Determine normalisation. This is normally the original diagonal plus
// remote contributions. This needs to be stabilised for hole cells
// which can have a zero diagonal. Assume that if any component has
// a non-zero diagonal the cell does not need stabilisation.
tmp<scalarField> tnorm(tmp<scalarField>::New(m.diag()));
scalarField& norm = tnorm.ref();
// Add boundary coeffs to duplicate behaviour of fvMatrix::addBoundaryDiag
// Add remote coeffs to duplicate behaviour of fvMatrix::addBoundaryDiag
const FieldField<Field, Type>& internalCoeffs = m.internalCoeffs();
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
......@@ -174,10 +174,14 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation
// Count number of problematic cells
label nZeroDiag = 0;
for (const scalar n : norm)
forAll(norm, celli)
{
const scalar& n = norm[celli];
if (magSqr(n) < sqr(SMALL))
{
//Pout<< "For field " << m.psi().name()
// << " have diagonal " << n << " for cell " << celli
// << " at:" << cellCentres()[celli] << endl;
nZeroDiag++;
}
}
......@@ -302,22 +306,19 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation
forAll(norm, celli)
{
scalar& n = norm[celli];
if (mag(n) < SMALL)
if (magSqr(n) < sqr(SMALL))
{
//Pout<< "For field " << m.psi().name()
// << " for cell " << celli
// << " at:" << cellCentres()[celli]
// << " have norm " << n
// << " have extrapolated norm " << extrapolatedNorm[celli]
// << endl;
// Override the norm
n = extrapolatedNorm[celli];
}
else
{
// Use original diagonal
n = m.diag()[celli];
}
}
}
else
{
// Use original diagonal
norm = m.diag();
}
return tnorm;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment