Loading...
Searching...
No Matches
createROMfields.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Application
27 createROMfields
28
29Group
30 grpPostProcessingUtilities
31
32Description
33 Create fields using reduced-order modelling (ROM) data
34 at specific time instants without requiring any CFD computations.
35
36Usage
37 Minimal example by using \c system/ROMfieldsDict:
38 \verbatim
39 // Mandatory entries
40 ROMmodel <word>;
41
42 // Inherited entries
43 // See DMD.H for the 'DMD' ROMmodel
44 ...
45 \endverbatim
46
47 where the entries mean:
48 \table
49 Property | Description | Type | Reqd | Deflt
50 ROMmodel | Type of reduced-order model | word | yes | -
51 \endtable
52
53 Options for the \c ROMmodel entry:
54 \verbatim
55 DMD | Streaming total dynamic mode decomposition
56 \endverbatim
57
58 The inherited entries are elaborated in:
59 - \link ROMmodel.H \endlink
60 - \link DMD.H \endlink
61
62Note
63 - The quality of results depends on the capabilities of the underlying
64 reduced-order model, and the quality of the input data.
65 - Warning: Reduced-order modelling is an active research area at the time of
66 writing; therefore, there could be cases whereat oddities can be seen.
67
68\*---------------------------------------------------------------------------*/
69
70#include "argList.H"
71#include "timeSelector.H"
72#include "fvCFD.H"
74
75using namespace Foam;
76
77// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78
79int main(int argc, char *argv[])
80{
82 (
83 "Create fields using reduced-order modelling (ROM) data at specific "
84 "time instants without requiring any CFD computations."
85 );
86
88 (
89 "dict",
90 "file",
91 "Alternative dictionary for ROMfieldsDict"
92 );
93
94 // No -constant, no special treatment for 0/
96
97 // Remove treatments unnecessary for this utility
99 argList::removeOption("noZero");
100 argList::removeOption("world");
101
102
103 #include "addRegionOption.H"
104
105 #include "setRootCase.H"
106 #include "createTime.H"
107
108 const word dictName("ROMfieldsDict");
110 Info<< "Reading " << dictIO.name() << nl << endl;
112
114 if (times.empty())
115 {
117 << "No times selected." << nl
118 << exit(FatalError);
119 }
120
121 #include "createNamedMesh.H"
122
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124
125 auto ROMptr = ROMmodel::New(runTime, mesh, dict, times);
126
127 ROMptr->read(dict);
128
129 ROMptr->createAndWrite();
130
131
132 Info<< nl;
133 runTime.printExecutionTime(Info);
134
135 Info<< "End\n" << endl;
136
137 return 0;
138}
139
140
141// ************************************************************************* //
Required Classes.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
static autoPtr< ROMmodel > New(Time &runTime, fvMesh &mesh, const dictionary &dict, const instantList &times)
Return a reference to the selected ROMmodel.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
Definition UList.H:701
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
Definition argList.C:562
static void removeOption(const word &optName)
Remove option from validOptions and from optionUsage.
Definition argList.C:486
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition argList.C:400
static void addNote(const string &note)
Add extra notes for the usage information.
Definition argList.C:477
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options and also set the runTime to the first i...
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
engineTime & runTime
Required Classes.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
const word dictName("faMeshDefinition")
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< instant > instantList
List of instants.
Definition instantList.H:41
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict
IOobject dictIO
Foam::argList args(argc, argv)