Go to the documentation of this file.
41 namespace functionObjects
50 bool Foam::functionObjects::ddt2::checkFormatName
52 const std::string& str
55 if (std::string::npos == str.find(
"@@"))
58 <<
"Bad result naming (no '@@' token found)."
66 <<
"Bad result naming (only a '@@' token found)."
76 bool Foam::functionObjects::ddt2::accept(
const word& fieldName)
const
80 return !denyField_.match(fieldName);
84 int Foam::functionObjects::ddt2::process(
const word& fieldName)
86 if (!accept(fieldName))
93 apply<volScalarField>(fieldName, state);
94 apply<volVectorField>(fieldName, state);
114 mag_(
dict.getOrDefault(
"mag",
false))
126 if (
word(mesh_.ddtScheme(
"default")) ==
"steadyState")
129 << typeName <<
" function object not appropriate for steady-state"
134 dict.readEntry(
"fields", selectFields_);
135 selectFields_.uniq();
137 Info<<
type() <<
" fields: " << selectFields_ <<
nl;
139 resultName_ =
dict.getOrDefault<
word>
142 ( mag_ ?
"mag(ddt(@@))" :
"magSqr(ddt(@@))" )
148 (selectFields_.size() == 1 && selectFields_.first().isLiteral())
149 || checkFormatName(resultName_)
155 .replace(
"@@",
"(.+)")
175 for (
const wordRe& select : selectFields_)
177 if (select.isLiteral())
179 const word& fieldName = select;
181 if (!candidates.erase(fieldName))
183 missing.append(fieldName);
185 else if (process(fieldName) < 1)
187 ignored.append(fieldName);
192 for (
const word& fieldName : candidates)
200 <<
"Missing field " << missing <<
endl;
205 <<
"Unprocessed field " << ignored <<
endl;
220 const wordList outputList = results_.sortedToc();
221 for (
const word& fieldName : outputList)
223 if (foundObject<regIOobject>(fieldName))
225 const regIOobject& io = lookupObject<regIOobject>(fieldName);
227 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.
StringType quotemeta(const StringType &str, const UnaryPredicate &meta, const char quote='\\')
Quote any meta-characters in given string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Operations on lists of strings.
#define WarningInFunction
Report a warning using Foam::Warning.