36namespace functionObjects
46void 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?"
71 bool processed =
false;
72 processed = processed || nComponents<scalar>(fieldName, nComps);
73 processed = processed || nComponents<vector>(fieldName, nComps);
74 processed = processed || nComponents<sphericalTensor>(fieldName, nComps);
75 processed = processed || nComponents<symmTensor>(fieldName, nComps);
76 processed = processed || nComponents<tensor>(fieldName, nComps);
81 <<
"Unknown type of input field during initialisation: "
90void Foam::functionObjects::DMD::initialise()
92 const label nComps = nComponents(fieldName_);
96 nSnap_ = nComps*mesh_.nCells();
102 mesh_.boundaryMesh().patchSet(patches_).sortedToc()
105 for (
const label patchi : patchis)
107 nSnap_ += nComps*(mesh_.C().boundaryField()[patchi]).size();
111 const label nSnapTotal =
returnReduce(nSnap_, sumOp<label>());
116 <<
"Zero-size input field = " << fieldName_
122 z_ = RMatrix(2*nSnap_, 1,
Zero);
126 z_ = RMatrix(1, 1,
Zero);
151 fieldName_(
dict.get<
word>(
"field")),
159 <<
"DMD is available only for fixed time-step computations."
167 <<
"DMD is available only for non-changing mesh topology."
198 DMDModelPtr_->initialise(z_);
203 DMDModelPtr_->update(z_);
208 Log <<
tab <<
"Execution index = " << step_ <<
" for field: " << fieldName_
239 <<
"DMD needs at least three snapshots to produce output" <<
nl
240 <<
" Only " << step_ + 1 <<
" snapshots are available" <<
nl
241 <<
" Skipping DMD output calculation and write"
251 mesh_.time().printExecutionTime(
Info);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Abstract base class for DMD models to handle DMD characteristics for the DMD function object.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual bool isAdjustTimeStep() const
Return true if adjustTimeStep is true.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
virtual const word & type() const =0
Runtime type information.
Computes a dynamic mode decomposition model on a specified field.
virtual bool read(const dictionary &dict)
Read DMD settings.
virtual bool execute()
Execute DMD.
virtual bool write()
Write DMD results.
virtual bool end()
Write DMD results.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
static constexpr direction nComponents
Number of components in bool is 1.
bool topoChanging() const noexcept
Is mesh topology changing.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)