mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
cleanup of time handling (cosmetic changes), used timeSelector in more places
This commit is contained in:
@ -45,6 +45,7 @@ Description
|
|||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "polyTopoChange.H"
|
#include "polyTopoChange.H"
|
||||||
@ -340,7 +341,8 @@ void dumpFeatures
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
# include "addTimeOptions.H"
|
timeSelector::addOptions(true, false);
|
||||||
|
|
||||||
argList::validArgs.append("feature angle[0-180]");
|
argList::validArgs.append("feature angle[0-180]");
|
||||||
argList::validOptions.insert("splitAllFaces", "");
|
argList::validOptions.insert("splitAllFaces", "");
|
||||||
argList::validOptions.insert("doNotPreserveFaceZones", "");
|
argList::validOptions.insert("doNotPreserveFaceZones", "");
|
||||||
@ -349,13 +351,10 @@ int main(int argc, char *argv[])
|
|||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
// Get times list
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
instantList Times = runTime.times();
|
|
||||||
|
|
||||||
# include "checkTimeOptions.H"
|
|
||||||
runTime.setTime(Times[startTime], startTime);
|
|
||||||
|
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
|
|
||||||
const word oldInstance = mesh.pointsInstance();
|
const word oldInstance = mesh.pointsInstance();
|
||||||
|
|
||||||
// Mark boundary edges and points.
|
// Mark boundary edges and points.
|
||||||
|
|||||||
@ -59,11 +59,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
pointField zeroPoints(mesh.points());
|
pointField zeroPoints(mesh.points());
|
||||||
|
|
||||||
runTime.setTime(Times[0], 0);
|
// skip "constant" time
|
||||||
|
for (label timeI = 1; timeI < Times.size(); ++timeI)
|
||||||
for (int i = 1; i<Times.size(); i++)
|
|
||||||
{
|
{
|
||||||
runTime.setTime(Times[i], i);
|
runTime.setTime(Times[timeI], timeI);
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << endl;
|
Info<< "Time = " << runTime.timeName() << endl;
|
||||||
|
|
||||||
|
|||||||
@ -387,7 +387,6 @@ int main(int argc, char *argv[])
|
|||||||
const word oldInstance = mesh.pointsInstance();
|
const word oldInstance = mesh.pointsInstance();
|
||||||
|
|
||||||
const bool blockOrder = args.optionFound("blockOrder");
|
const bool blockOrder = args.optionFound("blockOrder");
|
||||||
|
|
||||||
if (blockOrder)
|
if (blockOrder)
|
||||||
{
|
{
|
||||||
Info<< "Ordering cells into regions (using decomposition);"
|
Info<< "Ordering cells into regions (using decomposition);"
|
||||||
@ -396,7 +395,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool orderPoints = args.optionFound("orderPoints");
|
const bool orderPoints = args.optionFound("orderPoints");
|
||||||
|
|
||||||
if (orderPoints)
|
if (orderPoints)
|
||||||
{
|
{
|
||||||
Info<< "Ordering points into internal and boundary points." << nl
|
Info<< "Ordering points into internal and boundary points." << nl
|
||||||
|
|||||||
@ -591,24 +591,10 @@ commandStatus parseType
|
|||||||
}
|
}
|
||||||
else if (setType == "time")
|
else if (setType == "time")
|
||||||
{
|
{
|
||||||
scalar time = readScalar(is);
|
scalar requestedTime = readScalar(is);
|
||||||
|
|
||||||
instantList Times = runTime.times();
|
instantList Times = runTime.times();
|
||||||
|
|
||||||
int nearestIndex = -1;
|
label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
|
||||||
scalar nearestDiff = Foam::GREAT;
|
|
||||||
|
|
||||||
forAll(Times, timeIndex)
|
|
||||||
{
|
|
||||||
if (Times[timeIndex].name() == "constant") continue;
|
|
||||||
|
|
||||||
scalar diff = fabs(Times[timeIndex].value() - time);
|
|
||||||
if (diff < nearestDiff)
|
|
||||||
{
|
|
||||||
nearestDiff = diff;
|
|
||||||
nearestIndex = timeIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Pout<< "Changing time from " << runTime.timeName()
|
Pout<< "Changing time from " << runTime.timeName()
|
||||||
<< " to " << Times[nearestIndex].name()
|
<< " to " << Times[nearestIndex].name()
|
||||||
@ -646,7 +632,8 @@ commandStatus parseType
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn("parseType") << "Illegal mesh update state "
|
FatalErrorIn("parseType")
|
||||||
|
<< "Illegal mesh update state "
|
||||||
<< stat << abort(FatalError);
|
<< stat << abort(FatalError);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -746,7 +733,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Pout<< "Reading commands from file " << batchFile << endl;
|
Pout<< "Reading commands from file " << batchFile << endl;
|
||||||
|
|
||||||
// we also cannot handle .gz files
|
// we cannot handle .gz files
|
||||||
if (!isFile(batchFile, false))
|
if (!isFile(batchFile, false))
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
@ -864,7 +851,7 @@ int main(int argc, char *argv[])
|
|||||||
delete fileStreamPtr;
|
delete fileStreamPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pout << nl << "End" << endl;
|
Pout<< "\nEnd" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,7 +64,6 @@ int main(int argc, char *argv[])
|
|||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
|
||||||
bool noFlipMap = args.optionFound("noFlipMap");
|
bool noFlipMap = args.optionFound("noFlipMap");
|
||||||
|
|
||||||
// Get times list
|
// Get times list
|
||||||
@ -73,9 +72,8 @@ int main(int argc, char *argv[])
|
|||||||
label startTime = Times.size()-1;
|
label startTime = Times.size()-1;
|
||||||
label endTime = Times.size();
|
label endTime = Times.size();
|
||||||
|
|
||||||
|
// check -time and -latestTime options
|
||||||
# include "checkTimeOption.H"
|
# include "checkTimeOption.H"
|
||||||
# include "checkLatestTimeOption.H"
|
|
||||||
|
|
||||||
|
|
||||||
runTime.setTime(Times[startTime], startTime);
|
runTime.setTime(Times[startTime], startTime);
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@ Note
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|||||||
@ -23,7 +23,8 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Write out the FOAM mesh in Version 3.0 Fieldview-UNS format (binary).
|
Write out the OpenFOAM mesh in Version 3.0 Fieldview-UNS format (binary).
|
||||||
|
|
||||||
See Fieldview Release 9 Reference Manual - Appendix D
|
See Fieldview Release 9 Reference Manual - Appendix D
|
||||||
(Unstructured Data Format)
|
(Unstructured Data Format)
|
||||||
Borrows various from uns/write_binary_uns.c from FieldView dist.
|
Borrows various from uns/write_binary_uns.c from FieldView dist.
|
||||||
@ -31,6 +32,7 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
@ -176,20 +178,15 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validOptions.insert("noWall", "");
|
argList::validOptions.insert("noWall", "");
|
||||||
|
timeSelector::addOptions(true, false);
|
||||||
|
|
||||||
# include "addTimeOptions.H"
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
instantList Times = runTime.times();
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
# include "checkTimeOptions.H"
|
|
||||||
|
|
||||||
runTime.setTime(Times[startTime], startTime);
|
|
||||||
|
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
|
|
||||||
|
|
||||||
// Initialize name mapping table
|
// Initialize name mapping table
|
||||||
FieldviewNames.insert("alpha", "aalpha");
|
FieldviewNames.insert("alpha", "aalpha");
|
||||||
FieldviewNames.insert("Alpha", "AAlpha");
|
FieldviewNames.insert("Alpha", "AAlpha");
|
||||||
@ -285,17 +282,16 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
label fieldViewTime = 0;
|
label fieldViewTime = 0;
|
||||||
|
|
||||||
for (label i=startTime; i<endTime; i++)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
runTime.setTime(Times[i], i);
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
Info<< "Time: " << runTime.timeName() << endl;
|
||||||
Info<< "Time " << Times[i].name() << endl;
|
|
||||||
|
|
||||||
fvMesh::readUpdateState state = mesh.readUpdate();
|
fvMesh::readUpdateState state = mesh.readUpdate();
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
i == startTime
|
timeI == 0
|
||||||
|| state == fvMesh::TOPO_CHANGE
|
|| state == fvMesh::TOPO_CHANGE
|
||||||
|| state == fvMesh::TOPO_PATCH_CHANGE
|
|| state == fvMesh::TOPO_PATCH_CHANGE
|
||||||
)
|
)
|
||||||
@ -334,7 +330,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
fileName fvFileName
|
fileName fvFileName
|
||||||
(
|
(
|
||||||
fvPath/runTime.caseName() + "_" + Foam::name(i) + ".uns"
|
fvPath/runTime.caseName() + "_" + Foam::name(timeI) + ".uns"
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " file:" << fvFileName.c_str() << endl;
|
Info<< " file:" << fvFileName.c_str() << endl;
|
||||||
@ -364,7 +360,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Output constants for time, fsmach, alpha and re.
|
// Output constants for time, fsmach, alpha and re.
|
||||||
float fBuf[4];
|
float fBuf[4];
|
||||||
fBuf[0] = Times[i].value();
|
fBuf[0] = runTime.value();
|
||||||
fBuf[1] = 0.0;
|
fBuf[1] = 0.0;
|
||||||
fBuf[2] = 0.0;
|
fBuf[2] = 0.0;
|
||||||
fBuf[3] = 1.0;
|
fBuf[3] = 1.0;
|
||||||
@ -892,7 +888,7 @@ int main(int argc, char *argv[])
|
|||||||
writeInt(fvParticleFile, fieldViewTime + 1);
|
writeInt(fvParticleFile, fieldViewTime + 1);
|
||||||
|
|
||||||
// Time value
|
// Time value
|
||||||
writeFloat(fvParticleFile, Times[i].value());
|
writeFloat(fvParticleFile, runTime.value());
|
||||||
|
|
||||||
// Read particles
|
// Read particles
|
||||||
Cloud<passiveParticle> parcels(mesh);
|
Cloud<passiveParticle> parcels(mesh);
|
||||||
|
|||||||
@ -5,9 +5,9 @@ HashSet<word> surfVectorHash;
|
|||||||
HashSet<word> sprayScalarHash;
|
HashSet<word> sprayScalarHash;
|
||||||
HashSet<word> sprayVectorHash;
|
HashSet<word> sprayVectorHash;
|
||||||
|
|
||||||
forAll(Times, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
runTime.setTime(Times[timeI], timeI);
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
// Add all fields to hashtable
|
// Add all fields to hashtable
|
||||||
IOobjectList objects(mesh, runTime.timeName());
|
IOobjectList objects(mesh, runTime.timeName());
|
||||||
|
|||||||
@ -113,11 +113,9 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
|
|||||||
instantList Times = runTime.times();
|
instantList Times = runTime.times();
|
||||||
|
|
||||||
int nearestIndex = timeIndex_;
|
int nearestIndex = timeIndex_;
|
||||||
|
|
||||||
for (int requestI = 0; requestI < nRequest; ++requestI)
|
for (int requestI = 0; requestI < nRequest; ++requestI)
|
||||||
{
|
{
|
||||||
int index = Time::findClosestTimeIndex(Times, requestTimes[requestI]);
|
int index = Time::findClosestTimeIndex(Times, requestTimes[requestI]);
|
||||||
|
|
||||||
if (index >= 0 && index != timeIndex_)
|
if (index >= 0 && index != timeIndex_)
|
||||||
{
|
{
|
||||||
nearestIndex = index;
|
nearestIndex = index;
|
||||||
@ -125,7 +123,6 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (nearestIndex < 0)
|
if (nearestIndex < 0)
|
||||||
{
|
{
|
||||||
nearestIndex = 0;
|
nearestIndex = 0;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ int USERD_get_maxsize_info
|
|||||||
return Z_ERR;
|
return Z_ERR;
|
||||||
|
|
||||||
#ifdef ENSIGHTDEBUG
|
#ifdef ENSIGHTDEBUG
|
||||||
Info << "Entering: USERD_get_maxsize_info" << endl << flush;
|
Info << "Entering: USERD_get_maxsize_info" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
label maxNPoints = 0;
|
label maxNPoints = 0;
|
||||||
@ -21,7 +21,7 @@ int USERD_get_maxsize_info
|
|||||||
|
|
||||||
Info<< "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl;
|
Info<< "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl;
|
||||||
|
|
||||||
for (label t=1; t < TimeList.size(); t++)
|
for (label timeI=1; timeI < timeDirs.size(); ++timeI)
|
||||||
{
|
{
|
||||||
|
|
||||||
label nPen06 = 0;
|
label nPen06 = 0;
|
||||||
@ -29,21 +29,21 @@ int USERD_get_maxsize_info
|
|||||||
label nPyr05 = 0;
|
label nPyr05 = 0;
|
||||||
label nTet04 = 0;
|
label nTet04 = 0;
|
||||||
|
|
||||||
runTimePtr->setTime(TimeList[t], t);
|
runTimePtr->setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
Info << "Checking time = " << TimeList[t].value() << endl << flush;
|
Info<< "Checking time = " << runTimePtr->timeName() << endl;
|
||||||
|
|
||||||
const cellShapeList& cells = meshPtr->cellShapes();
|
const cellShapeList& cells = meshPtr->cellShapes();
|
||||||
|
|
||||||
label nPoints = meshPtr->nPoints();
|
const label nPoints = meshPtr->nPoints();
|
||||||
label nCells = cells.size();
|
const label nCells = cells.size();
|
||||||
|
|
||||||
maxNPoints = max(maxNPoints, nPoints);
|
maxNPoints = max(maxNPoints, nPoints);
|
||||||
|
|
||||||
for (label n=0; n<nCells;n++)
|
for (label n=0; n<nCells;n++)
|
||||||
{
|
{
|
||||||
label nFaces = cells[n].nFaces();
|
label nFaces = cells[n].nFaces();
|
||||||
labelList points = cells[n];
|
const labelList& points = cells[n];
|
||||||
|
|
||||||
if ((nFaces == 6) && (points.size() == 8))
|
if ((nFaces == 6) && (points.size() == 8))
|
||||||
{
|
{
|
||||||
@ -70,7 +70,6 @@ int USERD_get_maxsize_info
|
|||||||
|
|
||||||
if (Numparts_available > 1)
|
if (Numparts_available > 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get the maximum number of spray parcels
|
// Get the maximum number of spray parcels
|
||||||
// and store it
|
// and store it
|
||||||
Cloud<passiveParticle> lagrangian(*meshPtr);
|
Cloud<passiveParticle> lagrangian(*meshPtr);
|
||||||
@ -79,9 +78,7 @@ int USERD_get_maxsize_info
|
|||||||
{
|
{
|
||||||
nMaxParcels = lagrangian.size();
|
nMaxParcels = lagrangian.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
max_number_of_nodes[0] = maxNPoints;
|
max_number_of_nodes[0] = maxNPoints;
|
||||||
@ -97,7 +94,7 @@ int USERD_get_maxsize_info
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENSIGHTDEBUG
|
#ifdef ENSIGHTDEBUG
|
||||||
Info << "Leaving: USERD_get_maxsize_info" << endl << flush;
|
Info<< "Leaving: USERD_get_maxsize_info" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
|
|||||||
@ -10,18 +10,18 @@ int USERD_get_sol_times
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef ENSIGHTDEBUG
|
#ifdef ENSIGHTDEBUG
|
||||||
Info << "Entering: USERD_get_sol_times" << endl << flush;
|
Info<< "Entering: USERD_get_sol_times\n" << timeDirs << endl;
|
||||||
Info << TimeList << endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (label n=0; n<Num_time_steps;n++)
|
for (label n=0; n<Num_time_steps;n++)
|
||||||
{
|
{
|
||||||
solution_times[n] = TimeList[n+1].value();
|
solution_times[n] = timeDirs[n+1].value();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TimeList[1].value() < 0)
|
if (timeDirs[1].value() < 0)
|
||||||
{
|
{
|
||||||
scalar addCAD = 360.0;
|
scalar addCAD = 360.0;
|
||||||
while (TimeList[1].value() + addCAD < 0.0)
|
while (timeDirs[1].value() + addCAD < 0.0)
|
||||||
{
|
{
|
||||||
addCAD += 360.0;
|
addCAD += 360.0;
|
||||||
}
|
}
|
||||||
@ -29,14 +29,14 @@ int USERD_get_sol_times
|
|||||||
{
|
{
|
||||||
solution_times[n] += addCAD;
|
solution_times[n] += addCAD;
|
||||||
|
|
||||||
Info << "Time[" << n << "] = " << TimeList[n+1].value()
|
Info << "Time[" << n << "] = " << timeDirs[n+1].value()
|
||||||
<< " was corrected to " << solution_times[n] << endl;
|
<< " was corrected to " << solution_times[n] << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENSIGHTDEBUG
|
#ifdef ENSIGHTDEBUG
|
||||||
Info << "Leaving: USERD_get_sol_times" << endl << flush;
|
Info<< "Leaving: USERD_get_sol_times" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
|
|||||||
@ -6,11 +6,10 @@ int USERD_get_timeset_description
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ENSIGHTDEBUG
|
#ifdef ENSIGHTDEBUG
|
||||||
Info << "Entering: USERD_get_timeset_description" << endl
|
Info<< "Entering: USERD_get_timeset_description" << endl;
|
||||||
<< flush;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (TimeList[1].value() < 0)
|
if (timeDirs[1].value() < 0)
|
||||||
{
|
{
|
||||||
strncpy(timeset_description, "CAD", Z_BUFL);
|
strncpy(timeset_description, "CAD", Z_BUFL);
|
||||||
}
|
}
|
||||||
@ -20,8 +19,7 @@ int USERD_get_timeset_description
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENSIGHTDEBUG
|
#ifdef ENSIGHTDEBUG
|
||||||
Info << "Leaving: USERD_get_timeset_description" << endl
|
Info<< "Leaving: USERD_get_timeset_description" << endl;
|
||||||
<< flush;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
|
|||||||
@ -79,18 +79,18 @@ int USERD_set_filenames
|
|||||||
);
|
);
|
||||||
|
|
||||||
// set the available number of time-steps
|
// set the available number of time-steps
|
||||||
TimeList = (const instantList&)Foam::Time::findTimes(rootDir/caseDir);
|
timeDirs = Foam::Time::findTimes(rootDir/caseDir);
|
||||||
|
|
||||||
Num_time_steps = TimeList.size() - 1;
|
Num_time_steps = timeDirs.size() - 1;
|
||||||
|
|
||||||
nPatches = meshPtr->boundaryMesh().size();
|
nPatches = meshPtr->boundaryMesh().size();
|
||||||
|
|
||||||
// set the number of fields and store their names
|
// set the number of fields and store their names
|
||||||
// a valid field must exist for all time-steps
|
// a valid field must exist for all time-steps
|
||||||
runTime.setTime(TimeList[TimeList.size()-1], TimeList.size()-1);
|
runTime.setTime(timeDirs[timeDirs.size()-1], timeDirs.size()-1);
|
||||||
IOobjectList objects(*meshPtr, runTime.timeName());
|
IOobjectList objects(*meshPtr, runTime.timeName());
|
||||||
|
|
||||||
fieldNames = (const wordList&)objects.names();
|
fieldNames = objects.names();
|
||||||
|
|
||||||
// because of the spray being a 'field' ...
|
// because of the spray being a 'field' ...
|
||||||
// get the availabe number of variables and
|
// get the availabe number of variables and
|
||||||
@ -149,7 +149,7 @@ int USERD_set_filenames
|
|||||||
label n = 0;
|
label n = 0;
|
||||||
while (!lagrangianNamesFound && n < Num_time_steps)
|
while (!lagrangianNamesFound && n < Num_time_steps)
|
||||||
{
|
{
|
||||||
runTime.setTime(TimeList[n+1], n+1);
|
runTime.setTime(timeDirs[n+1], n+1);
|
||||||
|
|
||||||
Cloud<passiveParticle> lagrangian(*meshPtr);
|
Cloud<passiveParticle> lagrangian(*meshPtr);
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ int USERD_set_filenames
|
|||||||
}
|
}
|
||||||
|
|
||||||
Current_time_step = Num_time_steps;
|
Current_time_step = Num_time_steps;
|
||||||
runTime.setTime(TimeList[Current_time_step], Current_time_step);
|
runTime.setTime(timeDirs[Current_time_step], Current_time_step);
|
||||||
|
|
||||||
Num_variables = nVar + nSprayVariables;
|
Num_variables = nVar + nSprayVariables;
|
||||||
Numparts_available = Num_unstructured_parts + Num_structured_parts + nPatches;
|
Numparts_available = Num_unstructured_parts + Num_structured_parts + nPatches;
|
||||||
|
|||||||
@ -20,18 +20,30 @@ void USERD_set_time_set_and_step
|
|||||||
|
|
||||||
if (time_step == 0)
|
if (time_step == 0)
|
||||||
{
|
{
|
||||||
runTime.setTime(TimeList[Current_time_step], Current_time_step);
|
runTime.setTime
|
||||||
|
(
|
||||||
|
timeDirs[Current_time_step],
|
||||||
|
Current_time_step
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1);
|
runTime.setTime
|
||||||
|
(
|
||||||
|
timeDirs[Current_time_step + 1],
|
||||||
|
Current_time_step + 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
meshPtr->readUpdate();
|
meshPtr->readUpdate();
|
||||||
|
|
||||||
if (time_step == 0)
|
if (time_step == 0)
|
||||||
{
|
{
|
||||||
runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1);
|
runTime.setTime
|
||||||
|
(
|
||||||
|
timeDirs[Current_time_step + 1],
|
||||||
|
Current_time_step + 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Numparts_available > nPatches+1)
|
if (Numparts_available > nPatches+1)
|
||||||
|
|||||||
@ -5,7 +5,6 @@ nVar -= Num_variables - nSprayVariables + lagrangianScalarNames.size();
|
|||||||
|
|
||||||
if (nVar >= 0)
|
if (nVar >= 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
word name = lagrangianVectorNames[nVar];
|
word name = lagrangianVectorNames[nVar];
|
||||||
|
|
||||||
IOField<vector> v
|
IOField<vector> v
|
||||||
|
|||||||
@ -41,7 +41,7 @@ static word pointPrepend = "point_";
|
|||||||
static fileName rootDir;
|
static fileName rootDir;
|
||||||
static fileName caseDir;
|
static fileName caseDir;
|
||||||
|
|
||||||
static instantList TimeList;
|
static instantList timeDirs;
|
||||||
|
|
||||||
static List<word> fieldNames;
|
static List<word> fieldNames;
|
||||||
static List<word> lagrangianScalarNames;
|
static List<word> lagrangianScalarNames;
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"txx",
|
"txx",
|
||||||
Times[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -28,7 +28,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"tyy",
|
"tyy",
|
||||||
Times[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -44,7 +44,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"tzz",
|
"tzz",
|
||||||
Times[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -60,7 +60,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"txy",
|
"txy",
|
||||||
Times[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
|
|||||||
@ -48,18 +48,13 @@ Description
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
# include "addTimeOptions.H"
|
timeSelector::addOptions();
|
||||||
# include "setRootCase.H"
|
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
// Get times list
|
// Get times list
|
||||||
instantList Times = runTime.times();
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
// set startTime and endTime depending on -time and -latestTime options
|
|
||||||
# include "checkTimeOptions.H"
|
|
||||||
|
|
||||||
runTime.setTime(Times[startTime], startTime);
|
|
||||||
|
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
# include "readTransportProperties.H"
|
# include "readTransportProperties.H"
|
||||||
@ -83,10 +78,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// For each time step read all fields
|
// For each time step read all fields
|
||||||
for (label i=startTime; i<endTime; i++)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
runTime.setTime(Times[i], i);
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
Info<< "Collapsing fields for time " << runTime.timeName() << endl;
|
Info<< "Collapsing fields for time " << runTime.timeName() << endl;
|
||||||
|
|
||||||
# include "readFields.H"
|
# include "readFields.H"
|
||||||
@ -96,7 +90,7 @@ int main(int argc, char *argv[])
|
|||||||
# include "collapse.H"
|
# include "collapse.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "end" << endl;
|
Info<< "\nEnd" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
IOobject UMeanHeader
|
IOobject UMeanHeader
|
||||||
(
|
(
|
||||||
"UMean",
|
"UMean",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
);
|
);
|
||||||
@ -23,7 +23,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"UPrime2Mean",
|
"UPrime2Mean",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
),
|
),
|
||||||
@ -39,7 +39,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"pPrime2Mean",
|
"pPrime2Mean",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
),
|
),
|
||||||
@ -52,7 +52,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"epsilonMean",
|
"epsilonMean",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
),
|
),
|
||||||
@ -64,7 +64,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"nuMean",
|
"nuMean",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
),
|
),
|
||||||
@ -76,7 +76,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"gammaDotMean",
|
"gammaDotMean",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
),
|
),
|
||||||
@ -88,7 +88,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"nuPrime",
|
"nuPrime",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
),
|
),
|
||||||
@ -102,7 +102,7 @@
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"gammaDotPrime",
|
"gammaDotPrime",
|
||||||
runTime.times()[i].name(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Info<< nl << "Create databases as time" << endl;
|
Info << "\nCreate databases as time" << endl;
|
||||||
|
|
||||||
Time runTimeSource
|
Time runTimeSource
|
||||||
(
|
(
|
||||||
|
|||||||
@ -43,31 +43,6 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int getTimeIndex
|
|
||||||
(
|
|
||||||
const instantList& times,
|
|
||||||
const scalar t
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int nearestIndex = -1;
|
|
||||||
scalar nearestDiff = Foam::GREAT;
|
|
||||||
|
|
||||||
forAll(times, timeIndex)
|
|
||||||
{
|
|
||||||
if (times[timeIndex].name() == "constant") continue;
|
|
||||||
|
|
||||||
scalar diff = fabs(times[timeIndex].value() - t);
|
|
||||||
if (diff < nearestDiff)
|
|
||||||
{
|
|
||||||
nearestDiff = diff;
|
|
||||||
nearestIndex = timeIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nearestIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mapConsistentMesh
|
void mapConsistentMesh
|
||||||
(
|
(
|
||||||
const fvMesh& meshSource,
|
const fvMesh& meshSource,
|
||||||
@ -254,9 +229,7 @@ wordList addProcessorPatches
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
# include "setRoots.H"
|
# include "setRoots.H"
|
||||||
|
|
||||||
# include "createTimes.H"
|
# include "createTimes.H"
|
||||||
|
|
||||||
# include "setTimeIndex.H"
|
# include "setTimeIndex.H"
|
||||||
|
|
||||||
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
|
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
|
||||||
|
|||||||
@ -8,12 +8,18 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scalar sourceTime = args.optionRead<scalar>("sourceTime");
|
sourceTimeIndex = Time::findClosestTimeIndex
|
||||||
sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
|
(
|
||||||
|
sourceTimes,
|
||||||
|
args.optionRead<scalar>("sourceTime")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scalar sourceTime = runTimeTarget.time().value();
|
sourceTimeIndex = Time::findClosestTimeIndex
|
||||||
sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
|
(
|
||||||
|
sourceTimes,
|
||||||
|
runTimeTarget.time().value()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
@ -174,19 +175,13 @@ public:
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
timeSelector::addOptions();
|
||||||
|
|
||||||
# include "addTimeOptions.H"
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
// Get times list
|
// Get times list
|
||||||
instantList Times = runTime.times();
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
// set startTime and endTime depending on -time and -latestTime options
|
|
||||||
# include "checkTimeOptions.H"
|
|
||||||
|
|
||||||
runTime.setTime(Times[startTime], startTime);
|
|
||||||
|
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
|
|
||||||
@ -220,9 +215,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
PtrList<entry> regions(setFieldsDict.lookup("regions"));
|
PtrList<entry> regions(setFieldsDict.lookup("regions"));
|
||||||
|
|
||||||
forAll(regions, regioni)
|
forAll(regions, regionI)
|
||||||
{
|
{
|
||||||
const entry& region = regions[regioni];
|
const entry& region = regions[regionI];
|
||||||
|
|
||||||
autoPtr<topoSetSource> cellSelector =
|
autoPtr<topoSetSource> cellSelector =
|
||||||
topoSetSource::New(region.keyword(), mesh, region.dict());
|
topoSetSource::New(region.keyword(), mesh, region.dict());
|
||||||
@ -247,7 +242,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info << nl << "End" << endl;
|
Info<< "\nEnd" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,20 +109,20 @@ void Foam::Time::setControls()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Search directory for valid time directories
|
// Search directory for valid time directories
|
||||||
instantList Times = findTimes(path());
|
instantList timeDirs = findTimes(path());
|
||||||
|
|
||||||
if (startFrom == "firstTime")
|
if (startFrom == "firstTime")
|
||||||
{
|
{
|
||||||
if (Times.size())
|
if (timeDirs.size())
|
||||||
{
|
{
|
||||||
startTime_ = Times[0].value();
|
startTime_ = timeDirs[0].value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (startFrom == "latestTime")
|
else if (startFrom == "latestTime")
|
||||||
{
|
{
|
||||||
if (Times.size())
|
if (timeDirs.size())
|
||||||
{
|
{
|
||||||
startTime_ = Times[Times.size()-1].value();
|
startTime_ = timeDirs[timeDirs.size()-1].value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -385,13 +385,13 @@ Foam::instantList Foam::Time::times() const
|
|||||||
|
|
||||||
Foam::word Foam::Time::findInstancePath(const instant& t) const
|
Foam::word Foam::Time::findInstancePath(const instant& t) const
|
||||||
{
|
{
|
||||||
instantList times = Time::findTimes(path());
|
instantList timeDirs = findTimes(path());
|
||||||
|
|
||||||
forAllReverse(times, i)
|
forAllReverse(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
if (times[i] == t)
|
if (timeDirs[timeI] == t)
|
||||||
{
|
{
|
||||||
return times[i].name();
|
return timeDirs[timeI].name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,37 +401,37 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const
|
|||||||
|
|
||||||
Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
||||||
{
|
{
|
||||||
instantList times = Time::findTimes(path());
|
instantList timeDirs = findTimes(path());
|
||||||
|
|
||||||
// If there is only one time it is "constant" so return it
|
// there is only one time (likely "constant") so return it
|
||||||
if (times.size() == 1)
|
if (timeDirs.size() == 1)
|
||||||
{
|
{
|
||||||
return times[0];
|
return timeDirs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t < times[1].value())
|
if (t < timeDirs[1].value())
|
||||||
{
|
{
|
||||||
return times[1];
|
return timeDirs[1];
|
||||||
}
|
}
|
||||||
else if (t > times[times.size() - 1].value())
|
else if (t > timeDirs[timeDirs.size()-1].value())
|
||||||
{
|
{
|
||||||
return times[times.size() - 1];
|
return timeDirs[timeDirs.size()-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
label nearestIndex = -1;
|
label nearestIndex = -1;
|
||||||
scalar deltaT = GREAT;
|
scalar deltaT = GREAT;
|
||||||
|
|
||||||
for (label i=1; i < times.size(); i++)
|
for (label timeI=1; timeI < timeDirs.size(); ++timeI)
|
||||||
{
|
{
|
||||||
scalar diff = mag(times[i].value() - t);
|
scalar diff = mag(timeDirs[timeI].value() - t);
|
||||||
if (diff < deltaT)
|
if (diff < deltaT)
|
||||||
{
|
{
|
||||||
deltaT = diff;
|
deltaT = diff;
|
||||||
nearestIndex = i;
|
nearestIndex = timeI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return times[nearestIndex];
|
return timeDirs[nearestIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -440,29 +440,29 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
|||||||
//
|
//
|
||||||
// Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
// Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
||||||
// {
|
// {
|
||||||
// instantList times = Time::findTimes(path());
|
// instantList timeDirs = findTimes(path());
|
||||||
// label timeIndex = min(findClosestTimeIndex(times, t), 0);
|
// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0);
|
||||||
// return times[timeIndex];
|
// return timeDirs[timeIndex];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Foam::label Foam::Time::findClosestTimeIndex
|
Foam::label Foam::Time::findClosestTimeIndex
|
||||||
(
|
(
|
||||||
const instantList& times,
|
const instantList& timeDirs,
|
||||||
const scalar t
|
const scalar t
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label nearestIndex = -1;
|
label nearestIndex = -1;
|
||||||
scalar deltaT = GREAT;
|
scalar deltaT = GREAT;
|
||||||
|
|
||||||
forAll (times, i)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
if (times[i].name() == "constant") continue;
|
if (timeDirs[timeI].name() == "constant") continue;
|
||||||
|
|
||||||
scalar diff = fabs(times[i].value() - t);
|
scalar diff = mag(timeDirs[timeI].value() - t);
|
||||||
if (diff < deltaT)
|
if (diff < deltaT)
|
||||||
{
|
{
|
||||||
deltaT = diff;
|
deltaT = diff;
|
||||||
nearestIndex = i;
|
nearestIndex = timeI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -170,7 +170,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select
|
|||||||
// determine latestTime selection (if any)
|
// determine latestTime selection (if any)
|
||||||
// this must appear before the -time option processing
|
// this must appear before the -time option processing
|
||||||
label latestIdx = -1;
|
label latestIdx = -1;
|
||||||
if (args.options().found("latestTime"))
|
if (args.optionFound("latestTime"))
|
||||||
{
|
{
|
||||||
selectTimes = false;
|
selectTimes = false;
|
||||||
latestIdx = timeDirs.size() - 1;
|
latestIdx = timeDirs.size() - 1;
|
||||||
@ -182,12 +182,12 @@ Foam::List<Foam::instant> Foam::timeSelector::select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.options().found("time"))
|
if (args.optionFound("time"))
|
||||||
{
|
{
|
||||||
// can match 0/, but can never match constant/
|
// can match 0/, but can never match constant/
|
||||||
selectTimes = timeSelector
|
selectTimes = timeSelector
|
||||||
(
|
(
|
||||||
IStringStream(args.options()["time"])()
|
args.optionLookup("time")()
|
||||||
).selected(timeDirs);
|
).selected(timeDirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,13 +201,13 @@ Foam::List<Foam::instant> Foam::timeSelector::select
|
|||||||
if (constantIdx >= 0)
|
if (constantIdx >= 0)
|
||||||
{
|
{
|
||||||
// only add constant/ if specifically requested
|
// only add constant/ if specifically requested
|
||||||
selectTimes[constantIdx] = args.options().found("constant");
|
selectTimes[constantIdx] = args.optionFound("constant");
|
||||||
}
|
}
|
||||||
|
|
||||||
// special treatment for 0/
|
// special treatment for 0/
|
||||||
if (zeroIdx >= 0)
|
if (zeroIdx >= 0)
|
||||||
{
|
{
|
||||||
if (args.options().found("noZero"))
|
if (args.optionFound("noZero"))
|
||||||
{
|
{
|
||||||
// exclude 0/ if specifically requested
|
// exclude 0/ if specifically requested
|
||||||
selectTimes[zeroIdx] = false;
|
selectTimes[zeroIdx] = false;
|
||||||
@ -215,7 +215,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select
|
|||||||
else if (argList::validOptions.found("zeroTime"))
|
else if (argList::validOptions.found("zeroTime"))
|
||||||
{
|
{
|
||||||
// with -zeroTime enabled, drop 0/ unless specifically requested
|
// with -zeroTime enabled, drop 0/ unless specifically requested
|
||||||
selectTimes[zeroIdx] = args.options().found("zeroTime");
|
selectTimes[zeroIdx] = args.optionFound("zeroTime");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -136,7 +136,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Return the set of times selected based on the argList options
|
//- Return the set of times selected based on the argList options
|
||||||
static List<Foam::instant> select
|
static List<instant> select
|
||||||
(
|
(
|
||||||
const List<instant>&,
|
const List<instant>&,
|
||||||
const argList& args
|
const argList& args
|
||||||
@ -144,7 +144,7 @@ public:
|
|||||||
|
|
||||||
//- Return the set of times selected based on the argList options
|
//- Return the set of times selected based on the argList options
|
||||||
// also set the runTime to the first instance
|
// also set the runTime to the first instance
|
||||||
static List<Foam::instant> select0
|
static List<instant> select0
|
||||||
(
|
(
|
||||||
Time& runTime,
|
Time& runTime,
|
||||||
const argList& args
|
const argList& args
|
||||||
|
|||||||
@ -1 +1,5 @@
|
|||||||
argList::validOptions.insert("region", "name");
|
//
|
||||||
|
// addRegionOption.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Foam::argList::validOptions.insert("region", "name");
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// addTimeOptions.H
|
// addTimeOptions.H
|
||||||
// ~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
argList::validOptions.insert("constant", "");
|
Foam::argList::validOptions.insert("constant", "");
|
||||||
argList::validOptions.insert("latestTime", "");
|
Foam::argList::validOptions.insert("latestTime", "");
|
||||||
argList::validOptions.insert("noZero", "");
|
Foam::argList::validOptions.insert("noZero", "");
|
||||||
argList::validOptions.insert("time", "time");
|
Foam::argList::validOptions.insert("time", "time");
|
||||||
|
|||||||
@ -1,4 +1,14 @@
|
|||||||
if (Times.size() > 1 && !args.optionFound("constant"))
|
//
|
||||||
|
// checkConstantOption.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// unless -constant is present, skip startTime if it is "constant"
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!args.optionFound("constant")
|
||||||
|
&& (startTime < Times.size()-1)
|
||||||
|
&& (Times[startTime].name() == "constant")
|
||||||
|
)
|
||||||
{
|
{
|
||||||
startTime = 1;
|
startTime++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
if (args.optionFound("latestTime"))
|
|
||||||
{
|
|
||||||
startTime = Times.size() - 1;
|
|
||||||
}
|
|
||||||
@ -1,7 +1,17 @@
|
|||||||
|
//
|
||||||
|
// checkTimeOption.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
// check -time and -latestTime options
|
||||||
|
|
||||||
if (args.optionFound("time"))
|
if (args.optionFound("time"))
|
||||||
{
|
{
|
||||||
scalar timeValue = args.optionRead<scalar>("time");
|
Foam::scalar timeValue = args.optionRead<scalar>("time");
|
||||||
|
|
||||||
startTime = Time::findClosestTimeIndex(Times, timeValue);
|
startTime = Foam::Time::findClosestTimeIndex(Times, timeValue);
|
||||||
endTime = startTime + 1;
|
endTime = startTime + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.optionFound("latestTime"))
|
||||||
|
{
|
||||||
|
startTime = Times.size() - 1;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
label startTime = 0;
|
//
|
||||||
label endTime = Times.size();
|
// checkTimeOptions.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Foam::label startTime = 0;
|
||||||
|
Foam::label endTime = Times.size();
|
||||||
|
|
||||||
|
// unless -constant is present, skip startTime if it is "constant"
|
||||||
# include "checkConstantOption.H"
|
# include "checkConstantOption.H"
|
||||||
|
|
||||||
|
// check -time and -latestTime options
|
||||||
# include "checkTimeOption.H"
|
# include "checkTimeOption.H"
|
||||||
# include "checkLatestTimeOption.H"
|
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
label startTime = 0;
|
//
|
||||||
label endTime = Times.size();
|
// checkTimeOptionsNoConstant.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Foam::label startTime = 0;
|
||||||
|
Foam::label endTime = Times.size();
|
||||||
|
|
||||||
|
// check -time and -latestTime options
|
||||||
# include "checkTimeOption.H"
|
# include "checkTimeOption.H"
|
||||||
# include "checkLatestTimeOption.H"
|
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
Foam::Info<< "Create mesh for time = "
|
//
|
||||||
|
// createMesh.H
|
||||||
|
// ~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Foam::Info
|
||||||
|
<< "Create mesh for time = "
|
||||||
<< runTime.timeName() << Foam::nl << Foam::endl;
|
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||||
|
|
||||||
Foam::fvMesh mesh
|
Foam::fvMesh mesh
|
||||||
|
|||||||
@ -1,13 +1,19 @@
|
|||||||
Info<< "Create mesh, no clear-out for time = "
|
//
|
||||||
<< runTime.timeName() << nl << endl;
|
// createMeshNoClear.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~
|
||||||
|
// currently identical to createMesh.H
|
||||||
|
|
||||||
fvMesh mesh
|
Foam::Info
|
||||||
|
<< "Create mesh, no clear-out for time = "
|
||||||
|
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||||
|
|
||||||
|
Foam::fvMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
Foam::IOobject
|
||||||
(
|
(
|
||||||
fvMesh::defaultRegion,
|
Foam::fvMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
Foam::IOobject::MUST_READ
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,24 +1,30 @@
|
|||||||
word regionName;
|
//
|
||||||
|
// createNamedMesh.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Foam::word regionName;
|
||||||
|
|
||||||
if (args.optionReadIfPresent("region", regionName))
|
if (args.optionReadIfPresent("region", regionName))
|
||||||
{
|
{
|
||||||
Info<< "Create mesh " << regionName << " for time = "
|
Foam::Info
|
||||||
<< runTime.timeName() << nl << endl;
|
<< "Create mesh " << regionName << " for time = "
|
||||||
|
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
regionName = fvMesh::defaultRegion;
|
regionName = Foam::fvMesh::defaultRegion;
|
||||||
Info<< "Create mesh for time = "
|
Foam::Info
|
||||||
<< runTime.timeName() << nl << endl;
|
<< "Create mesh for time = "
|
||||||
|
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
fvMesh mesh
|
Foam::fvMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
Foam::IOobject
|
||||||
(
|
(
|
||||||
regionName,
|
regionName,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
Foam::IOobject::MUST_READ
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,24 +1,30 @@
|
|||||||
word regionName;
|
//
|
||||||
|
// createNamedPolyMesh.H
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Foam::word regionName;
|
||||||
|
|
||||||
if (args.optionReadIfPresent("region", regionName))
|
if (args.optionReadIfPresent("region", regionName))
|
||||||
{
|
{
|
||||||
Info<< "Create polyMesh " << regionName << " for time = "
|
Foam::Info
|
||||||
<< runTime.timeName() << nl << endl;
|
<< "Create polyMesh " << regionName << " for time = "
|
||||||
|
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
regionName = polyMesh::defaultRegion;
|
regionName = Foam::polyMesh::defaultRegion;
|
||||||
Info<< "Create polyMesh for time = "
|
Foam::Info
|
||||||
<< runTime.timeName() << nl << endl;
|
<< "Create polyMesh for time = "
|
||||||
|
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
polyMesh mesh
|
Foam::polyMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
Foam::IOobject
|
||||||
(
|
(
|
||||||
regionName,
|
regionName,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
Foam::IOobject::MUST_READ
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,13 +1,18 @@
|
|||||||
Info<< "Create polyMesh for time = "
|
//
|
||||||
<< runTime.timeName() << nl << endl;
|
// createPolyMesh.H
|
||||||
|
// ~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
polyMesh mesh
|
Foam::Info
|
||||||
|
<< "Create polyMesh for time = "
|
||||||
|
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||||
|
|
||||||
|
Foam::polyMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
Foam::IOobject
|
||||||
(
|
(
|
||||||
polyMesh::defaultRegion,
|
Foam::polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
Foam::IOobject::MUST_READ
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
//
|
||||||
|
// createTime.H
|
||||||
|
// ~~~~~~~~~~~~
|
||||||
|
|
||||||
Foam::Info<< "Create time\n" << Foam::endl;
|
Foam::Info<< "Create time\n" << Foam::endl;
|
||||||
|
|
||||||
Foam::Time runTime
|
Foam::Time runTime
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
Foam::argList args(argc, argv);
|
//
|
||||||
|
// setRootCase.H
|
||||||
|
// ~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Foam::argList args(argc, argv);
|
||||||
if (!args.checkRootCase())
|
if (!args.checkRootCase())
|
||||||
{
|
{
|
||||||
Foam::FatalError.exit();
|
Foam::FatalError.exit();
|
||||||
|
|||||||
@ -232,14 +232,14 @@ void Foam::calcTypes::addSubtract::preCalc
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.options().found("field"))
|
if (args.optionFound("field"))
|
||||||
{
|
{
|
||||||
addSubtractFieldName_ = args.options()["field"];
|
addSubtractFieldName_ = args.option("field");
|
||||||
calcType_ = FIELD;
|
calcType_ = FIELD;
|
||||||
}
|
}
|
||||||
else if (args.options().found("value"))
|
else if (args.optionFound("value"))
|
||||||
{
|
{
|
||||||
addSubtractValueStr_ = args.options()["value"];
|
addSubtractValueStr_ = args.option("value");
|
||||||
calcType_ = VALUE;
|
calcType_ = VALUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -249,9 +249,9 @@ void Foam::calcTypes::addSubtract::preCalc
|
|||||||
<< nl << exit(FatalError);
|
<< nl << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.options().found("resultName"))
|
if (args.optionFound("resultName"))
|
||||||
{
|
{
|
||||||
resultName_ = args.options()["resultName"];
|
resultName_ = args.option("resultName");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user