mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-profiling' into 'develop'
high-level profiling/timing functionality See merge request !47
This commit is contained in:
3
applications/test/cpuInfo/Make/files
Normal file
3
applications/test/cpuInfo/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-cpuInfo.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-cpuInfo
|
||||||
0
applications/test/cpuInfo/Make/options
Normal file
0
applications/test/cpuInfo/Make/options
Normal file
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -21,49 +21,26 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "memInfo.H"
|
#include "cpuInfo.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
using namespace Foam;
|
||||||
|
|
||||||
Foam::memInfo::memInfo(Istream& is)
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
:
|
// Main program:
|
||||||
base1(is),
|
|
||||||
base2(is),
|
int main(int argc, char *argv[])
|
||||||
member1(is),
|
|
||||||
member2(is)
|
|
||||||
{
|
{
|
||||||
// Check state of Istream
|
cpuInfo().write(Info);
|
||||||
is.check("Foam::memInfo::memInfo(Foam::Istream&)");
|
Info<< endl;
|
||||||
}
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
// * * * * * * * * * * * * * * * 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
3
applications/test/sysInfo/Make/files
Normal file
3
applications/test/sysInfo/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-sysInfo.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-sysInfo
|
||||||
0
applications/test/sysInfo/Make/options
Normal file
0
applications/test/sysInfo/Make/options
Normal file
46
applications/test/sysInfo/Test-sysInfo.C
Normal file
46
applications/test/sysInfo/Test-sysInfo.C
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -59,6 +59,7 @@ Description
|
|||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "decompositionModel.H"
|
#include "decompositionModel.H"
|
||||||
#include "fvMeshTools.H"
|
#include "fvMeshTools.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -633,6 +634,7 @@ int main(int argc, char *argv[])
|
|||||||
"fileName",
|
"fileName",
|
||||||
"name of the file to save the simplified surface to"
|
"name of the file to save the simplified surface to"
|
||||||
);
|
);
|
||||||
|
#include "addProfilingOption.H"
|
||||||
#include "addDictOption.H"
|
#include "addDictOption.H"
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
@ -816,7 +818,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false));
|
const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false));
|
||||||
|
|
||||||
|
|
||||||
// Read decomposePar dictionary
|
// Read decomposePar dictionary
|
||||||
dictionary decomposeDict;
|
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
|
// Read geometry
|
||||||
// ~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~
|
||||||
@ -957,6 +960,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (surfaceSimplify)
|
if (surfaceSimplify)
|
||||||
{
|
{
|
||||||
|
addProfiling(surfaceSimplify, "snappyHexMesh::surfaceSimplify");
|
||||||
IOdictionary foamyHexMeshDict
|
IOdictionary foamyHexMeshDict
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -1001,6 +1005,8 @@ int main(int argc, char *argv[])
|
|||||||
refineDict.lookupOrDefault("gapLevelIncrement", 0),
|
refineDict.lookupOrDefault("gapLevelIncrement", 0),
|
||||||
initialCellSize/defaultCellSize
|
initialCellSize/defaultCellSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
profiling::writeNow();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1535,6 +1541,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Mesh refined in = "
|
Info<< "Mesh refined in = "
|
||||||
<< timer.cpuTimeIncrement() << " s." << endl;
|
<< timer.cpuTimeIncrement() << " s." << endl;
|
||||||
|
|
||||||
|
profiling::writeNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wantSnap)
|
if (wantSnap)
|
||||||
@ -1583,6 +1591,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Mesh snapped in = "
|
Info<< "Mesh snapped in = "
|
||||||
<< timer.cpuTimeIncrement() << " s." << endl;
|
<< timer.cpuTimeIncrement() << " s." << endl;
|
||||||
|
|
||||||
|
profiling::writeNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wantLayers)
|
if (wantLayers)
|
||||||
@ -1639,11 +1649,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Layers added in = "
|
Info<< "Layers added in = "
|
||||||
<< timer.cpuTimeIncrement() << " s." << endl;
|
<< timer.cpuTimeIncrement() << " s." << endl;
|
||||||
|
|
||||||
|
profiling::writeNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
addProfiling(checkMesh, "snappyHexMesh::checkMesh");
|
||||||
|
|
||||||
// Check final mesh
|
// Check final mesh
|
||||||
Info<< "Checking final mesh ..." << endl;
|
Info<< "Checking final mesh ..." << endl;
|
||||||
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
|
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
|
||||||
@ -1665,11 +1678,15 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Finished meshing without any errors" << endl;
|
Info<< "Finished meshing without any errors" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profiling::writeNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (surfaceSimplify)
|
if (surfaceSimplify)
|
||||||
{
|
{
|
||||||
|
addProfiling(surfaceSimplify, "snappyHexMesh::surfaceSimplify");
|
||||||
|
|
||||||
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
|
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
|
||||||
|
|
||||||
labelHashSet includePatches(bMesh.size());
|
labelHashSet includePatches(bMesh.size());
|
||||||
@ -1727,6 +1744,7 @@ int main(int argc, char *argv[])
|
|||||||
cellCentres.write();
|
cellCentres.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profiling::writeNow();
|
||||||
|
|
||||||
Info<< "Finished meshing in = "
|
Info<< "Finished meshing in = "
|
||||||
<< runTime.elapsedCpuTime() << " s." << endl;
|
<< runTime.elapsedCpuTime() << " s." << endl;
|
||||||
|
|||||||
@ -10,6 +10,7 @@ fileStat.C
|
|||||||
POSIX.C
|
POSIX.C
|
||||||
cpuTime/cpuTime.C
|
cpuTime/cpuTime.C
|
||||||
clockTime/clockTime.C
|
clockTime/clockTime.C
|
||||||
|
cpuInfo/cpuInfo.C
|
||||||
memInfo/memInfo.C
|
memInfo/memInfo.C
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
241
src/OSspecific/POSIX/cpuInfo/cpuInfo.C
Normal file
241
src/OSspecific/POSIX/cpuInfo/cpuInfo.C
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cpuInfo.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope function
|
||||||
|
template<class T>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
110
src/OSspecific/POSIX/cpuInfo/cpuInfo.H
Normal file
110
src/OSspecific/POSIX/cpuInfo/cpuInfo.H
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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 <string>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,14 +24,29 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "memInfo.H"
|
#include "memInfo.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope function
|
||||||
|
template<class T>
|
||||||
|
inline static void writeEntry
|
||||||
|
(
|
||||||
|
Foam::Ostream& os, const Foam::word& key, const T& value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os.writeKeyword(key) << value << Foam::token::END_STATEMENT << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::memInfo::memInfo()
|
Foam::memInfo::memInfo()
|
||||||
:
|
:
|
||||||
peak_(-1),
|
peak_(0),
|
||||||
size_(-1),
|
size_(0),
|
||||||
rss_(-1)
|
rss_(0)
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -48,7 +63,7 @@ Foam::memInfo::~memInfo()
|
|||||||
const Foam::memInfo& Foam::memInfo::update()
|
const Foam::memInfo& Foam::memInfo::update()
|
||||||
{
|
{
|
||||||
// reset to invalid values first
|
// reset to invalid values first
|
||||||
peak_ = size_ = rss_ = -1;
|
peak_ = size_ = rss_ = 0;
|
||||||
IFstream is("/proc/" + name(pid()) + "/status");
|
IFstream is("/proc/" + name(pid()) + "/status");
|
||||||
|
|
||||||
while (is.good())
|
while (is.good())
|
||||||
@ -81,7 +96,15 @@ const Foam::memInfo& Foam::memInfo::update()
|
|||||||
|
|
||||||
bool Foam::memInfo::valid() const
|
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)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const memInfo& m)
|
||||||
{
|
{
|
||||||
os << token::BEGIN_LIST
|
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;
|
<< token::END_LIST;
|
||||||
|
|
||||||
// Check state of Ostream
|
// Check state of Ostream
|
||||||
os.check
|
os.check
|
||||||
(
|
(
|
||||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, const Foam::memInfo&)"
|
||||||
"const Foam::memInfo&)"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,7 +28,7 @@ Description
|
|||||||
Memory usage information for the process running this object.
|
Memory usage information for the process running this object.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
Uses the information from /proc/\<pid\>/status
|
Uses the information from /proc/PID/status
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
memInfo.C
|
memInfo.C
|
||||||
@ -47,6 +47,10 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// forward declarations
|
||||||
|
class Istream;
|
||||||
|
class Ostream;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class memInfo Declaration
|
Class memInfo Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -55,15 +59,20 @@ class memInfo
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Peak memory used by the process (VmPeak in /proc/\<pid\>/status)
|
//- Peak memory used by the process (VmPeak in /proc/PID/status)
|
||||||
int peak_;
|
int peak_;
|
||||||
|
|
||||||
//- Memory used by the process (VmSize in /proc/\<pid\>/status)
|
//- Memory used by the process (VmSize in /proc/PID/status)
|
||||||
int size_;
|
int size_;
|
||||||
|
|
||||||
//- Resident set size of the process (VmRSS in /proc/\<pid\>/status)
|
//- Resident set size of the process (VmRSS in /proc/PID/status)
|
||||||
int rss_;
|
int rss_;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const memInfo&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default copy constructor
|
||||||
|
memInfo(const memInfo&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -79,27 +88,24 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Parse /proc/\<pid\>/status
|
//- Parse /proc/PID/status and update accordingly
|
||||||
const memInfo& update();
|
const memInfo& update();
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Access the stored peak memory (VmPeak in /proc/\<pid\>/status)
|
//- Peak memory (VmPeak in /proc/PID/status) at last update()
|
||||||
// The value is stored from the previous update()
|
|
||||||
int peak() const
|
int peak() const
|
||||||
{
|
{
|
||||||
return peak_;
|
return peak_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Access the stored memory size (VmSize in /proc/\<pid\>/status)
|
//- Memory size (VmSize in /proc/PID/status) at last update()
|
||||||
// The value is stored from the previous update()
|
|
||||||
int size() const
|
int size() const
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Access the stored rss value (VmRSS in /proc/\<pid\>/status)
|
//- Resident set size (VmRSS in /proc/PID/status) at last update()
|
||||||
// The value is stored from the previous update()
|
|
||||||
int rss() const
|
int rss() const
|
||||||
{
|
{
|
||||||
return rss_;
|
return rss_;
|
||||||
@ -109,6 +115,10 @@ public:
|
|||||||
bool valid() const;
|
bool valid() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Write content as dictionary entries
|
||||||
|
void write(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
//- Read peak/size/rss from stream
|
//- Read peak/size/rss from stream
|
||||||
|
|||||||
@ -3,6 +3,8 @@ global/global.Cver
|
|||||||
/* global/constants/dimensionedConstants.C in global.Cver */
|
/* global/constants/dimensionedConstants.C in global.Cver */
|
||||||
global/argList/argList.C
|
global/argList/argList.C
|
||||||
global/clock/clock.C
|
global/clock/clock.C
|
||||||
|
global/profiling/profiling.C
|
||||||
|
global/profiling/profilingSysInfo.C
|
||||||
|
|
||||||
bools = primitives/bools
|
bools = primitives/bools
|
||||||
$(bools)/bool/bool.C
|
$(bools)/bool/bool.C
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@ -333,6 +334,60 @@ 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")
|
||||||
|
);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
profilingDict
|
||||||
|
&& profilingDict->lookupOrDefault<Switch>("active", true)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
profiling::initialize
|
||||||
|
(
|
||||||
|
*profilingDict,
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"profiling",
|
||||||
|
timeName(),
|
||||||
|
"uniform",
|
||||||
|
*this,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
*this
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Time::Time
|
Foam::Time::Time
|
||||||
@ -401,25 +456,7 @@ Foam::Time::Time
|
|||||||
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||||
|
|
||||||
setControls();
|
setControls();
|
||||||
|
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
|
|
||||||
controlDict_.files().clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -496,24 +533,8 @@ Foam::Time::Time
|
|||||||
|
|
||||||
setControls();
|
setControls();
|
||||||
|
|
||||||
// Time objects not registered so do like objectRegistry::checkIn ourselves.
|
// '-profiling' = force profiling, ignore controlDict entry
|
||||||
if (runTimeModifiable_)
|
setMonitoring(args.optionFound("profiling"));
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -588,25 +609,7 @@ Foam::Time::Time
|
|||||||
controlDict_.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
controlDict_.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||||
|
|
||||||
setControls();
|
setControls();
|
||||||
|
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 since not needed
|
|
||||||
controlDict_.files().clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -667,6 +670,7 @@ Foam::Time::Time
|
|||||||
functionObjects_(*this, enableFunctionObjects)
|
functionObjects_(*this, enableFunctionObjects)
|
||||||
{
|
{
|
||||||
libs_.open(controlDict_, "libs");
|
libs_.open(controlDict_, "libs");
|
||||||
|
setMonitoring(); // for profiling etc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -681,6 +685,9 @@ Foam::Time::~Time()
|
|||||||
|
|
||||||
// destroy function objects first
|
// destroy function objects first
|
||||||
functionObjects_.clear();
|
functionObjects_.clear();
|
||||||
|
|
||||||
|
// cleanup profiling
|
||||||
|
profiling::stop(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -922,9 +929,13 @@ bool Foam::Time::run() const
|
|||||||
{
|
{
|
||||||
// Ensure functionObjects execute on last time step
|
// Ensure functionObjects execute on last time step
|
||||||
// (and hence write uptodate functionObjectProperties)
|
// (and hence write uptodate functionObjectProperties)
|
||||||
|
addProfiling(foExec, "functionObjects.execute()");
|
||||||
functionObjects_.execute();
|
functionObjects_.execute();
|
||||||
|
endProfiling(foExec);
|
||||||
|
|
||||||
|
addProfiling(foEnd, "functionObjects.end()");
|
||||||
functionObjects_.end();
|
functionObjects_.end();
|
||||||
|
endProfiling(foEnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -936,10 +947,12 @@ bool Foam::Time::run() const
|
|||||||
|
|
||||||
if (timeIndex_ == startTimeIndex_)
|
if (timeIndex_ == startTimeIndex_)
|
||||||
{
|
{
|
||||||
|
addProfiling(functionObjects, "functionObjects.start()");
|
||||||
functionObjects_.start();
|
functionObjects_.start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
addProfiling(functionObjects, "functionObjects.execute()");
|
||||||
functionObjects_.execute();
|
functionObjects_.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -181,6 +181,10 @@ protected:
|
|||||||
//- Set the controls from the current controlDict
|
//- Set the controls from the current controlDict
|
||||||
void setControls();
|
void setControls();
|
||||||
|
|
||||||
|
//- Set file monitoring, profiling, etc
|
||||||
|
// Optionally force profiling without inspecting the controlDict
|
||||||
|
void setMonitoring(const bool forceProfiling=false);
|
||||||
|
|
||||||
//- Read the control dictionary and set the write controls etc.
|
//- Read the control dictionary and set the write controls etc.
|
||||||
virtual void readDict();
|
virtual void readDict();
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
#include "simpleObjectRegistry.H"
|
#include "simpleObjectRegistry.H"
|
||||||
#include "dimensionedConstants.H"
|
#include "dimensionedConstants.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -518,6 +519,8 @@ bool Foam::Time::writeObject
|
|||||||
{
|
{
|
||||||
if (outputTime())
|
if (outputTime())
|
||||||
{
|
{
|
||||||
|
addProfiling(writing, "objectRegistry::writeObject");
|
||||||
|
|
||||||
const word tmName(timeName());
|
const word tmName(timeName());
|
||||||
|
|
||||||
IOdictionary timeDict
|
IOdictionary timeDict
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "functionObjectList.H"
|
#include "functionObjectList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "mapPolyMesh.H"
|
#include "mapPolyMesh.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -220,6 +221,12 @@ bool Foam::functionObjectList::execute(const bool forceWrite)
|
|||||||
|
|
||||||
forAll(*this, objectI)
|
forAll(*this, objectI)
|
||||||
{
|
{
|
||||||
|
addProfiling
|
||||||
|
(
|
||||||
|
fo,
|
||||||
|
"functionObject::" + operator[](objectI).name() + "::execute"
|
||||||
|
);
|
||||||
|
|
||||||
ok = operator[](objectI).execute(forceWrite) && ok;
|
ok = operator[](objectI).execute(forceWrite) && ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,6 +264,12 @@ bool Foam::functionObjectList::end()
|
|||||||
|
|
||||||
forAll(*this, objectI)
|
forAll(*this, objectI)
|
||||||
{
|
{
|
||||||
|
addProfiling
|
||||||
|
(
|
||||||
|
fo,
|
||||||
|
"functionObject::" + operator[](objectI).name() + "::end"
|
||||||
|
);
|
||||||
|
|
||||||
ok = operator[](objectI).end() && ok;
|
ok = operator[](objectI).end() && ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,6 +352,8 @@ bool Foam::functionObjectList::read()
|
|||||||
|
|
||||||
label nFunc = 0;
|
label nFunc = 0;
|
||||||
|
|
||||||
|
addProfiling(fo,"functionObjects::read");
|
||||||
|
|
||||||
if (entryPtr->isDict())
|
if (entryPtr->isDict())
|
||||||
{
|
{
|
||||||
// A dictionary of functionObjects
|
// A dictionary of functionObjects
|
||||||
@ -366,12 +381,24 @@ bool Foam::functionObjectList::read()
|
|||||||
// An existing functionObject, and dictionary changed
|
// An existing functionObject, and dictionary changed
|
||||||
if (newDigs[nFunc] != digests_[oldIndex])
|
if (newDigs[nFunc] != digests_[oldIndex])
|
||||||
{
|
{
|
||||||
|
addProfiling
|
||||||
|
(
|
||||||
|
fo2,
|
||||||
|
"functionObject::" + objPtr->name() + "::read"
|
||||||
|
);
|
||||||
|
|
||||||
ok = objPtr->read(dict) && ok;
|
ok = objPtr->read(dict) && ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// New functionObject
|
// New functionObject
|
||||||
|
addProfiling
|
||||||
|
(
|
||||||
|
fo2,
|
||||||
|
"functionObject::" + key + "::start"
|
||||||
|
);
|
||||||
|
|
||||||
objPtr = functionObject::New(key, time_, dict).ptr();
|
objPtr = functionObject::New(key, time_, dict).ptr();
|
||||||
ok = objPtr->start() && ok;
|
ok = objPtr->start() && ok;
|
||||||
}
|
}
|
||||||
|
|||||||
546
src/OpenFOAM/global/profiling/profiling.C
Normal file
546
src/OpenFOAM/global/profiling/profiling.C
Normal file
@ -0,0 +1,546 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#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 * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::profiling* Foam::profiling::pool_(0);
|
||||||
|
|
||||||
|
Foam::label Foam::profiling::Information::nextId_(0);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope function
|
||||||
|
template<class T>
|
||||||
|
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_++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::profiling::Information::raiseID(label maxVal)
|
||||||
|
{
|
||||||
|
if (nextId_ < maxVal)
|
||||||
|
{
|
||||||
|
nextId_ = 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,
|
||||||
|
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<< "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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (pool_->memInfo_)
|
||||||
|
{
|
||||||
|
info->maxMem_ = Foam::max
|
||||||
|
(
|
||||||
|
info->maxMem_,
|
||||||
|
pool_->memInfo_->update().size()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::profiling::unstack(const Information *info)
|
||||||
|
{
|
||||||
|
if (pool_ && info)
|
||||||
|
{
|
||||||
|
Information *top = pool_->pop();
|
||||||
|
|
||||||
|
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_(),
|
||||||
|
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<Switch>("sysInfo", true)
|
||||||
|
? new sysInfo() : 0
|
||||||
|
),
|
||||||
|
cpuInfo_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault<Switch>("cpuInfo", true)
|
||||||
|
? new cpuInfo() : 0
|
||||||
|
),
|
||||||
|
memInfo_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault<Switch>("memInfo", false)
|
||||||
|
? new memInfo() : 0
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::profiling::Information::Information()
|
||||||
|
:
|
||||||
|
id_(getNextId()),
|
||||||
|
description_("application::main"),
|
||||||
|
parent_(this),
|
||||||
|
calls_(0),
|
||||||
|
totalTime_(0),
|
||||||
|
childTime_(0),
|
||||||
|
maxMem_(0),
|
||||||
|
onStack_(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::profiling::Information::Information
|
||||||
|
(
|
||||||
|
Information *parent,
|
||||||
|
const string& descr
|
||||||
|
)
|
||||||
|
:
|
||||||
|
id_(getNextId()),
|
||||||
|
description_(descr),
|
||||||
|
parent_(parent),
|
||||||
|
calls_(0),
|
||||||
|
totalTime_(0),
|
||||||
|
childTime_(0),
|
||||||
|
maxMem_(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()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(sysInfo_);
|
||||||
|
deleteDemandDrivenData(cpuInfo_);
|
||||||
|
deleteDemandDrivenData(memInfo_);
|
||||||
|
|
||||||
|
if (pool_ == this)
|
||||||
|
{
|
||||||
|
pool_ = 0;
|
||||||
|
Information::nextId_ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::profiling::Information::~Information()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::profiling::Trigger::~Trigger()
|
||||||
|
{
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * 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);
|
||||||
|
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<const Information*> 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;
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * 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_.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::profiling::Trigger::running() const
|
||||||
|
{
|
||||||
|
return ptr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::profiling::Information::push() const
|
||||||
|
{
|
||||||
|
onStack_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::profiling::Information::pop() const
|
||||||
|
{
|
||||||
|
onStack_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
if (maxMem_)
|
||||||
|
{
|
||||||
|
writeEntry(os, "maxMem", maxMem_);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
478
src/OpenFOAM/global/profiling/profiling.H
Normal file
478
src/OpenFOAM/global/profiling/profiling.H
Normal file
@ -0,0 +1,478 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::profiling
|
||||||
|
|
||||||
|
Description
|
||||||
|
Code profiling.
|
||||||
|
|
||||||
|
This is typically activated from within the system/controlDict as follows
|
||||||
|
(defaults shown):
|
||||||
|
\code
|
||||||
|
profiling
|
||||||
|
{
|
||||||
|
active true;
|
||||||
|
cpuInfo true;
|
||||||
|
memInfo false;
|
||||||
|
sysInfo true;
|
||||||
|
}
|
||||||
|
\endcode
|
||||||
|
or simply using all defaults:
|
||||||
|
\code
|
||||||
|
profiling
|
||||||
|
{}
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
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 dictionary;
|
||||||
|
class cpuInfo;
|
||||||
|
class memInfo;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class profiling Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class profiling
|
||||||
|
:
|
||||||
|
public regIOobject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Forward declarations of components
|
||||||
|
|
||||||
|
class Information;
|
||||||
|
class Trigger;
|
||||||
|
class sysInfo;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Static Data Members
|
||||||
|
|
||||||
|
//- Only one global pool object is possible
|
||||||
|
static profiling *pool_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Data Members
|
||||||
|
|
||||||
|
typedef HashPtrTable<Information, string> StorageContainer;
|
||||||
|
typedef LIFOStack<Information*> 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<clockTime*> timers_;
|
||||||
|
|
||||||
|
//- General system information (optional)
|
||||||
|
sysInfo* sysInfo_;
|
||||||
|
|
||||||
|
//- CPU-Information (optional)
|
||||||
|
cpuInfo* cpuInfo_;
|
||||||
|
|
||||||
|
//- MEM-Information (optional)
|
||||||
|
memInfo* memInfo_;
|
||||||
|
|
||||||
|
|
||||||
|
// 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, everything enabled
|
||||||
|
profiling(const IOobject&, const Time&);
|
||||||
|
|
||||||
|
//- Construct IO object with finer control over behaviour
|
||||||
|
profiling(const dictionary&, 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);
|
||||||
|
|
||||||
|
//- Remove from stack and remove timer lookup (based on Id).
|
||||||
|
// Returns pointer to profiling information element
|
||||||
|
Information* pop();
|
||||||
|
|
||||||
|
|
||||||
|
// Static control elements
|
||||||
|
|
||||||
|
//- 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&);
|
||||||
|
|
||||||
|
//- 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
|
||||||
|
|
||||||
|
//- 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;
|
||||||
|
|
||||||
|
//- 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_;
|
||||||
|
|
||||||
|
//- 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_;
|
||||||
|
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
//- Mark as being off the stack
|
||||||
|
void pop() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- 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 int maxMem() const
|
||||||
|
{
|
||||||
|
return maxMem_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 description.
|
||||||
|
// Descriptions beginning with 'application::' are reserved for
|
||||||
|
// internal use.
|
||||||
|
Trigger(const char* name);
|
||||||
|
|
||||||
|
//- Construct profiling with given description.
|
||||||
|
// Descriptions beginning with 'application::' are reserved for
|
||||||
|
// internal use.
|
||||||
|
Trigger(const string& name);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~Trigger();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- True if the triggered profiling is active
|
||||||
|
bool running() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Stop triggered profiling
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Macros
|
||||||
|
|
||||||
|
//- 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)
|
||||||
|
|
||||||
|
//- 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 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
|
||||||
|
// \sa addProfiling0
|
||||||
|
#define endProfiling(name) profilingTriggerFor##name.stop()
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
94
src/OpenFOAM/global/profiling/profilingSysInfo.C
Normal file
94
src/OpenFOAM/global/profiling/profilingSysInfo.C
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "profilingSysInfo.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "foamVersion.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope function
|
||||||
|
template<class T>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
114
src/OpenFOAM/global/profiling/profilingSysInfo.H
Normal file
114
src/OpenFOAM/global/profiling/profilingSysInfo.H
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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 sys-info, use dictionary format.
|
||||||
|
Ostream& write(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
5
src/OpenFOAM/include/addProfilingOption.H
Normal file
5
src/OpenFOAM/include/addProfilingOption.H
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Foam::argList::addBoolOption
|
||||||
|
(
|
||||||
|
"profiling",
|
||||||
|
"activate application-level profiling"
|
||||||
|
);
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -59,6 +59,7 @@ SourceFiles
|
|||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
#include "solverPerformance.H"
|
#include "solverPerformance.H"
|
||||||
#include "InfoProxy.H"
|
#include "InfoProxy.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -116,6 +117,7 @@ public:
|
|||||||
//- Convergence tolerance relative to the initial
|
//- Convergence tolerance relative to the initial
|
||||||
scalar relTol_;
|
scalar relTol_;
|
||||||
|
|
||||||
|
profiling::Trigger profiling_;
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -147,7 +147,8 @@ Foam::lduMatrix::solver::solver
|
|||||||
interfaceBouCoeffs_(interfaceBouCoeffs),
|
interfaceBouCoeffs_(interfaceBouCoeffs),
|
||||||
interfaceIntCoeffs_(interfaceIntCoeffs),
|
interfaceIntCoeffs_(interfaceIntCoeffs),
|
||||||
interfaces_(interfaces),
|
interfaces_(interfaces),
|
||||||
controlDict_(solverControls)
|
controlDict_(solverControls),
|
||||||
|
profiling_("lduMatrix::solver." + fieldName)
|
||||||
{
|
{
|
||||||
readControls();
|
readControls();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,6 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "smoothSolver.H"
|
#include "smoothSolver.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -87,6 +88,8 @@ Foam::solverPerformance Foam::smoothSolver::solve
|
|||||||
// If the nSweeps_ is negative do a fixed number of sweeps
|
// If the nSweeps_ is negative do a fixed number of sweeps
|
||||||
if (nSweeps_ < 0)
|
if (nSweeps_ < 0)
|
||||||
{
|
{
|
||||||
|
addProfiling(solve, "lduMatrix::smoother." + fieldName_);
|
||||||
|
|
||||||
autoPtr<lduMatrix::smoother> smootherPtr = lduMatrix::smoother::New
|
autoPtr<lduMatrix::smoother> smootherPtr = lduMatrix::smoother::New
|
||||||
(
|
(
|
||||||
fieldName_,
|
fieldName_,
|
||||||
@ -144,6 +147,8 @@ Foam::solverPerformance Foam::smoothSolver::solve
|
|||||||
|| !solverPerf.checkConvergence(tolerance_, relTol_)
|
|| !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(solve, "lduMatrix::smoother." + fieldName_);
|
||||||
|
|
||||||
autoPtr<lduMatrix::smoother> smootherPtr = lduMatrix::smoother::New
|
autoPtr<lduMatrix::smoother> smootherPtr = lduMatrix::smoother::New
|
||||||
(
|
(
|
||||||
fieldName_,
|
fieldName_,
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -23,6 +23,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -57,6 +59,8 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
|
|||||||
|
|
||||||
if (fieldI != -1)
|
if (fieldI != -1)
|
||||||
{
|
{
|
||||||
|
addProfiling(fvopt, "fvOption()." + source.name());
|
||||||
|
|
||||||
source.setApplied(fieldI);
|
source.setApplied(fieldI);
|
||||||
|
|
||||||
if (source.isActive())
|
if (source.isActive())
|
||||||
@ -113,6 +117,8 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
|
|||||||
|
|
||||||
if (fieldI != -1)
|
if (fieldI != -1)
|
||||||
{
|
{
|
||||||
|
addProfiling(fvopt, "fvOption()." + source.name());
|
||||||
|
|
||||||
source.setApplied(fieldI);
|
source.setApplied(fieldI);
|
||||||
|
|
||||||
if (source.isActive())
|
if (source.isActive())
|
||||||
@ -172,6 +178,8 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
|
|||||||
|
|
||||||
if (fieldI != -1)
|
if (fieldI != -1)
|
||||||
{
|
{
|
||||||
|
addProfiling(fvopt, "fvOption()." + source.name());
|
||||||
|
|
||||||
source.setApplied(fieldI);
|
source.setApplied(fieldI);
|
||||||
|
|
||||||
if (source.isActive())
|
if (source.isActive())
|
||||||
@ -255,6 +263,8 @@ void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn)
|
|||||||
|
|
||||||
if (fieldI != -1)
|
if (fieldI != -1)
|
||||||
{
|
{
|
||||||
|
addProfiling(fvopt, "fvOption::constrain." + eqn.psi().name());
|
||||||
|
|
||||||
source.setApplied(fieldI);
|
source.setApplied(fieldI);
|
||||||
|
|
||||||
if (source.isActive())
|
if (source.isActive())
|
||||||
@ -288,6 +298,8 @@ void Foam::fv::optionList::correct
|
|||||||
|
|
||||||
if (fieldI != -1)
|
if (fieldI != -1)
|
||||||
{
|
{
|
||||||
|
addProfiling(fvopt, "fvOption::correct." + source.name());
|
||||||
|
|
||||||
source.setApplied(fieldI);
|
source.setApplied(fieldI);
|
||||||
|
|
||||||
if (source.isActive())
|
if (source.isActive())
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "LduMatrix.H"
|
#include "LduMatrix.H"
|
||||||
#include "diagTensorField.H"
|
#include "diagTensorField.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -58,6 +59,8 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve
|
|||||||
const dictionary& solverControls
|
const dictionary& solverControls
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(solve, "fvMatrix::solve." + psi_.name());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info.masterStream(this->mesh().comm())
|
Info.masterStream(this->mesh().comm())
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "fvScalarMatrix.H"
|
#include "fvScalarMatrix.H"
|
||||||
#include "extrapolatedCalculatedFvPatchFields.H"
|
#include "extrapolatedCalculatedFvPatchFields.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,6 +60,8 @@ Foam::fvMatrix<Foam::scalar>::solver
|
|||||||
const dictionary& solverControls
|
const dictionary& solverControls
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(solve, "fvMatrix::solve." + psi_.name());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info.masterStream(this->mesh().comm())
|
Info.masterStream(this->mesh().comm())
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,6 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "IMULES.H"
|
#include "IMULES.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -36,6 +37,8 @@ void Foam::MULES::implicitSolve
|
|||||||
const scalar psiMin
|
const scalar psiMin
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(solve, "MULES::implicitSolve");
|
||||||
|
|
||||||
implicitSolve
|
implicitSolve
|
||||||
(
|
(
|
||||||
geometricOneField(),
|
geometricOneField(),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,6 +29,7 @@ License
|
|||||||
#include "fvmDdt.H"
|
#include "fvmDdt.H"
|
||||||
#include "fvmSup.H"
|
#include "fvmSup.H"
|
||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -65,6 +66,8 @@ void Foam::MULES::implicitSolve
|
|||||||
const scalar psiMin
|
const scalar psiMin
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(solve, "MULES::implicitSolve");
|
||||||
|
|
||||||
const fvMesh& mesh = psi.mesh();
|
const fvMesh& mesh = psi.mesh();
|
||||||
|
|
||||||
const dictionary& MULEScontrols = mesh.solverDict(psi.name());
|
const dictionary& MULEScontrols = mesh.solverDict(psi.name());
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,6 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "MULES.H"
|
#include "MULES.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -36,6 +37,8 @@ void Foam::MULES::explicitSolve
|
|||||||
const scalar psiMin
|
const scalar psiMin
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(solve, "MULES::explicitSolve");
|
||||||
|
|
||||||
explicitSolve
|
explicitSolve
|
||||||
(
|
(
|
||||||
geometricOneField(),
|
geometricOneField(),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,6 +33,7 @@ License
|
|||||||
#include "PatchInteractionModel.H"
|
#include "PatchInteractionModel.H"
|
||||||
#include "StochasticCollisionModel.H"
|
#include "StochasticCollisionModel.H"
|
||||||
#include "SurfaceFilmModel.H"
|
#include "SurfaceFilmModel.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
@ -90,6 +91,8 @@ template<class CloudType>
|
|||||||
template<class TrackData>
|
template<class TrackData>
|
||||||
void Foam::KinematicCloud<CloudType>::solve(TrackData& td)
|
void Foam::KinematicCloud<CloudType>::solve(TrackData& td)
|
||||||
{
|
{
|
||||||
|
addProfiling(prof, "cloud::solve");
|
||||||
|
|
||||||
if (solution_.steadyState())
|
if (solution_.steadyState())
|
||||||
{
|
{
|
||||||
td.cloud().storeState();
|
td.cloud().storeState();
|
||||||
|
|||||||
@ -57,6 +57,7 @@ Description
|
|||||||
#include "localPointRegion.H"
|
#include "localPointRegion.H"
|
||||||
#include "externalDisplacementMeshMover.H"
|
#include "externalDisplacementMeshMover.H"
|
||||||
#include "scalarIOField.H"
|
#include "scalarIOField.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -3399,6 +3400,7 @@ void Foam::snappyLayerDriver::addLayers
|
|||||||
// extrudeStatus
|
// extrudeStatus
|
||||||
//);
|
//);
|
||||||
|
|
||||||
|
addProfiling(grow, "snappyHexMesh::layers::grow");
|
||||||
|
|
||||||
// Grow out region of non-extrusion
|
// Grow out region of non-extrusion
|
||||||
for (label i = 0; i < layerParams.nGrow(); i++)
|
for (label i = 0; i < layerParams.nGrow(); i++)
|
||||||
@ -3749,7 +3751,10 @@ void Foam::snappyLayerDriver::addLayers
|
|||||||
);
|
);
|
||||||
fvMesh& newMesh = newMeshPtr();
|
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.updateMesh(map);
|
||||||
|
|
||||||
newMesh.setInstance(meshRefiner_.timeName());
|
newMesh.setInstance(meshRefiner_.timeName());
|
||||||
@ -4219,6 +4224,7 @@ void Foam::snappyLayerDriver::doLayers
|
|||||||
fvMeshDistribute& distributor
|
fvMeshDistribute& distributor
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(layers, "snappyHexMesh::layers");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
|
|||||||
@ -39,6 +39,7 @@ License
|
|||||||
#include "localPointRegion.H"
|
#include "localPointRegion.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "labelVector.H"
|
#include "labelVector.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ Foam::label Foam::snappyRefineDriver::featureEdgeRefine
|
|||||||
const label minRefine
|
const label minRefine
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(edge, "snappyHexMesh::refine::edge");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
label iter = 0;
|
label iter = 0;
|
||||||
@ -188,6 +190,7 @@ Foam::label Foam::snappyRefineDriver::smallFeatureRefine
|
|||||||
const label maxIter
|
const label maxIter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(feature, "snappyHexMesh::refine::smallFeature");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
|
|
||||||
@ -310,6 +313,7 @@ Foam::label Foam::snappyRefineDriver::surfaceOnlyRefine
|
|||||||
const label maxIter
|
const label maxIter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(surface, "snappyHexMesh::refine::surface");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
// Determine the maximum refinement level over all surfaces. This
|
// Determine the maximum refinement level over all surfaces. This
|
||||||
@ -807,6 +811,7 @@ Foam::label Foam::snappyRefineDriver::danglingCellRefine
|
|||||||
const label maxIter
|
const label maxIter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(dangling, "snappyHexMesh::refine::danglingCell");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
label iter;
|
label iter;
|
||||||
@ -952,6 +957,7 @@ Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
|
|||||||
const label maxIter
|
const label maxIter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(interface, "snappyHexMesh::refine::transition");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
label iter = 0;
|
label iter = 0;
|
||||||
@ -1342,6 +1348,7 @@ Foam::label Foam::snappyRefineDriver::shellRefine
|
|||||||
const label maxIter
|
const label maxIter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(shell, "snappyHexMesh::refine::shell");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
// Mark current boundary faces with 0. Have meshRefiner maintain them.
|
// Mark current boundary faces with 0. Have meshRefiner maintain them.
|
||||||
@ -1517,6 +1524,7 @@ void Foam::snappyRefineDriver::baffleAndSplitMesh
|
|||||||
const dictionary& motionDict
|
const dictionary& motionDict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(split, "snappyHexMesh::refine::splitting");
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "Splitting mesh at surface intersections" << nl
|
<< "Splitting mesh at surface intersections" << nl
|
||||||
<< "---------------------------------------" << nl
|
<< "---------------------------------------" << nl
|
||||||
@ -1841,6 +1849,7 @@ void Foam::snappyRefineDriver::mergePatchFaces
|
|||||||
const dictionary& motionDict
|
const dictionary& motionDict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(merge, "snappyHexMesh::refine::merge");
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "Merge refined boundary faces" << nl
|
<< "Merge refined boundary faces" << nl
|
||||||
<< "----------------------------" << nl
|
<< "----------------------------" << nl
|
||||||
@ -1895,6 +1904,7 @@ void Foam::snappyRefineDriver::doRefine
|
|||||||
const dictionary& motionDict
|
const dictionary& motionDict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(refine, "snappyHexMesh::refine");
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "Refinement phase" << nl
|
<< "Refinement phase" << nl
|
||||||
<< "----------------" << nl
|
<< "----------------" << nl
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,6 +45,7 @@ Description
|
|||||||
#include "localPointRegion.H"
|
#include "localPointRegion.H"
|
||||||
#include "PatchTools.H"
|
#include "PatchTools.H"
|
||||||
#include "refinementFeatures.H"
|
#include "refinementFeatures.H"
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -832,6 +833,7 @@ void Foam::snappySnapDriver::preSmoothPatch
|
|||||||
motionSmoother& meshMover
|
motionSmoother& meshMover
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(smooth, "snappyHexMesh::snap::smoothing");
|
||||||
const fvMesh& mesh = meshRefiner.mesh();
|
const fvMesh& mesh = meshRefiner.mesh();
|
||||||
|
|
||||||
labelList checkFaces;
|
labelList checkFaces;
|
||||||
@ -2168,6 +2170,7 @@ bool Foam::snappySnapDriver::scaleMesh
|
|||||||
motionSmoother& meshMover
|
motionSmoother& meshMover
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(scale, "snappyHexMesh::snap::scale");
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
// Relax displacement until correct mesh
|
// Relax displacement until correct mesh
|
||||||
@ -2534,6 +2537,7 @@ void Foam::snappySnapDriver::doSnap
|
|||||||
const snapParameters& snapParams
|
const snapParameters& snapParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
addProfiling(snap, "snappyHexMesh::snap");
|
||||||
fvMesh& mesh = meshRefiner_.mesh();
|
fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
|
|||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -7,10 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# remove old time and post-processing directories
|
# remove old time and post-processing directories
|
||||||
rm -rf 0 *[1-9]* processor* postProcessing
|
rm -rf 0 *[1-9]* processor* postProcessing
|
||||||
|
|
||||||
|
|
||||||
# copy 0.org to 0
|
|
||||||
cp -r 0.org 0
|
|
||||||
|
|
||||||
cleanCase
|
cleanCase
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
20
tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun
Executable file
20
tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun
Executable file
@ -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`
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -45,6 +45,10 @@ timePrecision 6;
|
|||||||
|
|
||||||
runTimeModifiable yes;
|
runTimeModifiable yes;
|
||||||
|
|
||||||
|
profiling
|
||||||
|
{
|
||||||
|
memInfo true;
|
||||||
|
}
|
||||||
|
|
||||||
functions
|
functions
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user