From 4396caaa39ea97f539918f32a751e81858b1e44f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 30 Jul 2018 16:07:49 +0200 Subject: [PATCH 1/5] BUG: double read when updating ensight fieldsDict --- .../sampledSurface/writers/ensight/ensightSurfaceWriter.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C index ef6575a29d..d944d03dcf 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C @@ -156,7 +156,7 @@ void Foam::ensightSurfaceWriter::updateMesh IFstream is(baseDir/"fieldsDict"); if (is.good() && dict.read(is)) { - dict.read(is); + // ... any futher actions } } From d99707facdd67c0e6de7c79258929ee813717f4b Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 2 Aug 2018 10:18:59 +0100 Subject: [PATCH 2/5] COMP: Allwmake: pass through targetType --- applications/utilities/postProcessing/noise/Allwmake | 3 ++- applications/utilities/preProcessing/boxTurb/Allwmake | 3 ++- applications/utilities/surface/surfaceBooleanFeatures/Allwmake | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/applications/utilities/postProcessing/noise/Allwmake b/applications/utilities/postProcessing/noise/Allwmake index 7452621cd2..2c9d265a5d 100755 --- a/applications/utilities/postProcessing/noise/Allwmake +++ b/applications/utilities/postProcessing/noise/Allwmake @@ -1,12 +1,13 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching) . $WM_PROJECT_DIR/wmake/scripts/have_fftw #------------------------------------------------------------------------------ if have_fftw then - wmake + wmake $targetType else echo "==> skip noise utility (no FFTW)" fi diff --git a/applications/utilities/preProcessing/boxTurb/Allwmake b/applications/utilities/preProcessing/boxTurb/Allwmake index 21e6762b4a..820f2da552 100755 --- a/applications/utilities/preProcessing/boxTurb/Allwmake +++ b/applications/utilities/preProcessing/boxTurb/Allwmake @@ -1,12 +1,13 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching) . $WM_PROJECT_DIR/wmake/scripts/have_fftw #------------------------------------------------------------------------------ if have_fftw then - wmake + wmake $targetType else echo "==> skip boxTurb utility (no FFTW)" fi diff --git a/applications/utilities/surface/surfaceBooleanFeatures/Allwmake b/applications/utilities/surface/surfaceBooleanFeatures/Allwmake index 0aae5a7cfb..933ee039b9 100755 --- a/applications/utilities/surface/surfaceBooleanFeatures/Allwmake +++ b/applications/utilities/surface/surfaceBooleanFeatures/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching) . $WM_PROJECT_DIR/wmake/scripts/have_cgal #------------------------------------------------------------------------------ @@ -14,6 +15,6 @@ else export COMP_FLAGS="-DNO_CGAL" fi -wmake +wmake $targetType #------------------------------------------------------------------------------ From 5e7a766159e0a2f8a1267b8968cf2802befe6476 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 24 Jul 2018 15:54:32 +0100 Subject: [PATCH 3/5] BUG: cubicEqn, quadraticEqn: Correction to repeated roots Also extended the cubic equation test routine and modified the error methods so that they more accurately generate the round of error of evaluation. This resolves bug report https://bugs.openfoam.org/view.php?id=3015 --- applications/test/cubicEqn/Test-cubicEqn.C | 27 +++++++++++++++---- .../polynomialEqns/cubicEqn/cubicEqn.C | 4 +-- .../polynomialEqns/cubicEqn/cubicEqnI.H | 5 +++- .../polynomialEqns/linearEqn/linearEqnI.H | 2 +- .../quadraticEqn/quadraticEqn.C | 2 +- .../quadraticEqn/quadraticEqnI.H | 4 ++- 6 files changed, 33 insertions(+), 11 deletions(-) diff --git a/applications/test/cubicEqn/Test-cubicEqn.C b/applications/test/cubicEqn/Test-cubicEqn.C index d0ab606666..aa0579a419 100644 --- a/applications/test/cubicEqn/Test-cubicEqn.C +++ b/applications/test/cubicEqn/Test-cubicEqn.C @@ -51,7 +51,7 @@ void test(const Type& polynomialEqn, const scalar tol) case roots::real: v[i] = polynomialEqn.value(r[i]); e[i] = polynomialEqn.error(r[i]); - ok = ok && mag(v[i]) < tol*mag(e[i]); + ok = ok && mag(v[i]) <= tol*mag(e[i]); break; case roots::posInf: v[i] = + inf; @@ -79,8 +79,10 @@ void test(const Type& polynomialEqn, const scalar tol) int main() { - const int nTests = 1000000; - for (int t = 0; t < nTests; ++ t) + const scalar tol = 5; + + const label nTests = 1000000; + for (label t = 0; t < nTests; ++ t) { test ( @@ -91,11 +93,26 @@ int main() randomScalar(1e-50, 1e+50), randomScalar(1e-50, 1e+50) ), - 100 + tol ); } + Info << nTests << " random cubics tested" << endl; - Info << nTests << " cubics tested" << endl; + const label coeffMin = -9, coeffMax = 10, nCoeff = coeffMax - coeffMin; + for (label a = coeffMin; a < coeffMax; ++ a) + { + for (label b = coeffMin; b < coeffMax; ++ b) + { + for (label c = coeffMin; c < coeffMax; ++ c) + { + for (label d = coeffMin; d < coeffMax; ++ d) + { + test(cubicEqn(a, b, c, d), tol); + } + } + } + } + Info<< nCoeff*nCoeff*nCoeff*nCoeff << " integer cubics tested" << endl; return 0; } diff --git a/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.C b/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.C index c46b794c38..3aad674001 100644 --- a/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.C +++ b/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.C @@ -81,7 +81,7 @@ Foam::Roots<3> Foam::cubicEqn::roots() const // This is assumed not to over- or under-flow. If it does, all bets are off. const scalar p = c*a - b*b/3; - const scalar q = b*b*b*(2.0/27.0) - b*c*a/3 + d*a*a; + const scalar q = b*b*b*scalar(2)/27 - b*c*a/3 + d*a*a; const scalar disc = p*p*p/27 + q*q/4; // How many roots of what types are available? @@ -96,7 +96,7 @@ Foam::Roots<3> Foam::cubicEqn::roots() const if (oneReal) { - const Roots<1> r = linearEqn(- a, b/3).roots(); + const Roots<1> r = linearEqn(a, b/3).roots(); return Roots<3>(r.type(0), r[0]); } else if (twoReal) diff --git a/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqnI.H b/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqnI.H index da5fc3cba1..cb528b6be4 100644 --- a/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqnI.H +++ b/src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqnI.H @@ -114,7 +114,10 @@ inline Foam::scalar Foam::cubicEqn::derivative(const scalar x) const inline Foam::scalar Foam::cubicEqn::error(const scalar x) const { - return mag(SMALL*x*(x*(x*3*a() + 2*b()) + c())); + return + SMALL*magSqr(x)*(mag(x*a()) + mag(b())) + + SMALL*mag(x)*(mag(x*(x*a() + b())) + mag(c())) + + SMALL*(mag(x*(x*(x*a() + b()) + c())) + mag(d())); } diff --git a/src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqnI.H b/src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqnI.H index 17bfdf452d..f5c4f2b7c9 100644 --- a/src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqnI.H +++ b/src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqnI.H @@ -82,7 +82,7 @@ inline Foam::scalar Foam::linearEqn::derivative(const scalar x) const inline Foam::scalar Foam::linearEqn::error(const scalar x) const { - return mag(SMALL*x*a()); + return SMALL*(mag(x*a()) + mag(b())); } diff --git a/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqn.C b/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqn.C index d84c2928c2..d2ac0ea8a1 100644 --- a/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqn.C +++ b/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqn.C @@ -71,7 +71,7 @@ Foam::Roots<2> Foam::quadraticEqn::roots() const if (oneReal) { - const Roots<1> r = linearEqn(- a, b/2).roots(); + const Roots<1> r = linearEqn(a, b/2).roots(); return Roots<2>(r, r); } else if (twoReal) diff --git a/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqnI.H b/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqnI.H index 7672a74d72..15ffe4e4e2 100644 --- a/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqnI.H +++ b/src/OpenFOAM/primitives/polynomialEqns/quadraticEqn/quadraticEqnI.H @@ -100,7 +100,9 @@ inline Foam::scalar Foam::quadraticEqn::derivative(const scalar x) const inline Foam::scalar Foam::quadraticEqn::error(const scalar x) const { - return mag(SMALL*x*(x*2*a() + b())); + return + SMALL*mag(x)*(mag(x*a()) + mag(b())) + + SMALL*(mag(x*(x*a() + b())) + mag(c())); } From 98898e78611cea5e8e30036534382c59b8520799 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Tue, 28 Aug 2018 15:39:06 +0100 Subject: [PATCH 4/5] BUG: externalWallHeatFluxTemperature - set size of qrPrevious_ before mapping. Fixes #983 --- .../externalWallHeatFluxTemperatureFvPatchScalarField.C | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index 3fac6847e7..f87c8c9b39 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -215,6 +215,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField if (qrName_ != "none") { + qrPrevious_.setSize(mapper.size()); qrPrevious_.map(ptf.qrPrevious_, mapper); } } From 688469d127f0bc2b2795c8ae0357dff3dddf0128 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 29 Aug 2018 12:50:50 +0100 Subject: [PATCH 5/5] BUG: bitSet: extraneous exit. Fixes #984. --- src/OpenFOAM/containers/Bits/bitSet/bitSet.C | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/OpenFOAM/containers/Bits/bitSet/bitSet.C b/src/OpenFOAM/containers/Bits/bitSet/bitSet.C index e92769cf8a..1714dbe6df 100644 --- a/src/OpenFOAM/containers/Bits/bitSet/bitSet.C +++ b/src/OpenFOAM/containers/Bits/bitSet/bitSet.C @@ -159,9 +159,6 @@ Foam::bitSet& Foam::bitSet::orEq(const bitSet& other, const bool strict) << "Perform |= on dissimilar sized bitSets: " << size() << " vs. " << other.size() << nl; } - { - return *this; - } label minpos = -1; // Min trim point