Go to the documentation of this file.
40 namespace functionObjects
49 bool Foam::functionObjects::ddt2::checkFormatName
51 const std::string& str
54 if (std::string::npos == str.find(
"@@"))
57 <<
"Bad result naming (no '@@' token found)."
65 <<
"Bad result naming (only a '@@' token found)."
75 bool Foam::functionObjects::ddt2::accept(
const word& fieldName)
const
79 return !denyField_.match(fieldName);
83 int Foam::functionObjects::ddt2::process(
const word& fieldName)
85 if (!accept(fieldName))
92 apply<volScalarField>(fieldName, state);
93 apply<volVectorField>(fieldName, state);
113 mag_(
dict.getOrDefault(
"mag",
false))
125 if (
word(mesh_.ddtScheme(
"default")) ==
"steadyState")
128 << typeName <<
" function object not appropriate for steady-state"
133 dict.readEntry(
"fields", selectFields_);
134 selectFields_.uniq();
136 Info<<
type() <<
" fields: " << selectFields_ <<
nl;
138 resultName_ =
dict.getOrDefault<
word>
141 ( mag_ ?
"mag(ddt(@@))" :
"magSqr(ddt(@@))" )
147 (selectFields_.size() == 1 && selectFields_.first().isLiteral())
148 || checkFormatName(resultName_)
153 string::quotemeta<regExp>
156 ).replace(
"@@",
"(.+)")
176 for (
const wordRe& select : selectFields_)
178 if (select.isLiteral())
180 const word& fieldName = select;
182 if (!candidates.
erase(fieldName))
184 missing.append(fieldName);
186 else if (process(fieldName) < 1)
188 ignored.append(fieldName);
193 for (
const word& fieldName : candidates)
201 <<
"Missing field " << missing <<
endl;
206 <<
"Unprocessed field " << ignored <<
endl;
221 const wordList outputList = results_.sortedToc();
222 for (
const word& fieldName : outputList)
224 if (foundObject<regIOobject>(fieldName))
226 const regIOobject& io = lookupObject<regIOobject>(fieldName);
228 Log <<
" " << fieldName <<
endl;
virtual bool write()
Write the ddt2 fields.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual bool read(const dictionary &)
Read the ddt2 specification.
A class for handling words, derived from Foam::string.
virtual bool execute()
Calculate the ddt2 fields.
bool read(const char *buf, int32_t &val)
Same as readInt32.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
ddt2(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual bool write(const bool valid=true) const
Write using setting from DB.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
StringListType subsetStrings(const regExp &matcher, const StringListType &input, const bool invert=false)
Extract elements of StringList when regular expression matches.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool read(const dictionary &dict)
Read optional controls.
Macros for easy insertion into run-time selection tables.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
defineTypeNameAndDebug(ObukhovLength, 0)
static const word null
An empty word.
Operations on lists of strings.
#define WarningInFunction
Report a warning using Foam::Warning.