From 93fbd41785fa50b8e7b4dd3bfa906b3eacb2ed96 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 3 Feb 2017 10:52:35 +0000 Subject: [PATCH 01/40] kOmegaSSTBase: make correctNut(S2, F2) virtual kOmegaSSTSato: Change correctNut() to correctNut(S2, F2) Resolves bug-report https://bugs.openfoam.org/view.php?id=2450 --- .../RAS/kOmegaSSTSato/kOmegaSSTSato.C | 16 ++++++++-------- .../RAS/kOmegaSSTSato/kOmegaSSTSato.H | 13 +++++++++---- .../Base/kOmegaSST/kOmegaSSTBase.C | 2 +- .../Base/kOmegaSST/kOmegaSSTBase.H | 8 ++++++-- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C index 7f0af09be6..505d794a1e 100644 --- a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C +++ b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,8 +130,13 @@ kOmegaSSTSato::gasTurbulence() const template -void kOmegaSSTSato::correctNut() +void kOmegaSSTSato::correctNut +( + const volScalarField& S2, + const volScalarField& F2 +) { + InfoInFunction; const PhaseCompressibleTurbulenceModel& gasTurbulence = this->gasTurbulence(); @@ -141,12 +146,7 @@ void kOmegaSSTSato::correctNut() ); this->nut_ = - this->a1_*this->k_ - /max - ( - this->a1_*this->omega_, - this->F23()*sqrt(2.0)*mag(symm(fvc::grad(this->U_))) - ) + this->a1_*this->k_/max(this->a1_*this->omega_, this->b1_*F2*sqrt(S2)) + sqr(1 - exp(-yPlus/16.0)) *Cmub_*gasTurbulence.transport().d()*gasTurbulence.alpha() *(mag(this->U_ - gasTurbulence.U())); diff --git a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.H b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.H index 4a95eb1aba..37fd2a8b4c 100644 --- a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.H +++ b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,8 +68,8 @@ Description to specify the near-wall omega as appropriate. The blending functions (15) and (16) are not currently used because of the - uncertainty in their origin, range of applicability and that is y+ becomes - sufficiently small blending u_tau in this manner clearly becomes nonsense. + uncertainty in their origin, range of applicability and that as y+ becomes + sufficiently small blending u_tau in this manner is clearly nonsense. The default model coefficients correspond to the following: \verbatim @@ -156,7 +156,12 @@ protected: // Protected Member Functions - virtual void correctNut(); + virtual void correctNut + ( + const volScalarField& S2, + const volScalarField& F2 + ); + public: diff --git a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C index c6c65b51bc..8832e2bd34 100644 --- a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C +++ b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H index 72301b6792..4001b77e04 100644 --- a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H +++ b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -215,7 +215,11 @@ protected: return blend(F1, gamma1_, gamma2_); } - void correctNut(const volScalarField& S2, const volScalarField& F2); + virtual void correctNut + ( + const volScalarField& S2, + const volScalarField& F2 + ); virtual void correctNut(); From 74f38251f87e7559d1cd4732bab9db87d1ce1a22 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 3 Feb 2017 11:37:56 +0000 Subject: [PATCH 02/40] kOmegaSSTSato: removed debug message --- .../phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C | 1 - 1 file changed, 1 deletion(-) diff --git a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C index 505d794a1e..1b0d5feb31 100644 --- a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C +++ b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C @@ -136,7 +136,6 @@ void kOmegaSSTSato::correctNut const volScalarField& F2 ) { - InfoInFunction; const PhaseCompressibleTurbulenceModel& gasTurbulence = this->gasTurbulence(); From 83787036a93c9ee0947ba1eeae355a9a750d0088 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 3 Feb 2017 14:25:02 +0000 Subject: [PATCH 03/40] functionObjects::streamLine: Reinstated default "U" --- src/functionObjects/field/streamLine/streamLine.C | 2 +- src/functionObjects/field/streamLine/streamLine.H | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/functionObjects/field/streamLine/streamLine.C b/src/functionObjects/field/streamLine/streamLine.C index 0c66a5fce0..2947d0d801 100644 --- a/src/functionObjects/field/streamLine/streamLine.C +++ b/src/functionObjects/field/streamLine/streamLine.C @@ -311,7 +311,7 @@ bool Foam::functionObjects::streamLine::read(const dictionary& dict) Info<< type() << " " << name() << ":" << nl; dict.lookup("fields") >> fields_; - dict.lookup("U") >> UName_; + UName_ = dict.lookupOrDefault("U", word("U")); if (findIndex(fields_, UName_) == -1) { diff --git a/src/functionObjects/field/streamLine/streamLine.H b/src/functionObjects/field/streamLine/streamLine.H index 7c0995e69f..07a124c481 100644 --- a/src/functionObjects/field/streamLine/streamLine.H +++ b/src/functionObjects/field/streamLine/streamLine.H @@ -72,7 +72,7 @@ Usage Property | Description | Required | Default value type | Type name: streamLine | yes | setFormat | Output data type | yes | - U | Tracking velocity field name | yes | + U | Tracking velocity field name | no | U fields | Fields to sample | yes | lifetime | Maximum number of particle tracking steps | yes | trackLength | Tracking segment length | no | From 78ee6c2abb17713297ce89188c65cb2904c01b1e Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 3 Feb 2017 14:27:38 +0000 Subject: [PATCH 04/40] Time: When increasing precision check if the time name is unchanged Patch contributed by Mattijs Janssens --- src/OpenFOAM/db/Time/Time.C | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 9a306d7eac..5738f5f4dd 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -184,6 +184,8 @@ void Foam::Time::setControls() int oldPrecision = precision_; int requiredPrecision = -1; bool found = false; + word oldTime(timeName()); + for ( precision_ = maxPrecision_; @@ -194,6 +196,14 @@ void Foam::Time::setControls() // Update the time formatting setTime(startTime_, 0); + // Check that the time name has changed otherwise exit loop + word newTime(timeName()); + if (newTime == oldTime) + { + break; + } + oldTime = newTime; + // Check the existence of the time directory with the new format found = exists(timePath(), false); From 7612b5182807f7c578dab45ccea496f7bb6be4d1 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 3 Feb 2017 14:29:07 +0000 Subject: [PATCH 05/40] lagrangian::NonInertialFrameForce: Use field references rather than copies Patch contributed by Mattijs Janssens --- .../NonInertialFrame/NonInertialFrameForce.C | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/NonInertialFrame/NonInertialFrameForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/NonInertialFrame/NonInertialFrameForce.C index 9630f242b2..17f57041f4 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/NonInertialFrame/NonInertialFrameForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/NonInertialFrame/NonInertialFrameForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -121,7 +121,7 @@ void Foam::NonInertialFrameForce::cacheFields(const bool store) ) ) { - uniformDimensionedVectorField W = this->mesh().template + const uniformDimensionedVectorField& W = this->mesh().template lookupObject(WName_); W_ = W.value(); @@ -135,7 +135,7 @@ void Foam::NonInertialFrameForce::cacheFields(const bool store) ) ) { - uniformDimensionedVectorField omega = this->mesh().template + const uniformDimensionedVectorField& omega = this->mesh().template lookupObject(omegaName_); omega_ = omega.value(); @@ -149,7 +149,8 @@ void Foam::NonInertialFrameForce::cacheFields(const bool store) ) ) { - uniformDimensionedVectorField omegaDot = this->mesh().template + const uniformDimensionedVectorField& omegaDot = + this->mesh().template lookupObject(omegaDotName_); omegaDot_ = omegaDot.value(); @@ -163,7 +164,7 @@ void Foam::NonInertialFrameForce::cacheFields(const bool store) ) ) { - uniformDimensionedVectorField centreOfRotation = + const uniformDimensionedVectorField& centreOfRotation = this->mesh().template lookupObject ( From 7a7fa4350df2dbdcd6e81c67c40004189a57acf7 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 3 Feb 2017 14:51:04 +0000 Subject: [PATCH 06/40] Time: when "writeFormat" is set to "binary" disallow compression Compressing and decompressing binary files introduces a significant IO overhead without a providing significant reduction in file-size. --- src/OpenFOAM/db/Time/TimeIO.C | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index 436661040f..39e88a66d1 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -347,6 +347,20 @@ void Foam::Time::readDict() ( controlDict_.lookup("writeCompression") ); + + if + ( + writeFormat_ == IOstream::BINARY + && writeCompression_ == IOstream::COMPRESSED + ) + { + IOWarningInFunction(controlDict_) + << "Selecting compressed binary is inefficient and ineffective" + ", resetting to uncompressed binary" + << endl; + + writeCompression_ = IOstream::UNCOMPRESSED; + } } controlDict_.readIfPresent("graphFormat", graphFormat_); From 23809f7ae70bec62391839de93a598cc3400e9d8 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 3 Feb 2017 18:36:40 +0000 Subject: [PATCH 07/40] PBiCG: Suggest changing to the more robust PBiCGStab solver if convergence is not achieved within the maximum number of iterations. Sometimes, particularly running in parallel, PBiCG fails to converge or diverges without warning or obvious cause leaving a solution field containing significant errors which can cause divergence of the application. PBiCGStab is more robust and does not suffer from the problems encountered with PBiCG. --- .../matrices/LduMatrix/LduMatrix/LduMatrix.H | 5 ++++- .../matrices/LduMatrix/LduMatrix/LduMatrixSolver.C | 4 ++-- .../matrices/lduMatrix/lduMatrix/lduMatrix.C | 5 ++++- .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 5 ++++- .../matrices/lduMatrix/lduMatrix/lduMatrixSolver.C | 8 ++++---- .../matrices/lduMatrix/solvers/PBiCG/PBiCG.C | 12 +++++++++++- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H index 1da27f106b..f96d583b1f 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -122,6 +122,9 @@ public: //- Dictionary of controls dictionary controlDict_; + //- Default maximum number of iterations in the solver + static const label defaultMaxIter_ = 1000; + //- Maximum number of iterations in the solver label maxIter_; diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C index 651be6cee2..dd908b91f0 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -131,7 +131,7 @@ Foam::LduMatrix::solver::solver controlDict_(solverDict), - maxIter_(1000), + maxIter_(defaultMaxIter_), minIter_(0), tolerance_(1e-6*pTraits::one), relTol_(Zero) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C index 11cdf31485..e9eb25143a 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,6 +35,9 @@ namespace Foam } +const Foam::label Foam::lduMatrix::solver::defaultMaxIter_ = 1000; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Foam::lduMatrix::lduMatrix(const lduMesh& mesh) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 575916f633..30ba325a5a 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,6 +106,9 @@ public: //- Dictionary of controls dictionary controlDict_; + //- Default maximum number of iterations in the solver + static const label defaultMaxIter_; + //- Maximum number of iterations in the solver label maxIter_; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index d554375cae..bc1e134741 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -157,10 +157,10 @@ Foam::lduMatrix::solver::solver void Foam::lduMatrix::solver::readControls() { - maxIter_ = controlDict_.lookupOrDefault