From c9bf66a632429d5a19fd8a7e88cb9923f267afed Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 12 May 2023 11:45:51 +0100 Subject: [PATCH] fvMeshStitcher: Stabilise calculation of error face areas --- src/fvMeshStitchers/moving/fvMeshStitchersMoving.C | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C b/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C index e1b7d12fa5..c141a44833 100644 --- a/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C +++ b/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C @@ -987,11 +987,14 @@ void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi const label errorPatchFacei0 = 2*origPatchFacei; const label errorPatchFacei1 = 2*origPatchFacei + 1; - const vector errorSf = - origPp.faceNormals()[origPatchFacei] - *phi.boundaryField()[errorPatchi][errorPatchFacei0] + const scalar a = + phi.boundaryField()[errorPatchi][errorPatchFacei0] /max(meshMagUfb[origPatchi][origPatchFacei], vSmall); + const vector errorSf = + sign(a)*min(mag(a), origPp.magFaceAreas()[origPatchFacei]) + *origPp.faceNormals()[origPatchFacei]; + fvsPatchField& Sfp = SfSf.boundaryFieldRef()[errorPatchi]; Sfp[errorPatchFacei0] += errorSf;