43#include "primitiveFields.H"
44#include "FieldFields.H"
45#include "scalarMatrices.H"
46#include "SortableList.H"
47#include "volFieldsFwd.H"
49#include "forceCoeffs.H"
58#include "ITHACAparameters.H"
61int main(
int argc,
char *argv[])
64#include "setRootCase.H"
65#include "createTime.H"
66#include "createMesh.H"
68 PtrList<volVectorField> Vfield;
69 PtrList<volScalarField> Sfield;
70 PtrList<volVectorField> Vmodes;
71 PtrList<volScalarField> Smodes;
79 if (stat(
"./ITHACAoutput/POD", &sb) == 0 && S_ISDIR(sb.st_mode))
86 Info <<
"POD don't exist, performing a POD decomposition" << endl;
91 Info <<
"The POD has already been performed, please delete the ITHACAoutput folder and try again." << endl;
101 IOdictionary ITHACAPODdict
114 instantList Times = runTime.times();
117 const entry* existnsnap = ITHACAPODdict.lookupEntryPtr(
"Nsnapshots",
false,
true);
118 const entry* existLT = ITHACAPODdict.lookupEntryPtr(
"FinalTime",
false,
true);
121 if ((existnsnap) && (existLT))
123 Info <<
"Error you cannot define LatestTime and NSnapShots together" << endl;
128 scalar InitialTime = ITHACAPODdict.lookupOrDefault<scalar>(
"InitialTime", 0);
129 nSnapshots = readScalar(ITHACAPODdict.lookup(
"Nsnapshots"));
130 startTime = Time::findClosestTimeIndex(runTime.times(), InitialTime);
131 nSnapshots =
min(nSnapshots , Times.size() - startTime);
132 endTime = startTime + nSnapshots - 1;
133 Info << nSnapshots << endl;
137 scalar InitialTime = ITHACAPODdict.lookupOrDefault<scalar>(
"InitialTime", 0);
138 scalar FinalTime = ITHACAPODdict.lookupOrDefault<scalar>(
"FinalTime", 100000000000000);
139 endTime = Time::findClosestTimeIndex(runTime.times(), FinalTime);
140 startTime = Time::findClosestTimeIndex(runTime.times(), InitialTime);
141 nSnapshots = endTime - startTime + 1;
142 if (InitialTime > FinalTime)
144 Info <<
"FinalTime cannot be smaller than the InitialTime check your ITHACAPODdict file\n" << endl;
149 Info <<
"startTime: " << startTime <<
"\n" <<
"endTime: " << endTime <<
"\n" <<
"nSnapshots: " << nSnapshots <<
"\n" << endl;
152 runTime.setTime(Times[startTime], startTime);
156 ITHACAPODdict.lookup(
"fields")
162 if (startTime == endTime)
164 Info <<
"The case has no snapshots to process, exiting the code" << endl;
168 for (label k = 0; k < fieldlist.size(); k++)
170 dictionary& subDict = ITHACAPODdict.subDict(fieldlist[k]);
171 scalar nmodes = readScalar(subDict.lookup(
"nmodes"));
172 word field_name(subDict.lookup(
"field_name"));
173 word field_type(subDict.lookup(
"field_type"));
175 for (label i = startTime; i < endTime + 1; i++)
177 Info <<
"Reading snapshot " << i <<
" for field " << field_name << endl;
178 runTime.setTime(Times[i], i);
181 if (field_type ==
"vector")
184 volVectorField vector_field
195 Vfield.append(vector_field.clone());
198 if (field_type ==
"scalar")
200 volScalarField scalar_field
211 Sfield.append(scalar_field.clone());
215 if (field_type ==
"vector")
219 if (field_type ==
"scalar")
228 Info <<
"End\n" << endl;
Header file of the ITHACAPOD class.
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
T min(Eigen::SparseMatrix< T > &mat, label &ind_row, label &ind_col)
Find the minimum of a sparse Matrix (Useful for DEIM).
void getModes(PtrList< GeometricField< Type, PatchField, GeoMesh > > &snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, word fieldName, bool podex, bool supex, bool sup, label nmodes, bool correctBC)
Computes the bases or reads them for a field.
void createSymLink(word folder)
Creates symbolic links to 0, system and constant.