Go to the documentation of this file.
36 namespace functionObjects
46 void Foam::functionObjects::DMD::snapshot()
48 bool processed =
false;
49 processed = processed || getSnapshot<scalar>();
50 processed = processed || getSnapshot<vector>();
51 processed = processed || getSnapshot<sphericalTensor>();
52 processed = processed || getSnapshot<symmTensor>();
53 processed = processed || getSnapshot<tensor>();
58 <<
" functionObjects::" <<
type() <<
" " <<
name() <<
":"
59 <<
" cannot find required input field during snapshot loading: "
61 <<
" Do you execute required functionObjects"
62 <<
" before executing DMD, e.g. mapFields?"
68 void Foam::functionObjects::DMD::initialise()
70 const label nComps = DMDModelPtr_->nComponents(fieldName_);
74 nSnap_ = nComps*mesh_.nCells();
78 const label patchi = mesh_.boundaryMesh().findPatchID(patch_);
83 <<
"Cannot find patch " << patch_
87 nSnap_ = nComps*(mesh_.C().boundaryField()[patchi]).size();
90 const label nSnapTotal =
returnReduce(nSnap_, sumOp<label>());
95 <<
" # Zero-size input field = " << fieldName_ <<
" #"
101 z_ = RMatrix(2*nSnap_, 1,
Zero);
105 z_ = RMatrix(1, 1,
Zero);
122 fieldName_(
dict.get<
word>(
"field")),
128 if (
runTime.isAdjustTimeStep())
131 <<
" # DMD: Available only for fixed time-step computations. #"
136 if (mesh_.topoChanging())
139 <<
" # DMD: Available only for non-changing mesh topology. #"
170 DMDModelPtr_->initialise(z_);
175 DMDModelPtr_->update(z_);
180 Log <<
tab <<
"Execution index = " << step_ <<
" for field: " << fieldName_
211 <<
" # DMD needs at least three snapshots to produce output #"
213 <<
" # Only " << step_ + 1 <<
" snapshots are available #"
215 <<
" # Skipping DMD output calculation and write #"
225 mesh_.time().printExecutionTime(
Info);
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
static constexpr const zero Zero
Global zero (0)
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...
static autoPtr< DMDModel > New(const fvMesh &mesh, const word &name, const dictionary &dict)
Return a reference to the selected DMD model.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool execute()
Execute DMD.
virtual bool write()
Write DMD results.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const noexcept
Return the name of this functionObject.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual const word & type() const =0
Runtime type information.
virtual bool end()
Write DMD results.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
DMD(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual bool read(const dictionary &dict)
Read DMD settings.
#define WarningInFunction
Report a warning using Foam::Warning.