diff --git a/applications/test/volField/Test-volField.C b/applications/test/volField/Test-volField.C index 6e6980481e..81b0783c47 100644 --- a/applications/test/volField/Test-volField.C +++ b/applications/test/volField/Test-volField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -112,10 +112,6 @@ int main(int argc, char *argv[]) << "Detailed SolverPerformance: " << nl << " " << sP << endl; - Info<< nl - << "solverPerformanceDict: " - << mesh.solverPerformanceDict() << endl; - return 0; } diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 2e0f63524f..40f528be5e 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -709,5 +709,6 @@ $(writers)/xmgrGraph/xmgrGraph.C $(writers)/jplotGraph/jplotGraph.C meshes/data/data.C +meshes/Residuals/residuals.C LIB = $(FOAM_LIBBIN)/libOpenFOAM diff --git a/src/OpenFOAM/meshes/Residuals/Residuals.C b/src/OpenFOAM/meshes/Residuals/Residuals.C new file mode 100644 index 0000000000..9d4146e79c --- /dev/null +++ b/src/OpenFOAM/meshes/Residuals/Residuals.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "Residuals.H" +#include "Time.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::Residuals::Residuals(const polyMesh& mesh) +: + MeshObject>(mesh), + prevTimeIndex_(-1) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +Foam::List Foam::Residuals::fieldNames(const polyMesh& mesh) +{ + return MeshObject>::New + ( + mesh + ).HashTable>>::toc(); +} + + +template +bool Foam::Residuals::found(const polyMesh& mesh, const word& fieldName) +{ + return MeshObject>::New + ( + mesh + ).HashTable>>::found(fieldName); +} + + +template +const Foam::DynamicList>& +Foam::Residuals::field +( + const polyMesh& mesh, + const word& fieldName +) +{ + return MeshObject>::New + ( + mesh + )[fieldName]; +} + + +template +void Foam::Residuals::append +( + const polyMesh& mesh, + const SolverPerformance& sp +) +{ + Residuals& residuals = const_cast&> + ( + MeshObject>::New + ( + mesh + ) + ); + + HashTable>>& table = residuals; + + const label timeIndex = + mesh.time().subCycling() + ? mesh.time().prevTimeState().timeIndex() + : mesh.time().timeIndex(); + + if (residuals.prevTimeIndex_ != timeIndex) + { + // Reset solver performance between iterations + residuals.prevTimeIndex_ = timeIndex; + table.clear(); + } + + if (table.found(sp.fieldName())) + { + table[sp.fieldName()].append(sp); + } + else + { + table.insert + ( + sp.fieldName(), + DynamicList>(1, sp) + ); + } +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/Residuals/Residuals.H b/src/OpenFOAM/meshes/Residuals/Residuals.H new file mode 100644 index 0000000000..308960e439 --- /dev/null +++ b/src/OpenFOAM/meshes/Residuals/Residuals.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::Residuals + +Description + MeshObject to store the solver performance residuals of all the fields + of the type it is instantiated on. + +SourceFiles + Residuals.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Residuals_H +#define Residuals_H + +#include "MeshObject.H" +#include "polyMesh.H" +#include "solverPerformance.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class Residuals Declaration +\*---------------------------------------------------------------------------*/ + +template +class Residuals +: + public MeshObject>, + public HashTable>> +{ + // Private data + + //- Previously used time-index, used for reset between iterations + mutable label prevTimeIndex_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Residuals(const Residuals&); + + //- Disallow default bitwise assignment + void operator=(const Residuals&); + + +public: + + //- Runtime type information + TypeName("residuals"); + + + // Constructors + + //- Construct for given mesh + Residuals(const polyMesh& mesh); + + + // Member Functions + + //- Return the list of field names of the particular type + // for which residuals are stored + static List fieldNames(const polyMesh& mesh); + + //- Return true if residuals for the given field are stored + static bool found(const polyMesh& mesh, const word& fieldName); + + //- Return the list of solver performance residuals for the given field + static const DynamicList>& field + ( + const polyMesh& mesh, + const word& fieldName + ); + + //- Append the given solver performance residuals + // in the corresponding list + static void append + ( + const polyMesh& mesh, + const SolverPerformance& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "Residuals.C" +#endif + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/data/dataTemplates.C b/src/OpenFOAM/meshes/Residuals/residuals.C similarity index 52% rename from src/OpenFOAM/meshes/data/dataTemplates.C rename to src/OpenFOAM/meshes/Residuals/residuals.C index e27e449804..39a7ecbf4d 100644 --- a/src/OpenFOAM/meshes/data/dataTemplates.C +++ b/src/OpenFOAM/meshes/Residuals/residuals.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,55 +23,21 @@ License \*---------------------------------------------------------------------------*/ -#include "data.H" -#include "Time.H" -#include "solverPerformance.H" +#include "Residuals.H" +#include "fieldTypes.H" -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -void Foam::data::setSolverPerformance -( - const word& name, - const SolverPerformance& sp -) const +#define makeResiduals(Type) \ + defineTemplateTypeNameAndDebug(Residuals, 0); + +namespace Foam { - dictionary& dict = const_cast(solverPerformanceDict()); - - // Use a DynamicList to improve performance of the append - DynamicList> perfs; - - const label timeIndex = - this->time().subCycling() - ? this->time().prevTimeState().timeIndex() - : this->time().timeIndex(); - - if (prevTimeIndex_ != timeIndex) - { - // Reset solver performance between iterations - prevTimeIndex_ = timeIndex; - dict.clear(); - } - else - { - dict.readIfPresent(name, perfs); - } - - // Append to list - perfs.append(sp); - - dict.set(name, perfs); + makeResiduals(scalar); + makeResiduals(vector); + makeResiduals(sphericalTensor); + makeResiduals(symmTensor); + makeResiduals(tensor); } - -template -void Foam::data::setSolverPerformance -( - const SolverPerformance& sp -) const -{ - setSolverPerformance(sp.fieldName(), sp); -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/data/data.C b/src/OpenFOAM/meshes/data/data.C index 36f934a35f..1048a2c46d 100644 --- a/src/OpenFOAM/meshes/data/data.C +++ b/src/OpenFOAM/meshes/data/data.C @@ -44,19 +44,8 @@ Foam::data::data(const objectRegistry& obr) IOobject::NO_READ, IOobject::NO_WRITE ) - ), - prevTimeIndex_(-1) -{ - set("solverPerformance", dictionary()); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::dictionary& Foam::data::solverPerformanceDict() const -{ - return subDict("solverPerformance"); -} + ) +{} // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/data/data.H b/src/OpenFOAM/meshes/data/data.H index 1306e255d0..c5197ba873 100644 --- a/src/OpenFOAM/meshes/data/data.H +++ b/src/OpenFOAM/meshes/data/data.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::data Description - Database for solution data, solver performance and other reduced data. + Database for solution and other reduced data. fvMesh is derived from data so that all fields have access to the data from the mesh reference they hold. @@ -39,7 +39,6 @@ SourceFiles #define data_H #include "IOdictionary.H" -#include "solverPerformance.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,12 +53,6 @@ class data : public IOdictionary { - // Private data - - //- Previously used time-index, used for reset between iterations - mutable label prevTimeIndex_; - - // Private Member Functions //- Disallow default bitwise copy construct @@ -79,31 +72,6 @@ public: //- Construct for objectRegistry data(const objectRegistry& obr); - - - // Member Functions - - // Access - - //- Return the dictionary of solver performance data - // which includes initial and final residuals for convergence - // checking - const dictionary& solverPerformanceDict() const; - - //- Add/set the solverPerformance entry for the named field - template - void setSolverPerformance - ( - const word& name, - const SolverPerformance& - ) const; - - //- Add/set the solverPerformance entry, using its fieldName - template - void setSolverPerformance - ( - const SolverPerformance& - ) const; }; @@ -113,12 +81,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository - #include "dataTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C index 61fca62743..4f3a38f842 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "staticFvMesh.H" +#include "Time.H" // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.C b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.C index 1a02088d87..c465e98cb2 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,29 +36,37 @@ namespace Foam // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // +Foam::DynamicList Foam::convergenceControl::getFieldNames +( + const fvMesh& mesh +) +{ + DynamicList fieldNames; + + getFieldTypeNames(mesh, fieldNames); + getFieldTypeNames(mesh, fieldNames); + getFieldTypeNames(mesh, fieldNames); + getFieldTypeNames(mesh, fieldNames); + getFieldTypeNames(mesh, fieldNames); + + return fieldNames; +} + + void Foam::convergenceControl::getInitialResiduals ( const fvMesh& mesh, const word& fieldName, const label solvei, - ITstream& data, scalar& r0, scalar& r ) { - getInitialTypeResiduals(mesh, fieldName, solvei, data, r0, r); - getInitialTypeResiduals(mesh, fieldName, solvei, data, r0, r); - getInitialTypeResiduals - ( - mesh, - fieldName, - solvei, - data, - r0, - r - ); - getInitialTypeResiduals(mesh, fieldName, solvei, data, r0, r); - getInitialTypeResiduals(mesh, fieldName, solvei, data, r0, r); + getInitialTypeResiduals(mesh, fieldName, solvei, r0, r); + getInitialTypeResiduals(mesh, fieldName, solvei, r0, r); + getInitialTypeResiduals(mesh, fieldName, solvei, r0, r); + getInitialTypeResiduals(mesh, fieldName, solvei, r0, r); + getInitialTypeResiduals(mesh, fieldName, solvei, r0, r); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.H b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.H index 746d2c349a..bb12dc4b1a 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControl.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,6 +65,10 @@ public: // Static Functions + //- Get the list of names of the fields + // for which residual data is available + static DynamicList getFieldNames(const fvMesh& mesh); + //- Get the initial residuals for the first and the i-th solves in this // time-step static void getInitialResiduals @@ -72,7 +76,6 @@ public: const fvMesh& mesh, const word& fieldName, const label solvei, - ITstream& data, scalar& r0, scalar& r ); @@ -90,6 +93,14 @@ public: const bool useRegEx=true ); + //- Append the of names of the fields of this Type to the given list + template + static void getFieldTypeNames + ( + const fvMesh& mesh, + DynamicList& fieldNames + ); + //- Get the initial residuals for the first and the i-th solves in this // time-step template @@ -98,7 +109,6 @@ public: const fvMesh& mesh, const word& fieldName, const label solvei, - ITstream& data, scalar& r0, scalar& r ); diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControlTemplates.C b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControlTemplates.C index 2b43c4ff26..e15b0af837 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControlTemplates.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/convergenceControl/convergenceControlTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,6 +23,8 @@ License \*---------------------------------------------------------------------------*/ +#include "Residuals.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -49,13 +51,23 @@ Foam::label Foam::convergenceControl::residualControlIndex } +template +void Foam::convergenceControl::getFieldTypeNames +( + const fvMesh& mesh, + DynamicList& fieldNames +) +{ + fieldNames.append(Residuals::fieldNames(mesh)); +} + + template void Foam::convergenceControl::getInitialTypeResiduals ( const fvMesh& mesh, const word& fieldName, const label solvei, - ITstream& data, scalar& r0, scalar& r ) @@ -64,7 +76,11 @@ void Foam::convergenceControl::getInitialTypeResiduals if (mesh.foundObject(fieldName)) { - const List> sp(data); + const DynamicList>& sp + ( + Residuals::field(mesh, fieldName) + ); + r0 = cmptMax(sp[0].initialResidual()); r = cmptMax(sp[solvei].initialResidual()); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.C b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.C index fc444882ea..1158b1e140 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,15 +40,14 @@ void Foam::correctorConvergenceControl::getNSolves ( const fvMesh& mesh, const word& fieldName, - ITstream& data, label& n ) { - getNTypeSolves(mesh, fieldName, data, n); - getNTypeSolves(mesh, fieldName, data, n); - getNTypeSolves(mesh, fieldName, data, n); - getNTypeSolves(mesh, fieldName, data, n); - getNTypeSolves(mesh, fieldName, data, n); + getNTypeSolves(mesh, fieldName, n); + getNTypeSolves(mesh, fieldName, n); + getNTypeSolves(mesh, fieldName, n); + getNTypeSolves(mesh, fieldName, n); + getNTypeSolves(mesh, fieldName, n); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.H b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.H index 4108812d52..2d11948b86 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControl.H @@ -93,7 +93,6 @@ protected: ( const fvMesh& mesh, const word& fieldName, - ITstream& data, label& n ); @@ -107,7 +106,6 @@ protected: ( const fvMesh& mesh, const word& fieldName, - ITstream& data, label& n ); diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControlTemplates.C b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControlTemplates.C index 6359b1de76..cadd6f0127 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControlTemplates.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/correctorConvergenceControl/correctorConvergenceControlTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,6 +23,8 @@ License \*---------------------------------------------------------------------------*/ +#include "Residuals.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -30,7 +32,6 @@ void Foam::correctorConvergenceControl::getNTypeSolves ( const fvMesh& mesh, const word& fieldName, - ITstream& data, label& n ) { @@ -38,7 +39,11 @@ void Foam::correctorConvergenceControl::getNTypeSolves if (mesh.foundObject(fieldName)) { - const List> sp(data); + const DynamicList>& sp + ( + Residuals::field(mesh, fieldName) + ); + n = sp.size(); } } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionConvergenceControl/singleRegionConvergenceControl.C b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionConvergenceControl/singleRegionConvergenceControl.C index a44a087420..2fde739730 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionConvergenceControl/singleRegionConvergenceControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionConvergenceControl/singleRegionConvergenceControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -151,21 +151,21 @@ bool Foam::singleRegionConvergenceControl::criteriaSatisfied() const Info<< control_.algorithmName() << ": Residuals" << endl; } - const dictionary& solverDict = mesh_.solverPerformanceDict(); - forAllConstIter(dictionary, solverDict, iter) + DynamicList fieldNames(getFieldNames(mesh_)); + + forAll(fieldNames, i) { - const word& variableName = iter().keyword(); + const word& fieldName = fieldNames[i]; const label fieldi = - residualControlIndex(variableName, residualControl_); + residualControlIndex(fieldName, residualControl_); if (fieldi != -1) { scalar residual; getInitialResiduals ( mesh_, - variableName, + fieldName, 0, - iter().stream(), residual, residual ); @@ -178,7 +178,7 @@ bool Foam::singleRegionConvergenceControl::criteriaSatisfied() const if (control_.debug) { - Info<< control_.algorithmSpace() << " " << variableName + Info<< control_.algorithmSpace() << " " << fieldName << ": tolerance " << residual << " (" << residualControl_[fieldi].absTol << ")" << (absCheck ? " CONVERGED" : "") << endl; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionCorrectorConvergenceControl/singleRegionCorrectorConvergenceControl.C b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionCorrectorConvergenceControl/singleRegionCorrectorConvergenceControl.C index f8c55631b4..0e8bbf8cbf 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionCorrectorConvergenceControl/singleRegionCorrectorConvergenceControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/convergenceControl/singleRegionCorrectorConvergenceControl/singleRegionCorrectorConvergenceControl.C @@ -173,10 +173,11 @@ corrCriteriaSatisfied() const Info<< control_.algorithmName() << ": Correction residuals" << endl; } - const dictionary& solverDict = mesh_.solverPerformanceDict(); - forAllConstIter(dictionary, solverDict, iter) + DynamicList fieldNames(convergenceControl::getFieldNames(mesh_)); + + forAll(fieldNames, i) { - const word& fieldName = iter().keyword(); + const word& fieldName = fieldNames[i]; const label fieldi = convergenceControl::residualControlIndex ( @@ -191,7 +192,6 @@ corrCriteriaSatisfied() const mesh_, fieldName, solveIndex_.found(fieldName) ? solveIndex_[fieldName] : 0, - iter().stream(), firstResidual, residual ); @@ -230,15 +230,16 @@ void Foam::singleRegionCorrectorConvergenceControl::resetCorrSolveIndex() void Foam::singleRegionCorrectorConvergenceControl::updateCorrSolveIndex() { - const dictionary& solverDict = mesh_.solverPerformanceDict(); - forAllConstIter(dictionary, solverDict, iter) + DynamicList fieldNames(convergenceControl::getFieldNames(mesh_)); + + forAll(fieldNames, i) { - const word& fieldName = iter().keyword(); + const word& fieldName = fieldNames[i]; + getNSolves ( mesh_, fieldName, - iter().stream(), solveIndex_(fieldName) ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C index 5dad3be700..9b7eed8b2f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C @@ -133,7 +133,7 @@ void Foam::freestreamPressureFvPatchScalarField::updateCoeffs() const Field magUp(mag(Up)); - const Field& nf = patch().nf(); + const Field nf(patch().nf()); Field& vf = valueFraction(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C index 8e0e185c9f..a20b8c498a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C @@ -109,7 +109,7 @@ void Foam::freestreamVelocityFvPatchVectorField::updateCoeffs() const Field& Up = *this; const Field magUp(mag(Up)); - const Field& nf = patch().nf(); + const Field nf(patch().nf()); Field& vf = valueFraction(); diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index 1a8cbf7eff..264f968eb8 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "LduMatrix.H" #include "diagTensorField.H" +#include "Residuals.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -209,7 +210,7 @@ Foam::SolverPerformance Foam::fvMatrix::solveSegregated psi.correctBoundaryConditions(); - psi.mesh().setSolverPerformance(psi.name(), solverPerfVec); + Residuals::append(psi.mesh(), solverPerfVec); return solverPerfVec; } @@ -269,7 +270,7 @@ Foam::SolverPerformance Foam::fvMatrix::solveCoupled psi.correctBoundaryConditions(); - psi.mesh().setSolverPerformance(psi.name(), solverPerf); + Residuals::append(psi.mesh(), solverPerf); return solverPerf; } diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index f55d00b939..079f18e771 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "fvScalarMatrix.H" +#include "Residuals.H" #include "extrapolatedCalculatedFvPatchFields.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -127,7 +128,7 @@ Foam::solverPerformance Foam::fvMatrix::fvSolver::solve psi.correctBoundaryConditions(); - psi.mesh().setSolverPerformance(psi.name(), solverPerf); + Residuals::append(psi.mesh(), solverPerf); return solverPerf; } @@ -177,7 +178,7 @@ Foam::solverPerformance Foam::fvMatrix::solveSegregated psi.correctBoundaryConditions(); - psi.mesh().setSolverPerformance(psi.name(), solverPerf); + Residuals::append(psi.mesh(), solverPerf); return solverPerf; } diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueI.H b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueI.H index ef4e29f6ca..85a6ae5912 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueI.H +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "surfaceFieldValue.H" +#include "Time.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/functionObjects/utilities/residuals/residualsTemplates.C b/src/functionObjects/utilities/residuals/residualsTemplates.C index 211bc3d95a..557729bd8f 100644 --- a/src/functionObjects/utilities/residuals/residualsTemplates.C +++ b/src/functionObjects/utilities/residuals/residualsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "residuals.H" #include "volFields.H" +#include "Residuals.H" #include "ListOps.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,13 +64,11 @@ void Foam::functionObjects::residuals::writeResidual(const word& fieldName) if (obr_.foundObject(fieldName)) { - const Foam::dictionary& solverDict = mesh_.solverPerformanceDict(); - - if (solverDict.found(fieldName)) + if (Residuals::found(mesh_, fieldName)) { - const List> sp + const DynamicList>& sp ( - solverDict.lookup(fieldName) + Residuals::field(mesh_, fieldName) ); const Type& residual = sp.first().initialResidual(); diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C index aa27492ea3..26112a162a 100644 --- a/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "surfaceTensionModel.H" #include "fvMesh.H" +#include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/aerofoilNACA0012/system/controlDict b/tutorials/compressible/rhoPimpleFoam/RAS/aerofoilNACA0012/system/controlDict index deb6bb17f1..563ffc3989 100644 --- a/tutorials/compressible/rhoPimpleFoam/RAS/aerofoilNACA0012/system/controlDict +++ b/tutorials/compressible/rhoPimpleFoam/RAS/aerofoilNACA0012/system/controlDict @@ -14,8 +14,6 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -libs ("libmodifiedInletOutlet.so"); - application rhoPimpleFoam; startFrom latestTime;