mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added sourceTime option to mapFields
This commit is contained in:
@ -43,6 +43,31 @@ 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
|
||||
(
|
||||
const fvMesh& meshSource,
|
||||
@ -232,7 +257,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
# include "createTimes.H"
|
||||
|
||||
runTimeSource.setTime(runTimeTarget);
|
||||
# include "setTimeIndex.H"
|
||||
|
||||
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
|
||||
|
||||
Info<< "\nSource time: " << runTimeSource.value()
|
||||
<< "\nTarget time: " << runTimeTarget.value()
|
||||
@ -302,7 +329,11 @@ int main(int argc, char *argv[])
|
||||
caseDirSource/fileName(word("processor") + name(procI))
|
||||
);
|
||||
|
||||
runTimeSource.setTime(runTimeTarget);
|
||||
runTimeSource.setTime
|
||||
(
|
||||
sourceTimes[sourceTimeIndex],
|
||||
sourceTimeIndex
|
||||
);
|
||||
|
||||
fvMesh meshSource
|
||||
(
|
||||
@ -446,7 +477,11 @@ int main(int argc, char *argv[])
|
||||
caseDirSource/fileName(word("processor") + name(procISource))
|
||||
);
|
||||
|
||||
runTimeSource.setTime(runTimeTarget);
|
||||
runTimeSource.setTime
|
||||
(
|
||||
sourceTimes[sourceTimeIndex],
|
||||
sourceTimeIndex
|
||||
);
|
||||
|
||||
fvMesh meshSource
|
||||
(
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
argList::validArgs.clear();
|
||||
|
||||
argList::validOptions.insert("source", "dir");
|
||||
argList::validOptions.insert("sourceTime", "scalar");
|
||||
|
||||
argList::validOptions.erase(argList::validOptions.find("parallel"));
|
||||
argList::validOptions.insert("parallelSource", "");
|
||||
|
||||
Reference in New Issue
Block a user