Commit 92dd330a authored by Henry Weller's avatar Henry Weller
Browse files

functionObjectList::list: Support recursion when listing functionObject configuration files

parent 07ae9b67
Overview
========
- This directory contains files to help post-processing of OpenFOAM cases
- It primariy "packages" functionObject functionality in a convenient form for
users to plug into their OpenFOAM cases
- While some tools are quite generic, e.g. minMax, others are more application-
oriented, e.g. flowRate.
How the tools work
==================
- The configuration of functionObjects includes both required input data and
control parameters for the functionObject
- This creates a lot of input that can be confusing to users
- The tools here are packaged so that the user input is separated from control
parameters
- Control parameters are pre-configured in .cfg files - users can ignore these
files
- For each tool, required user input is all in one file, for the users to copy
into their case and set accordingly
Example of how to use the tools
===============================
Task: monitor flow rate at an outlet patch named "outlet" for a case
Solution:
- locate the flowRatePatch tool in the flowRate directory
- copy the flowRatePatch file into the case system directory (not
flowRatePatch.cfg)
- edit system/flowRatePatch to set the patch name
replace "name <patchName>;"
with "name outlet;"
- activate the function object by including the flowRatePatch file in functions
sub-dictionary in the case controlDict file, e.g.
functions
{
#includeFunc flowRatePatch
... other function objects here ...
}
Current tools
=============
- fields calculate specific fields, e.g. Q
- flowRate tools to calculate flow rate
- forces forces and forceCoeffs for incompressible/compressible flows
- graphs simple sampling for graph plotting, e.g. singleGraph
- minMax range of minimum and maximum field monitoring, e.g. cellMax
- numerical outputs information relating to numerics, e.g. residuals
- pressure calculates different forms of pressure, pressure drop, etc
- probes options for probing data
- scalarTransport for plugin scalar transport calculations
- visualization post-processing VTK files for cutting planes, streamlines,...
- surfaceRegion configuration for some of the tools above
......@@ -72,6 +72,35 @@ Foam::functionObject* Foam::functionObjectList::remove
}
void Foam::functionObjectList::listDir
(
const fileName& dir,
HashSet<word>& foMap
)
{
// Search specified directory for functionObject configuration files
{
fileNameList foFiles(readDir(dir));
forAll(foFiles, f)
{
if (foFiles[f].ext().empty())
{
foMap.insert(foFiles[f]);
}
}
}
// Recurse into sub-directories
{
fileNameList foDirs(readDir(dir, fileName::DIRECTORY));
forAll(foDirs, fd)
{
listDir(dir/foDirs[fd], foMap);
}
}
}
void Foam::functionObjectList::list()
{
HashSet<word> foMap;
......@@ -80,20 +109,7 @@ void Foam::functionObjectList::list()
forAll(etcDirs, ed)
{
fileNameList foDirs(readDir(etcDirs[ed], fileName::DIRECTORY));
forAll(foDirs, fd)
{
fileNameList foFiles(readDir(etcDirs[ed]/foDirs[fd]));
{
forAll(foFiles, f)
{
if (foFiles[f].ext().empty())
{
foMap.insert(foFiles[f]);
}
}
}
}
listDir(etcDirs[ed], foMap);
}
Info<< nl
......
......@@ -74,7 +74,7 @@ class functionObjectList
//- The parent dictionary containing a "functions" entry
// This entry can either be a list or a dictionary of
// functionObject specifications.
// functionObject specifications
const dictionary& parentDict_;
//- Switch for the execution of the functionObjects
......@@ -88,9 +88,13 @@ class functionObjectList
//- Remove and return the function object pointer by name,
// and returns the old index via the parameter.
// Returns a NULL pointer (and index -1) if it didn't exist.
// Returns a NULL pointer (and index -1) if it didn't exist
functionObject* remove(const word&, label& oldIndex);
//- Search the specified directory for functionObject
// configuration files, add to the given map and recurse
static void listDir(const fileName& dir, HashSet<word>& foMap);
//- Disallow default bitwise copy construct
functionObjectList(const functionObjectList&);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment