From 1944b09bb530a8b9a2546ac3b196b137668d329f Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 10 Nov 2015 08:50:11 +0000 Subject: [PATCH] SolverPerformance: Complete the integration of the templated SolverPerformance Now solvers return solver performance information for all components with backward compatibility provided by the "max" function which created the scalar solverPerformance from the maximum component residuals from the SolverPerformance. The residuals functionObject has been upgraded to support SolverPerformance so that now the initial residuals for all (valid) components are tabulated, e.g. for the cavity tutorial case the residuals for p, Ux and Uy are listed vs time. Currently the residualControl option of pimpleControl and simpleControl is supported in backward compatibility mode (only the maximum component residual is considered) but in the future this will be upgraded to support convergence control for the components individually. This development started from patches provided by Bruno Santos, See http://www.openfoam.org/mantisbt/view.php?id=1824 --- .../solidDisplacementFoam.C | 2 +- applications/test/volField/Test-volField.C | 32 +++++++-- src/OpenFOAM/db/IOstreams/token/tokenI.H | 8 +-- .../LduMatrix/LduMatrix/SolverPerformance.C | 32 ++++++++- .../LduMatrix/LduMatrix/SolverPerformance.H | 31 +++++--- .../LduMatrix/LduMatrix/solverPerformance.C | 10 ++- .../LduMatrix/LduMatrix/solverPerformance.H | 7 +- src/OpenFOAM/meshes/data/data.C | 40 +---------- src/OpenFOAM/meshes/data/data.H | 14 +++- src/OpenFOAM/meshes/data/dataTemplates.C | 71 +++++++++++++++++++ src/OpenFOAM/primitives/Scalar/Scalar.C | 4 +- src/OpenFOAM/primitives/Scalar/Scalar.H | 3 + src/OpenFOAM/primitives/bools/bool/bool.C | 4 +- src/OpenFOAM/primitives/ints/int32/int32.C | 4 +- src/OpenFOAM/primitives/ints/int64/int64.C | 4 +- src/OpenFOAM/primitives/ints/uint32/uint32.C | 4 +- src/OpenFOAM/primitives/ints/uint64/uint64.C | 4 +- .../pimpleControl/pimpleControl.C | 8 +-- .../simpleControl/simpleControl.C | 7 +- .../solutionControl/solutionControl.C | 39 ++++++++++ .../solutionControl/solutionControl.H | 19 +++++ .../fvMatrices/fvMatrix/fvMatrix.C | 18 ++--- .../fvMatrices/fvMatrix/fvMatrix.H | 20 +++--- .../fvMatrices/fvMatrix/fvMatrixSolve.C | 33 ++++----- src/finiteVolume/fvMesh/fvMesh.C | 8 +++ src/finiteVolume/fvMesh/fvMesh.H | 14 +++- src/finiteVolume/fvMesh/fvMeshTemplates.C | 45 ++++++++++++ .../fvPatch/fvPatchFvMeshTemplates.C | 2 +- .../utilities/residuals/residuals.C | 22 +++--- .../utilities/residuals/residuals.H | 4 ++ .../utilities/residuals/residualsTemplates.C | 57 +++++++++++++-- 31 files changed, 428 insertions(+), 142 deletions(-) create mode 100644 src/OpenFOAM/meshes/data/dataTemplates.C create mode 100644 src/finiteVolume/fvMesh/fvMeshTemplates.C diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C index e2c6c94337..f79242dcf0 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) //DEqn.setComponentReference(1, 0, vector::X, 0); //DEqn.setComponentReference(1, 0, vector::Z, 0); - initialResidual = DEqn.solve().initialResidual(); + initialResidual = DEqn.solve().max().initialResidual(); if (!compactNormalStress) { diff --git a/applications/test/volField/Test-volField.C b/applications/test/volField/Test-volField.C index 25d8fbabff..37e4d303bf 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 | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,13 +83,35 @@ int main(int argc, char *argv[]) zeroGradientFvPatchSymmTensorField::typeName ); - solve + SolverPerformance sP = ( - fvm::ddt(st) - + fvm::div(phi, st) - - fvm::laplacian(dimensionedScalar("D", sqr(dimLength)/dimTime, 1), st) + solve + ( + fvm::ddt(st) + + fvm::div(phi, st) + - fvm::laplacian + ( + dimensionedScalar("D", sqr(dimLength)/dimTime, 1), + st + ) + == + dimensioned + ( + "source", + dimless/dimTime, + symmTensor(0, 2, 0, 1, 1.5, 0) + ) + ) ); + Info<< nl + << "Detailed SolverPerformance: " << nl + << " " << sP << endl; + + Info<< nl + << "solverPerformanceDict: " + << mesh.solverPerformanceDict() << endl; + return 0; } diff --git a/src/OpenFOAM/db/IOstreams/token/tokenI.H b/src/OpenFOAM/db/IOstreams/token/tokenI.H index 8c2a024bbf..6d34249a61 100644 --- a/src/OpenFOAM/db/IOstreams/token/tokenI.H +++ b/src/OpenFOAM/db/IOstreams/token/tokenI.H @@ -231,7 +231,7 @@ inline const word& token::wordToken() const } else { - parseError("word"); + parseError(word::typeName); return word::null; } } @@ -254,7 +254,7 @@ inline const string& token::stringToken() const } else { - parseError("string"); + parseError(string::typeName); return string::null; } } @@ -272,7 +272,7 @@ inline label token::labelToken() const } else { - parseError("label"); + parseError(pTraits