From 4265fc24594115a182fe60cb0b56397561589021 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Thu, 12 Sep 2019 13:42:38 +0100 Subject: [PATCH] BUG: overset: use correct normalisation. Fixes #1437. --- .../dynamicOversetFvMesh.C | 10 +++--- .../dynamicOversetFvMeshTemplates.C | 33 ++++++++++--------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C index a5491a723fa..bf77f6b11a6 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C @@ -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; diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C index 2d54a3cbb65..0edf51be285 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C @@ -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; } -- GitLab