mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
functionObjectList::list: Support recursion when listing functionObject configuration files
This commit is contained in:
@ -1,52 +0,0 @@
|
||||
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,19 +72,15 @@ Foam::functionObject* Foam::functionObjectList::remove
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectList::list()
|
||||
void Foam::functionObjectList::listDir
|
||||
(
|
||||
const fileName& dir,
|
||||
HashSet<word>& foMap
|
||||
)
|
||||
{
|
||||
HashSet<word> foMap;
|
||||
|
||||
fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
|
||||
|
||||
forAll(etcDirs, ed)
|
||||
{
|
||||
fileNameList foDirs(readDir(etcDirs[ed], fileName::DIRECTORY));
|
||||
forAll(foDirs, fd)
|
||||
{
|
||||
fileNameList foFiles(readDir(etcDirs[ed]/foDirs[fd]));
|
||||
// Search specified directory for functionObject configuration files
|
||||
{
|
||||
fileNameList foFiles(readDir(dir));
|
||||
forAll(foFiles, f)
|
||||
{
|
||||
if (foFiles[f].ext().empty())
|
||||
@ -93,8 +89,28 @@ void Foam::functionObjectList::list()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
|
||||
|
||||
forAll(etcDirs, ed)
|
||||
{
|
||||
listDir(etcDirs[ed], foMap);
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Available configured functionObjects:"
|
||||
|
||||
@ -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&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user