Commit 4265fc24 authored by mattijs's avatar mattijs Committed by Andrew Heather
Browse files

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

parent a3f3ec81
...@@ -330,7 +330,6 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const ...@@ -330,7 +330,6 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
<< " lower:" << addr.lowerAddr().size() << " lower:" << addr.lowerAddr().size()
<< " upper:" << addr.upperAddr().size() << endl; << " upper:" << addr.upperAddr().size() << endl;
lduInterfacePtrsList iFaces = this->interfaces();
// Using lduAddressing::patch // Using lduAddressing::patch
forAll(patchAddr, patchI) forAll(patchAddr, patchI)
{ {
...@@ -340,17 +339,16 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const ...@@ -340,17 +339,16 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
} }
// Using interfaces // Using interfaces
Pout<< "iFaces:" << iFaces.size() << endl; const lduInterfacePtrsList& iFaces = allInterfaces_;
Pout<< "Adapted interFaces:" << iFaces.size() << endl;
forAll(iFaces, patchI) forAll(iFaces, patchI)
{ {
if (iFaces.set(patchI)) if (iFaces.set(patchI))
{ {
Pout<< " " << patchI << "\tiFace:" << iFaces[patchI].type() Pout<< " " << patchI << "\tinterface:"
<< endl; << iFaces[patchI].type() << endl;
} }
} }
Pout<< "end of printing." << endl;
} }
return true; return true;
......
...@@ -2,7 +2,7 @@ ...@@ -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) 2014-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2014-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -149,14 +149,14 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation ...@@ -149,14 +149,14 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation
const fvMatrix<Type>& m const fvMatrix<Type>& m
) const ) const
{ {
// Determine normalisation. This is normally the original diagonal. // Determine normalisation. This is normally the original diagonal plus
// This needs to be stabilised for hole cells // remote contributions. This needs to be stabilised for hole cells
// which can have a zero diagonal. Assume that if any component has // which can have a zero diagonal. Assume that if any component has
// a non-zero diagonal the cell does not need stabilisation. // a non-zero diagonal the cell does not need stabilisation.
tmp<scalarField> tnorm(tmp<scalarField>::New(m.diag())); tmp<scalarField> tnorm(tmp<scalarField>::New(m.diag()));
scalarField& norm = tnorm.ref(); 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(); const FieldField<Field, Type>& internalCoeffs = m.internalCoeffs();
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{ {
...@@ -174,10 +174,14 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation ...@@ -174,10 +174,14 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation
// Count number of problematic cells // Count number of problematic cells
label nZeroDiag = 0; label nZeroDiag = 0;
for (const scalar n : norm) forAll(norm, celli)
{ {
const scalar& n = norm[celli];
if (magSqr(n) < sqr(SMALL)) if (magSqr(n) < sqr(SMALL))
{ {
//Pout<< "For field " << m.psi().name()
// << " have diagonal " << n << " for cell " << celli
// << " at:" << cellCentres()[celli] << endl;
nZeroDiag++; nZeroDiag++;
} }
} }
...@@ -302,22 +306,19 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation ...@@ -302,22 +306,19 @@ Foam::tmp<Foam::scalarField> Foam::dynamicOversetFvMesh::normalisation
forAll(norm, celli) forAll(norm, celli)
{ {
scalar& n = 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]; n = extrapolatedNorm[celli];
} }
else
{
// Use original diagonal
n = m.diag()[celli];
}
} }
} }
else
{
// Use original diagonal
norm = m.diag();
}
return tnorm; 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