From 4d9ab22fbefea31b86c9f2c66c40ad0b1623681c Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 6 Oct 2011 14:40:34 +0100 Subject: [PATCH] Improvement of round-off error handling --- .../cfdTools/general/include/checkVolContinuity.H | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/include/checkVolContinuity.H b/src/finiteVolume/cfdTools/general/include/checkVolContinuity.H index 8cf0882fe..c79cbb9a6 100644 --- a/src/finiteVolume/cfdTools/general/include/checkVolContinuity.H +++ b/src/finiteVolume/cfdTools/general/include/checkVolContinuity.H @@ -8,10 +8,13 @@ if (mesh.moving()) scalar sumV = gSum(V); scalar sumV0 = gSum(V0); - scalarField volChange = (1.0 - V0/V)/dt; + // Rewrite of mesh motion check based on round-off error problems + // Note precision around V and avoiding division with dt + // HJ, 4/Oct/2011 + scalarField volChange = (V - V0)/V; scalarField divFlux = - - fvc::div(mesh.phi())().internalField(); + - fvc::div(mesh.phi())().internalField()*dt; scalarField conserve = volChange + divFlux;