Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "streamLineBase.H"
#include "fvMesh.H"
#include "ReadFields.H"
#include "sampledSet.H"
#include "globalIndex.H"
#include "mapDistribute.H"
#include "interpolationCellPoint.H"
#include "wallPolyPatch.H"
#include "meshSearchMeshObject.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(streamLineBase, 0);
}
}
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&
Foam::functionObjects::streamLineBase::sampledSetAxis() const
{
if (!sampledSetPtr_)
{
sampledSetPoints();
}
return sampledSetAxis_;
}
const Foam::sampledSet&
Foam::functionObjects::streamLineBase::sampledSetPoints() const
{
if (!sampledSetPtr_)
{
sampledSetPtr_ = sampledSet::New
(
"seedSampleSet",
mesh_,
meshSearchMeshObject::New(mesh_),
dict_.subDict("seedSampleSet")
);
sampledSetAxis_ = sampledSetPtr_->axis();
}
Foam::autoPtr<Foam::indirectPrimitivePatch>
Foam::functionObjects::streamLineBase::wallPatch() const
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
for (const polyPatch& pp : patches)
//if (!polyPatch::constraintType(pp.type()))
if (isA<wallPolyPatch>(pp))
}
}
labelList addressing(nFaces);
nFaces = 0;
for (const polyPatch& pp : patches)
//if (!polyPatch::constraintType(pp.type()))
if (isA<wallPolyPatch>(pp))
{
forAll(pp, i)
{
addressing[nFaces++] = pp.start()+i;
}
}
}
return autoPtr<indirectPrimitivePatch>::New
IndirectList<face>
mesh_.faces(),
addressing
),
mesh_.points()
void Foam::functionObjects::streamLineBase::initInterpolations
(
const label nSeeds,
label& UIndex,
PtrList<volScalarField>& vsFlds,
PtrList<interpolation<scalar>>& vsInterp,
PtrList<volVectorField>& vvFlds,
PtrList<interpolation<vector>>& vvInterp
// Read fields
label nScalar = 0;
label nVector = 0;
for (const word& fieldName : fields_)
if (foundObject<volScalarField>(fieldName))
{
Andrew Heather
committed
++nScalar;
}
else if (foundObject<volVectorField>(fieldName))
Andrew Heather
committed
++nVector;
else
{
FatalErrorInFunction
<< "Cannot find field " << fieldName << nl
<< "Valid scalar fields are:"
<< flatOutput(mesh_.names(volScalarField::typeName)) << nl
<< "Valid vector fields are:"
<< flatOutput(mesh_.names(volVectorField::typeName))
<< exit(FatalError);
}
}
vsInterp.setSize(nScalar);
nScalar = 0;
vvInterp.setSize(nVector);
nVector = 0;
for (const word& fieldName : fields_)
{
if (foundObject<volScalarField>(fieldName))
const volScalarField& f = lookupObject<volScalarField>(fieldName);
nScalar++,
interpolation<scalar>::New
(
interpolationScheme_,
f
else if (foundObject<volVectorField>(fieldName))
const volVectorField& f = lookupObject<volVectorField>(fieldName);
if (f.name() == UName_)
Loading
Loading full blame...