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 {