47 namespace functionObjects
54 wallBoundedStreamLine,
64 Foam::functionObjects::wallBoundedStreamLine::wallPatch()
const 66 const fvMesh& mesh =
dynamic_cast<const fvMesh&
>(obr_);
75 if (isA<wallPolyPatch>(patches[patchi]))
77 nFaces += patches[
patchi].size();
88 if (isA<wallPolyPatch>(patches[patchi]))
90 const polyPatch& pp = patches[
patchi];
94 addressing[nFaces++] = pp.start()+i;
99 return autoPtr<indirectPrimitivePatch>
114 Foam::tetIndices Foam::functionObjects::wallBoundedStreamLine::findNearestTet
116 const PackedBoolList& isWallPatch,
121 const fvMesh& mesh =
dynamic_cast<const fvMesh&
>(obr_);
123 const cell& cFaces = mesh.cells()[celli];
126 label minTetPtI = -1;
127 scalar minDistSqr =
sqr(GREAT);
131 label facei = cFaces[cFacei];
133 if (isWallPatch[facei])
135 const face& f = mesh.faces()[facei];
136 const label fp0 = mesh.tetBasePtIs()[facei];
137 const point& basePoint = mesh.points()[f[fp0]];
139 label fp = f.fcIndex(fp0);
140 for (
label i = 2; i < f.size(); i++)
142 const point& thisPoint = mesh.points()[f[fp]];
143 label nextFp = f.fcIndex(fp);
144 const point& nextPoint = mesh.points()[f[nextFp]];
146 const triPointRef tri(basePoint, thisPoint, nextPoint);
148 scalar d2 =
magSqr(tri.centre() - seedPt);
171 void Foam::functionObjects::wallBoundedStreamLine::track()
173 const fvMesh& mesh =
dynamic_cast<const fvMesh&
>(obr_);
180 autoPtr<indirectPrimitivePatch> boundaryPatch(wallPatch());
181 PackedBoolList isWallPatch(mesh.nFaces());
182 forAll(boundaryPatch().addressing(), i)
184 isWallPatch[boundaryPatch().addressing()[i]] = 1;
192 IDLList<wallBoundedStreamLineParticle> initialParticles;
193 wallBoundedStreamLineParticleCloud particles
204 const sampledSet& seedPoints = sampledSetPtr_();
209 const point& seedPt = seedPoints[i];
210 label celli = seedPoints.cells()[i];
212 tetIndices ids(findNearestTet(isWallPatch, seedPt, celli));
214 if (ids.face() != -1 && isWallPatch[ids.face()])
223 particles.addParticle
225 new wallBoundedStreamLineParticle
228 ids.faceTri(mesh).centre(),
240 Pout<<
type() <<
" : ignoring seed " << seedPt
241 <<
" since not in wall cell." <<
endl;
248 Info<<
type() <<
" : seeded " << nSeeds <<
" particles." <<
endl;
253 PtrList<volScalarField> vsFlds;
254 PtrList<interpolation<scalar>> vsInterp;
255 PtrList<volVectorField> vvFlds;
256 PtrList<interpolation<vector>> vvInterp;
276 <<
"Cannot find field " << fields_[i] << endl
277 <<
"Valid scalar fields are:" 279 <<
"Valid vector fields are:" 285 vsInterp.setSize(nScalar);
287 vvInterp.setSize(nVector);
303 interpolationScheme_,
315 if (f.name() == UName_)
325 interpolationScheme_,
333 scalarNames_.
setSize(vsInterp.size());
336 scalarNames_[i] = vsInterp[i].psi().name();
338 vectorNames_.setSize(vvInterp.size());
341 vectorNames_[i] = vvInterp[i].psi().name();
349 <<
"Cannot find field to move particles with : " << UName_
351 <<
"This field has to be present in the sampled fields " 353 <<
" and in the objectRegistry." << endl
362 allTracks_.setCapacity(nSeeds);
363 allScalars_.setSize(vsInterp.size());
366 allScalars_[i].clear();
367 allScalars_[i].setCapacity(nSeeds);
369 allVectors_.setSize(vvInterp.size());
372 allVectors_[i].clear();
373 allVectors_[i].setCapacity(nSeeds);
378 wallBoundedStreamLineParticle::trackingData td
399 particles.move(td, trackTime);
405 Foam::functionObjects::wallBoundedStreamLine::wallBoundedStreamLine
422 if (!isA<fvMesh>(obr_))
443 dict.
lookup(
"fields") >> fields_;
446 dict.
lookup(
"U") >> UName_;
456 ) <<
"Using deprecated entry \"U\"." 457 <<
" Please use \"UName\" instead." 459 dict.
lookup(
"U") >> UName_;
468 ) <<
"Velocity field for tracking " << UName_
469 <<
" should be present in the list of fields " << fields_
474 dict.
lookup(
"trackForward") >> trackForward_;
475 dict.
lookup(
"lifeTime") >> lifeTime_;
479 <<
"Illegal value " << lifeTime_ <<
" for lifeTime" 482 trackLength_ = VGREAT;
483 if (dict.
found(
"trackLength"))
485 dict.
lookup(
"trackLength") >> trackLength_;
487 Info<<
type() <<
" : fixed track length specified : " 488 << trackLength_ <<
nl <<
endl;
494 "interpolationScheme",
501 "wallBoundedStreamLine" 503 dict.
lookup(
"seedSampleSet") >> seedSet_;
516 coeffsDict.
lookup(
"axis") >> sampledSetAxis_;
526 faceSet faces(mesh,
"lowQualityTetFaces", mesh.
nFaces()/100+1);
541 <<
"Found " << nFaces
542 <<
" faces with low quality or negative volume " 543 <<
"decomposition tets. Writing to faceSet " << faces.name()
551 const cell& cFaces = mesh.
cells()[celli];
553 numFacesPerEdge.
clear();
557 label facei = cFaces[cFacei];
563 numFacesPerEdge.
find(
e);
564 if (eFnd != numFacesPerEdge.
end())
580 <<
"problem cell:" << celli
627 fromProc.
setSize(globalTrackIDs.localSize(proci));
630 fromProc[i] = trackI++;
636 toMaster.
setSize(globalTrackIDs.localSize());
644 globalTrackIDs.size(),
656 distMap.constructSize(),
659 distMap.constructMap(),
666 forAll(allScalars_, scalarI)
668 allScalars_[scalarI].shrink();
673 distMap.constructSize(),
676 distMap.constructMap(),
678 allScalars_[scalarI],
681 allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
684 forAll(allVectors_, vectorI)
686 allVectors_[vectorI].shrink();
691 distMap.constructSize(),
694 distMap.constructMap(),
696 allVectors_[vectorI],
699 allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
705 forAll(allTracks_, trackI)
707 n += allTracks_[trackI].size();
710 Info<<
" Tracks:" << allTracks_.size() <<
nl 711 <<
" Total samples:" << n <<
endl;
724 ? runTime.
path()/
".."/
"postProcessing"/
"sets"/
name()
725 : runTime.
path()/
"postProcessing"/
"sets"/
name()
729 vtkPath = vtkPath/mesh.
name();
738 forAll(allTracks_, trackI)
749 tracks[trackI].transfer(allTracks_[trackI]);
754 if (allScalars_.size() > 0)
758 forAll(allScalars_, scalarI)
761 allScalars_[scalarI];
762 scalarValues[scalarI].
setSize(allTrackVals.
size());
764 forAll(allTrackVals, trackI)
767 scalarValues[scalarI][trackI].
transfer(trackVals);
774 / scalarFormatterPtr_().getFileName
783 scalarFormatterPtr_().
write 795 if (allVectors_.size() > 0)
799 forAll(allVectors_, vectorI)
802 allVectors_[vectorI];
803 vectorValues[vectorI].
setSize(allTrackVals.
size());
805 forAll(allTrackVals, trackI)
808 vectorValues[vectorI][trackI].
transfer(trackVals);
815 / vectorFormatterPtr_().getFileName
822 vectorFormatterPtr_().write
842 const fvMesh& mesh_ =
dynamic_cast<const fvMesh&
>(obr_);
844 if (&mpm.
mesh() == &mesh_)
856 const fvMesh& mesh_ =
dynamic_cast<const fvMesh&
>(obr_);
const Time & time() const
Return time.
Class containing functor to negate primitives. Dummy for all other types.
virtual bool write()
Calculate and write the wall-bounded streamlines.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
const double e
Elementary charge.
A list of keyword definitions, which are a keyword followed by any number of values (e...
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
static const char *const typeName
static bool checkFaceTets(const polyMesh &mesh, scalar tol=minTetQuality, const bool report=false, labelHashSet *setPtr=NULL)
Check face-decomposition tet volume.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static autoPtr< interpolation< scalar > > New(const word &interpolationType, const GeometricField< scalar, fvPatchField, volMesh > &psi)
Return a reference to the specified interpolation scheme.
void size(const label)
Override size to be inconsistent with allocated storage.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
static word defaultRegion
Return the default region name.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool read(const dictionary &)
Read the field average data.
static bool master(const label communicator=0)
Am I the master process.
Field reading functions for post-processing utilities.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Abstract base-class for Time/database function objects.
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const cellList & cells() const
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
static const meshSearchMeshObject & New(const polyMesh &mesh)
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
virtual ~wallBoundedStreamLine()
Destructor.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
bool read(const char *, int32_t &)
void setSize(const label)
Alter the addressed list size.
Holds list of sampling positions.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
void clear()
Clear all entries from table.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &, const negateOp &negOp, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for Pstream::scheduled.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
List< label > labelList
A List of labels.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
static autoPtr< writer > New(const word &writeFormat)
Return a reference to the selected writer.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
prefixOSstream Pout(cout,"Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
word name(const complex &)
Return a string representation of a complex.
void setSize(const label)
Reset size of List.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
Class containing processor-to-processor mapping information.
vector point
Point is a vector.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A cell is defined as a list of faces with extra functionality.
addToRunTimeSelectionTable(functionObject, blendingFactor, dictionary)
Mesh data needed to do the Finite Volume discretisation.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
triangle< point, const point & > triPointRef
virtual bool execute()
Do nothing.
label nextLabel(const label i) const
Next vertex on face.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual Ostream & write(const token &)=0
Write next token to stream.
Mesh consisting of general polyhedral cells.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
Registry of regIOobjects.
virtual const faceList & faces() const
Return raw faces.
fileName path() const
Return path.
void transfer(List< T > &)
Transfer contents of the argument List into this.
fileName path() const
Return directory path name (part before last /)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
static const scalar minTetQuality
Minimum tetrahedron quality.
const word & name() const
Return reference to name.
const polyMesh & mesh() const
Return polyMesh.
const Time & time() const
Return the top-level database.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.