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?"
68Foam::label Foam::functionObjects::DMD::nComponents(
const word& fieldName)
const
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()
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);
151 fieldName_(
dict.get<
word>(
"field")),
156 if (
runTime.isAdjustTimeStep())
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.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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 bool read(const dictionary &dict)
Read and set the function object if its data have changed.
static bool postProcess
Global post-processing mode switch.
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 the function-object dictionary.
DMD(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
virtual bool end()
Write DMD results.
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
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.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
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.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
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).