ENH: streamLine: add bidirectional tracking. Fixes #1466.

This commit is contained in:
mattijs
2019-10-23 16:52:27 +01:00
committed by Andrew Heather
parent 88ebf110ff
commit fb7698f6a1
10 changed files with 184 additions and 46 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2015 OpenFOAM Foundation
@ -47,6 +47,18 @@ namespace functionObjects
}
const Foam::Enum
<
Foam::functionObjects::streamLineBase::trackDirType
>
Foam::functionObjects::streamLineBase::trackDirTypeNames
({
{ trackDirType::FORWARD, "forward" },
{ trackDirType::BACKWARD, "backward" },
{ trackDirType::BIDIRECTIONAL, "bidirectional" }
});
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::word&
@ -886,7 +898,27 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
Info<< " Employing velocity field " << UName_ << endl;
dict.readEntry("trackForward", trackForward_);
bool trackForward;
if (dict.readIfPresent("trackForward", trackForward))
{
trackDir_ =
(
trackForward
? trackDirType::FORWARD
: trackDirType::BACKWARD
);
if (dict.found("direction"))
{
FatalIOErrorInFunction(dict) << "Cannot specify both "
<< "\"trackForward\" and \"direction\""
<< exit(FatalIOError);
}
}
else
{
trackDir_ = trackDirTypeNames.get("direction", dict);
}
dict.readEntry("lifeTime", lifeTime_);
if (lifeTime_ < 1)
{