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;
87 mkDir(
"./ITHACAoutput/POD");
88 system(
"ln -s ../../constant ./ITHACAoutput/POD/constant");
89 system(
"ln -s ../../0 ./ITHACAoutput/POD/0");
90 system(
"ln -s ../../system ./ITHACAoutput/POD/system");
94 Info <<
"The POD has already been performed, please delete the ITHACAoutput folder and try again." << endl;
104 IOdictionary ITHACAPODdict
117 instantList Times =
runTime.times();
120 const entry* existnsnap = ITHACAPODdict.lookupEntryPtr(
"Nsnapshots",
false,
true);
121 const entry* existLT = ITHACAPODdict.lookupEntryPtr(
"FinalTime",
false,
true);
124 if ((existnsnap) && (existLT))
126 Info <<
"Error you cannot define LatestTime and NSnapShots together" << endl;
131 scalar InitialTime = ITHACAPODdict.lookupOrDefault<scalar>(
"InitialTime", 0);
132 nSnapshots = readScalar(ITHACAPODdict.lookup(
"Nsnapshots"));
133 startTime = Time::findClosestTimeIndex(
runTime.times(), InitialTime);
134 nSnapshots = min(nSnapshots , Times.size() - startTime);
135 endTime = startTime + nSnapshots - 1;
136 Info << nSnapshots << endl;
140 scalar InitialTime = ITHACAPODdict.lookupOrDefault<scalar>(
"InitialTime", 0);
141 scalar FinalTime = ITHACAPODdict.lookupOrDefault<scalar>(
"FinalTime", 100000000000000);
142 endTime = Time::findClosestTimeIndex(
runTime.times(), FinalTime);
143 startTime = Time::findClosestTimeIndex(
runTime.times(), InitialTime);
144 nSnapshots = endTime - startTime + 1;
145 if (InitialTime > FinalTime)
147 Info <<
"FinalTime cannot be smaller than the InitialTime check your ITHACAPODdict file\n" << endl;
152 Info <<
"startTime: " << startTime <<
"\n" <<
"endTime: " << endTime <<
"\n" <<
"nSnapshots: " << nSnapshots <<
"\n" << endl;
155 runTime.setTime(Times[startTime], startTime);
159 ITHACAPODdict.lookup(
"fields")
165 if (startTime == endTime)
167 Info <<
"The case has no snapshots to process, exiting the code" << endl;
171 for (label k = 0; k < fieldlist.size(); k++)
173 dictionary& subDict = ITHACAPODdict.subDict(fieldlist[k]);
174 scalar nmodes = readScalar(subDict.lookup(
"nmodes"));
175 word field_name(subDict.lookup(
"field_name"));
176 word field_type(subDict.lookup(
"field_type"));
178 for (label
i = startTime;
i < endTime + 1;
i++)
180 Info <<
"Reading snapshot " <<
i <<
" for field " << field_name << endl;
184 if (field_type ==
"vector")
187 volVectorField vector_field
198 Vfield.append(vector_field.clone());
201 if (field_type ==
"scalar")
203 volScalarField scalar_field
214 Sfield.append(scalar_field.clone());
218 if (field_type ==
"vector")
222 if (field_type ==
"scalar")
231 Info <<
"End\n" << endl;
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.