From 3d854a683dcf46dad1132ebd4b141942f2994037 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 23 Jun 2017 11:42:51 +0100 Subject: [PATCH 01/25] ENH: solutionControl - added frozenFlow option --- .../solutionControl/solutionControl/solutionControl.C | 2 ++ .../solutionControl/solutionControl/solutionControl.H | 8 ++++++++ .../solutionControl/solutionControl/solutionControlI.H | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index 6e686a10f5..c5a47ca61e 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -46,6 +46,7 @@ void Foam::solutionControl::read(const bool absTolOnly) solutionDict.lookupOrDefault("momentumPredictor", true); transonic_ = solutionDict.lookupOrDefault("transonic", false); consistent_ = solutionDict.lookupOrDefault("consistent", false); + frozenFlow_ = solutionDict.lookupOrDefault("frozenFlow", false); // Read residual information const dictionary residualDict @@ -228,6 +229,7 @@ Foam::solutionControl::solutionControl(fvMesh& mesh, const word& algorithmName) momentumPredictor_(true), transonic_(false), consistent_(false), + frozenFlow_(false), corr_(0), corrNonOrtho_(0) {} diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H index c9c7b87633..19b45f724b 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H @@ -87,6 +87,10 @@ protected: // "consistent" approach of SIMPLEC bool consistent_; + //- Flag to indicate that the flow system of equations should not + // be evolved + bool frozenFlow_; + // Evolution @@ -199,6 +203,10 @@ public: // "consistent" approach of SIMPLEC inline bool consistent() const; + //- Flag to indicate that the flow system of equations should not + // be evolved + inline bool frozenFlow() const; + // Evolution diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H index 61a647e408..d2316407c0 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H @@ -73,6 +73,12 @@ inline bool Foam::solutionControl::consistent() const } +inline bool Foam::solutionControl::frozenFlow() const +{ + return frozenFlow_; +} + + inline bool Foam::solutionControl::correctNonOrthogonal() { corrNonOrtho_++; From ff9d2c3a9c042db46bbd0ebe6aa24cfab379d1a1 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 23 Jun 2017 11:43:55 +0100 Subject: [PATCH 02/25] ENH: Updated frozenFlow option for interFoam and interIsoFoam --- applications/solvers/multiphase/interFoam/interFoam.C | 5 +++++ .../solvers/multiphase/interIsoFoam/createIsoAdvection.H | 8 -------- .../solvers/multiphase/interIsoFoam/interIsoFoam.C | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 858624b2d5..356d795e15 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -110,6 +110,11 @@ int main(int argc, char *argv[]) mixture.correct(); + if (pimple.frozenFlow()) + { + continue; + } + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/interIsoFoam/createIsoAdvection.H b/applications/solvers/multiphase/interIsoFoam/createIsoAdvection.H index 889af7228f..3360cdae65 100644 --- a/applications/solvers/multiphase/interIsoFoam/createIsoAdvection.H +++ b/applications/solvers/multiphase/interIsoFoam/createIsoAdvection.H @@ -1,10 +1,2 @@ // Defining isoAdvection isoAdvection advector(alpha1, phi, U); - -bool frozenFlow = pimple.dict().lookupOrDefault("frozenFlow", false); -if (frozenFlow) -{ - Info<< "Employing frozen-flow assumption: " - << "pressure-velocity system will not be updated" - << endl; -} diff --git a/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C b/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C index 1514c5c0cb..14242048fc 100644 --- a/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C +++ b/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) mixture.correct(); - if (frozenFlow) + if (pimple.frozenFlow()) { continue; } From e6951da06f35f11c607f73f1260c58e11d117cfa Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 23 Jun 2017 11:56:22 +0100 Subject: [PATCH 03/25] ENH: valueAverage FO - update window to use user time --- src/functionObjects/field/valueAverage/valueAverage.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/functionObjects/field/valueAverage/valueAverage.C b/src/functionObjects/field/valueAverage/valueAverage.C index e8d1a0faa8..3e74e5f4b6 100644 --- a/src/functionObjects/field/valueAverage/valueAverage.C +++ b/src/functionObjects/field/valueAverage/valueAverage.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -114,7 +114,10 @@ bool Foam::functionObjects::valueAverage::read(const dictionary& dict) dict.lookup("functionObject") >> functionObjectName_; dict.lookup("fields") >> fieldNames_; - window_ = dict.lookupOrDefault("window", -1); + if (dict.readIfPresent("window", window_)) + { + window_ = obr().time().userTimeToTime(window_); + } totalTime_.setSize(fieldNames_.size()); forAll(totalTime_, i) From 34a1a5dec203d5369c43e2dcac9ce91ab1add693 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 23 Jun 2017 12:13:46 +0100 Subject: [PATCH 04/25] STYLE: Minor corrections to comments/fix typos --- src/OpenFOAM/db/functionObjects/timeControl/timeControl.C | 2 +- src/functionObjects/field/pressure/pressure.H | 4 ++-- src/meshTools/coordinateSystems/coordinateSystem.H | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C index e8647eed49..816049967d 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C @@ -248,7 +248,7 @@ bool Foam::timeControl::execute() default: { FatalErrorInFunction - << "Undefined output control: " + << "Undefined time control: " << timeControlNames_[timeControl_] << nl << abort(FatalError); break; diff --git a/src/functionObjects/field/pressure/pressure.H b/src/functionObjects/field/pressure/pressure.H index a3978f1f5d..586deb14c6 100644 --- a/src/functionObjects/field/pressure/pressure.H +++ b/src/functionObjects/field/pressure/pressure.H @@ -92,14 +92,14 @@ Usage Where the entries comprise: \table Property | Description | Required | Default value - type | type name: pressure | yes | + type | type name: pressure | yes | field | Name of the pressure field | no | p U | Name of the velocity field | no | U rho | Name of the density field | no | rho result | Name of the resulting field | no | derived from p calcTotal | Calculate total coefficient | yes | pRef | Reference pressure for total pressure | no | 0 - calcCoeff | Calculate pressure coefficient | yes | + calcCoeff | Calculate pressure coefficient | yes | pInf | Freestream pressure for coefficient calculation | no | UInf | Freestream velocity for coefficient calculation | no | rhoInf | Freestream density for coefficient calculation | no | diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index 561482a2fd..ee81ee365a 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -274,7 +274,7 @@ public: return R_(); } - //- Update and return the co-ordinate roation for a list of cells + //- Update and return the co-ordinate rotation for a list of cells const coordinateRotation& R ( const polyMesh& mesh, From fef4e493d4c1a0ca666fce27fbcf7d748d5fb118 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 23 Jun 2017 12:23:04 +0100 Subject: [PATCH 05/25] STYLE: Updated messages to use pretty macros --- .../oversetPolyPatch/oversetFvPatchField.C | 12 +-- src/overset/regionsToCell/findRefCells.C | 75 +++---------------- .../windowModels/windowModel/windowModelNew.C | 6 +- .../surfaceFormats/fire/FLMAsurfaceFormat.C | 12 +-- 4 files changed, 16 insertions(+), 89 deletions(-) diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C index 0d38b83514..de61b8c118 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -80,16 +80,8 @@ Foam::oversetFvPatchField::oversetFvPatchField { if (!isA(p)) { - FatalIOErrorIn - ( - "oversetFvPatchField::oversetFvPatchField" - "(" - "const fvPatch&, " - "const DimensionedField&, " - "const dictionary&" - ")", - dict - ) << " patch type '" << p.type() + FatalIOErrorInFunction(dict) + << " patch type '" << p.type() << "' not constraint type '" << typeName << "'" << "\n for patch " << p.name() << " of field " << this->internalField().name() diff --git a/src/overset/regionsToCell/findRefCells.C b/src/overset/regionsToCell/findRefCells.C index 289bb1959b..67ac1ba0f8 100644 --- a/src/overset/regionsToCell/findRefCells.C +++ b/src/overset/regionsToCell/findRefCells.C @@ -108,19 +108,8 @@ void Foam::setRefCells if (refCells.size() != regionNeedReference.size()) { - FatalIOErrorIn - ( - "setRefCell\n" - "(\n" - " const volScalarField&,\n" - " const volScalarField&,\n" - " const dictionary&,\n" - " labelList&,\n" - " scalarField&,\n" - " const bool\n" - ")\n", - dict - ) << "Number of refCells " << refCells.size() + FatalIOErrorInFunction(dict) + << "Number of refCells " << refCells.size() << " does not correspond to number of regions " << regionNeedReference.size() << exit(FatalIOError); @@ -146,19 +135,8 @@ void Foam::setRefCells && regionRefCells[regionI] == -1 ) { - FatalIOErrorIn - ( - "setRefCell\n" - "(\n" - " const volScalarField&,\n" - " const volScalarField&,\n" - " const dictionary&,\n" - " labelList&,\n" - " scalarField&,\n" - " const bool\n" - ")\n", - dict - ) << "Have no reference cell for region " << regionI + FatalIOErrorInFunction(dict) + << "Have no reference cell for region " << regionI << nl << "Overall per-region reference cells " << regionRefCells @@ -173,19 +151,8 @@ void Foam::setRefCells if (refPoints.size() != regionNeedReference.size()) { - FatalIOErrorIn - ( - "setRefCell\n" - "(\n" - " const volScalarField&,\n" - " const volScalarField&,\n" - " const dictionary&,\n" - " labelList&,\n" - " scalarField&,\n" - " const bool\n" - ")\n", - dict - ) << "Number of refPoints " << refPoints.size() + FatalIOErrorInFunction(dict) + << "Number of refPoints " << refPoints.size() << " does not correspond to number of regions " << regionNeedReference.size() << exit(FatalIOError); @@ -226,19 +193,8 @@ void Foam::setRefCells { if (hasRef[regionI] != 1) { - FatalIOErrorIn - ( - "setRefCell\n" - "(\n" - " const volScalarField&,\n" - " const volScalarField&,\n" - " const dictionary&,\n" - " labelList&,\n" - " scalarField&,\n" - " const bool\n" - ")\n", - dict - ) << "Unable to set reference cell for field " << field.name() + FatalIOErrorInFunction(dict) + << "Unable to set reference cell for field " << field.name() << nl << " Reference points " << refPointName << " " << refPoints @@ -251,19 +207,8 @@ void Foam::setRefCells } else { - FatalIOErrorIn - ( - "setRefCell\n" - "(\n" - " const volScalarField&,\n" - " const volScalarField&,\n" - " const dictionary&,\n" - " labelList&,\n" - " scalarField&,\n" - " const bool\n" - ")\n", - dict - ) << "Unable to set reference cell for field " << field.name() + FatalIOErrorInFunction(dict) + << "Unable to set reference cell for field " << field.name() << nl << " Please supply either " << refCellName << " or " << refPointName << nl << exit(FatalIOError); diff --git a/src/randomProcesses/windowModels/windowModel/windowModelNew.C b/src/randomProcesses/windowModels/windowModel/windowModelNew.C index d4dd15b07e..7b1c8a7e72 100644 --- a/src/randomProcesses/windowModels/windowModel/windowModelNew.C +++ b/src/randomProcesses/windowModels/windowModel/windowModelNew.C @@ -42,10 +42,8 @@ Foam::autoPtr Foam::windowModel::New if (!cstrIter.found()) { - FatalErrorIn - ( - "windowModel::New(const dictionary&, const label)" - ) << "Unknown windowModel type " + FatalErrorInFunction + << "Unknown windowModel type " << modelType << nl << nl << "Valid windowModel types are:" << nl << dictionaryConstructorTablePtr_->sortedToc() diff --git a/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormat.C b/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormat.C index de258c1010..43eecf8ae5 100644 --- a/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormat.C @@ -159,11 +159,7 @@ void Foam::fileFormats::FLMAsurfaceFormat::write { if (!os.good()) { - FatalErrorIn - ( - "fileFormats::FLMAsurfaceFormat::write" - "(OSstream&, const MeshedSurfaceProxy&)" - ) + FatalErrorInFunction << "bad output state " << exit(FatalError); } @@ -352,11 +348,7 @@ void Foam::fileFormats::FLMAsurfaceFormat::write } else { - FatalErrorIn - ( - "fileFormats::FLMAsurfaceFormat::write" - "(const fileName&, const MeshedSurfaceProxy&)" - ) + FatalErrorInFunction << "Cannot open file for writing " << filename << exit(FatalError); } From a22d9fe76074f72b602e14f7ad55b0a72adcf343 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 26 Jun 2017 09:52:26 +0100 Subject: [PATCH 06/25] BUG: correctPhi: reference cells could become -1. Part fix for #507. --- .../pimpleFoam/overPimpleDyMFoam/correctPhi.H | 23 +++++++++++-- .../interFoam/overInterDyMFoam/correctPhi.H | 32 ++++++++++++++----- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H index 0066d23051..e5bbcadc67 100644 --- a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H @@ -86,9 +86,25 @@ if (mesh.changing()) fvm::laplacian(rAUf, pcorr) == fvc::div(phi) ); - //pcorrEqn.setReference(refCellI2, 0.0, true); - scalarList values(nZones, 0.0); - pcorrEqn.setReferences(refCells, values, true); + + // Only set reference for cells that are CALCULATED + { + DynamicList