From a2be9acca43a72a56930cbbf7ed092e259f43418 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 May 2016 10:40:51 +0100 Subject: [PATCH 01/19] BUG: mapNearestAMI: move normalisation to AMIMethod. Avoids cells shared among processors to be counted multiple times and having weights > 1. --- .../AMIInterpolation/AMIInterpolation.C | 6 +- .../AMIInterpolation/AMIInterpolation.H | 28 ++++- .../AMIInterpolation/AMIInterpolationI.H | 66 ++++++++++- .../AMIMethod/AMIMethod/AMIMethod.H | 12 +- .../AMIMethod/directAMI/directAMI.C | 11 ++ .../AMIMethod/directAMI/directAMI.H | 8 ++ .../faceAreaWeightAMI/faceAreaWeightAMI.C | 11 ++ .../faceAreaWeightAMI/faceAreaWeightAMI.H | 10 +- .../AMIMethod/mapNearestAMI/mapNearestAMI.C | 110 ++++++++++++++++-- .../AMIMethod/mapNearestAMI/mapNearestAMI.H | 10 +- .../partialFaceAreaWeightAMI.H | 2 +- 11 files changed, 256 insertions(+), 18 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index e5dcad0c8d..801877daac 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1062,7 +1062,7 @@ void Foam::AMIInterpolation::update ); // weights normalisation - normaliseWeights(AMIPtr->conformal(), true); + AMIPtr->normaliseWeights(true, *this); // cache maps and reset addresses List > cMap; @@ -1095,7 +1095,7 @@ void Foam::AMIInterpolation::update tgtWeights_ ); - normaliseWeights(AMIPtr->conformal(), true); + AMIPtr->normaliseWeights(true, *this); } if (debug) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index 67205b69a7..02bdf413e2 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -372,16 +372,29 @@ public: //- Return const access to source patch face areas inline const scalarField& srcMagSf() const; + //- Return access to source patch face areas + inline scalarField& srcMagSf(); + //- Return const access to source patch addressing inline const labelListList& srcAddress() const; + //- Return access to source patch addressing + inline labelListList& srcAddress(); + //- Return const access to source patch weights inline const scalarListList& srcWeights() const; + //- Return access to source patch weights + inline scalarListList& srcWeights(); + //- Return const access to normalisation factor of source // patch weights (i.e. the sum before normalisation) inline const scalarField& srcWeightsSum() const; + //- Return access to normalisation factor of source + // patch weights (i.e. the sum before normalisation) + inline scalarField& srcWeightsSum(); + //- Source map pointer - valid only if singlePatchProc = -1 // This gets source data into a form to be consumed by // tgtAddress, tgtWeights @@ -393,16 +406,29 @@ public: //- Return const access to target patch face areas inline const scalarField& tgtMagSf() const; + //- Return access to target patch face areas + inline scalarField& tgtMagSf(); + //- Return const access to target patch addressing inline const labelListList& tgtAddress() const; + //- Return access to target patch addressing + inline labelListList& tgtAddress(); + //- Return const access to target patch weights inline const scalarListList& tgtWeights() const; + //- Return access to target patch weights + inline scalarListList& tgtWeights(); + //- Return const access to normalisation factor of target // patch weights (i.e. the sum before normalisation) inline const scalarField& tgtWeightsSum() const; + //- Return access to normalisation factor of target + // patch weights (i.e. the sum before normalisation) + inline scalarField& tgtWeightsSum(); + //- Target map pointer - valid only if singlePatchProc=-1. // This gets target data into a form to be consumed by // srcAddress, srcWeights diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H index 9c59cb6865..5e6acaa64a 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,6 +56,14 @@ Foam::AMIInterpolation::srcMagSf() const } +template +inline Foam::scalarField& +Foam::AMIInterpolation::srcMagSf() +{ + return srcMagSf_; +} + + template inline const Foam::labelListList& Foam::AMIInterpolation::srcAddress() const @@ -64,6 +72,14 @@ Foam::AMIInterpolation::srcAddress() const } +template +inline Foam::labelListList& +Foam::AMIInterpolation::srcAddress() +{ + return srcAddress_; +} + + template inline const Foam::scalarListList& Foam::AMIInterpolation::srcWeights() const @@ -72,6 +88,14 @@ Foam::AMIInterpolation::srcWeights() const } +template +inline Foam::scalarListList& +Foam::AMIInterpolation::srcWeights() +{ + return srcWeights_; +} + + template inline const Foam::scalarField& Foam::AMIInterpolation::srcWeightsSum() const @@ -80,6 +104,14 @@ Foam::AMIInterpolation::srcWeightsSum() const } +template +inline Foam::scalarField& +Foam::AMIInterpolation::srcWeightsSum() +{ + return srcWeightsSum_; +} + + template inline const Foam::mapDistribute& Foam::AMIInterpolation::srcMap() const @@ -96,6 +128,14 @@ Foam::AMIInterpolation::tgtMagSf() const } +template +inline Foam::scalarField& +Foam::AMIInterpolation::tgtMagSf() +{ + return tgtMagSf_; +} + + template inline const Foam::labelListList& Foam::AMIInterpolation::tgtAddress() const @@ -104,6 +144,14 @@ Foam::AMIInterpolation::tgtAddress() const } +template +inline Foam::labelListList& +Foam::AMIInterpolation::tgtAddress() +{ + return tgtAddress_; +} + + template inline const Foam::scalarListList& Foam::AMIInterpolation::tgtWeights() const @@ -112,6 +160,14 @@ Foam::AMIInterpolation::tgtWeights() const } +template +inline Foam::scalarListList& +Foam::AMIInterpolation::tgtWeights() +{ + return tgtWeights_; +} + + template inline const Foam::scalarField& Foam::AMIInterpolation::tgtWeightsSum() const @@ -120,6 +176,14 @@ Foam::AMIInterpolation::tgtWeightsSum() const } +template +inline Foam::scalarField& +Foam::AMIInterpolation::tgtWeightsSum() +{ + return tgtWeightsSum_; +} + + template inline const Foam::mapDistribute& Foam::AMIInterpolation::tgtMap() const diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H index 2e9417782d..7d76657fe9 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpcnCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,6 +48,8 @@ SourceFiles namespace Foam { +template class AMIInterpolation; + /*---------------------------------------------------------------------------*\ Class AMIMethod Declaration \*---------------------------------------------------------------------------*/ @@ -238,6 +240,14 @@ public: label srcFaceI = -1, label tgtFaceI = -1 ) = 0; + + //- Normalise the weight. Can optionally subset addressing + // (e.g. for mapNearest) + virtual void normaliseWeights + ( + const bool verbose, + AMIInterpolation& inter + ) = 0; }; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C index a0a14f8258..e263dbdfd2 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C @@ -322,4 +322,15 @@ void Foam::directAMI::calculate } +template +void Foam::directAMI::normaliseWeights +( + const bool verbose, + AMIInterpolation& inter +) +{ + inter.normaliseWeights(this->conformal(), verbose); +} + + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H index d74094d0b5..9159f629ed 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H @@ -135,6 +135,14 @@ public: label srcFaceI = -1, label tgtFaceI = -1 ); + + //- Normalise the weight. Can optionally subset addressing + // (e.g. for mapNearest) + virtual void normaliseWeights + ( + const bool verbose, + AMIInterpolation& inter + ); }; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C index da5c84ac97..3d89330198 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -568,4 +568,15 @@ void Foam::faceAreaWeightAMI::calculate } +template +void Foam::faceAreaWeightAMI::normaliseWeights +( + const bool verbose, + AMIInterpolation& inter +) +{ + inter.normaliseWeights(this->conformal(), verbose); +} + + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H index 2d1b552018..0a7f497407 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -167,6 +167,14 @@ public: label srcFaceI = -1, label tgtFaceI = -1 ); + + //- Normalise the weight. Can optionally subset addressing + // (e.g. for mapNearest) + virtual void normaliseWeights + ( + const bool verbose, + AMIInterpolation& inter + ); }; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C index 0efaf241f4..211a81cdba 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -322,19 +322,111 @@ void Foam::mapNearestAMI::calculate // transfer data to persistent storage - forAll(srcAddr, i) + const pointField& srcFc = this->srcPatch_.faceCentres(); + const pointField& tgtFc = this->tgtPatch_.faceCentres(); + + forAll(srcAddr, srcI) { - scalar magSf = this->srcMagSf_[i]; - srcAddress[i].transfer(srcAddr[i]); - srcWeights[i] = scalarList(1, magSf); + srcAddress[srcI].transfer(srcAddr[srcI]); + + const labelList& addr = srcAddress[srcI]; + srcWeights[srcI].setSize(addr.size()); + const point& srcPt = srcFc[srcI]; + forAll(addr, i) + { + srcWeights[srcI][i] = magSqr(srcPt-tgtFc[addr[i]]); + } } - forAll(tgtAddr, i) + forAll(tgtAddr, tgtI) { - scalar magSf = this->tgtMagSf_[i]; - tgtAddress[i].transfer(tgtAddr[i]); - tgtWeights[i] = scalarList(1, magSf); + tgtAddress[tgtI].transfer(tgtAddr[tgtI]); + + const labelList& addr = tgtAddress[tgtI]; + tgtWeights[tgtI].setSize(addr.size()); + const point& tgtPt = tgtFc[tgtI]; + forAll(addr, i) + { + tgtWeights[tgtI][i] = magSqr(tgtPt-srcFc[addr[i]]); + } } } +template +void Foam::mapNearestAMI::normaliseWeights +( + const bool verbose, + AMIInterpolation& inter +) +{ + { + labelListList& srcAddress = inter.srcAddress(); + scalarListList& srcWeights = inter.srcWeights(); + + forAll(srcAddress, srcI) + { + labelList& addr = srcAddress[srcI]; + scalarList& wghts = srcWeights[srcI]; + + // Choose one with smallest weight (since calculate above returns + // distance) + if (addr.size()) + { + label minFaceI = addr[0]; + scalar minWeight = wghts[0]; + + for (label i = 0; i < addr.size(); i++) + { + if (wghts[i] < minWeight) + { + minWeight = wghts[i]; + minFaceI = addr[i]; + } + } + + wghts.setSize(1); + wghts[0] = this->srcMagSf_[srcI]; + addr.setSize(1); + addr[0] = minFaceI; + } + } + } + + { + labelListList& tgtAddress = inter.tgtAddress(); + scalarListList& tgtWeights = inter.tgtWeights(); + + forAll(tgtAddress, tgtI) + { + labelList& addr = tgtAddress[tgtI]; + scalarList& wghts = tgtWeights[tgtI]; + + // Choose one with smallest weight (since calculate above returns + // distance) + if (addr.size()) + { + label minFaceI = addr[0]; + scalar minWeight = wghts[0]; + + for (label i = 0; i < addr.size(); i++) + { + if (wghts[i] < minWeight) + { + minWeight = wghts[i]; + minFaceI = addr[i]; + } + } + + wghts.setSize(1); + wghts[0] = inter.tgtMagSf()[tgtI]; + addr.setSize(1); + addr[0] = minFaceI; + } + } + } + + inter.normaliseWeights(this->conformal(), verbose); +} + + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H index 86d8c615f2..0b5eb1657a 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -139,6 +139,14 @@ public: label srcFaceI = -1, label tgtFaceI = -1 ); + + //- Normalise the weight. Can optionally subset addressing + // (e.g. for mapNearest) + virtual void normaliseWeights + ( + const bool verbose, + AMIInterpolation& inter + ); }; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H index de8afcf0ef..9212258019 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. From 9ab102bce36bcbd1eacfa12778880cbcd0fdee1d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 8 Jun 2016 16:33:46 +0100 Subject: [PATCH 02/19] STYLE: reduce code duplication in Time.C --- src/OpenFOAM/db/Time/Time.C | 86 ++++++++++++------------------------- src/OpenFOAM/db/Time/Time.H | 5 ++- 2 files changed, 32 insertions(+), 59 deletions(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 4153ec823a..59faf93c86 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -333,6 +333,29 @@ void Foam::Time::setControls() } +void Foam::Time::setMonitoring() +{ + // Time objects not registered so do like objectRegistry::checkIn ourselves. + if (runTimeModifiable_) + { + monitorPtr_.reset + ( + new fileMonitor + ( + regIOobject::fileModificationChecking == inotify + || regIOobject::fileModificationChecking == inotifyMaster + ) + ); + + // Monitor all files that controlDict depends on + addWatches(controlDict_, controlDict_.files()); + } + + // Clear dependent files - not needed now + controlDict_.files().clear(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::Time::Time @@ -401,25 +424,7 @@ Foam::Time::Time readOpt() = IOobject::MUST_READ_IF_MODIFIED; setControls(); - - // Time objects not registered so do like objectRegistry::checkIn ourselves. - if (runTimeModifiable_) - { - monitorPtr_.reset - ( - new fileMonitor - ( - regIOobject::fileModificationChecking == inotify - || regIOobject::fileModificationChecking == inotifyMaster - ) - ); - - // Monitor all files that controlDict depends on - addWatches(controlDict_, controlDict_.files()); - } - - // Clear dependent files - controlDict_.files().clear(); + setMonitoring(); } @@ -495,25 +500,7 @@ Foam::Time::Time readOpt() = IOobject::MUST_READ_IF_MODIFIED; setControls(); - - // Time objects not registered so do like objectRegistry::checkIn ourselves. - if (runTimeModifiable_) - { - monitorPtr_.reset - ( - new fileMonitor - ( - regIOobject::fileModificationChecking == inotify - || regIOobject::fileModificationChecking == inotifyMaster - ) - ); - - // Monitor all files that controlDict depends on - addWatches(controlDict_, controlDict_.files()); - } - - // Clear dependent files since not needed - controlDict_.files().clear(); + setMonitoring(); } @@ -588,25 +575,7 @@ Foam::Time::Time controlDict_.readOpt() = IOobject::MUST_READ_IF_MODIFIED; setControls(); - - // Time objects not registered so do like objectRegistry::checkIn ourselves. - if (runTimeModifiable_) - { - monitorPtr_.reset - ( - new fileMonitor - ( - regIOobject::fileModificationChecking == inotify - || regIOobject::fileModificationChecking == inotifyMaster - ) - ); - - // Monitor all files that controlDict depends on - addWatches(controlDict_, controlDict_.files()); - } - - // Clear dependent files since not needed - controlDict_.files().clear(); + setMonitoring(); } @@ -667,6 +636,7 @@ Foam::Time::Time functionObjects_(*this, enableFunctionObjects) { libs_.open(controlDict_, "libs"); + setMonitoring(); // for profiling etc } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index cac8f2e02e..24d7abee3f 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -181,6 +181,9 @@ protected: //- Set the controls from the current controlDict void setControls(); + //- Set file monitoring, profiling, etc + void setMonitoring(); + //- Read the control dictionary and set the write controls etc. virtual void readDict(); From ef34e60e2dc44ebba88d199128098ab9375f24bd Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 8 Jun 2016 16:38:10 +0100 Subject: [PATCH 03/19] ENH: add profiling code from Bernhard Gschaider - activate via the case's : profiling yes; --- src/OpenFOAM/Make/files | 1 + src/OpenFOAM/db/Time/Time.C | 28 ++ src/OpenFOAM/db/Time/TimeIO.C | 5 +- .../functionObjectList/functionObjectList.C | 27 ++ src/OpenFOAM/global/profiling/Profiling.C | 373 +++++++++++++++ src/OpenFOAM/global/profiling/Profiling.H | 424 ++++++++++++++++++ .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 4 +- .../lduMatrix/lduMatrix/lduMatrixSolver.C | 5 +- .../solvers/smoothSolver/smoothSolver.C | 7 +- .../general/fvOptions/fvOptionListTemplates.C | 14 +- .../fvMatrices/fvMatrix/fvMatrixSolve.C | 5 +- .../fvScalarMatrix/fvScalarMatrix.C | 5 +- .../fvMatrices/solvers/MULES/IMULES.C | 5 +- .../solvers/MULES/IMULESTemplates.C | 5 +- .../fvMatrices/solvers/MULES/MULES.C | 5 +- .../Templates/KinematicCloud/KinematicCloud.C | 5 +- 16 files changed, 906 insertions(+), 12 deletions(-) create mode 100644 src/OpenFOAM/global/profiling/Profiling.C create mode 100644 src/OpenFOAM/global/profiling/Profiling.H diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 460c85c164..bc9265235f 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -3,6 +3,7 @@ global/global.Cver /* global/constants/dimensionedConstants.C in global.Cver */ global/argList/argList.C global/clock/clock.C +global/profiling/Profiling.C bools = primitives/bools $(bools)/bool/bool.C diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 59faf93c86..732dbceb60 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -27,6 +27,7 @@ License #include "PstreamReduceOps.H" #include "argList.H" #include "HashSet.H" +#include "Profiling.H" #include @@ -335,6 +336,24 @@ void Foam::Time::setControls() void Foam::Time::setMonitoring() { + // initialize profiling on request + if (controlDict_.lookupOrDefault("profiling", false)) + { + Profiling::initialize + ( + IOobject + ( + "profiling", + timeName(), + "uniform", + *this, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + *this + ); + } + // Time objects not registered so do like objectRegistry::checkIn ourselves. if (runTimeModifiable_) { @@ -651,6 +670,9 @@ Foam::Time::~Time() // destroy function objects first functionObjects_.clear(); + + // cleanup profiling + Profiling::stop(*this); } @@ -892,9 +914,13 @@ bool Foam::Time::run() const { // Ensure functionObjects execute on last time step // (and hence write uptodate functionObjectProperties) + addProfiling(foExec, "functionObjects.execute()"); functionObjects_.execute(); + endProfiling(foExec); + addProfiling(foEnd, "functionObjects.end()"); functionObjects_.end(); + endProfiling(foEnd); } } @@ -906,10 +932,12 @@ bool Foam::Time::run() const if (timeIndex_ == startTimeIndex_) { + addProfiling(functionObjects, "functionObjects.start()"); functionObjects_.start(); } else { + addProfiling(functionObjects, "functionObjects.execute()"); functionObjects_.execute(); } } diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index f6b41ab2cf..557b9a9e7d 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,7 @@ License #include "Pstream.H" #include "simpleObjectRegistry.H" #include "dimensionedConstants.H" +#include "Profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -518,6 +519,8 @@ bool Foam::Time::writeObject { if (outputTime()) { + addProfiling(writing, "objectRegistry::writeObject"); + const word tmName(timeName()); IOdictionary timeDict diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index a66ef2893b..378046c2b5 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -26,6 +26,7 @@ License #include "functionObjectList.H" #include "Time.H" #include "mapPolyMesh.H" +#include "Profiling.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // @@ -220,6 +221,12 @@ bool Foam::functionObjectList::execute(const bool forceWrite) forAll(*this, objectI) { + addProfiling + ( + fo, + "functionObject::" + operator[](objectI).name() + "::execute" + ); + ok = operator[](objectI).execute(forceWrite) && ok; } } @@ -257,6 +264,12 @@ bool Foam::functionObjectList::end() forAll(*this, objectI) { + addProfiling + ( + fo, + "functionObject::" + operator[](objectI).name() + "::end" + ); + ok = operator[](objectI).end() && ok; } } @@ -339,6 +352,8 @@ bool Foam::functionObjectList::read() label nFunc = 0; + addProfiling(fo,"functionObjects::read"); + if (entryPtr->isDict()) { // A dictionary of functionObjects @@ -366,12 +381,24 @@ bool Foam::functionObjectList::read() // An existing functionObject, and dictionary changed if (newDigs[nFunc] != digests_[oldIndex]) { + addProfiling + ( + fo2, + "functionObject::" + objPtr->name() + "::read" + ); + ok = objPtr->read(dict) && ok; } } else { // New functionObject + addProfiling + ( + fo2, + "functionObject::" + key + "::start" + ); + objPtr = functionObject::New(key, time_, dict).ptr(); ok = objPtr->start() && ok; } diff --git a/src/OpenFOAM/global/profiling/Profiling.C b/src/OpenFOAM/global/profiling/Profiling.C new file mode 100644 index 0000000000..0e8ae48dd8 --- /dev/null +++ b/src/OpenFOAM/global/profiling/Profiling.C @@ -0,0 +1,373 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2016 Bernhard Gschaider + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "Profiling.H" +#include "dictionary.H" + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +Foam::Profiling* Foam::Profiling::pool_(0); + +Foam::label Foam::Profiling::Information::nextId_(0); + + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::label Foam::Profiling::Information::getNextId() +{ + return nextId_++; +} + + +void Foam::Profiling::Information::raiseID(label maxVal) +{ + if (nextId_ < maxVal) + { + nextId_ = maxVal; + } +} + + +void Foam::Profiling::initialize +( + const IOobject& ioObj, + const Time& owner +) +{ + if (pool_) + { + WarningInFunction + << "Already initialized" << endl; + } + else + { + pool_ = new Profiling(ioObj, owner); + + Information *info = pool_->store + ( + new Information() + ); + + pool_->push(info, pool_->clockTime_); + info->push(); // mark as on stack + } +} + + +void Foam::Profiling::stop(const Time& owner) +{ + if (pool_ && &owner == &(pool_->owner_)) + { + delete pool_; + pool_ = 0; + } +} + + +Foam::Profiling::Information* Foam::Profiling::New +( + const string& name, + clockTime& timer +) +{ + Information *info = 0; + + if (pool_) + { + info = pool_->find(name); + if (!info) + { + info = pool_->store + ( + new Information(pool_->stack_.top(), name) + ); + } + + pool_->push(info, timer); + info->push(); // mark as on stack + } + + return info; +} + + +void Foam::Profiling::unstack(const Information *info) +{ + if (pool_ && info) + { + Information *top = pool_->stack_.pop(); + top->pop(); // mark as off stack + + if (info->id() != top->id()) + { + FatalErrorInFunction + << "The profiling information to unstack has different" + << " id than on the top of the profiling stack" << nl + << " info: " << info->id() << " (" << info->description() + << ")\n" + << " top: " << top->id() << " (" << top->description() + << ")\n" << endl + << abort(FatalError); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Profiling::Profiling +( + const IOobject& io, + const Time& owner +) +: + regIOobject(io), + owner_(owner), + clockTime_(), + hash_(), + stack_(), + timers_() +{} + + +Foam::Profiling::Information::Information() +: + id_(getNextId()), + description_("application::main"), + parent_(this), + calls_(0), + totalTime_(0), + childTime_(0), + onStack_(false) +{} + + +Foam::Profiling::Information::Information +( + Information *parent, + const string& descr +) +: + id_(getNextId()), + description_(descr), + parent_(parent), + calls_(0), + totalTime_(0), + childTime_(0), + onStack_(false) +{} + + +Foam::Profiling::Trigger::Trigger(const char* name) +: + clock_(), + ptr_(Profiling::New(name, clock_)) +{} + + +Foam::Profiling::Trigger::Trigger(const string& name) +: + clock_(), + ptr_(Profiling::New(name, clock_)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Profiling::~Profiling() +{ + if (pool_ == this) + { + pool_ = 0; + Information::nextId_ = 0; + } +} + + +Foam::Profiling::Information::~Information() +{} + + +Foam::Profiling::Trigger::~Trigger() +{ + stop(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::Profiling::Information* Foam::Profiling::find(const string& name) +{ + StorageContainer::iterator iter = hash_.find(name); + return (iter != hash_.end() ? iter() : 0); +} + + +void Foam::Profiling::Information::update(const scalar& elapsed) +{ + ++calls_; + totalTime_ += elapsed; + + if (id_ != parent().id()) + { + parent().childTime_ += elapsed; + } +} + + +bool Foam::Profiling::writeData(Ostream& os) const +{ + os << indent << "profiling" << nl + << indent << token::BEGIN_LIST << incrIndent << nl; + + // write on-stack items + // newest is first on the stack, top-level is at the end + // this is how the child times are summed + { + scalar oldElapsed = 0; + forAllConstIter(StackContainer, stack_, iter) + { + const Information *info = *iter; + scalar elapsed = timers_[info->id()]->elapsedTime(); + + info->write(os, true, elapsed, oldElapsed); + oldElapsed = elapsed; + } + } + + + // write off-stack items + // using an additional Map to sort by Id + { + typedef Map LookupContainer; + LookupContainer lookup; + + forAllConstIter(StorageContainer, hash_, iter) + { + const Information *info = iter(); + + if (!info->onStack()) + { + lookup.set(info->id(), info); + } + } + + forAllConstIter(LookupContainer, lookup, iter) + { + iter()->write(os); + } + } + + os << decrIndent + << indent << token::END_LIST << token::END_STATEMENT << nl; + + return os; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::Profiling::Information* Foam::Profiling::store(Information *info) +{ + hash_.insert(info->description(), info); + return info; +} + + +void Foam::Profiling::push(Information *info, clockTime& timer) +{ + stack_.push(info); + timers_.insert(info->id(), &timer); +} + + +void Foam::Profiling::Trigger::stop() +{ + if (ptr_) + { + ptr_->update(clock_.elapsedTime()); + Profiling::unstack(ptr_); + // pointer is managed by pool storage -> thus no delete here + } + ptr_ = 0; +} + + +// file-scope function +template +inline static void writeEntry +( + Foam::Ostream& os, const Foam::word& key, const T& value +) +{ + os.writeKeyword(key) << value << Foam::token::END_STATEMENT << '\n'; +} + + +Foam::Ostream& Foam::Profiling::Information::write +( + Ostream& os, + const bool offset, + const scalar& elapsedTime, + const scalar& childTimes +) const +{ + // write in dictionary format + + // os.beginBlock("_" + Foam::name(id_)) << nl; + os.beginBlock() << nl; // FUTURE: without nl + + // FUTURE: os.writeEntry(key, value); + + writeEntry(os, "id", id_); + if (id_ != parent().id()) + { + writeEntry(os, "parentId", parent().id()); + } + writeEntry(os, "description", description()); + writeEntry(os, "calls", calls() + (offset ? 1 : 0)); + writeEntry(os, "totalTime", totalTime() + elapsedTime); + writeEntry(os, "childTime", childTime() + childTimes); + writeEntry(os, "onStack", Switch(onStack())); + + os.endBlock() << nl; // FUTURE: without nl + + return os; +} + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const Profiling::Information& info +) +{ + return info.write(os); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/profiling/Profiling.H b/src/OpenFOAM/global/profiling/Profiling.H new file mode 100644 index 0000000000..01fcaad12f --- /dev/null +++ b/src/OpenFOAM/global/profiling/Profiling.H @@ -0,0 +1,424 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2016 Bernhard Gschaider + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. +------------------------------------------------------------------------------- +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::Profiling + +Description + Code profiling. + +SourceFiles + Profiling.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Profiling_H +#define Profiling_H + +#include "HashPtrTable.H" +#include "LIFOStack.H" +#include "Map.H" +#include "Time.H" +#include "clockTime.H" + +namespace Foam +{ + +// Forward declaration of classes +class Ostream; + +/*---------------------------------------------------------------------------*\ + Class Profiling Declaration +\*---------------------------------------------------------------------------*/ + +class Profiling +: + public regIOobject +{ +public: + + // Forward declarations of components + + class Information; + class Trigger; + +private: + + // Private Static Data Members + + //- Only one global pool object is possible + static Profiling *pool_; + + + // Private Data Members + + typedef HashPtrTable StorageContainer; + typedef LIFOStack StackContainer; + + + //- The owner of the profiling + const Time& owner_; + + //- A global timer for the profiling + clockTime clockTime_; + + //- Storage of profiling information + StorageContainer hash_; + + //- Local stack of profiling information + StackContainer stack_; + + //- Note the timers (by Id) for the correct stack-output + Map timers_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Profiling(const Profiling&) = delete; + + //- Disallow default bitwise assignment + void operator=(const Profiling&) = delete; + + +protected: + + // Friendship + + friend class Time; + + + // Constructors + + //- Construct IO object + Profiling(const IOobject&, const Time&); + + + //- Destructor + ~Profiling(); + + + // Protected Member Functions + + //- Find profiling information element or null on failure + Information* find(const string& name); + + //- Add to hashed storage, + // returns pointer to newly stored element for chaining + Information* store(Information*); + + //- Add to stack and set timer lookup (based on Id) + void push(Information*, clockTime& timer); + + + // Static control elements + + //- Singleton to initialize profiling pool + static void initialize(const IOobject&, const Time&); + + //- Stop profiling, cleanup pool if possible + static void stop(const Time&); + + //- Existing or new element on pool, add to stack + // Returns null if profiling has not been initialized + static Information* New(const string& name, clockTime& timer); + + //- Remove the information from the top of the stack + static void unstack(const Information*); + +public: + + // Member Functions + + //- The owner of the profiling + const Time& owner() const + { + return owner_; + } + + + //- The size of the current stack + Foam::label size() const + { + return stack_.size(); + } + + + //- writeData member function required by regIOobject + virtual bool writeData(Ostream&) const; + +}; + + +/*---------------------------------------------------------------------------*\ + Class Profiling::Information Declaration +\*---------------------------------------------------------------------------*/ + +class Profiling::Information +{ + // Private Static Data Members + + //- Counter to generate the ids + static label nextId_; + + //- get a new ID and update the counter + static label getNextId(); + + //- raise the next possible ID (to avoid ID-clashes during reading) + static void raiseID(label maxVal); + + + // Private Data Members + + //- Unique id to identify it + const label id_; + + //- What this timer does + const string description_; + + //- Pointer to the parent object (or self for top-level) + Information* parent_; + + //- Nr of times this was called + label calls_; + + //- Total time spent + scalar totalTime_; + + //- Time spent in children + scalar childTime_; + + //- Is this information currently on the stack? + mutable bool onStack_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Information(const Information&) = delete; + + //- Disallow default bitwise assignment + void operator=(const Information&) = delete; + + +protected: + + // Friendship + + friend class Profiling; + + + // Constructors + + //- Construct null - only the master-element + Information(); + + + // Member Functions + + //- Mark as being on the stack + void push() const + { + onStack_ = true; + } + + + //- Mark as being off the stack + void pop() const + { + onStack_ = false; + } + + + //- Write the profiling times, optionally with additional values + // Use dictionary format. + Ostream& write + ( + Ostream& os, + const bool offset = false, + const scalar& elapsedTime = 0, + const scalar& childTime = 0 + ) const; + +public: + + + // Constructors + + //- Construct from components + Information(Information* parent, const string& descr); + + + //- Destructor + ~Information(); + + + // Member Functions + + // Access + + inline label id() const + { + return id_; + } + + + inline const string& description() const + { + return description_; + } + + + inline Information& parent() const + { + return *parent_; + } + + + inline label calls() const + { + return calls_; + } + + + inline const scalar& totalTime() const + { + return totalTime_; + } + + + inline const scalar& childTime() const + { + return childTime_; + } + + + inline bool onStack() const + { + return onStack_; + } + + + // Edit + + //- Update it with a new timing information + void update(const scalar& elapsedTime); + + + // IOstream Operators + + friend Ostream& operator<<(Ostream&, const Information&); + +}; + + +/*---------------------------------------------------------------------------*\ + Class Profiling::Trigger Declaration +\*---------------------------------------------------------------------------*/ + +class Profiling::Trigger +{ + // Private Data Members + + //- The timer for the profiling information + clockTime clock_; + + //- The profiling information + Information *ptr_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Trigger(const Trigger&) = delete; + + //- Disallow default bitwise assignment + void operator=(const Trigger&) = delete; + + +public: + + // Constructors + + //- Construct profiling with given name + Trigger(const char* name); + + //- Construct profiling with given name + Trigger(const string& name); + + + //- Destructor + ~Trigger(); + + + // Member Functions + + // Access + + //- True if the triggered profiling is active + inline bool running() const + { + return ptr_; + } + + + // Edit + + //- Stop triggered profiling + void stop(); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Macros + +//- Define profiling with specified name and description correspond to the name +// \sa addProfiling +// \sa endProfiling +#define addProfiling0(name) \ + Foam::Profiling::Trigger profilingTriggerFor##name(#name) + + +//- Define profiling with specified name and description string +// This is required if the description contains space, colons etc. +// \sa addProfiling0 +// \sa endProfiling +#define addProfiling(name,descr) \ + Foam::Profiling::Trigger profilingTriggerFor##name(descr) + + +//- Remove profiling with specified name +// \sa addProfiling +// \sa addProfiling0 +#define endProfiling(name) profilingTriggerFor##name.stop() + + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 771317ed72..d425040364 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,6 +59,7 @@ SourceFiles #include "runTimeSelectionTables.H" #include "solverPerformance.H" #include "InfoProxy.H" +#include "Profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -116,6 +117,7 @@ public: //- Convergence tolerance relative to the initial scalar relTol_; + Profiling::Trigger profiling_; // Protected Member Functions diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index 1f6bd82d11..bbd5969082 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -147,7 +147,8 @@ Foam::lduMatrix::solver::solver interfaceBouCoeffs_(interfaceBouCoeffs), interfaceIntCoeffs_(interfaceIntCoeffs), interfaces_(interfaces), - controlDict_(solverControls) + controlDict_(solverControls), + profiling_("lduMatrix::solver." + fieldName) { readControls(); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C index 1fa2ee70cf..2aea792876 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "smoothSolver.H" +#include "Profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -87,6 +88,8 @@ Foam::solverPerformance Foam::smoothSolver::solve // If the nSweeps_ is negative do a fixed number of sweeps if (nSweeps_ < 0) { + addProfiling(solve, "lduMatrix::smoother." + fieldName_); + autoPtr smootherPtr = lduMatrix::smoother::New ( fieldName_, @@ -144,6 +147,8 @@ Foam::solverPerformance Foam::smoothSolver::solve || !solverPerf.checkConvergence(tolerance_, relTol_) ) { + addProfiling(solve, "lduMatrix::smoother." + fieldName_); + autoPtr smootherPtr = lduMatrix::smoother::New ( fieldName_, diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C index 8b9c65856c..9123ddc412 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,6 +23,8 @@ License \*---------------------------------------------------------------------------*/ +#include "Profiling.H" + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -57,6 +59,8 @@ Foam::tmp> Foam::fv::optionList::operator() if (fieldI != -1) { + addProfiling(fvopt, "fvOption()." + source.name()); + source.setApplied(fieldI); if (source.isActive()) @@ -113,6 +117,8 @@ Foam::tmp> Foam::fv::optionList::operator() if (fieldI != -1) { + addProfiling(fvopt, "fvOption()." + source.name()); + source.setApplied(fieldI); if (source.isActive()) @@ -172,6 +178,8 @@ Foam::tmp> Foam::fv::optionList::operator() if (fieldI != -1) { + addProfiling(fvopt, "fvOption()." + source.name()); + source.setApplied(fieldI); if (source.isActive()) @@ -255,6 +263,8 @@ void Foam::fv::optionList::constrain(fvMatrix& eqn) if (fieldI != -1) { + addProfiling(fvopt, "fvOption::constrain." + eqn.psi().name()); + source.setApplied(fieldI); if (source.isActive()) @@ -288,6 +298,8 @@ void Foam::fv::optionList::correct if (fieldI != -1) { + addProfiling(fvopt, "fvOption::correct." + source.name()); + source.setApplied(fieldI); if (source.isActive()) diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index 26dab20b75..4876078b15 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,6 +25,7 @@ License #include "LduMatrix.H" #include "diagTensorField.H" +#include "Profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -58,6 +59,8 @@ Foam::SolverPerformance Foam::fvMatrix::solve const dictionary& solverControls ) { + addProfiling(solve, "fvMatrix::solve." + psi_.name()); + if (debug) { Info.masterStream(this->mesh().comm()) diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index 46fa555289..323babfec4 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,6 +25,7 @@ License #include "fvScalarMatrix.H" #include "extrapolatedCalculatedFvPatchFields.H" +#include "Profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -59,6 +60,8 @@ Foam::fvMatrix::solver const dictionary& solverControls ) { + addProfiling(solve, "fvMatrix::solve." + psi_.name()); + if (debug) { Info.masterStream(this->mesh().comm()) diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C index 2bc88decb5..6ba8c4d407 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "IMULES.H" +#include "Profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -36,6 +37,8 @@ void Foam::MULES::implicitSolve const scalar psiMin ) { + addProfiling(solve, "MULES::implicitSolve"); + implicitSolve ( geometricOneField(), diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C index 4cc8cd128c..f52f9dac79 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,6 +29,7 @@ License #include "fvmDdt.H" #include "fvmSup.H" #include "fvcDiv.H" +#include "Profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,6 +66,8 @@ void Foam::MULES::implicitSolve const scalar psiMin ) { + addProfiling(solve, "MULES::implicitSolve"); + const fvMesh& mesh = psi.mesh(); const dictionary& MULEScontrols = mesh.solverDict(psi.name()); diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C index f9fb29f17e..7e0b2fbb71 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "MULES.H" +#include "Profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -36,6 +37,8 @@ void Foam::MULES::explicitSolve const scalar psiMin ) { + addProfiling(solve, "MULES::explicitSolve"); + explicitSolve ( geometricOneField(), diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index aa72f933dc..9d519e87be 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,6 +33,7 @@ License #include "PatchInteractionModel.H" #include "StochasticCollisionModel.H" #include "SurfaceFilmModel.H" +#include "Profiling.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -90,6 +91,8 @@ template template void Foam::KinematicCloud::solve(TrackData& td) { + addProfiling(prof, "cloud::solve"); + if (solution_.steadyState()) { td.cloud().storeState(); From f3ac9b771e1447d2bb8197d3bc98bc8680d9646e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 9 Jun 2016 10:49:04 +0100 Subject: [PATCH 04/19] STYLE: dead timer pointers left behind in profiling lookup - not de-referenced and no current issues, but cleaner this way --- src/OpenFOAM/global/profiling/Profiling.C | 18 +++++++++++++----- src/OpenFOAM/global/profiling/Profiling.H | 8 +++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/global/profiling/Profiling.C b/src/OpenFOAM/global/profiling/Profiling.C index 0e8ae48dd8..47db7505b1 100644 --- a/src/OpenFOAM/global/profiling/Profiling.C +++ b/src/OpenFOAM/global/profiling/Profiling.C @@ -72,7 +72,6 @@ void Foam::Profiling::initialize ); pool_->push(info, pool_->clockTime_); - info->push(); // mark as on stack } } @@ -107,7 +106,6 @@ Foam::Profiling::Information* Foam::Profiling::New } pool_->push(info, timer); - info->push(); // mark as on stack } return info; @@ -118,8 +116,7 @@ void Foam::Profiling::unstack(const Information *info) { if (pool_ && info) { - Information *top = pool_->stack_.pop(); - top->pop(); // mark as off stack + Information *top = pool_->pop(); if (info->id() != top->id()) { @@ -300,7 +297,18 @@ Foam::Profiling::Information* Foam::Profiling::store(Information *info) void Foam::Profiling::push(Information *info, clockTime& timer) { stack_.push(info); - timers_.insert(info->id(), &timer); + timers_.set(info->id(), &timer); + info->push(); // mark as on stack +} + + +Foam::Profiling::Information* Foam::Profiling::pop() +{ + Information *info = stack_.pop(); + timers_.erase(info->id()); + info->pop(); // mark as off stack + + return info; } diff --git a/src/OpenFOAM/global/profiling/Profiling.H b/src/OpenFOAM/global/profiling/Profiling.H index 01fcaad12f..8e329b7e73 100644 --- a/src/OpenFOAM/global/profiling/Profiling.H +++ b/src/OpenFOAM/global/profiling/Profiling.H @@ -41,6 +41,8 @@ SourceFiles #include "Time.H" #include "clockTime.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + namespace Foam { @@ -130,6 +132,10 @@ protected: //- Add to stack and set timer lookup (based on Id) void push(Information*, clockTime& timer); + //- Remove from stack and remove timer lookup (based on Id). + // Returns pointer to profiling information element + Information* pop(); + // Static control elements @@ -139,7 +145,7 @@ protected: //- Stop profiling, cleanup pool if possible static void stop(const Time&); - //- Existing or new element on pool, add to stack + //- Existing or new element on pool, add to stack. // Returns null if profiling has not been initialized static Information* New(const string& name, clockTime& timer); From e2d01c02e3602c7a16177e9cf040fa5519ee7715 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 15 Jun 2016 11:29:11 +0200 Subject: [PATCH 05/19] GIT: remove stray (unused) memInfoIO.C file --- src/OSspecific/POSIX/memInfo/memInfoIO.C | 70 ------------------------ 1 file changed, 70 deletions(-) delete mode 100644 src/OSspecific/POSIX/memInfo/memInfoIO.C diff --git a/src/OSspecific/POSIX/memInfo/memInfoIO.C b/src/OSspecific/POSIX/memInfo/memInfoIO.C deleted file mode 100644 index 883b216103..0000000000 --- a/src/OSspecific/POSIX/memInfo/memInfoIO.C +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 "memInfo.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::memInfo::memInfo(Istream& is) -: - base1(is), - base2(is), - member1(is), - member2(is) -{ - // Check state of Istream - is.check("Foam::memInfo::memInfo(Foam::Istream&)"); -} - - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Istream& Foam::operator>>(Istream& is, memInfo&) -{ - // Check state of Istream - is.check - ( - "Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::memInfo&)" - ); - - return is; -} - - -Foam::Ostream& Foam::operator<<(Ostream& os, const memInfo&) -{ - // Check state of Ostream - os.check - ( - "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " - "const Foam::memInfo&)" - ); - - return os; -} - - -// ************************************************************************* // From c7b27f5af9446438f99a44008cfce40d88758d5e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 15 Jun 2016 12:38:46 +0200 Subject: [PATCH 06/19] ENH: provide basic cpu-information - can be useful later when trying to interpret run-times etc. Contains only the most basic information. --- applications/test/cpuInfo/Make/files | 3 + applications/test/cpuInfo/Make/options | 0 applications/test/cpuInfo/Test-cpuInfo.C | 47 +++++ src/OSspecific/POSIX/Make/files | 1 + src/OSspecific/POSIX/cpuInfo/cpuInfo.C | 241 +++++++++++++++++++++++ src/OSspecific/POSIX/cpuInfo/cpuInfo.H | 110 +++++++++++ src/OSspecific/POSIX/memInfo/memInfo.C | 42 +++- src/OSspecific/POSIX/memInfo/memInfo.H | 34 ++-- 8 files changed, 457 insertions(+), 21 deletions(-) create mode 100644 applications/test/cpuInfo/Make/files create mode 100644 applications/test/cpuInfo/Make/options create mode 100644 applications/test/cpuInfo/Test-cpuInfo.C create mode 100644 src/OSspecific/POSIX/cpuInfo/cpuInfo.C create mode 100644 src/OSspecific/POSIX/cpuInfo/cpuInfo.H diff --git a/applications/test/cpuInfo/Make/files b/applications/test/cpuInfo/Make/files new file mode 100644 index 0000000000..f9302d8ef2 --- /dev/null +++ b/applications/test/cpuInfo/Make/files @@ -0,0 +1,3 @@ +Test-cpuInfo.C + +EXE = $(FOAM_USER_APPBIN)/Test-cpuInfo diff --git a/applications/test/cpuInfo/Make/options b/applications/test/cpuInfo/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/cpuInfo/Test-cpuInfo.C b/applications/test/cpuInfo/Test-cpuInfo.C new file mode 100644 index 0000000000..785b804678 --- /dev/null +++ b/applications/test/cpuInfo/Test-cpuInfo.C @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +Application + +Description + +\*---------------------------------------------------------------------------*/ + +#include "cpuInfo.H" +#include "IOstreams.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + cpuInfo().write(Info); + Info<< endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/OSspecific/POSIX/Make/files b/src/OSspecific/POSIX/Make/files index 90dc5bc92e..4780174be9 100644 --- a/src/OSspecific/POSIX/Make/files +++ b/src/OSspecific/POSIX/Make/files @@ -10,6 +10,7 @@ fileStat.C POSIX.C cpuTime/cpuTime.C clockTime/clockTime.C +cpuInfo/cpuInfo.C memInfo/memInfo.C /* diff --git a/src/OSspecific/POSIX/cpuInfo/cpuInfo.C b/src/OSspecific/POSIX/cpuInfo/cpuInfo.C new file mode 100644 index 0000000000..ef71120a74 --- /dev/null +++ b/src/OSspecific/POSIX/cpuInfo/cpuInfo.C @@ -0,0 +1,241 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 "cpuInfo.H" +#include "IFstream.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +// file-scope function +template +inline static void writeEntry +( + Foam::Ostream& os, const Foam::word& key, const T& value +) +{ + os.writeKeyword(key) << value << Foam::token::END_STATEMENT << '\n'; +} + + +// file-scope function +static bool split(std::string& line, std::string& key, std::string& val) +{ + std::string::size_type sep = line.find(':'); + + if (sep == std::string::npos) + { + return false; + } + + std::string::size_type endKey = line.find_last_not_of("\t:", sep); + std::string::size_type begVal = line.find_first_not_of(" :", sep); + + if (endKey == std::string::npos || begVal == std::string::npos) + { + return false; + } + ++endKey; + + // replace spaces in key with '_' for ease of use/consistency + for + ( + std::string::iterator iter = line.begin(); + iter != line.end(); + ++iter + ) + { + if (*iter == ' ') + { + *iter = '_'; + } + else if (*iter == ':') + { + break; + } + } + + key = line.substr(0, endKey); + val = line.substr(begVal); + + // std::cerr<<"key=" << key << " val= " << val << '\n'; + + return true; +} + + +// file-scope function - get int +static inline bool getInt(const std::string& str, int& val) +{ + int i; + if (sscanf(str.c_str(), "%d", &i) == 1) + { + val = i; + return true; + } + else + { + return false; + } +} + +// file-scope function - get float +static inline bool getFlt(const std::string& str, float& val) +{ + float f; + if (sscanf(str.c_str(), "%f", &f) == 1) + { + val = f; + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// parse this type of content: +// =========================== +// processor : 0 +// vendor_id : GenuineIntel +// cpu family : 6 +// model : 63 +// model name : Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz +// stepping : 2 +// microcode : 0x35 +// cpu MHz : 1200.000 +// cache size : 15360 KB +// physical id : 0 +// siblings : 12 +// core id : 0 +// cpu cores : 6 +// apicid : 0 +// initial apicid : 0 +// fpu : yes +// fpu_exception : yes +// cpuid level : 15 +// wp : yes +// flags : fpu vme ... +// bugs : +// bogomips : 4789.15 +// clflush size : 64 +// cache_alignment : 64 +// address sizes : 46 bits physical, 48 bits virtual +// power management: + +void Foam::cpuInfo::parse() +{ + int ncpu = 0; + + IFstream is("/proc/cpuinfo"); + while (is.good()) + { + string line, key, value; + is.getLine(line); + + if (!split(line, key, value)) + { + continue; + } + + if (key == "processor") + { + if (ncpu++) + { + break; // stop after the first cpu + } + } + else if (key == "vendor_id") { vendor_id = value; } + else if (key == "model_name") { model_name = value; } + else if (key == "cpu_family") { getInt(value, cpu_family); } + else if (key == "model") { getInt(value, model); } + else if (key == "cpu_MHz") { getFlt(value, cpu_MHz); } + else if (key == "cpu_cores") { getInt(value, cpu_cores); } + else if (key == "siblings") { getInt(value, siblings); } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cpuInfo::cpuInfo() +: + vendor_id(), + model_name(), + cpu_family(-1), + model(-1), + cpu_MHz(0), + siblings(0), + cpu_cores(0) +{ + parse(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cpuInfo::~cpuInfo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::cpuInfo::write(Ostream& os) const +{ + if (!vendor_id.empty()) + { + writeEntry(os, "vendor_id", vendor_id); + } + if (!model_name.empty()) + { + writeEntry(os, "model_name", model_name); + } + if (cpu_family != -1) + { + writeEntry(os, "cpu_family", cpu_family); + } + if (model != -1) + { + writeEntry(os, "model", model); + } + if (cpu_MHz > 0) + { + writeEntry(os, "cpu_MHz", cpu_MHz); + } + if (cpu_cores > 0) + { + writeEntry(os, "cpu_cores", cpu_cores); + } + if (siblings > 0) + { + writeEntry(os, "siblings", siblings); + } +} + + +// ************************************************************************* // diff --git a/src/OSspecific/POSIX/cpuInfo/cpuInfo.H b/src/OSspecific/POSIX/cpuInfo/cpuInfo.H new file mode 100644 index 0000000000..6821684f61 --- /dev/null +++ b/src/OSspecific/POSIX/cpuInfo/cpuInfo.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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::cpuInfo + +Description + General CPU characteristics. + + If the machine has multiple cpus/cores, only the characteristics + of the first core are used. + +Note + Uses the information from /proc/cpuinfo + +SourceFiles + cpuInfo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cpuInfo_H +#define cpuInfo_H + +#include + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +// forward declarations +class Ostream; + +/*---------------------------------------------------------------------------*\ + Class cpuInfo Declaration +\*---------------------------------------------------------------------------*/ + +class cpuInfo +{ + // Private data + + // Various bits from /proc/cpuinfo + + std::string vendor_id; + std::string model_name; + int cpu_family; + int model; + float cpu_MHz; + int siblings; + int cpu_cores; + + // Private Member Functions + + //- Parse /proc/cpuinfo + void parse(); + + //- Disallow default bitwise assignment + void operator=(const cpuInfo&) = delete; + + //- Disallow default copy constructor + cpuInfo(const cpuInfo&) = delete; + +public: + + // Constructors + + //- Construct null + cpuInfo(); + + + //- Destructor + ~cpuInfo(); + + + // Member Functions + + //- Write content as dictionary entries + void write(Ostream&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OSspecific/POSIX/memInfo/memInfo.C b/src/OSspecific/POSIX/memInfo/memInfo.C index 6273fe5aa1..43037b5c79 100644 --- a/src/OSspecific/POSIX/memInfo/memInfo.C +++ b/src/OSspecific/POSIX/memInfo/memInfo.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,14 +24,29 @@ License \*---------------------------------------------------------------------------*/ #include "memInfo.H" +#include "IFstream.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +// file-scope function +template +inline static void writeEntry +( + Foam::Ostream& os, const Foam::word& key, const T& value +) +{ + os.writeKeyword(key) << value << Foam::token::END_STATEMENT << '\n'; +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::memInfo::memInfo() : - peak_(-1), - size_(-1), - rss_(-1) + peak_(0), + size_(0), + rss_(0) { update(); } @@ -48,7 +63,7 @@ Foam::memInfo::~memInfo() const Foam::memInfo& Foam::memInfo::update() { // reset to invalid values first - peak_ = size_ = rss_ = -1; + peak_ = size_ = rss_ = 0; IFstream is("/proc/" + name(pid()) + "/status"); while (is.good()) @@ -81,7 +96,15 @@ const Foam::memInfo& Foam::memInfo::update() bool Foam::memInfo::valid() const { - return peak_ != -1; + return peak_ > 0; +} + + +void Foam::memInfo::write(Ostream& os) const +{ + writeEntry(os, "size", size_); + writeEntry(os, "peak", peak_); + writeEntry(os, "rss", rss_); } @@ -108,14 +131,15 @@ Foam::Istream& Foam::operator>>(Istream& is, memInfo& m) Foam::Ostream& Foam::operator<<(Ostream& os, const memInfo& m) { os << token::BEGIN_LIST - << m.peak_ << token::SPACE << m.size_ << token::SPACE << m.rss_ + << m.peak_ << token::SPACE + << m.size_ << token::SPACE + << m.rss_ << token::END_LIST; // Check state of Ostream os.check ( - "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " - "const Foam::memInfo&)" + "Foam::Ostream& Foam::operator<<(Foam::Ostream&, const Foam::memInfo&)" ); return os; diff --git a/src/OSspecific/POSIX/memInfo/memInfo.H b/src/OSspecific/POSIX/memInfo/memInfo.H index 540ea9b6d1..cc970896fc 100644 --- a/src/OSspecific/POSIX/memInfo/memInfo.H +++ b/src/OSspecific/POSIX/memInfo/memInfo.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,7 +28,7 @@ Description Memory usage information for the process running this object. Note - Uses the information from /proc/\/status + Uses the information from /proc/PID/status SourceFiles memInfo.C @@ -47,6 +47,10 @@ SourceFiles namespace Foam { +// forward declarations +class Istream; +class Ostream; + /*---------------------------------------------------------------------------*\ Class memInfo Declaration \*---------------------------------------------------------------------------*/ @@ -55,15 +59,20 @@ class memInfo { // Private data - //- Peak memory used by the process (VmPeak in /proc/\/status) + //- Peak memory used by the process (VmPeak in /proc/PID/status) int peak_; - //- Memory used by the process (VmSize in /proc/\/status) + //- Memory used by the process (VmSize in /proc/PID/status) int size_; - //- Resident set size of the process (VmRSS in /proc/\/status) + //- Resident set size of the process (VmRSS in /proc/PID/status) int rss_; + //- Disallow default bitwise assignment + void operator=(const memInfo&) = delete; + + //- Disallow default copy constructor + memInfo(const memInfo&) = delete; public: @@ -79,27 +88,24 @@ public: // Member Functions - //- Parse /proc/\/status + //- Parse /proc/PID/status and update accordingly const memInfo& update(); // Access - //- Access the stored peak memory (VmPeak in /proc/\/status) - // The value is stored from the previous update() + //- Peak memory (VmPeak in /proc/PID/status) at last update() int peak() const { return peak_; } - //- Access the stored memory size (VmSize in /proc/\/status) - // The value is stored from the previous update() + //- Memory size (VmSize in /proc/PID/status) at last update() int size() const { return size_; } - //- Access the stored rss value (VmRSS in /proc/\/status) - // The value is stored from the previous update() + //- Resident set size (VmRSS in /proc/PID/status) at last update() int rss() const { return rss_; @@ -109,6 +115,10 @@ public: bool valid() const; + //- Write content as dictionary entries + void write(Ostream&) const; + + // IOstream Operators //- Read peak/size/rss from stream From 2dc31390dfb98eb98050da3f87dff61bcb42eac3 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 15 Jun 2016 20:17:44 +0200 Subject: [PATCH 07/19] ENH: add some system information when outputting profiling - basic cpuInfo (model identification, MHz, etc) - process memInfo - profiling is activated via the case system/controlDict by adding a "profiling" sub-dictionary. Simply add the following (everything enabled): profiling {} Which corresponds to the longer form: profiling { active true; // default: true cpuInfo true; // default: true memInfo true; // default: true sysInfo true; // default: true } This can be used to selectively disable any extra information (eg, you don't want anyone else to know what hardware was used). --- applications/test/sysInfo/Make/files | 3 + applications/test/sysInfo/Make/options | 0 applications/test/sysInfo/Test-sysInfo.C | 46 ++++++ src/OpenFOAM/Make/files | 1 + src/OpenFOAM/db/Time/Time.C | 9 +- src/OpenFOAM/global/profiling/Profiling.C | 136 ++++++++++++++++-- src/OpenFOAM/global/profiling/Profiling.H | 55 +++++-- .../global/profiling/ProfilingSysInfo.C | 94 ++++++++++++ .../global/profiling/ProfilingSysInfo.H | 115 +++++++++++++++ 9 files changed, 434 insertions(+), 25 deletions(-) create mode 100644 applications/test/sysInfo/Make/files create mode 100644 applications/test/sysInfo/Make/options create mode 100644 applications/test/sysInfo/Test-sysInfo.C create mode 100644 src/OpenFOAM/global/profiling/ProfilingSysInfo.C create mode 100644 src/OpenFOAM/global/profiling/ProfilingSysInfo.H diff --git a/applications/test/sysInfo/Make/files b/applications/test/sysInfo/Make/files new file mode 100644 index 0000000000..7406672887 --- /dev/null +++ b/applications/test/sysInfo/Make/files @@ -0,0 +1,3 @@ +Test-sysInfo.C + +EXE = $(FOAM_USER_APPBIN)/Test-sysInfo diff --git a/applications/test/sysInfo/Make/options b/applications/test/sysInfo/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/sysInfo/Test-sysInfo.C b/applications/test/sysInfo/Test-sysInfo.C new file mode 100644 index 0000000000..3c04ce0187 --- /dev/null +++ b/applications/test/sysInfo/Test-sysInfo.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +Application + +Description + +\*---------------------------------------------------------------------------*/ + +#include "ProfilingSysInfo.H" +#include "IOstreams.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + Profiling::sysInfo().write(Info); + + return 0; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index bc9265235f..ff6fade3be 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -4,6 +4,7 @@ global/global.Cver global/argList/argList.C global/clock/clock.C global/profiling/Profiling.C +global/profiling/ProfilingSysInfo.C bools = primitives/bools $(bools)/bool/bool.C diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 732dbceb60..6ec558b5ad 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -337,10 +337,17 @@ void Foam::Time::setControls() void Foam::Time::setMonitoring() { // initialize profiling on request - if (controlDict_.lookupOrDefault("profiling", false)) + // skip if 'active' keyword is explicitly set to false + const dictionary* profilingDict = controlDict_.subDictPtr("profiling"); + if + ( + profilingDict + && profilingDict->lookupOrDefault("active", true) + ) { Profiling::initialize ( + *profilingDict, IOobject ( "profiling", diff --git a/src/OpenFOAM/global/profiling/Profiling.C b/src/OpenFOAM/global/profiling/Profiling.C index 47db7505b1..79ffa68aef 100644 --- a/src/OpenFOAM/global/profiling/Profiling.C +++ b/src/OpenFOAM/global/profiling/Profiling.C @@ -24,8 +24,13 @@ License \*---------------------------------------------------------------------------*/ #include "Profiling.H" +#include "ProfilingSysInfo.H" +#include "cpuInfo.H" +#include "memInfo.H" +#include "OSspecific.H" +#include "IOstreams.H" #include "dictionary.H" - +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -36,6 +41,17 @@ Foam::label Foam::Profiling::Information::nextId_(0); // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // +// file-scope function +template +inline static void writeEntry +( + Foam::Ostream& os, const Foam::word& key, const T& value +) +{ + os.writeKeyword(key) << value << Foam::token::END_STATEMENT << '\n'; +} + + Foam::label Foam::Profiling::Information::getNextId() { return nextId_++; @@ -72,6 +88,34 @@ void Foam::Profiling::initialize ); pool_->push(info, pool_->clockTime_); + Info<< "Profiling initialized" << nl; + } +} + + +void Foam::Profiling::initialize +( + const dictionary& dict, + const IOobject& ioObj, + const Time& owner +) +{ + if (pool_) + { + WarningInFunction + << "Already initialized" << endl; + } + else + { + pool_ = new Profiling(dict, ioObj, owner); + + Information *info = pool_->store + ( + new Information() + ); + + pool_->push(info, pool_->clockTime_); + Info<< "Profiling initialized" << nl; } } @@ -146,7 +190,41 @@ Foam::Profiling::Profiling clockTime_(), hash_(), stack_(), - timers_() + timers_(), + sysInfo_(new sysInfo()), + cpuInfo_(new cpuInfo()), + memInfo_(new memInfo()) +{} + + +Foam::Profiling::Profiling +( + const dictionary& dict, + const IOobject& io, + const Time& owner +) +: + regIOobject(io), + owner_(owner), + clockTime_(), + hash_(), + stack_(), + timers_(), + sysInfo_ + ( + dict.lookupOrDefault("sysInfo", true) + ? new sysInfo() : 0 + ), + cpuInfo_ + ( + dict.lookupOrDefault("cpuInfo", true) + ? new cpuInfo() : 0 + ), + memInfo_ + ( + dict.lookupOrDefault("memInfo", true) + ? new memInfo() : 0 + ) {} @@ -196,6 +274,10 @@ Foam::Profiling::Trigger::Trigger(const string& name) Foam::Profiling::~Profiling() { + deleteDemandDrivenData(sysInfo_); + deleteDemandDrivenData(cpuInfo_); + deleteDemandDrivenData(memInfo_); + if (pool_ == this) { pool_ = 0; @@ -281,6 +363,34 @@ bool Foam::Profiling::writeData(Ostream& os) const os << decrIndent << indent << token::END_LIST << token::END_STATEMENT << nl; + + if (sysInfo_) + { + os << nl; + os.beginBlock("sysInfo") << nl; // FUTURE: without nl + sysInfo_->write(os); + os.endBlock() << nl; // FUTURE: without nl + } + + if (cpuInfo_) + { + os << nl; + os.beginBlock("cpuInfo") << nl; // FUTURE: without nl + cpuInfo_->write(os); + os.endBlock() << nl; // FUTURE: without nl + } + + if (memInfo_) + { + memInfo_->update(); + + os << nl; + os.beginBlock("memInfo") << nl; // FUTURE: without nl + memInfo_->write(os); + writeEntry(os, "units", "kB"); + os.endBlock() << nl; // FUTURE: without nl + } + return os; } @@ -312,6 +422,12 @@ Foam::Profiling::Information* Foam::Profiling::pop() } +bool Foam::Profiling::Trigger::running() const +{ + return ptr_; +} + + void Foam::Profiling::Trigger::stop() { if (ptr_) @@ -324,14 +440,15 @@ void Foam::Profiling::Trigger::stop() } -// file-scope function -template -inline static void writeEntry -( - Foam::Ostream& os, const Foam::word& key, const T& value -) +void Foam::Profiling::Information::push() const { - os.writeKeyword(key) << value << Foam::token::END_STATEMENT << '\n'; + onStack_ = true; +} + + +void Foam::Profiling::Information::pop() const +{ + onStack_ = false; } @@ -366,6 +483,7 @@ Foam::Ostream& Foam::Profiling::Information::write return os; } + // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< diff --git a/src/OpenFOAM/global/profiling/Profiling.H b/src/OpenFOAM/global/profiling/Profiling.H index 8e329b7e73..7821dfede5 100644 --- a/src/OpenFOAM/global/profiling/Profiling.H +++ b/src/OpenFOAM/global/profiling/Profiling.H @@ -27,6 +27,22 @@ Class Description Code profiling. + This is typically activated from within the system/controlDict as follows: + \code + profiling + { + active true; // default: true + cpuInfo true; // default: true + memInfo true; // default: true + sysInfo true; // default: true + } + \endcode + or simply using all defaults: + \code + profiling + {} + \endcode + SourceFiles Profiling.C @@ -48,6 +64,9 @@ namespace Foam // Forward declaration of classes class Ostream; +class dictionary; +class cpuInfo; +class memInfo; /*---------------------------------------------------------------------------*\ Class Profiling Declaration @@ -63,6 +82,7 @@ public: class Information; class Trigger; + class sysInfo; private: @@ -93,6 +113,15 @@ private: //- Note the timers (by Id) for the correct stack-output Map timers_; + //- General system information (optional) + sysInfo* sysInfo_; + + //- CPU-Information (optional) + cpuInfo* cpuInfo_; + + //- MEM-Information (optional) + memInfo* memInfo_; + // Private Member Functions @@ -112,9 +141,12 @@ protected: // Constructors - //- Construct IO object + //- Construct IO object, everything enabled Profiling(const IOobject&, const Time&); + //- Construct IO object with finer control over behaviour + Profiling(const dictionary&, const IOobject&, const Time&); + //- Destructor ~Profiling(); @@ -139,9 +171,12 @@ protected: // Static control elements - //- Singleton to initialize profiling pool + //- Singleton to initialize profiling pool, everything enabled static void initialize(const IOobject&, const Time&); + //- Singleton to initialize profiling pool with finer control + static void initialize(const dictionary&, const IOobject&, const Time&); + //- Stop profiling, cleanup pool if possible static void stop(const Time&); @@ -243,17 +278,10 @@ protected: // Member Functions //- Mark as being on the stack - void push() const - { - onStack_ = true; - } - + void push() const; //- Mark as being off the stack - void pop() const - { - onStack_ = false; - } + void pop() const; //- Write the profiling times, optionally with additional values @@ -382,10 +410,7 @@ public: // Access //- True if the triggered profiling is active - inline bool running() const - { - return ptr_; - } + bool running() const; // Edit diff --git a/src/OpenFOAM/global/profiling/ProfilingSysInfo.C b/src/OpenFOAM/global/profiling/ProfilingSysInfo.C new file mode 100644 index 0000000000..153fb3c11e --- /dev/null +++ b/src/OpenFOAM/global/profiling/ProfilingSysInfo.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 "ProfilingSysInfo.H" +#include "demandDrivenData.H" +#include "foamVersion.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +// file-scope function +template +inline static void writeEntry +( + Foam::Ostream& os, const Foam::word& key, const T& value +) +{ + os.writeKeyword(key) << value << Foam::token::END_STATEMENT << '\n'; +} + + +// file-scope function +inline static void printEnv +( + Foam::Ostream& os, const Foam::word& key, const Foam::word& envName +) +{ + const std::string value = getEnv(envName); + if (!value.empty()) + { + writeEntry(os, key, value); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Profiling::sysInfo::sysInfo() +{} + + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Profiling::sysInfo::~sysInfo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::Ostream& Foam::Profiling::sysInfo::write +( + Ostream& os +) const +{ + writeEntry(os, "host", hostName(false)); // short name + writeEntry(os, "date", clock::dateTime()); + + // compile-time information + writeEntry(os, "version", std::string(FOAMversion)); + writeEntry(os, "build", std::string(FOAMbuild)); + + printEnv(os, "arch", "WM_ARCH"); + printEnv(os, "compilerType", "WM_COMPILER_TYPE"); + printEnv(os, "compiler", "WM_COMPILER"); + printEnv(os, "mplib", "WM_MPLIB"); + printEnv(os, "options", "WM_OPTIONS"); + + return os; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/profiling/ProfilingSysInfo.H b/src/OpenFOAM/global/profiling/ProfilingSysInfo.H new file mode 100644 index 0000000000..1174082b33 --- /dev/null +++ b/src/OpenFOAM/global/profiling/ProfilingSysInfo.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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::Profiling::SysInfo + +Description + General system information + +SourceFiles + ProfilingSysInfo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ProfilingSysInfo_H +#define ProfilingSysInfo_H + +#include "Profiling.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Ostream; + +/*---------------------------------------------------------------------------*\ + Class Profiling::sysInfo Declaration +\*---------------------------------------------------------------------------*/ + +class Profiling::sysInfo +{ + // Private Static Data Members + + + // Private Data Members + + + // Private Member Functions + + //- Disallow default bitwise copy construct + sysInfo(const sysInfo&) = delete; + + //- Disallow default bitwise assignment + void operator=(const sysInfo&) = delete; + + +protected: + + // Friendship + + friend class Profiling; + + + // Member Functions + +public: + + + // Constructors + + //- Construct from components + sysInfo(); + + + //- Destructor + ~sysInfo(); + + + // Member Functions + + // Access + + + // Edit + + //- Update it with a new timing information + void update(); + + //- Write the profiling times, optionally with additional values + // Use dictionary format. + Ostream& write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From e57a0e68a21be9d828bd3f81717b39564e3ac70a Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 17 Jun 2016 17:41:04 +0100 Subject: [PATCH 08/19] ENH: (further) Doxygen documentation updates for module support --- doc/Doxygen/Doxyfile | 2 +- src/OpenFOAM/global/foamDoc.H | 16 +++++- .../matrices/lduMatrix/doc/lduMatrix.dox | 36 ++++++++++++ .../matrices/lduMatrix/doc/lduMatrixDoc.H | 56 +++++++++++++++++++ .../DICPreconditioner/DICPreconditioner.H | 3 + .../DILUPreconditioner/DILUPreconditioner.H | 3 + .../FDICPreconditioner/FDICPreconditioner.H | 3 + .../GAMGPreconditioner/GAMGPreconditioner.H | 3 + .../diagonalPreconditioner.H | 3 + .../noPreconditioner/noPreconditioner.H | 3 + .../lduMatrix/smoothers/DIC/DICSmoother.H | 3 + .../DICGaussSeidel/DICGaussSeidelSmoother.H | 3 + .../lduMatrix/smoothers/DILU/DILUSmoother.H | 3 + .../GaussSeidel/GaussSeidelSmoother.H | 3 + .../nonBlockingGaussSeidelSmoother.H | 3 + .../symGaussSeidel/symGaussSeidelSmoother.H | 3 + .../matrices/lduMatrix/solvers/BICCG/BICCG.H | 7 ++- .../lduMatrix/solvers/GAMG/GAMGSolver.H | 7 ++- .../matrices/lduMatrix/solvers/ICCG/ICCG.H | 5 +- .../matrices/lduMatrix/solvers/PCG/PCG.H | 5 +- .../solvers/diagonalSolver/diagonalSolver.H | 5 +- .../solvers/smoothSolver/smoothSolver.H | 4 ++ .../turbulenceModels/doc/turbulenceModel.dox | 36 ++++++++++++ .../finiteVolume/doc/finiteVolumeSchemes.dox | 40 +++++++++++++ .../finiteVolume/doc/finiteVolumeSchemesDoc.H | 1 + .../fixedTemperatureConstraint.H | 3 + .../velocityDampingConstraint.H | 3 + .../explicitSetValue/ExplicitSetValue.H | 3 + .../limitTemperature/limitTemperature.H | 3 + src/fvOptions/doc/fvOptionsDoc.H | 51 +++++++++++++++++ .../actuationDiskSource/actuationDiskSource.H | 3 + .../derived/buoyancyEnergy/buoyancyEnergy.H | 3 + .../derived/buoyancyForce/buoyancyForce.H | 3 + ...irectionalPressureGradientExplicitSource.H | 3 + .../effectivenessHeatExchangerSource.H | 3 + .../explicitPorositySource.H | 3 + .../meanVelocityForce/meanVelocityForce.H | 3 + .../radialActuationDiskSource.H | 3 + .../derived/rotorDiskSource/rotorDiskSource.H | 3 + .../solidificationMeltingSource.H | 3 + .../tabulatedAccelerationSource.H | 6 +- .../sources/general/codedSource/CodedSource.H | 3 + .../semiImplicitSource/SemiImplicitSource.H | 3 + .../interRegionExplicitPorositySource.H | 3 + .../constantHeatTransfer.H | 3 + .../interRegionHeatTransferModel.H | 3 + .../tabulatedHeatTransfer.H | 3 + .../tabulatedNTUHeatTransfer.H | 3 + .../variableHeatTransfer.H | 3 + .../doc/lagrangianIntermediate.dox | 41 ++++++++++++++ ...hemesDoc.H => lagrangianIntermediateDoc.H} | 0 .../functionObjects/doc/functionObjects.dox | 3 +- .../reactionsSensitivityAnalysis.H | 2 +- .../doc/thermophysicalModels.dox | 33 +++++++++++ .../doc/thermophysicalModelsDoc.H | 6 ++ .../chemistryReader/chemistryReader.H | 3 + .../chemkinReader/chemkinReader.H | 3 + .../foamChemistryReader/foamChemistryReader.H | 3 + .../fixedUnburntEnthalpyFvPatchScalarField.H | 5 +- ...radientUnburntEnthalpyFvPatchScalarField.H | 3 + .../mixedUnburntEnthalpyFvPatchScalarField.H | 3 + .../reactionThermo/doc/reactionThermoDoc.H | 43 ++++++++++++++ .../moleFractions/moleFractions.H | 3 + .../mixtures/SpecieMixture/SpecieMixture.H | 3 + .../basicCombustionMixture.H | 3 + .../basicMultiComponentMixture.H | 3 + .../basicSpecieMixture/basicSpecieMixture.H | 3 + .../mixtures/egrMixture/egrMixture.H | 3 + .../homogeneousMixture/homogeneousMixture.H | 3 + .../inhomogeneousMixture.H | 3 + .../multiComponentMixture.H | 3 + .../reactingMixture/reactingMixture.H | 3 + .../singleStepReactingMixture.H | 3 + .../veryInhomogeneousMixture.H | 3 + 74 files changed, 550 insertions(+), 13 deletions(-) create mode 100644 src/OpenFOAM/matrices/lduMatrix/doc/lduMatrix.dox create mode 100644 src/OpenFOAM/matrices/lduMatrix/doc/lduMatrixDoc.H create mode 100644 src/TurbulenceModels/turbulenceModels/doc/turbulenceModel.dox create mode 100644 src/finiteVolume/finiteVolume/doc/finiteVolumeSchemes.dox create mode 100644 src/fvOptions/doc/fvOptionsDoc.H create mode 100644 src/lagrangian/intermediate/doc/lagrangianIntermediate.dox rename src/lagrangian/intermediate/doc/{finiteVolumeSchemesDoc.H => lagrangianIntermediateDoc.H} (100%) create mode 100644 src/thermophysicalModels/doc/thermophysicalModels.dox create mode 100644 src/thermophysicalModels/reactionThermo/doc/reactionThermoDoc.H diff --git a/doc/Doxygen/Doxyfile b/doc/Doxygen/Doxyfile index 4e86e5338d..694463d072 100644 --- a/doc/Doxygen/Doxyfile +++ b/doc/Doxygen/Doxyfile @@ -578,7 +578,7 @@ SORT_MEMBERS_CTORS_1ST = NO # appear in their defined order. # The default value is: NO. -SORT_GROUP_NAMES = NO +SORT_GROUP_NAMES = YES # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will diff --git a/src/OpenFOAM/global/foamDoc.H b/src/OpenFOAM/global/foamDoc.H index 73210859be..1d251618f5 100644 --- a/src/OpenFOAM/global/foamDoc.H +++ b/src/OpenFOAM/global/foamDoc.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,8 +56,22 @@ License \section usingTheCode Using the code + Solvers - \subpage pageSolvers + + Modelling + - \subpage pageThermophsyicalModels + - \subpage pageTurbulenceModelling + - \subpage pageLagrangianIntermediate + + Boundary conditions - \subpage pageBoundaryConditions + + Numerics + - \subpage pageFiniteVolumeSchemes + - \subpage pageMatrixSolvers + + Post-processing - \subpage pagePostProcessing diff --git a/src/OpenFOAM/matrices/lduMatrix/doc/lduMatrix.dox b/src/OpenFOAM/matrices/lduMatrix/doc/lduMatrix.dox new file mode 100644 index 0000000000..12e9bd033a --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/doc/lduMatrix.dox @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\page pageMatrixSolvers Matrix solvers + +\section secSchemes Overview +The available matrix solvers are grouped into the following categories: + - \ref grpLduMatrix + - \ref grpLduMatrixPreconditioners + - \ref grpLduMatrixSmoothers + - \ref grpLduMatrixSolvers + + +\*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/matrices/lduMatrix/doc/lduMatrixDoc.H b/src/OpenFOAM/matrices/lduMatrix/doc/lduMatrixDoc.H new file mode 100644 index 0000000000..c9da613b45 --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/doc/lduMatrixDoc.H @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\defgroup grpNumerics Numerics +@{ + This group contains numerics +@} + +\defgroup grpLduMatrix Matrix manipulation and solvers +@{ + \ingroup grpNumerics + This group contains matrices +@} + +\defgroup grpLduMatrixPreconditioners Preconditioners +@{ + \ingroup grpLduMatrix + This group contains matrix preconditioners +@} + +\defgroup grpLduMatrixSmoothers Smoothers +@{ + \ingroup grpLduMatrix + This group contains matrix smoothers +@} + +\defgroup grpLduMatrixSolvers Solvers +@{ + \ingroup grpLduMatrix + This group contains matrix solvers +@} + + +\*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/matrices/lduMatrix/preconditioners/DICPreconditioner/DICPreconditioner.H b/src/OpenFOAM/matrices/lduMatrix/preconditioners/DICPreconditioner/DICPreconditioner.H index 24c7432ebe..31a29b5b5c 100644 --- a/src/OpenFOAM/matrices/lduMatrix/preconditioners/DICPreconditioner/DICPreconditioner.H +++ b/src/OpenFOAM/matrices/lduMatrix/preconditioners/DICPreconditioner/DICPreconditioner.H @@ -24,6 +24,9 @@ License Class Foam::DICPreconditioner +Group + grpLduMatrixPreconditioners + Description Simplified diagonal-based incomplete Cholesky preconditioner for symmetric matrices (symmetric equivalent of DILU). The reciprocal of the diff --git a/src/OpenFOAM/matrices/lduMatrix/preconditioners/DILUPreconditioner/DILUPreconditioner.H b/src/OpenFOAM/matrices/lduMatrix/preconditioners/DILUPreconditioner/DILUPreconditioner.H index 90a9e8d694..5a9c5fda5c 100644 --- a/src/OpenFOAM/matrices/lduMatrix/preconditioners/DILUPreconditioner/DILUPreconditioner.H +++ b/src/OpenFOAM/matrices/lduMatrix/preconditioners/DILUPreconditioner/DILUPreconditioner.H @@ -24,6 +24,9 @@ License Class Foam::DILUPreconditioner +Group + grpLduMatrixPreconditioners + Description Simplified diagonal-based incomplete LU preconditioner for asymmetric matrices. The reciprocal of the preconditioned diagonal is calculated diff --git a/src/OpenFOAM/matrices/lduMatrix/preconditioners/FDICPreconditioner/FDICPreconditioner.H b/src/OpenFOAM/matrices/lduMatrix/preconditioners/FDICPreconditioner/FDICPreconditioner.H index 7f75f6ec64..044f44c253 100644 --- a/src/OpenFOAM/matrices/lduMatrix/preconditioners/FDICPreconditioner/FDICPreconditioner.H +++ b/src/OpenFOAM/matrices/lduMatrix/preconditioners/FDICPreconditioner/FDICPreconditioner.H @@ -24,6 +24,9 @@ License Class Foam::FDICPreconditioner +Group + grpLduMatrixPreconditioners + Description Faster version of the DICPreconditioner diagonal-based incomplete Cholesky preconditioner for symmetric matrices diff --git a/src/OpenFOAM/matrices/lduMatrix/preconditioners/GAMGPreconditioner/GAMGPreconditioner.H b/src/OpenFOAM/matrices/lduMatrix/preconditioners/GAMGPreconditioner/GAMGPreconditioner.H index f79f7f1f1f..adf0c63e70 100644 --- a/src/OpenFOAM/matrices/lduMatrix/preconditioners/GAMGPreconditioner/GAMGPreconditioner.H +++ b/src/OpenFOAM/matrices/lduMatrix/preconditioners/GAMGPreconditioner/GAMGPreconditioner.H @@ -24,6 +24,9 @@ License Class Foam::GAMGPreconditioner +Group + grpLduMatrixPreconditioners + Description Geometric agglomerated algebraic multigrid preconditioner. diff --git a/src/OpenFOAM/matrices/lduMatrix/preconditioners/diagonalPreconditioner/diagonalPreconditioner.H b/src/OpenFOAM/matrices/lduMatrix/preconditioners/diagonalPreconditioner/diagonalPreconditioner.H index 8348453544..20552e66fd 100644 --- a/src/OpenFOAM/matrices/lduMatrix/preconditioners/diagonalPreconditioner/diagonalPreconditioner.H +++ b/src/OpenFOAM/matrices/lduMatrix/preconditioners/diagonalPreconditioner/diagonalPreconditioner.H @@ -24,6 +24,9 @@ License Class Foam::diagonalPreconditioner +Group + grpLduMatrixPreconditioners + Description Diagonal preconditioner for both symmetric and asymmetric matrices. diff --git a/src/OpenFOAM/matrices/lduMatrix/preconditioners/noPreconditioner/noPreconditioner.H b/src/OpenFOAM/matrices/lduMatrix/preconditioners/noPreconditioner/noPreconditioner.H index 56fa455811..549f873a96 100644 --- a/src/OpenFOAM/matrices/lduMatrix/preconditioners/noPreconditioner/noPreconditioner.H +++ b/src/OpenFOAM/matrices/lduMatrix/preconditioners/noPreconditioner/noPreconditioner.H @@ -24,6 +24,9 @@ License Class Foam::noPreconditioner +Group + grpLduMatrixPreconditioners + Description Null preconditioner for both symmetric and asymmetric matrices. diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.H index d4c610f043..95a98fc94f 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.H +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.H @@ -24,6 +24,9 @@ License Class Foam::DICSmoother +Group + grpLduMatrixSmoothers + Description Simplified diagonal-based incomplete Cholesky smoother for symmetric matrices. diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/DICGaussSeidel/DICGaussSeidelSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/DICGaussSeidel/DICGaussSeidelSmoother.H index b95a020939..84407dcdeb 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/DICGaussSeidel/DICGaussSeidelSmoother.H +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/DICGaussSeidel/DICGaussSeidelSmoother.H @@ -24,6 +24,9 @@ License Class Foam::DICGaussSeidelSmoother +Group + grpLduMatrixSmoothers + Description Combined DIC/GaussSeidel smoother for symmetric matrices in which DIC smoothing is followed by GaussSeidel to ensure that any "spikes" created diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H index 843b386e77..e9eb245b0b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H @@ -24,6 +24,9 @@ License Class Foam::DILUSmoother +Group + grpLduMatrixSmoothers + Description Simplified diagonal-based incomplete LU smoother for asymmetric matrices. diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.H index 9a1ad0480c..d0720d5c1b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.H +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.H @@ -24,6 +24,9 @@ License Class Foam::GaussSeidelSmoother +Group + grpLduMatrixSmoothers + Description A lduMatrix::smoother for Gauss-Seidel diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.H index 0562d875cf..13aeb85186 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.H +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.H @@ -24,6 +24,9 @@ License Class Foam::nonBlockingGaussSeidelSmoother +Group + grpLduMatrixSmoothers + Description Variant of gaussSeidelSmoother that expects processor boundary cells to be sorted last and so can block later. Only when the diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.H index a9a25e651f..2a920a7cae 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.H +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.H @@ -24,6 +24,9 @@ License Class Foam::symGaussSeidelSmoother +Group + grpLduMatrixSmoothers + Description A lduMatrix::smoother for symmetric Gauss-Seidel diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H b/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H index 68a792c379..9990e8b23b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/BICCG/BICCG.H @@ -24,6 +24,9 @@ License Class Foam::BICCG +Group + grpLduMatrixSolvers + Description Diagonal incomplete LU preconditioned BiCG solver derived from the general preconditioned BiCG solver PBiCG but with the choice of preconditioner @@ -49,7 +52,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class BICCG Declaration + Class BICCG Declaration \*---------------------------------------------------------------------------*/ class BICCG @@ -64,6 +67,7 @@ class BICCG //- Disallow default bitwise assignment void operator=(const BICCG&); + public: //- Return the dictionary constructed from the components. @@ -112,7 +116,6 @@ public: //- Destructor virtual ~BICCG() {} - }; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H index 9e220067d1..c7cbd2c02b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H @@ -24,10 +24,13 @@ License Class Foam::GAMGSolver +Group + grpLduMatrixSolvers + Description Geometric agglomerated algebraic multigrid solver. - Characteristics: + Characteristics: - Requires positive definite, diagonally dominant matrix. - Agglomeration algorithm: selectable and optionally cached. - Restriction operator: summation. @@ -65,7 +68,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class GAMGSolver Declaration + Class GAMGSolver Declaration \*---------------------------------------------------------------------------*/ class GAMGSolver diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H b/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H index f3cf016461..494cff4558 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/ICCG/ICCG.H @@ -24,6 +24,9 @@ License Class Foam::ICCG +Group + grpLduMatrixSolvers + Description Incomplete Cholesky preconditioned CG solver derived from the general preconditioned CG solver PCG but with the choice of preconditioner @@ -64,6 +67,7 @@ class ICCG //- Disallow default bitwise assignment void operator=(const ICCG&); + public: //- Return the dictionary constructed from the components. @@ -111,7 +115,6 @@ public: //- Destructor virtual ~ICCG() {} - }; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.H b/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.H index 74b3abd17c..92b1b02d60 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.H @@ -24,6 +24,9 @@ License Class Foam::PCG +Group + grpLduMatrixSolvers + Description Preconditioned conjugate gradient solver for symmetric lduMatrices using a run-time selectable preconditioner. @@ -44,7 +47,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class PCG Declaration + Class PCG Declaration \*---------------------------------------------------------------------------*/ class PCG diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.H b/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.H index 85908b3349..ea0a754bb1 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.H @@ -24,6 +24,9 @@ License Class Foam::diagonalSolver +Group + grpLduMatrixSolvers + Description Foam::diagonalSolver @@ -43,7 +46,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class diagonalSolver Declaration + Class diagonalSolver Declaration \*---------------------------------------------------------------------------*/ class diagonalSolver diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.H b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.H index 3561969e0f..e795d19ff7 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.H @@ -24,6 +24,9 @@ License Class Foam::smoothSolver +Group + grpLduMatrixSolvers + Description Iterative solver for symmetric and asymetric matrices which uses a run-time selected smoother e.g. GaussSeidel to converge the solution to @@ -65,6 +68,7 @@ protected: //- Read the control parameters from the controlDict_ virtual void readControls(); + public: //- Runtime type information diff --git a/src/TurbulenceModels/turbulenceModels/doc/turbulenceModel.dox b/src/TurbulenceModels/turbulenceModels/doc/turbulenceModel.dox new file mode 100644 index 0000000000..4aa49fd43a --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/doc/turbulenceModel.dox @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\page pageTurbulenceModelling Turbulence modelling + +\section secSchemes Overview +The available turbulence models are grouped into the following categories: + - \ref grpTurbulence + - \ref grpRASTurbulence + - \ref grpDESTurbulence + - \ref grpLESTurbulence + + +\*---------------------------------------------------------------------------*/ diff --git a/src/finiteVolume/finiteVolume/doc/finiteVolumeSchemes.dox b/src/finiteVolume/finiteVolume/doc/finiteVolumeSchemes.dox new file mode 100644 index 0000000000..fe019b8850 --- /dev/null +++ b/src/finiteVolume/finiteVolume/doc/finiteVolumeSchemes.dox @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\page pageFiniteVolumeSchemes Numerical schemes + +\section secSchemes Overview +The available numerical schemes are grouped into the following categories: + - \ref grpFvGradSchemes + - \ref grpFvSnGradSchemes + - \ref grpFvDivSchemes + - \ref grpFvLaplacianSchemes + - \ref grpFvDdtSchemes + - \ref grpFvConvectionSchemes + - \ref grpFvSurfaceInterpolationSchemes + - \ref grpFvLimitedSurfaceInterpolationSchemes + + +\*---------------------------------------------------------------------------*/ diff --git a/src/finiteVolume/finiteVolume/doc/finiteVolumeSchemesDoc.H b/src/finiteVolume/finiteVolume/doc/finiteVolumeSchemesDoc.H index 6a82c72d9c..a8886e33d7 100644 --- a/src/finiteVolume/finiteVolume/doc/finiteVolumeSchemesDoc.H +++ b/src/finiteVolume/finiteVolume/doc/finiteVolumeSchemesDoc.H @@ -25,6 +25,7 @@ License \defgroup grpFvSchemes Finite volume numerical schemes @{ + \ingroup grpNumerics This group contains finite volume numerical schemes @} diff --git a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H index f2b7029425..5d9f9148d4 100644 --- a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H +++ b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H @@ -24,6 +24,9 @@ License Class Foam::fv::fixedTemperatureConstraint +Group + grpFvOptionsConstraints + Description Fixed temperature equation constraint diff --git a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H index 1b78c29330..cfc69515f8 100644 --- a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H +++ b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H @@ -24,6 +24,9 @@ License Class Foam::fv::velocityDampingConstraint +Group + grpFvOptionsConstraints + Description Constraint for velocity to dampen velocity fluctuations in steady simulations diff --git a/src/fvOptions/constraints/general/explicitSetValue/ExplicitSetValue.H b/src/fvOptions/constraints/general/explicitSetValue/ExplicitSetValue.H index 780ff55787..eaa4beab47 100644 --- a/src/fvOptions/constraints/general/explicitSetValue/ExplicitSetValue.H +++ b/src/fvOptions/constraints/general/explicitSetValue/ExplicitSetValue.H @@ -24,6 +24,9 @@ License Class Foam::fv::explicitSetValue +Group + grpFvOptionsConstraints + Description Set values field values explicity. diff --git a/src/fvOptions/corrections/limitTemperature/limitTemperature.H b/src/fvOptions/corrections/limitTemperature/limitTemperature.H index 03d6557045..a3eb829ed6 100644 --- a/src/fvOptions/corrections/limitTemperature/limitTemperature.H +++ b/src/fvOptions/corrections/limitTemperature/limitTemperature.H @@ -24,6 +24,9 @@ License Class Foam::fv::limitTemperature +Group + grpFvOptionsCorrections + Description Correction for temperature to apply limits between minimum and maximum values diff --git a/src/fvOptions/doc/fvOptionsDoc.H b/src/fvOptions/doc/fvOptionsDoc.H new file mode 100644 index 0000000000..574618b612 --- /dev/null +++ b/src/fvOptions/doc/fvOptionsDoc.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\defgroup grpFvOptions Finite volume Options +@{ + \ingroup grpNumerics + This group contains finite volume options +@} + +\defgroup grpFvOptionsSources Sources +@{ + \ingroup grpFvOptions + This group contains finite volume sources +@} + +\defgroup grpFvOptionsCorrections Corrections +@{ + \ingroup grpFvOptions + This group contains finite volume corrections +@} + +\defgroup grpFvOptionsConstraints Constraints +@{ + \ingroup grpFvOptions + This group contains finite volume constraints +@} + + +\*---------------------------------------------------------------------------*/ diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H index c825d0fd27..1810390d80 100644 --- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H +++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::actuationDiskSource +Group + grpFvOptionsSources + Description Actuation disk source diff --git a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H index 7c59a950ac..e27b5d82d9 100644 --- a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H +++ b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H @@ -24,6 +24,9 @@ License Class Foam::fv::buoyancyEnergy +Group + grpFvOptionsSources + Description Calculates and applies the buoyancy energy source rho*(U&g) to the energy equation. diff --git a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H index a1ac3cc2ad..a167e620eb 100644 --- a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H +++ b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H @@ -24,6 +24,9 @@ License Class Foam::fv::buoyancyForce +Group + grpFvOptionsSources + Description Calculates and applies the buoyancy force rho*g to the momentum equation corresponding to the specified velocity field. diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H index a36cbfe2d6..b6f3479bf0 100644 --- a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::directionalPressureGradientExplicitSource +Group + grpFvOptionsSources + Description Creates an explicit pressure gradient source in such a way to deflect the flow towards an specific direction (flowDir). Alternatively add an extra diff --git a/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H index a1629d9624..e2532e254d 100644 --- a/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H +++ b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::effectivenessHeatExchangerSource +Group + grpFvOptionsSources + Description Heat exchanger source model, in which the heat exchanger is defined as a selection of cells. diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H index 8fa468916e..345b6bda3d 100644 --- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H +++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H @@ -24,6 +24,9 @@ License Class Foam::fv::explicitPorositySource +Group + grpFvOptionsSources + Description Explicit porosity source diff --git a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H b/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H index 72809cfc09..37dc57d179 100644 --- a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H +++ b/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.H @@ -24,6 +24,9 @@ License Class Foam::fv::meanVelocityForce +Group + grpFvOptionsSources + Description Calculates and applies the force necessary to maintain the specified mean velocity. diff --git a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H index 0df0d1347c..31d585e6f6 100644 --- a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H +++ b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::radialActuationDiskSource +Group + grpFvOptionsSources + Description Actuation disk source including radial thrust diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H index f94a463eb7..0162fba072 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::rotorDiskSource +Group + grpFvOptionsSources + Description Rotor disk source diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H index 14a34a82f5..661be30ddf 100644 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H +++ b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::solidificationMeltingSource +Group + grpFvOptionsSources + Description This source is designed to model the effect of solidification and melting processes, e.g. windhield defrosting. The phase change occurs at the diff --git a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H index 6127d0bff6..26d3d65de1 100644 --- a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H +++ b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::tabulatedAccelerationSource +Group + grpFvOptionsSources + Description Solid-body 6-DoF acceleration source @@ -64,7 +67,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class tabulatedAccelerationSource Declaration + Class tabulatedAccelerationSource Declaration \*---------------------------------------------------------------------------*/ class tabulatedAccelerationSource @@ -84,6 +87,7 @@ protected: dimensionedVector g0_; + private: // Private Member Functions diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.H b/src/fvOptions/sources/general/codedSource/CodedSource.H index 6961faffbd..678e98d73e 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.H +++ b/src/fvOptions/sources/general/codedSource/CodedSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::codedSource +Group + grpFvOptionsSources + Description Constructs on-the-fly fvOption source diff --git a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H index 9a61f1b94a..6cdc0793dc 100644 --- a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H +++ b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H @@ -24,6 +24,9 @@ License Class Foam::fv::SemiImplicitSource +Group + grpFvOptionsSources + Description Semi-implicit source, described using an input dictionary. The injection rate coefficients are specified as pairs of Su-Sp coefficients, i.e. diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H index 93f50a3930..320a5b66ef 100644 --- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H @@ -24,6 +24,9 @@ License Class Foam::fv::interRegionExplicitPorositySource +Group + grpFvOptionsSources + Description Inter-region explicit porosity source. diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H index e3bd2830a2..1de4154726 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H @@ -24,6 +24,9 @@ License Class Foam::fv::constantHeatTransfer +Group + grpFvOptionsSources + Description Constant heat transfer model. htcConst [W/m2/K] and area/volume [1/m] must be provided. diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H index c5810cc321..3cca854aad 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H @@ -24,6 +24,9 @@ License Class Foam::fv::interRegionHeatTransferModel +Group + grpFvOptionsSources + Description Base class for inter region heat exchange. The derived classes must provide the heat transfer coeffisine (htc) which is used as follows diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H index 888f1e97a2..a16e94b1b2 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H @@ -24,6 +24,9 @@ License Class Foam::fv::tabulatedHeatTransfer +Group + grpFvOptionsSources + Description Tabulated heat transfer model. The heat exchange area per unit volume must be provided. The 2D table returns the heat transfer coefficient diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H index 1343dd4ac6..fb488418d4 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H @@ -24,6 +24,9 @@ License Class Foam::fv::tabulatedNTUHeatTransfer +Group + grpFvOptionsSources + Description Tabulated heat transfer model. diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H index 3b9d0f66fd..e639fc0792 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H @@ -24,6 +24,9 @@ License Class Foam::fv::variableHeatTransfer +Group + grpFvOptionsSources + Description Variable heat transfer model depending on local values. The area of contact between regions (area) must be provided. The Nu number is calculated as: diff --git a/src/lagrangian/intermediate/doc/lagrangianIntermediate.dox b/src/lagrangian/intermediate/doc/lagrangianIntermediate.dox new file mode 100644 index 0000000000..a314c0c60b --- /dev/null +++ b/src/lagrangian/intermediate/doc/lagrangianIntermediate.dox @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\page pageLagrangianIntermediate Lagrangian modelling + +\section secSchemes Overview +The available Lagrangian models are grouped into the following categories: + - \ref grpLagrangianIntermediateClouds + - \ref grpLagrangianIntermediateParcels + - \ref grpLagrangianIntermediateSubModels + - \ref grpLagrangianIntermediateKinematicSubModels + - \ref grpLagrangianIntermediateThermoSubModels + - \ref grpLagrangianIntermediateReactingSubModels + - \ref grpLagrangianIntermediateReactingMultiphaseSubModels + - \ref grpLagrangianIntermediateMPPICSubModels + - \ref grpLagrangianIntermediateFunctionObjects + + +\*---------------------------------------------------------------------------*/ diff --git a/src/lagrangian/intermediate/doc/finiteVolumeSchemesDoc.H b/src/lagrangian/intermediate/doc/lagrangianIntermediateDoc.H similarity index 100% rename from src/lagrangian/intermediate/doc/finiteVolumeSchemesDoc.H rename to src/lagrangian/intermediate/doc/lagrangianIntermediateDoc.H diff --git a/src/postProcessing/functionObjects/doc/functionObjects.dox b/src/postProcessing/functionObjects/doc/functionObjects.dox index d39e82c137..1f1702dca1 100644 --- a/src/postProcessing/functionObjects/doc/functionObjects.dox +++ b/src/postProcessing/functionObjects/doc/functionObjects.dox @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,6 +44,7 @@ The current range of features comprises of: - \ref grpIOFunctionObjects - \ref grpJobControlFunctionObjects - \ref grpUtilitiesFunctionObjects +- \ref grpThermophysicalFunctionObjects \linebreak \subsection secFieldFunctionObjectUsage Using function objects diff --git a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H index 270d0f4056..1a75aa7192 100644 --- a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H +++ b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H @@ -25,7 +25,7 @@ Class Foam::reactionsSensitivityAnalysis Group - grpUtilitiesFunctionObjects + grpUtilitiesFunctionObjects grpThermophysicalFunctionObjects Description This function object creates four data files named: diff --git a/src/thermophysicalModels/doc/thermophysicalModels.dox b/src/thermophysicalModels/doc/thermophysicalModels.dox new file mode 100644 index 0000000000..a8f7f48ae9 --- /dev/null +++ b/src/thermophysicalModels/doc/thermophysicalModels.dox @@ -0,0 +1,33 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\page pageThermophsyicalModels Thermophsyical Models + +\section secSchemes Overview +The available thermophysical models are grouped into the following categories: + - \ref grpThermophysicalModels + + +\*---------------------------------------------------------------------------*/ diff --git a/src/thermophysicalModels/doc/thermophysicalModelsDoc.H b/src/thermophysicalModels/doc/thermophysicalModelsDoc.H index a6bf6cf927..25563efa1e 100644 --- a/src/thermophysicalModels/doc/thermophysicalModelsDoc.H +++ b/src/thermophysicalModels/doc/thermophysicalModelsDoc.H @@ -28,5 +28,11 @@ License This group contains thermophysical models @} +\defgroup grpThermophysicalFunctionObjects Thermophysical function objects +@{ + \ingroup grpFunctionObjects + This group contains thermo-based function objects +@} + \*---------------------------------------------------------------------------*/ diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H index f298f1b9b7..e0429cbd70 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H @@ -24,6 +24,9 @@ License Class Foam::chemistryReader +Group + grpReactionThermophysicalChemistryReaders + Description Abstract class for reading chemistry diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H index 916c8c06f8..19aa7806f3 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H @@ -24,6 +24,9 @@ License Class Foam::chemkinReader +Group + grpReactionThermophysicalChemistryReaders + Description Foam::chemkinReader diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H index 16046fd29c..ec723e1e2c 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H @@ -24,6 +24,9 @@ License Class Foam::foamChemistryReader +Group + grpReactionThermophysicalChemistryReaders + Description Chemistry reader for OpenFOAM format diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.H b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.H index 5571f28489..e6b3b59c35 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.H +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.H @@ -24,6 +24,9 @@ License Class Foam::fixedUnburntEnthalpyFvPatchScalarField +Group + grpThermoBoundaryConditions + Description Fixed boundary condition for unburnt @@ -43,7 +46,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class fixedUnburntEnthalpyFvPatchScalarField Declaration + Class fixedUnburntEnthalpyFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ class fixedUnburntEnthalpyFvPatchScalarField diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.H b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.H index f23cc1f25e..2fcd45c3d2 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.H +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.H @@ -24,6 +24,9 @@ License Class Foam::gradientUnburntEnthalpyFvPatchScalarField +Group + grpThermoBoundaryConditions + Description gradient boundary condition for unburnt diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.H b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.H index 5bbf130aa0..a7800ee3bc 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.H +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.H @@ -24,6 +24,9 @@ License Class Foam::mixedUnburntEnthalpyFvPatchScalarField +Group + grpThermoBoundaryConditions + Description Mixed boundary condition for unburnt diff --git a/src/thermophysicalModels/reactionThermo/doc/reactionThermoDoc.H b/src/thermophysicalModels/reactionThermo/doc/reactionThermoDoc.H new file mode 100644 index 0000000000..01baf0e53b --- /dev/null +++ b/src/thermophysicalModels/reactionThermo/doc/reactionThermoDoc.H @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ 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 . + +\defgroup grpReactionThermophysicalModels Reaction thermophysical models +@{ + \ingroup grpThermophysicalModels + This group contains reaction thermophysical models +@} + +\defgroup grpReactionThermophysicalMixtures Mixtures +@{ + \ingroup grpReactionThermophysicalModels + This group contains reaction mixtures +@} + +\defgroup grpReactionThermophysicalChemistryReaders Chemistry readers +@{ + \ingroup grpReactionThermophysicalModels + This group contains chemistry readers +@} + + +\*---------------------------------------------------------------------------*/ diff --git a/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.H b/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.H index fa158e4754..6429ed6620 100644 --- a/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.H +++ b/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.H @@ -24,6 +24,9 @@ License Class Foam::moleFractions +Group + grpThermophysicalFunctionObjects + Description This function object calculates mole-fraction fields from the mass-fraction fields of the psi/rhoReactionThermo and caches them for output and further diff --git a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H index 24f95915ab..72219a4ac3 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H @@ -24,6 +24,9 @@ License Class Foam::SpecieMixture +Group + grpReactionThermophysicalMixtures + Description Foam::SpecieMixture diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H index 341418e1db..f192ef1c53 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H @@ -24,6 +24,9 @@ License Class Foam::basicCombustionMixture +Group + grpReactionThermophysicalMixtures + Description Specialization of the basicSpecieMixture for combustion. diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H index 51b08b6a59..f31318de5b 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H @@ -24,6 +24,9 @@ License Class Foam::basicMultiComponentMixture +Group + grpReactionThermophysicalMixtures + Description Multi-component mixture. diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H index e814154a9c..d967e8931f 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H @@ -24,6 +24,9 @@ License Class Foam::basicSpecieMixture +Group + grpReactionThermophysicalMixtures + Description Specialization of basicMultiComponentMixture for a mixture consisting of a number for molecular species. diff --git a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H index fa81aa92e1..5b9f031248 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H @@ -24,6 +24,9 @@ License Class Foam::egrMixture +Group + grpReactionThermophysicalMixtures + Description Foam::egrMixture diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H index 31915735d1..bb77c4601e 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H @@ -24,6 +24,9 @@ License Class Foam::homogeneousMixture +Group + grpReactionThermophysicalMixtures + Description Foam::homogeneousMixture diff --git a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H index ef9284dde8..d6ec1b63e0 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H @@ -24,6 +24,9 @@ License Class Foam::inhomogeneousMixture +Group + grpReactionThermophysicalMixtures + Description Foam::inhomogeneousMixture diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H index eaf395a91e..5f11d35b76 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H @@ -24,6 +24,9 @@ License Class Foam::multiComponentMixture +Group + grpReactionThermophysicalMixtures + Description Foam::multiComponentMixture diff --git a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H index 5261eb726e..6ef1df6d88 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H @@ -24,6 +24,9 @@ License Class Foam::reactingMixture +Group + grpReactionThermophysicalMixtures + Description Foam::reactingMixture diff --git a/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.H index b5a4a90fbf..10119b24f7 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.H @@ -24,6 +24,9 @@ License Class Foam::singleStepReactingMixture +Group + grpReactionThermophysicalMixtures + Description Single step reacting mixture diff --git a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H index 2e852b80c1..5b81432aa9 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H @@ -24,6 +24,9 @@ License Class Foam::veryInhomogeneousMixture +Group + grpReactionThermophysicalMixtures + Description Foam::veryInhomogeneousMixture From be73d81a2264c5711de6431a31e5436c67c6c769 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 17 Jun 2016 23:45:03 +0200 Subject: [PATCH 09/19] ENH: support '-profiling' command-line option - this option overrides any controlDict settings as a convenient means to selecting profiling without messing with the controlDict. - provide Profiling::writeNow() to emit profiling for utilities that don't have any natural time increment mechanism to trigger it. --- src/OpenFOAM/db/Time/Time.C | 14 +++++++-- src/OpenFOAM/db/Time/Time.H | 3 +- src/OpenFOAM/global/profiling/Profiling.C | 32 +++++++++++++++++++ src/OpenFOAM/global/profiling/Profiling.H | 38 ++++++++++++----------- src/OpenFOAM/include/addProfilingOption.H | 5 +++ 5 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 src/OpenFOAM/include/addProfilingOption.H diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 6ec558b5ad..4dec1f4851 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -334,11 +334,17 @@ void Foam::Time::setControls() } -void Foam::Time::setMonitoring() +void Foam::Time::setMonitoring(bool forceProfiling) { // initialize profiling on request // skip if 'active' keyword is explicitly set to false - const dictionary* profilingDict = controlDict_.subDictPtr("profiling"); + const dictionary* profilingDict = + ( + forceProfiling + ? &dictionary::null + : controlDict_.subDictPtr("profiling") + ); + if ( profilingDict @@ -526,7 +532,9 @@ Foam::Time::Time readOpt() = IOobject::MUST_READ_IF_MODIFIED; setControls(); - setMonitoring(); + + // '-profiling' = force profiling, ignore controlDict entry + setMonitoring(args.optionFound("profiling")); } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 24d7abee3f..1a32dcff00 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -182,7 +182,8 @@ protected: void setControls(); //- Set file monitoring, profiling, etc - void setMonitoring(); + // Optionally force profiling without inspecting the controlDict + void setMonitoring(const bool forceProfiling=false); //- Read the control dictionary and set the write controls etc. virtual void readDict(); diff --git a/src/OpenFOAM/global/profiling/Profiling.C b/src/OpenFOAM/global/profiling/Profiling.C index 79ffa68aef..a336da4555 100644 --- a/src/OpenFOAM/global/profiling/Profiling.C +++ b/src/OpenFOAM/global/profiling/Profiling.C @@ -67,6 +67,27 @@ void Foam::Profiling::Information::raiseID(label maxVal) } +bool Foam::Profiling::active() +{ + return pool_; +} + + +bool Foam::Profiling::writeNow() +{ + if (pool_) + { + Info<<"Profiling::writeNow() at time = " + << pool_->owner().timeName() << endl; + return pool_->write(); + } + else + { + return false; + } +} + + void Foam::Profiling::initialize ( const IOobject& ioObj, @@ -298,6 +319,17 @@ Foam::Profiling::Trigger::~Trigger() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::Time& Foam::Profiling::owner() const +{ + return owner_; +} + +Foam::label Foam::Profiling::size() const +{ + return stack_.size(); +} + + Foam::Profiling::Information* Foam::Profiling::find(const string& name) { StorageContainer::iterator iter = hash_.find(name); diff --git a/src/OpenFOAM/global/profiling/Profiling.H b/src/OpenFOAM/global/profiling/Profiling.H index 7821dfede5..670b0140bf 100644 --- a/src/OpenFOAM/global/profiling/Profiling.H +++ b/src/OpenFOAM/global/profiling/Profiling.H @@ -191,19 +191,17 @@ public: // Member Functions - //- The owner of the profiling - const Time& owner() const - { - return owner_; - } + //- True if profiling is active + static bool active(); + //- Write profiling information now + static bool writeNow(); + + //- The owner of the profiling + const Time& owner() const; //- The size of the current stack - Foam::label size() const - { - return stack_.size(); - } - + Foam::label size() const; //- writeData member function required by regIOobject virtual bool writeData(Ostream&) const; @@ -394,10 +392,14 @@ public: // Constructors - //- Construct profiling with given name + //- Construct profiling with given description. + // Descriptions beginning with 'application::' are reserved for + // internal use. Trigger(const char* name); - //- Construct profiling with given name + //- Construct profiling with given description. + // Descriptions beginning with 'application::' are reserved for + // internal use. Trigger(const string& name); @@ -430,23 +432,23 @@ public: // Macros //- Define profiling with specified name and description correspond to the name -// \sa addProfiling -// \sa endProfiling +// \sa addProfiling +// \sa endProfiling #define addProfiling0(name) \ Foam::Profiling::Trigger profilingTriggerFor##name(#name) //- Define profiling with specified name and description string // This is required if the description contains space, colons etc. -// \sa addProfiling0 -// \sa endProfiling +// \sa addProfiling0 +// \sa endProfiling #define addProfiling(name,descr) \ Foam::Profiling::Trigger profilingTriggerFor##name(descr) //- Remove profiling with specified name -// \sa addProfiling -// \sa addProfiling0 +// \sa addProfiling +// \sa addProfiling0 #define endProfiling(name) profilingTriggerFor##name.stop() diff --git a/src/OpenFOAM/include/addProfilingOption.H b/src/OpenFOAM/include/addProfilingOption.H new file mode 100644 index 0000000000..6c2374802d --- /dev/null +++ b/src/OpenFOAM/include/addProfilingOption.H @@ -0,0 +1,5 @@ +Foam::argList::addBoolOption +( + "profiling", + "activate application-level profiling" +); From e86d3f2e0eeacb164406d013516e7256b95a1ca5 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sat, 18 Jun 2016 01:00:55 +0200 Subject: [PATCH 10/19] ENH: add preliminary profiling items into snappyHexMesh - needs more refinement, but provides the general idea. --- .../generation/snappyHexMesh/snappyHexMesh.C | 24 ++++++++++++++++--- .../snappyHexMeshDriver/snappyLayerDriver.C | 3 +++ .../snappyHexMeshDriver/snappyRefineDriver.C | 10 ++++++++ .../snappyHexMeshDriver/snappySnapDriver.C | 6 ++++- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index b73c1fbecc..4faa6f74dd 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,6 +59,7 @@ Description #include "IOmanip.H" #include "decompositionModel.H" #include "fvMeshTools.H" +#include "Profiling.H" using namespace Foam; @@ -633,6 +634,7 @@ int main(int argc, char *argv[]) "fileName", "name of the file to save the simplified surface to" ); + #include "addProfilingOption.H" #include "addDictOption.H" #include "setRootCase.H" @@ -816,7 +818,6 @@ int main(int argc, char *argv[]) const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false)); - // Read decomposePar dictionary dictionary decomposeDict; { @@ -927,6 +928,8 @@ int main(int argc, char *argv[]) } } + // for the impatient who want to see some output files: + Profiling::writeNow(); // Read geometry // ~~~~~~~~~~~~~ @@ -957,6 +960,7 @@ int main(int argc, char *argv[]) if (surfaceSimplify) { + addProfiling(surfaceSimplify, "snappyHexMesh::surfaceSimplify"); IOdictionary foamyHexMeshDict ( IOobject @@ -1001,6 +1005,8 @@ int main(int argc, char *argv[]) refineDict.lookupOrDefault("gapLevelIncrement", 0), initialCellSize/defaultCellSize ); + + Profiling::writeNow(); } else { @@ -1535,6 +1541,8 @@ int main(int argc, char *argv[]) Info<< "Mesh refined in = " << timer.cpuTimeIncrement() << " s." << endl; + + Profiling::writeNow(); } if (wantSnap) @@ -1583,6 +1591,8 @@ int main(int argc, char *argv[]) Info<< "Mesh snapped in = " << timer.cpuTimeIncrement() << " s." << endl; + + Profiling::writeNow(); } if (wantLayers) @@ -1639,11 +1649,14 @@ int main(int argc, char *argv[]) Info<< "Layers added in = " << timer.cpuTimeIncrement() << " s." << endl; + + Profiling::writeNow(); } - { + addProfiling(checkMesh, "snappyHexMesh::checkMesh"); + // Check final mesh Info<< "Checking final mesh ..." << endl; faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100); @@ -1665,11 +1678,15 @@ int main(int argc, char *argv[]) { Info<< "Finished meshing without any errors" << endl; } + + Profiling::writeNow(); } if (surfaceSimplify) { + addProfiling(surfaceSimplify, "snappyHexMesh::surfaceSimplify"); + const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); labelHashSet includePatches(bMesh.size()); @@ -1727,6 +1744,7 @@ int main(int argc, char *argv[]) cellCentres.write(); } + Profiling::writeNow(); Info<< "Finished meshing in = " << runTime.elapsedCpuTime() << " s." << endl; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index cfbb7c3de8..49b952710e 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -57,6 +57,7 @@ Description #include "localPointRegion.H" #include "externalDisplacementMeshMover.H" #include "scalarIOField.H" +#include "Profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -3399,6 +3400,7 @@ void Foam::snappyLayerDriver::addLayers // extrudeStatus //); + addProfiling(grow, "snappyHexMesh::layers::grow"); // Grow out region of non-extrusion for (label i = 0; i < layerParams.nGrow(); i++) @@ -4219,6 +4221,7 @@ void Foam::snappyLayerDriver::doLayers fvMeshDistribute& distributor ) { + addProfiling(layers, "snappyHexMesh::layers"); const fvMesh& mesh = meshRefiner_.mesh(); Info<< nl diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C index 484229bf93..c6d24bd019 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C @@ -39,6 +39,7 @@ License #include "localPointRegion.H" #include "IOmanip.H" #include "labelVector.H" +#include "Profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -79,6 +80,7 @@ Foam::label Foam::snappyRefineDriver::featureEdgeRefine const label minRefine ) { + addProfiling(edge, "snappyHexMesh::refine::edge"); const fvMesh& mesh = meshRefiner_.mesh(); label iter = 0; @@ -188,6 +190,7 @@ Foam::label Foam::snappyRefineDriver::smallFeatureRefine const label maxIter ) { + addProfiling(feature, "snappyHexMesh::refine::smallFeature"); const fvMesh& mesh = meshRefiner_.mesh(); @@ -310,6 +313,7 @@ Foam::label Foam::snappyRefineDriver::surfaceOnlyRefine const label maxIter ) { + addProfiling(surface, "snappyHexMesh::refine::surface"); const fvMesh& mesh = meshRefiner_.mesh(); // Determine the maximum refinement level over all surfaces. This @@ -807,6 +811,7 @@ Foam::label Foam::snappyRefineDriver::danglingCellRefine const label maxIter ) { + addProfiling(dangling, "snappyHexMesh::refine::danglingCell"); const fvMesh& mesh = meshRefiner_.mesh(); label iter; @@ -952,6 +957,7 @@ Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine const label maxIter ) { + addProfiling(interface, "snappyHexMesh::refine::transition"); const fvMesh& mesh = meshRefiner_.mesh(); label iter = 0; @@ -1340,6 +1346,7 @@ Foam::label Foam::snappyRefineDriver::shellRefine const label maxIter ) { + addProfiling(shell, "snappyHexMesh::refine::shell"); const fvMesh& mesh = meshRefiner_.mesh(); // Mark current boundary faces with 0. Have meshRefiner maintain them. @@ -1515,6 +1522,7 @@ void Foam::snappyRefineDriver::baffleAndSplitMesh const dictionary& motionDict ) { + addProfiling(split, "snappyHexMesh::refine::splitting"); Info<< nl << "Splitting mesh at surface intersections" << nl << "---------------------------------------" << nl @@ -1839,6 +1847,7 @@ void Foam::snappyRefineDriver::mergePatchFaces const dictionary& motionDict ) { + addProfiling(merge, "snappyHexMesh::refine::merge"); Info<< nl << "Merge refined boundary faces" << nl << "----------------------------" << nl @@ -1893,6 +1902,7 @@ void Foam::snappyRefineDriver::doRefine const dictionary& motionDict ) { + addProfiling(refine, "snappyHexMesh::refine"); Info<< nl << "Refinement phase" << nl << "----------------" << nl diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C index 95178d2881..ebc4e90229 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,6 +45,7 @@ Description #include "localPointRegion.H" #include "PatchTools.H" #include "refinementFeatures.H" +#include "Profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -832,6 +833,7 @@ void Foam::snappySnapDriver::preSmoothPatch motionSmoother& meshMover ) { + addProfiling(smooth, "snappyHexMesh::snap::smoothing"); const fvMesh& mesh = meshRefiner.mesh(); labelList checkFaces; @@ -2168,6 +2170,7 @@ bool Foam::snappySnapDriver::scaleMesh motionSmoother& meshMover ) { + addProfiling(scale, "snappyHexMesh::snap::scale"); const fvMesh& mesh = meshRefiner_.mesh(); // Relax displacement until correct mesh @@ -2534,6 +2537,7 @@ void Foam::snappySnapDriver::doSnap const snapParameters& snapParams ) { + addProfiling(snap, "snappyHexMesh::snap"); fvMesh& mesh = meshRefiner_.mesh(); Info<< nl From b1d755aca1ddc6a1b095d0e43996b08dd9e10ba0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 20 Jun 2016 11:25:38 +0100 Subject: [PATCH 11/19] ENH: mapFieldsPar: map (global) constraint patches --- .../preProcessing/mapFieldsPar/MapVolFields.H | 95 ++++++++++++++++++- .../preProcessing/mapFieldsPar/mapFieldsPar.C | 30 +----- src/sampling/meshToMesh/meshToMesh.C | 11 ++- 3 files changed, 102 insertions(+), 34 deletions(-) diff --git a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H index c365bbddf6..c212b473ec 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H +++ b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,6 +35,88 @@ License namespace Foam { +template +void evaluateConstraintTypes(GeometricField& fld) +{ + typename GeometricField:: + GeometricBoundaryField& fldBf = fld.boundaryField(); + + if + ( + Pstream::defaultCommsType == Pstream::blocking + || Pstream::defaultCommsType == Pstream::nonBlocking + ) + { + label nReq = Pstream::nRequests(); + + forAll(fldBf, patchi) + { + fvPatchField& tgtField = fldBf[patchi]; + + if + ( + tgtField.type() == tgtField.patch().patch().type() + && polyPatch::constraintType(tgtField.patch().patch().type()) + ) + { + tgtField.initEvaluate(Pstream::defaultCommsType); + } + } + + // Block for any outstanding requests + if + ( + Pstream::parRun() + && Pstream::defaultCommsType == Pstream::nonBlocking + ) + { + Pstream::waitRequests(nReq); + } + + forAll(fldBf, patchi) + { + fvPatchField& tgtField = fldBf[patchi]; + + if + ( + tgtField.type() == tgtField.patch().patch().type() + && polyPatch::constraintType(tgtField.patch().patch().type()) + ) + { + tgtField.evaluate(Pstream::defaultCommsType); + } + } + } + else if (Pstream::defaultCommsType == Pstream::scheduled) + { + const lduSchedule& patchSchedule = + fld.mesh().globalData().patchSchedule(); + + forAll(patchSchedule, patchEvali) + { + label patchi = patchSchedule[patchEvali].patch; + fvPatchField& tgtField = fldBf[patchi]; + + if + ( + tgtField.type() == tgtField.patch().patch().type() + && polyPatch::constraintType(tgtField.patch().patch().type()) + ) + { + if (patchSchedule[patchEvali].init) + { + tgtField.initEvaluate(Pstream::scheduled); + } + else + { + tgtField.evaluate(Pstream::scheduled); + } + } + } + } +} + + template void MapVolFields ( @@ -57,8 +139,6 @@ void MapVolFields if (selectedFields.empty() || selectedFields.found(fieldName)) { - Info<< " interpolating " << fieldName << endl; - const fieldType fieldSource(*fieldIter(), meshSource); IOobject targetIO @@ -71,14 +151,21 @@ void MapVolFields if (targetIO.typeHeaderOk(true)) { + Info<< " interpolating onto existing field " + << fieldName << endl; fieldType fieldTarget(targetIO, meshTarget); interp.mapSrcToTgt(fieldSource, cop, fieldTarget); + evaluateConstraintTypes(fieldTarget); + fieldTarget.write(); } else { + Info<< " creating new field " + << fieldName << endl; + targetIO.readOpt() = IOobject::NO_READ; tmp @@ -86,6 +173,8 @@ void MapVolFields fieldType fieldTarget(targetIO, tfieldTarget); + evaluateConstraintTypes(fieldTarget); + fieldTarget.write(); } } diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C index 515dc66459..fdfdaad1da 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C @@ -121,34 +121,6 @@ void mapSubMesh } -wordList addProcessorPatches -( - const fvMesh& meshTarget, - const wordList& cuttingPatches -) -{ - // Add the processor patches to the cutting list - HashSet cuttingPatchTable; - forAll(cuttingPatches, i) - { - cuttingPatchTable.insert(cuttingPatches[i]); - } - - const polyBoundaryMesh& pbm = meshTarget.boundaryMesh(); - - forAll(pbm, patchI) - { - if (isA(pbm[patchI])) - { - const word& patchName = pbm[patchI].name(); - cuttingPatchTable.insert(patchName); - } - } - - return cuttingPatchTable.toc(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) @@ -369,7 +341,7 @@ int main(int argc, char *argv[]) meshSource, meshTarget, patchMap, - addProcessorPatches(meshTarget, cuttingPatches), + cuttingPatches, mapMethod, patchMapMethod, subtract, diff --git a/src/sampling/meshToMesh/meshToMesh.C b/src/sampling/meshToMesh/meshToMesh.C index 98d622e00c..3b336ba494 100644 --- a/src/sampling/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMesh/meshToMesh.C @@ -713,7 +713,11 @@ void Foam::meshToMesh::constructNoCuttingPatches forAll(srcBM, patchI) { const polyPatch& pp = srcBM[patchI]; - if (!polyPatch::constraintType(pp.type())) + + // We want to map all the global patches, including constraint + // patches (since they might have mappable properties, e.g. + // jumpCyclic). We'll fix the value afterwards. + if (!isA(pp)) { srcPatchID.append(pp.index()); @@ -764,7 +768,10 @@ void Foam::meshToMesh::constructFromCuttingPatches const polyPatch& srcPatch = srcRegion_.boundaryMesh()[srcPatchName]; - if (!polyPatch::constraintType(srcPatch.type())) + // We want to map all the global patches, including constraint + // patches (since they might have mappable properties, e.g. + // jumpCyclic). We'll fix the value afterwards. + if (!isA(srcPatch)) { const polyPatch& tgtPatch = tgtRegion_.boundaryMesh()[tgtPatchName]; From 37bf28c249186d01272a47e785872fa031681067 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 20 Jun 2016 21:20:31 +0200 Subject: [PATCH 12/19] STYLE: rename Profiling -> profiling --- .../generation/snappyHexMesh/snappyHexMesh.C | 16 ++-- src/OpenFOAM/Make/files | 4 +- src/OpenFOAM/db/Time/Time.C | 6 +- src/OpenFOAM/db/Time/TimeIO.C | 2 +- .../functionObjectList/functionObjectList.C | 2 +- .../profiling/{Profiling.C => profiling.C} | 89 ++++++++++--------- .../profiling/{Profiling.H => profiling.H} | 49 +++++----- ...{ProfilingSysInfo.C => profilingSysInfo.C} | 8 +- ...{ProfilingSysInfo.H => profilingSysInfo.H} | 19 ++-- .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 4 +- .../solvers/smoothSolver/smoothSolver.C | 2 +- .../general/fvOptions/fvOptionListTemplates.C | 2 +- .../fvMatrices/fvMatrix/fvMatrixSolve.C | 2 +- .../fvScalarMatrix/fvScalarMatrix.C | 2 +- .../fvMatrices/solvers/MULES/IMULES.C | 2 +- .../solvers/MULES/IMULESTemplates.C | 2 +- .../fvMatrices/solvers/MULES/MULES.C | 2 +- .../Templates/KinematicCloud/KinematicCloud.C | 2 +- .../snappyHexMeshDriver/snappyLayerDriver.C | 2 +- .../snappyHexMeshDriver/snappyRefineDriver.C | 2 +- .../snappyHexMeshDriver/snappySnapDriver.C | 2 +- 21 files changed, 110 insertions(+), 111 deletions(-) rename src/OpenFOAM/global/profiling/{Profiling.C => profiling.C} (82%) rename src/OpenFOAM/global/profiling/{Profiling.H => profiling.H} (93%) rename src/OpenFOAM/global/profiling/{ProfilingSysInfo.C => profilingSysInfo.C} (94%) rename src/OpenFOAM/global/profiling/{ProfilingSysInfo.H => profilingSysInfo.H} (87%) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 4faa6f74dd..b5187f1e94 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -59,7 +59,7 @@ Description #include "IOmanip.H" #include "decompositionModel.H" #include "fvMeshTools.H" -#include "Profiling.H" +#include "profiling.H" using namespace Foam; @@ -929,7 +929,7 @@ int main(int argc, char *argv[]) } // for the impatient who want to see some output files: - Profiling::writeNow(); + profiling::writeNow(); // Read geometry // ~~~~~~~~~~~~~ @@ -1006,7 +1006,7 @@ int main(int argc, char *argv[]) initialCellSize/defaultCellSize ); - Profiling::writeNow(); + profiling::writeNow(); } else { @@ -1542,7 +1542,7 @@ int main(int argc, char *argv[]) Info<< "Mesh refined in = " << timer.cpuTimeIncrement() << " s." << endl; - Profiling::writeNow(); + profiling::writeNow(); } if (wantSnap) @@ -1592,7 +1592,7 @@ int main(int argc, char *argv[]) Info<< "Mesh snapped in = " << timer.cpuTimeIncrement() << " s." << endl; - Profiling::writeNow(); + profiling::writeNow(); } if (wantLayers) @@ -1650,7 +1650,7 @@ int main(int argc, char *argv[]) Info<< "Layers added in = " << timer.cpuTimeIncrement() << " s." << endl; - Profiling::writeNow(); + profiling::writeNow(); } @@ -1679,7 +1679,7 @@ int main(int argc, char *argv[]) Info<< "Finished meshing without any errors" << endl; } - Profiling::writeNow(); + profiling::writeNow(); } @@ -1744,7 +1744,7 @@ int main(int argc, char *argv[]) cellCentres.write(); } - Profiling::writeNow(); + profiling::writeNow(); Info<< "Finished meshing in = " << runTime.elapsedCpuTime() << " s." << endl; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index ff6fade3be..1f42581d8b 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -3,8 +3,8 @@ global/global.Cver /* global/constants/dimensionedConstants.C in global.Cver */ global/argList/argList.C global/clock/clock.C -global/profiling/Profiling.C -global/profiling/ProfilingSysInfo.C +global/profiling/profiling.C +global/profiling/profilingSysInfo.C bools = primitives/bools $(bools)/bool/bool.C diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 4dec1f4851..e2cc8e28b5 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -27,7 +27,7 @@ License #include "PstreamReduceOps.H" #include "argList.H" #include "HashSet.H" -#include "Profiling.H" +#include "profiling.H" #include @@ -351,7 +351,7 @@ void Foam::Time::setMonitoring(bool forceProfiling) && profilingDict->lookupOrDefault("active", true) ) { - Profiling::initialize + profiling::initialize ( *profilingDict, IOobject @@ -687,7 +687,7 @@ Foam::Time::~Time() functionObjects_.clear(); // cleanup profiling - Profiling::stop(*this); + profiling::stop(*this); } diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index 557b9a9e7d..4747ea7d62 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -27,7 +27,7 @@ License #include "Pstream.H" #include "simpleObjectRegistry.H" #include "dimensionedConstants.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 378046c2b5..caa55f43c9 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -26,7 +26,7 @@ License #include "functionObjectList.H" #include "Time.H" #include "mapPolyMesh.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/profiling/Profiling.C b/src/OpenFOAM/global/profiling/profiling.C similarity index 82% rename from src/OpenFOAM/global/profiling/Profiling.C rename to src/OpenFOAM/global/profiling/profiling.C index a336da4555..704f8f868c 100644 --- a/src/OpenFOAM/global/profiling/Profiling.C +++ b/src/OpenFOAM/global/profiling/profiling.C @@ -23,8 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#include "Profiling.H" -#include "ProfilingSysInfo.H" +#include "profiling.H" +#include "profilingSysInfo.H" #include "cpuInfo.H" #include "memInfo.H" #include "OSspecific.H" @@ -34,9 +34,9 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -Foam::Profiling* Foam::Profiling::pool_(0); +Foam::profiling* Foam::profiling::pool_(0); -Foam::label Foam::Profiling::Information::nextId_(0); +Foam::label Foam::profiling::Information::nextId_(0); // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // @@ -52,13 +52,13 @@ inline static void writeEntry } -Foam::label Foam::Profiling::Information::getNextId() +Foam::label Foam::profiling::Information::getNextId() { return nextId_++; } -void Foam::Profiling::Information::raiseID(label maxVal) +void Foam::profiling::Information::raiseID(label maxVal) { if (nextId_ < maxVal) { @@ -67,17 +67,17 @@ void Foam::Profiling::Information::raiseID(label maxVal) } -bool Foam::Profiling::active() +bool Foam::profiling::active() { return pool_; } -bool Foam::Profiling::writeNow() +bool Foam::profiling::writeNow() { if (pool_) { - Info<<"Profiling::writeNow() at time = " + Info<<"profiling::writeNow() at time = " << pool_->owner().timeName() << endl; return pool_->write(); } @@ -88,7 +88,7 @@ bool Foam::Profiling::writeNow() } -void Foam::Profiling::initialize +void Foam::profiling::initialize ( const IOobject& ioObj, const Time& owner @@ -101,7 +101,7 @@ void Foam::Profiling::initialize } else { - pool_ = new Profiling(ioObj, owner); + pool_ = new profiling(ioObj, owner); Information *info = pool_->store ( @@ -109,12 +109,12 @@ void Foam::Profiling::initialize ); pool_->push(info, pool_->clockTime_); - Info<< "Profiling initialized" << nl; + Info<< "profiling initialized" << nl; } } -void Foam::Profiling::initialize +void Foam::profiling::initialize ( const dictionary& dict, const IOobject& ioObj, @@ -128,7 +128,7 @@ void Foam::Profiling::initialize } else { - pool_ = new Profiling(dict, ioObj, owner); + pool_ = new profiling(dict, ioObj, owner); Information *info = pool_->store ( @@ -136,12 +136,12 @@ void Foam::Profiling::initialize ); pool_->push(info, pool_->clockTime_); - Info<< "Profiling initialized" << nl; + Info<< "profiling initialized" << nl; } } -void Foam::Profiling::stop(const Time& owner) +void Foam::profiling::stop(const Time& owner) { if (pool_ && &owner == &(pool_->owner_)) { @@ -151,7 +151,7 @@ void Foam::Profiling::stop(const Time& owner) } -Foam::Profiling::Information* Foam::Profiling::New +Foam::profiling::Information* Foam::profiling::New ( const string& name, clockTime& timer @@ -177,7 +177,7 @@ Foam::Profiling::Information* Foam::Profiling::New } -void Foam::Profiling::unstack(const Information *info) +void Foam::profiling::unstack(const Information *info) { if (pool_ && info) { @@ -200,7 +200,7 @@ void Foam::Profiling::unstack(const Information *info) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::Profiling::Profiling +Foam::profiling::profiling ( const IOobject& io, const Time& owner @@ -218,7 +218,7 @@ Foam::Profiling::Profiling {} -Foam::Profiling::Profiling +Foam::profiling::profiling ( const dictionary& dict, const IOobject& io, @@ -249,7 +249,7 @@ Foam::Profiling::Profiling {} -Foam::Profiling::Information::Information() +Foam::profiling::Information::Information() : id_(getNextId()), description_("application::main"), @@ -257,11 +257,12 @@ Foam::Profiling::Information::Information() calls_(0), totalTime_(0), childTime_(0), + maxMem_(0), onStack_(false) {} -Foam::Profiling::Information::Information +Foam::profiling::Information::Information ( Information *parent, const string& descr @@ -277,23 +278,23 @@ Foam::Profiling::Information::Information {} -Foam::Profiling::Trigger::Trigger(const char* name) +Foam::profiling::Trigger::Trigger(const char* name) : clock_(), - ptr_(Profiling::New(name, clock_)) + ptr_(profiling::New(name, clock_)) {} -Foam::Profiling::Trigger::Trigger(const string& name) +Foam::profiling::Trigger::Trigger(const string& name) : clock_(), - ptr_(Profiling::New(name, clock_)) + ptr_(profiling::New(name, clock_)) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::Profiling::~Profiling() +Foam::profiling::~profiling() { deleteDemandDrivenData(sysInfo_); deleteDemandDrivenData(cpuInfo_); @@ -307,11 +308,11 @@ Foam::Profiling::~Profiling() } -Foam::Profiling::Information::~Information() +Foam::profiling::Information::~Information() {} -Foam::Profiling::Trigger::~Trigger() +Foam::profiling::Trigger::~Trigger() { stop(); } @@ -319,25 +320,25 @@ Foam::Profiling::Trigger::~Trigger() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::Time& Foam::Profiling::owner() const +const Foam::Time& Foam::profiling::owner() const { return owner_; } -Foam::label Foam::Profiling::size() const +Foam::label Foam::profiling::size() const { return stack_.size(); } -Foam::Profiling::Information* Foam::Profiling::find(const string& name) +Foam::profiling::Information* Foam::profiling::find(const string& name) { StorageContainer::iterator iter = hash_.find(name); return (iter != hash_.end() ? iter() : 0); } -void Foam::Profiling::Information::update(const scalar& elapsed) +void Foam::profiling::Information::update(const scalar& elapsed) { ++calls_; totalTime_ += elapsed; @@ -349,7 +350,7 @@ void Foam::Profiling::Information::update(const scalar& elapsed) } -bool Foam::Profiling::writeData(Ostream& os) const +bool Foam::profiling::writeData(Ostream& os) const { os << indent << "profiling" << nl << indent << token::BEGIN_LIST << incrIndent << nl; @@ -429,14 +430,14 @@ bool Foam::Profiling::writeData(Ostream& os) const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::Profiling::Information* Foam::Profiling::store(Information *info) +Foam::profiling::Information* Foam::profiling::store(Information *info) { hash_.insert(info->description(), info); return info; } -void Foam::Profiling::push(Information *info, clockTime& timer) +void Foam::profiling::push(Information *info, clockTime& timer) { stack_.push(info); timers_.set(info->id(), &timer); @@ -444,7 +445,7 @@ void Foam::Profiling::push(Information *info, clockTime& timer) } -Foam::Profiling::Information* Foam::Profiling::pop() +Foam::profiling::Information* Foam::profiling::pop() { Information *info = stack_.pop(); timers_.erase(info->id()); @@ -454,37 +455,37 @@ Foam::Profiling::Information* Foam::Profiling::pop() } -bool Foam::Profiling::Trigger::running() const +bool Foam::profiling::Trigger::running() const { return ptr_; } -void Foam::Profiling::Trigger::stop() +void Foam::profiling::Trigger::stop() { if (ptr_) { ptr_->update(clock_.elapsedTime()); - Profiling::unstack(ptr_); + profiling::unstack(ptr_); // pointer is managed by pool storage -> thus no delete here } ptr_ = 0; } -void Foam::Profiling::Information::push() const +void Foam::profiling::Information::push() const { onStack_ = true; } -void Foam::Profiling::Information::pop() const +void Foam::profiling::Information::pop() const { onStack_ = false; } -Foam::Ostream& Foam::Profiling::Information::write +Foam::Ostream& Foam::profiling::Information::write ( Ostream& os, const bool offset, @@ -521,7 +522,7 @@ Foam::Ostream& Foam::Profiling::Information::write Foam::Ostream& Foam::operator<< ( Ostream& os, - const Profiling::Information& info + const profiling::Information& info ) { return info.write(os); diff --git a/src/OpenFOAM/global/profiling/Profiling.H b/src/OpenFOAM/global/profiling/profiling.H similarity index 93% rename from src/OpenFOAM/global/profiling/Profiling.H rename to src/OpenFOAM/global/profiling/profiling.H index 670b0140bf..ce94fcaef5 100644 --- a/src/OpenFOAM/global/profiling/Profiling.H +++ b/src/OpenFOAM/global/profiling/profiling.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::Profiling + Foam::profiling Description Code profiling. @@ -44,12 +44,12 @@ Description \endcode SourceFiles - Profiling.C + profiling.C \*---------------------------------------------------------------------------*/ -#ifndef Profiling_H -#define Profiling_H +#ifndef profiling_H +#define profiling_H #include "HashPtrTable.H" #include "LIFOStack.H" @@ -69,10 +69,10 @@ class cpuInfo; class memInfo; /*---------------------------------------------------------------------------*\ - Class Profiling Declaration + Class profiling Declaration \*---------------------------------------------------------------------------*/ -class Profiling +class profiling : public regIOobject { @@ -89,7 +89,7 @@ private: // Private Static Data Members //- Only one global pool object is possible - static Profiling *pool_; + static profiling *pool_; // Private Data Members @@ -126,10 +126,10 @@ private: // Private Member Functions //- Disallow default bitwise copy construct - Profiling(const Profiling&) = delete; + profiling(const profiling&) = delete; //- Disallow default bitwise assignment - void operator=(const Profiling&) = delete; + void operator=(const profiling&) = delete; protected: @@ -142,14 +142,14 @@ protected: // Constructors //- Construct IO object, everything enabled - Profiling(const IOobject&, const Time&); + profiling(const IOobject&, const Time&); //- Construct IO object with finer control over behaviour - Profiling(const dictionary&, const IOobject&, const Time&); + profiling(const dictionary&, const IOobject&, const Time&); //- Destructor - ~Profiling(); + ~profiling(); // Protected Member Functions @@ -210,10 +210,10 @@ public: /*---------------------------------------------------------------------------*\ - Class Profiling::Information Declaration + Class profiling::Information Declaration \*---------------------------------------------------------------------------*/ -class Profiling::Information +class profiling::Information { // Private Static Data Members @@ -264,7 +264,7 @@ protected: // Friendship - friend class Profiling; + friend class profiling; // Constructors @@ -365,10 +365,10 @@ public: /*---------------------------------------------------------------------------*\ - Class Profiling::Trigger Declaration + Class profiling::Trigger Declaration \*---------------------------------------------------------------------------*/ -class Profiling::Trigger +class profiling::Trigger { // Private Data Members @@ -431,19 +431,18 @@ public: // Macros -//- Define profiling with specified name and description correspond to the name -// \sa addProfiling -// \sa endProfiling -#define addProfiling0(name) \ - Foam::Profiling::Trigger profilingTriggerFor##name(#name) - - //- Define profiling with specified name and description string // This is required if the description contains space, colons etc. // \sa addProfiling0 // \sa endProfiling #define addProfiling(name,descr) \ - Foam::Profiling::Trigger profilingTriggerFor##name(descr) + ::Foam::profiling::Trigger profilingTriggerFor##name(descr) + +//- Define profiling with specified name and description correspond to the name +// \sa addProfiling +// \sa endProfiling +#define addProfiling0(name) \ + ::Foam::Profiling::Trigger profilingTriggerFor##name(#name) //- Remove profiling with specified name diff --git a/src/OpenFOAM/global/profiling/ProfilingSysInfo.C b/src/OpenFOAM/global/profiling/profilingSysInfo.C similarity index 94% rename from src/OpenFOAM/global/profiling/ProfilingSysInfo.C rename to src/OpenFOAM/global/profiling/profilingSysInfo.C index 153fb3c11e..9b6ff2f34b 100644 --- a/src/OpenFOAM/global/profiling/ProfilingSysInfo.C +++ b/src/OpenFOAM/global/profiling/profilingSysInfo.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "ProfilingSysInfo.H" +#include "profilingSysInfo.H" #include "demandDrivenData.H" #include "foamVersion.H" @@ -56,20 +56,20 @@ inline static void printEnv // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::Profiling::sysInfo::sysInfo() +Foam::profiling::sysInfo::sysInfo() {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::Profiling::sysInfo::~sysInfo() +Foam::profiling::sysInfo::~sysInfo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::Ostream& Foam::Profiling::sysInfo::write +Foam::Ostream& Foam::profiling::sysInfo::write ( Ostream& os ) const diff --git a/src/OpenFOAM/global/profiling/ProfilingSysInfo.H b/src/OpenFOAM/global/profiling/profilingSysInfo.H similarity index 87% rename from src/OpenFOAM/global/profiling/ProfilingSysInfo.H rename to src/OpenFOAM/global/profiling/profilingSysInfo.H index 1174082b33..26201fac36 100644 --- a/src/OpenFOAM/global/profiling/ProfilingSysInfo.H +++ b/src/OpenFOAM/global/profiling/profilingSysInfo.H @@ -22,20 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::Profiling::SysInfo + Foam::profiling::sysInfo Description General system information SourceFiles - ProfilingSysInfo.C + profilingSysInfo.C \*---------------------------------------------------------------------------*/ -#ifndef ProfilingSysInfo_H -#define ProfilingSysInfo_H +#ifndef profilingSysInfo_H +#define profilingSysInfo_H -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,10 +46,10 @@ namespace Foam class Ostream; /*---------------------------------------------------------------------------*\ - Class Profiling::sysInfo Declaration + Class profiling::sysInfo Declaration \*---------------------------------------------------------------------------*/ -class Profiling::sysInfo +class profiling::sysInfo { // Private Static Data Members @@ -70,7 +70,7 @@ protected: // Friendship - friend class Profiling; + friend class profiling; // Member Functions @@ -98,8 +98,7 @@ public: //- Update it with a new timing information void update(); - //- Write the profiling times, optionally with additional values - // Use dictionary format. + //- Write the profiling sys-info, use dictionary format. Ostream& write(Ostream& os) const; }; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index d425040364..811c8fe15d 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -59,7 +59,7 @@ SourceFiles #include "runTimeSelectionTables.H" #include "solverPerformance.H" #include "InfoProxy.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -117,7 +117,7 @@ public: //- Convergence tolerance relative to the initial scalar relTol_; - Profiling::Trigger profiling_; + profiling::Trigger profiling_; // Protected Member Functions diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C index 2aea792876..31eb37add3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "smoothSolver.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C index 9123ddc412..19e0f1a7b4 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index 4876078b15..df56d919bd 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -25,7 +25,7 @@ License #include "LduMatrix.H" #include "diagTensorField.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index 323babfec4..5cec763e31 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -25,7 +25,7 @@ License #include "fvScalarMatrix.H" #include "extrapolatedCalculatedFvPatchFields.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C index 6ba8c4d407..62bda3abcb 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "IMULES.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C index f52f9dac79..37a730db9b 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/IMULESTemplates.C @@ -29,7 +29,7 @@ License #include "fvmDdt.H" #include "fvmSup.H" #include "fvcDiv.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C index 7e0b2fbb71..97ade8ef3e 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "MULES.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 9d519e87be..dff1907178 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -33,7 +33,7 @@ License #include "PatchInteractionModel.H" #include "StochasticCollisionModel.H" #include "SurfaceFilmModel.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index 49b952710e..9f973ba12c 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -57,7 +57,7 @@ Description #include "localPointRegion.H" #include "externalDisplacementMeshMover.H" #include "scalarIOField.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C index c6d24bd019..bc5942c0ee 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C @@ -39,7 +39,7 @@ License #include "localPointRegion.H" #include "IOmanip.H" #include "labelVector.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C index ebc4e90229..d429f77b6b 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C @@ -45,7 +45,7 @@ Description #include "localPointRegion.H" #include "PatchTools.H" #include "refinementFeatures.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // From cbc4e0d96f99d6537c02047055e2d43d37c34e04 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 20 Jun 2016 21:21:43 +0200 Subject: [PATCH 13/19] ENH: add maxMem information to profiling - value corresponds to the max memory when the corresponding profiling is started. Only used when the top-level profiling has memInfo active. - memInfo is disabled by default, since the new maxMem functionality otherwise adds overhead with every call. tutorial: /lagrangian/reactingParcelFoam/verticalChannelLTS --- src/OpenFOAM/global/profiling/profiling.C | 16 ++++- src/OpenFOAM/global/profiling/profiling.H | 32 ++++++++-- .../snappyHexMeshDriver/snappyLayerDriver.C | 5 +- .../verticalChannelLTS/0/H2O | 54 ---------------- .../reactingParcelFoam/verticalChannelLTS/0/T | 54 ---------------- .../reactingParcelFoam/verticalChannelLTS/0/U | 56 ----------------- .../verticalChannelLTS/0/air | 54 ---------------- .../verticalChannelLTS/0/alphat | 56 ----------------- .../reactingParcelFoam/verticalChannelLTS/0/k | 57 ----------------- .../verticalChannelLTS/0/nut | 58 ----------------- .../verticalChannelLTS/0/omega | 62 ------------------- .../reactingParcelFoam/verticalChannelLTS/0/p | 52 ---------------- .../verticalChannelLTS/Allclean | 4 -- .../verticalChannelLTS/Allrun | 20 ++++++ .../verticalChannelLTS/system/controlDict | 4 ++ 15 files changed, 70 insertions(+), 514 deletions(-) delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/H2O delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/T delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/U delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/air delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/alphat delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/k delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/nut delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/omega delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/p create mode 100755 tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun diff --git a/src/OpenFOAM/global/profiling/profiling.C b/src/OpenFOAM/global/profiling/profiling.C index 704f8f868c..f64504f75a 100644 --- a/src/OpenFOAM/global/profiling/profiling.C +++ b/src/OpenFOAM/global/profiling/profiling.C @@ -171,6 +171,15 @@ Foam::profiling::Information* Foam::profiling::New } pool_->push(info, timer); + + if (pool_->memInfo_) + { + info->maxMem_ = Foam::max + ( + info->maxMem_, + pool_->memInfo_->update().size() + ); + } } return info; @@ -243,7 +252,7 @@ Foam::profiling::profiling ), memInfo_ ( - dict.lookupOrDefault("memInfo", true) + dict.lookupOrDefault("memInfo", false) ? new memInfo() : 0 ) {} @@ -274,6 +283,7 @@ Foam::profiling::Information::Information calls_(0), totalTime_(0), childTime_(0), + maxMem_(0), onStack_(false) {} @@ -509,6 +519,10 @@ Foam::Ostream& Foam::profiling::Information::write writeEntry(os, "calls", calls() + (offset ? 1 : 0)); writeEntry(os, "totalTime", totalTime() + elapsedTime); writeEntry(os, "childTime", childTime() + childTimes); + if (maxMem_) + { + writeEntry(os, "maxMem", maxMem_); + } writeEntry(os, "onStack", Switch(onStack())); os.endBlock() << nl; // FUTURE: without nl diff --git a/src/OpenFOAM/global/profiling/profiling.H b/src/OpenFOAM/global/profiling/profiling.H index ce94fcaef5..409cbff461 100644 --- a/src/OpenFOAM/global/profiling/profiling.H +++ b/src/OpenFOAM/global/profiling/profiling.H @@ -27,14 +27,15 @@ Class Description Code profiling. - This is typically activated from within the system/controlDict as follows: + This is typically activated from within the system/controlDict as follows + (defaults shown): \code profiling { - active true; // default: true - cpuInfo true; // default: true - memInfo true; // default: true - sysInfo true; // default: true + active true; + cpuInfo true; + memInfo false; + sysInfo true; } \endcode or simply using all defaults: @@ -247,6 +248,10 @@ class profiling::Information //- Time spent in children scalar childTime_; + //- Max memory usage on call. + // Only valid when the calling profiling has memInfo active. + mutable int maxMem_; + //- Is this information currently on the stack? mutable bool onStack_; @@ -345,6 +350,12 @@ public: } + inline int maxMem() const + { + return maxMem_; + } + + inline bool onStack() const { return onStack_; @@ -444,6 +455,17 @@ public: #define addProfiling0(name) \ ::Foam::Profiling::Trigger profilingTriggerFor##name(#name) +//- Define profiling with specified name and description correspond to the +// compiler-defined function name string: +// \sa addProfiling +// \sa endProfiling +#ifdef __GNUC__ + #define addProfilingInFunction(name) \ + ::Foam::profiling::Trigger profilingTriggerFor##name(__PRETTY_FUNCTION__) +#else + #define addProfilingInFunction(name) \ + ::Foam::profiling::Trigger profilingTriggerFor##name(__func__) +#endif //- Remove profiling with specified name // \sa addProfiling diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index 9f973ba12c..154526895d 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -3751,7 +3751,10 @@ void Foam::snappyLayerDriver::addLayers ); fvMesh& newMesh = newMeshPtr(); - //?neccesary? Update fields + // get timing, but more importantly get memory information + addProfiling(grow, "snappyHexMesh::layers::updateMesh"); + + //?necessary? Update fields newMesh.updateMesh(map); newMesh.setInstance(meshRefiner_.timeName()); diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/H2O b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/H2O deleted file mode 100644 index 802c5d44b5..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/H2O +++ /dev/null @@ -1,54 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object H2O; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.01; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - walls - { - type zeroGradient; - } - outlet - { - type inletOutlet; - inletValue uniform 0.0; - } - inletSides - { - type fixedValue; - value uniform 0.01; - } - inletCentral - { - type fixedValue; - value uniform 0.01; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/T b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/T deleted file mode 100644 index 5e3608010f..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/T +++ /dev/null @@ -1,54 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object T; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 1 0 0 0]; - -internalField uniform 473.0; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - walls - { - type zeroGradient; - } - outlet - { - type inletOutlet; - inletValue uniform 473.0; - } - inletSides - { - type fixedValue; - value uniform 473.0; - } - inletCentral - { - type fixedValue; - value uniform 573.0; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/U b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/U deleted file mode 100644 index d0a367501d..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/U +++ /dev/null @@ -1,56 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volVectorField; - location "0"; - object U; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -1 0 0 0 0]; - -internalField uniform (0 0 0); - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - inletCentral - { - type flowRateInletVelocity; - massFlowRate constant 0.00379; - value uniform (0 14.68 0); - } - inletSides - { - type flowRateInletVelocity; - massFlowRate constant 0.00832; - value uniform (0 17.79 0); - } - outlet - { - type inletOutlet; - inletValue uniform (0 0 0); - } - walls - { - type noSlip; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/air b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/air deleted file mode 100644 index 29cc2be2dd..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/air +++ /dev/null @@ -1,54 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object air; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.99; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - walls - { - type zeroGradient; - } - outlet - { - type inletOutlet; - inletValue uniform 1.0; - } - inletSides - { - type fixedValue; - value uniform 0.99; - } - inletCentral - { - type fixedValue; - value uniform 0.99; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/alphat b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/alphat deleted file mode 100644 index 97f4ec8f38..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/alphat +++ /dev/null @@ -1,56 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object alphat; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [1 -1 -1 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - inletCentral - { - type calculated; - value uniform 0; - } - inletSides - { - type calculated; - value uniform 0; - } - outlet - { - type calculated; - value uniform 0; - } - walls - { - type compressible::alphatWallFunction; - Prt 0.85; - value uniform 0; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/k b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/k deleted file mode 100644 index d5f5819e48..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/k +++ /dev/null @@ -1,57 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object k; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -2 0 0 0 0]; - -internalField uniform 3.75e-9; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - inletCentral - { - type turbulentIntensityKineticEnergyInlet; - intensity 0.15; - value uniform 3.75e-9; - } - inletSides - { - type turbulentIntensityKineticEnergyInlet; - intensity 0.16; - value uniform 3.75e-9; - } - outlet - { - type inletOutlet; - inletValue uniform 3.75e-9; - } - walls - { - type kqRWallFunction; - value uniform 0; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/nut b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/nut deleted file mode 100644 index c89f6e4044..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/nut +++ /dev/null @@ -1,58 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object nut; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -1 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - inletCentral - { - type calculated; - value uniform 0; - } - inletSides - { - type calculated; - value uniform 0; - } - outlet - { - type calculated; - value uniform 0; - } - walls - { - type nutkWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value uniform 0; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/omega b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/omega deleted file mode 100644 index 26af2dccdd..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/omega +++ /dev/null @@ -1,62 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object omega; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 -1 0 0 0 0]; - -internalField uniform 4.5e-3; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - inletCentral - { - type turbulentMixingLengthFrequencyInlet; - mixingLength 0.007; - k k; - value uniform 4.5e-3; - } - inletSides - { - type turbulentMixingLengthFrequencyInlet; - mixingLength 0.007; - k k; - value uniform 4.5e-3; - } - outlet - { - type inletOutlet; - inletValue uniform 4.5e-3; - } - walls - { - type omegaWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value $internalField; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/p b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/p deleted file mode 100644 index bef7aaa77a..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/0/p +++ /dev/null @@ -1,52 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object p; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [1 -1 -2 0 0 0 0]; - -internalField uniform 100000; - -boundaryField -{ - back - { - type symmetryPlane; - } - front - { - type symmetryPlane; - } - inletCentral - { - type zeroGradient; - } - inletSides - { - type zeroGradient; - } - outlet - { - type fixedValue; - value uniform 100000; - } - walls - { - type zeroGradient; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allclean b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allclean index f0cffd5b25..df77730bc3 100755 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allclean +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allclean @@ -7,10 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory # remove old time and post-processing directories rm -rf 0 *[1-9]* processor* postProcessing - -# copy 0.org to 0 -cp -r 0.org 0 - cleanCase #------------------------------------------------------------------------------ diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun new file mode 100755 index 0000000000..35dc16c075 --- /dev/null +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun @@ -0,0 +1,20 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# create mesh +runApplication blockMesh + +cp -r 0.org 0 + +# initialise with potentialFoam solution +runApplication potentialFoam + +rm -f 0/phi + +# run the solver +runApplication `getApplication` + +#------------------------------------------------------------------------------ diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/controlDict b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/controlDict index 91aadac3e0..6bdfd86aaa 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/controlDict +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/controlDict @@ -45,6 +45,10 @@ timePrecision 6; runTimeModifiable yes; +profiling +{ + memInfo true; +} functions { From facb1457f2e7d1482b227a6f2209d46ddcc21057 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 22 Jun 2016 10:04:48 +0100 Subject: [PATCH 14/19] ENH: snappyHexMesh: move locationInMesh away from rotor. snappyHexMesh filters out zero-sized patches so no more createPatches. Fixes part of #152 --- .../incompressible/simpleFoam/rotorDisk/Allrun | 1 - .../simpleFoam/rotorDisk/system/snappyHexMeshDict | 14 +++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/tutorials/incompressible/simpleFoam/rotorDisk/Allrun b/tutorials/incompressible/simpleFoam/rotorDisk/Allrun index 14d69c2a9a..f6f1258231 100755 --- a/tutorials/incompressible/simpleFoam/rotorDisk/Allrun +++ b/tutorials/incompressible/simpleFoam/rotorDisk/Allrun @@ -8,7 +8,6 @@ cd ${0%/*} || exit 1 # Run from this directory runApplication blockMesh runApplication surfaceFeatureExtract runApplication snappyHexMesh -overwrite -runApplication createPatch -overwrite runApplication $(getApplication) diff --git a/tutorials/incompressible/simpleFoam/rotorDisk/system/snappyHexMeshDict b/tutorials/incompressible/simpleFoam/rotorDisk/system/snappyHexMeshDict index 81afb27c64..35b0bb756f 100644 --- a/tutorials/incompressible/simpleFoam/rotorDisk/system/snappyHexMeshDict +++ b/tutorials/incompressible/simpleFoam/rotorDisk/system/snappyHexMeshDict @@ -101,8 +101,9 @@ castellatedMeshControls } } - locationInMesh (1e-5 1e-5 1e-5); // Offset from (0 0 0) to avoid - // coinciding with face or edge + locationInMesh (1e-5 -1e-2 1e-5);// Offset from (0 0 0) to avoid + // coinciding with face or edge and keep + // away from disk itself } snapControls @@ -120,9 +121,6 @@ addLayersControls expansionRatio 1.2; finalLayerThickness 0.5; minThickness 1e-3; -// firstLayerThickness 0.01; - -// maxThicknessToMedialRatio 0.6; } meshQualityControls @@ -130,12 +128,6 @@ meshQualityControls // minTetQuality -1e+30; } -writeFlags -( - scalarLevels - layerSets - layerFields -); mergeTolerance 1e-6; From 606b952246324e085b04e384cd4d2757a59250f0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 22 Jun 2016 10:20:42 +0100 Subject: [PATCH 15/19] ENH: wallBoiling: underrelax mass transfer, solve intermediates tighter Fixes wallBoiling mentioned in #141 --- .../RAS/wallBoiling/system/fvSolution | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution index ff61cafc76..0a396b99ca 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution @@ -35,7 +35,7 @@ solvers agglomerator faceAreaPair; mergeLevels 1; tolerance 1e-8; - relTol 0.1; + relTol 0.01; maxIter 100; minIter 2; } @@ -98,7 +98,7 @@ relaxationFactors { fields { - iDmdt 0.4; + iDmdt 0.1; } equations From bcb17b23b142e2c7d8bcebca7603b71c37dfc66c Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 22 Jun 2016 11:21:00 +0100 Subject: [PATCH 16/19] ENH: createPatch: removed createPatch after snappyHexMesh to remove zero-sized patches This is now handled inside snappyHexMesh with the keepPatches setting. --- .../annularThermalMixer/Allrun | 1 - .../system/createPatchDict | 28 ------------------ .../rotorDisk/system/createPatchDict | 29 ------------------- .../ras/mixerVesselAMI/Allrun.pre | 3 -- .../ras/mixerVesselAMI/system/createPatchDict | 27 ----------------- 5 files changed, 88 deletions(-) delete mode 100644 tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/system/createPatchDict delete mode 100644 tutorials/incompressible/simpleFoam/rotorDisk/system/createPatchDict delete mode 100644 tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/createPatchDict diff --git a/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun b/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun index 5bf2beb557..24b6237449 100755 --- a/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun +++ b/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun @@ -13,7 +13,6 @@ if [ -d 0 ] ; then rm -rf 0 fi -runApplication createPatch -overwrite runApplication createBaffles -overwrite runApplication mergeOrSplitBaffles -split -overwrite diff --git a/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/system/createPatchDict b/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/system/createPatchDict deleted file mode 100644 index ef1206a09b..0000000000 --- a/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/system/createPatchDict +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object createPatchDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Do a synchronisation of coupled points after creation of any patches. -// Note: this does not work with points that are on multiple coupled patches -// with transformations (i.e. cyclics). -pointSync false; - -// Patches to create. An empty patch list just removes patches with zero -// faces from $FOAM_CASE/constant/polyMesh/boundary. -patches -( -); - -// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/rotorDisk/system/createPatchDict b/tutorials/incompressible/simpleFoam/rotorDisk/system/createPatchDict deleted file mode 100644 index 826307e447..0000000000 --- a/tutorials/incompressible/simpleFoam/rotorDisk/system/createPatchDict +++ /dev/null @@ -1,29 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object createPatchDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Do a synchronisation of coupled points after creation of any patches. -// Note: this does not work with points that are on multiple coupled patches -// with transformations (i.e. cyclics). -pointSync false; - -// Patches to create. An empty patch list just removes patches with zero -// faces from $FOAM_CASE/constant/polyMesh/boundary. -patches -( - -); - -// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre index 94f5661673..a491c1ae2e 100755 --- a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre +++ b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre @@ -16,9 +16,6 @@ runApplication snappyHexMesh -overwrite runApplication createBaffles -overwrite runApplication mergeOrSplitBaffles -split -overwrite -# Get rid of zero faced patches -runApplication createPatch -overwrite - # Copy fields after meshing to avoind the generation of unnecessary patch fields \cp -r 0.org 0 diff --git a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/createPatchDict b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/createPatchDict deleted file mode 100644 index e7cb1687cb..0000000000 --- a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/createPatchDict +++ /dev/null @@ -1,27 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: plus | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object createPatchDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Do a synchronisation of coupled points after creation of any patches. -// Note: this does not work with points that are on multiple coupled patches -// with transformations (i.e. cyclics). -pointSync false; - -// Patches to create. -patches -( -); - -// ************************************************************************* // From 2ca4082852e4669aeae3a8866f24739deb8f5617 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 22 Jun 2016 16:12:18 +0100 Subject: [PATCH 17/19] ENH: snappyHexMesh: add profiling of snappyHexMesh --- .../incompressible/pisoFoam/les/motorBike/motorBike/Allrun | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun index 70d7a99bb6..3aa5f32e81 100755 --- a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun +++ b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun @@ -15,7 +15,7 @@ runApplication blockMesh runApplication decomposePar -decomposeParDict system/decomposeParDict.hierarchical # cp system/decomposeParDict.ptscotch system/decomposeParDict -runParallel snappyHexMesh -decomposeParDict system/decomposeParDict.ptscotch -overwrite -parallel +runParallel snappyHexMesh -decomposeParDict system/decomposeParDict.ptscotch -profiling -overwrite -parallel find . -type f -iname "*level*" -exec rm {} \; From 85e246b8f277e944cac57da4b34ad88c6b8befe7 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 22 Jun 2016 17:20:15 +0200 Subject: [PATCH 18/19] BUG: profiling dictionary could be binary/compressed (fixed #157) BUG: memInfo not activated by -profiling option (fixed #157) --- src/OpenFOAM/db/Time/Time.C | 30 ++++++++++++++++------- src/OpenFOAM/global/profiling/profiling.C | 16 ++++++++++++ src/OpenFOAM/global/profiling/profiling.H | 8 ++++++ 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index e2cc8e28b5..7792e9dca2 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -336,16 +336,28 @@ void Foam::Time::setControls() void Foam::Time::setMonitoring(bool forceProfiling) { - // initialize profiling on request - // skip if 'active' keyword is explicitly set to false - const dictionary* profilingDict = - ( - forceProfiling - ? &dictionary::null - : controlDict_.subDictPtr("profiling") - ); + const dictionary* profilingDict = controlDict_.subDictPtr("profiling"); - if + // initialize profiling on request + // otherwise rely on profiling entry within controlDict + // and skip if 'active' keyword is explicitly set to false + if (forceProfiling) + { + profiling::initialize + ( + IOobject + ( + "profiling", + timeName(), + "uniform", + *this, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + *this + ); + } + else if ( profilingDict && profilingDict->lookupOrDefault("active", true) diff --git a/src/OpenFOAM/global/profiling/profiling.C b/src/OpenFOAM/global/profiling/profiling.C index f64504f75a..f1aec91820 100644 --- a/src/OpenFOAM/global/profiling/profiling.C +++ b/src/OpenFOAM/global/profiling/profiling.C @@ -438,6 +438,22 @@ bool Foam::profiling::writeData(Ostream& os) const } +bool Foam::profiling::writeObject +( + IOstream::streamFormat, + IOstream::versionNumber ver, + IOstream::compressionType +) const +{ + return regIOobject::writeObject + ( + IOstream::ASCII, + ver, + IOstream::UNCOMPRESSED + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::profiling::Information* Foam::profiling::store(Information *info) diff --git a/src/OpenFOAM/global/profiling/profiling.H b/src/OpenFOAM/global/profiling/profiling.H index 409cbff461..4986a92168 100644 --- a/src/OpenFOAM/global/profiling/profiling.H +++ b/src/OpenFOAM/global/profiling/profiling.H @@ -207,6 +207,14 @@ public: //- writeData member function required by regIOobject virtual bool writeData(Ostream&) const; + //- Write as uncompressed ASCII, using given format + virtual bool writeObject + ( + IOstream::streamFormat ignoreAlwaysASCII, + IOstream::versionNumber ver, + IOstream::compressionType ignoreAlwaysUncompressed + ) const; + }; From cc68190167fa54d245401357ed749a5b81b39281 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Wed, 22 Jun 2016 16:52:16 +0100 Subject: [PATCH 19/19] BUG: runTimePostProcessing - set the appropriate cell or point data type. Fixes #155 --- .../fieldVisualisationBase.C | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C index b90c26955c..bfdbbcb566 100644 --- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C +++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C @@ -29,6 +29,7 @@ License // VTK includes #include "vtkArrowSource.h" +#include "vtkCellData.h" #include "vtkColorTransferFunction.h" #include "vtkFloatArray.h" #include "vtkGlyph3D.h" @@ -136,7 +137,7 @@ void Foam::fieldVisualisationBase::addScalarBar vtkLookupTable* lut ) const { - // add scalar bar legend + // Add scalar bar legend if (!scalarBar_.visible_) { return; @@ -149,7 +150,7 @@ void Foam::fieldVisualisationBase::addScalarBar const vector textColour = colours_["text"]->value(position); - // workaround to supply our own scalarbar title + // Work-around to supply our own scalarbar title vtkSmartPointer titleActor = vtkSmartPointer::New(); sbar->SetTitle(" "); @@ -212,7 +213,7 @@ void Foam::fieldVisualisationBase::addScalarBar { sbar->SetOrientationToHorizontal(); - // adjustments since not using scalarbar title property + // Adjustments since not using scalarbar title property sbar->SetWidth(0.75); sbar->SetHeight(0.07); sbar->SetBarRatio(0.5); @@ -257,22 +258,40 @@ void Foam::fieldVisualisationBase::setField } case cbField: { - // create look-up table for colours + // Create look-up table for colours vtkSmartPointer lut = vtkSmartPointer::New(); setColourMap(lut); lut->SetVectorMode(vtkScalarsToColors::MAGNITUDE); - // configure the mapper + // Configure the mapper mapper->SelectColorArray(colourFieldName.c_str()); mapper->SetScalarRange(range_.first(), range_.second()); - mapper->SetScalarModeToUsePointFieldData(); + + // Set to use either cell or point data + vtkPolyData* pData = mapper->GetInput(); + const char* fieldName = colourFieldName.c_str(); + if (pData->GetCellData()->HasArray(fieldName) == 1) + { + mapper->SetScalarModeToUseCellFieldData(); + } + else if (pData->GetPointData()->HasArray(fieldName) == 1) + { + mapper->SetScalarModeToUsePointFieldData(); + } + else + { + WarningInFunction + << "Unable to determine cell or point data type " + << "- assuming point data"; + mapper->SetScalarModeToUsePointFieldData(); + } mapper->SetColorModeToMapScalars(); mapper->SetLookupTable(lut); mapper->ScalarVisibilityOn(); - // add the bar + // Add the bar addScalarBar(position, renderer, lut); break; } @@ -313,7 +332,7 @@ void Foam::fieldVisualisationBase::addGlyphs vtkSmartPointer::New(); sphere->SetCenter(0, 0, 0); sphere->SetRadius(0.5); -// setting higher resolution slows the rendering significantly +// Setting higher resolution slows the rendering significantly // sphere->SetPhiResolution(20); // sphere->SetThetaResolution(20); @@ -323,7 +342,7 @@ void Foam::fieldVisualisationBase::addGlyphs { double range[2]; -// can use values to find range +// Can use values to find range // vtkDataArray* values = // data->GetPointData()->GetScalars(scaleFieldName.c_str()); // values->GetRange(range); @@ -374,7 +393,7 @@ void Foam::fieldVisualisationBase::addGlyphs values->GetRange(range); /* - // attempt to set range for vectors... + // Attempt to set range for vectors... scalar x0 = sqrt(sqr(range_.first())/3.0); scalar x1 = sqrt(sqr(range_.second())/3.0); range[0] = x0;