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 Foam::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: " 90 void 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);
126 z_ = RMatrix(1, 1,
Zero);
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);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
defineTypeNameAndDebug(ObukhovLength, 0)
DMD(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
constexpr char tab
The tab '\t' character(0x09)
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
const word & name() const noexcept
Return the name of this functionObject.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
virtual const word & type() const =0
Runtime type information.
A List of wordRe with additional matching capabilities.
virtual bool read(const dictionary &dict)
Read DMD settings.
virtual bool end()
Write DMD results.
bool topoChanging() const noexcept
Is mesh topology changing.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool execute()
Execute DMD.
virtual bool write()
Write DMD results.
#define WarningInFunction
Report a warning using Foam::Warning.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
Abstract base class for DMD models to handle DMD characteristics for the DMD function object...
List< label > labelList
A List of labels.
const fvMesh & mesh_
Reference to the fvMesh.
static constexpr const zero Zero
Global zero (0)