52 Foam::wallBoundedStreamLine::wallPatch()
const 54 const fvMesh& mesh =
dynamic_cast<const fvMesh&
>(obr_);
56 const polyBoundaryMesh& patches = mesh.boundaryMesh();
63 if (isA<wallPolyPatch>(patches[patchI]))
65 nFaces += patches[patchI].size();
76 if (isA<wallPolyPatch>(patches[patchI]))
78 const polyPatch& pp = patches[patchI];
82 addressing[nFaces++] = pp.start()+i;
87 return autoPtr<indirectPrimitivePatch>
104 const PackedBoolList& isWallPatch,
109 const fvMesh& mesh =
dynamic_cast<const fvMesh&
>(obr_);
111 const cell& cFaces = mesh.cells()[cellI];
114 label minTetPtI = -1;
115 scalar minDistSqr =
sqr(GREAT);
119 label faceI = cFaces[cFaceI];
121 if (isWallPatch[faceI])
123 const face& f = mesh.faces()[faceI];
124 const label fp0 = mesh.tetBasePtIs()[faceI];
125 const point& basePoint = mesh.points()[f[fp0]];
127 label fp = f.fcIndex(fp0);
128 for (
label i = 2; i < f.size(); i++)
130 const point& thisPoint = mesh.points()[f[fp]];
131 label nextFp = f.fcIndex(fp);
132 const point& nextPoint = mesh.points()[f[nextFp]];
134 const triPointRef tri(basePoint, thisPoint, nextPoint);
136 scalar d2 =
magSqr(tri.centre() - seedPt);
159 void Foam::wallBoundedStreamLine::track()
161 const Time& runTime = obr_.time();
162 const fvMesh& mesh =
dynamic_cast<const fvMesh&
>(obr_);
169 autoPtr<indirectPrimitivePatch> boundaryPatch(wallPatch());
170 PackedBoolList isWallPatch(mesh.nFaces());
171 forAll(boundaryPatch().addressing(), i)
173 isWallPatch[boundaryPatch().addressing()[i]] = 1;
181 IDLList<wallBoundedStreamLineParticle> initialParticles;
182 wallBoundedStreamLineParticleCloud particles
193 const sampledSet& seedPoints = sampledSetPtr_();
198 const point& seedPt = seedPoints[i];
199 label cellI = seedPoints.cells()[i];
201 tetIndices ids(findNearestTet(isWallPatch, seedPt, cellI));
203 if (ids.face() != -1 && isWallPatch[ids.face()])
212 particles.addParticle
214 new wallBoundedStreamLineParticle
217 ids.faceTri(mesh).centre(),
229 Pout<<
type() <<
" : ignoring seed " << seedPt
230 <<
" since not in wall cell." <<
endl;
237 Info<<
type() <<
" : seeded " << nSeeds <<
" particles." <<
endl;
242 PtrList<volScalarField> vsFlds;
243 PtrList<interpolation<scalar> > vsInterp;
244 PtrList<volVectorField> vvFlds;
245 PtrList<interpolation<vector> > vvInterp;
251 IOobjectList allObjects(mesh, runTime.timeName());
253 IOobjectList objects(2*fields_.size());
256 objects.add(*allObjects[fields_[i]]);
260 vsInterp.setSize(vsFlds.size());
268 interpolationScheme_,
274 vvInterp.setSize(vvFlds.size());
282 interpolationScheme_,
306 <<
"Cannot find field " << fields_[i] << endl
307 <<
"Valid scalar fields are:" 309 <<
"Valid vector fields are:" 314 vsInterp.setSize(nScalar);
316 vvInterp.setSize(nVector);
332 interpolationScheme_,
344 if (f.name() == UName_)
354 interpolationScheme_,
363 scalarNames_.
setSize(vsInterp.size());
366 scalarNames_[i] = vsInterp[i].psi().name();
368 vectorNames_.setSize(vvInterp.size());
371 vectorNames_[i] = vvInterp[i].psi().name();
379 <<
"Cannot find field to move particles with : " << UName_
381 <<
"This field has to be present in the sampled fields " 383 <<
" and in the objectRegistry." << endl
392 allTracks_.setCapacity(nSeeds);
393 allScalars_.setSize(vsInterp.size());
396 allScalars_[i].clear();
397 allScalars_[i].setCapacity(nSeeds);
399 allVectors_.setSize(vvInterp.size());
402 allVectors_[i].clear();
403 allVectors_[i].setCapacity(nSeeds);
408 wallBoundedStreamLineParticle::trackingData td
429 particles.move(td, trackTime);
435 Foam::wallBoundedStreamLine::wallBoundedStreamLine
440 const bool loadFromFiles
446 loadFromFiles_(loadFromFiles),
450 if (isA<fvMesh>(obr_))
459 "wallBoundedStreamLine::wallBoundedStreamLine\n" 462 "const objectRegistry&, " 463 "const dictionary&, " 466 ) <<
"No fvMesh available, deactivating " << name_
485 dict.
lookup(
"fields") >> fields_;
486 if (dict.
found(
"UName"))
488 dict.
lookup(
"UName") >> UName_;
497 "wallBoundedStreamLine::read(const dictionary&)",
499 ) <<
"Using deprecated entry \"U\"." 500 <<
" Please use \"UName\" instead." 502 dict.
lookup(
"U") >> UName_;
510 "wallBoundedStreamLine::read(const dictionary&)",
512 ) <<
"Velocity field for tracking " << UName_
513 <<
" should be present in the list of fields " << fields_
518 dict.
lookup(
"trackForward") >> trackForward_;
519 dict.
lookup(
"lifeTime") >> lifeTime_;
522 FatalErrorIn(
":wallBoundedStreamLine::read(const dictionary&)")
523 <<
"Illegal value " << lifeTime_ <<
" for lifeTime" 526 trackLength_ = VGREAT;
527 if (dict.
found(
"trackLength"))
529 dict.
lookup(
"trackLength") >> trackLength_;
531 Info<<
type() <<
" : fixed track length specified : " 532 << trackLength_ <<
nl <<
endl;
538 "interpolationScheme",
548 "wallBoundedStreamLine" 550 dict.
lookup(
"seedSampleSet") >> seedSet_;
563 coeffsDict.
lookup(
"axis") >> sampledSetAxis_;
573 faceSet faces(mesh,
"lowQualityTetFaces", mesh.
nFaces()/100+1);
587 WarningIn(
"wallBoundedStreamLine::read(const dictionary&)")
588 <<
"Found " << nFaces
589 <<
" faces with low quality or negative volume " 590 <<
"decomposition tets. Writing to faceSet " << faces.name()
598 const cell& cFaces = mesh.
cells()[cellI];
600 numFacesPerEdge.
clear();
604 label faceI = cFaces[cFaceI];
610 numFacesPerEdge.
find(
e);
611 if (eFnd != numFacesPerEdge.
end())
628 "wallBoundedStreamLine::read(const dictionary&)" 629 ) <<
"problem cell:" << cellI
683 fromProc.
setSize(globalTrackIDs.localSize(procI));
686 fromProc[i] = trackI++;
692 toMaster.
setSize(globalTrackIDs.localSize());
700 globalTrackIDs.size(),
712 distMap.constructSize(),
714 distMap.constructMap(),
719 forAll(allScalars_, scalarI)
725 distMap.constructSize(),
727 distMap.constructMap(),
732 forAll(allVectors_, vectorI)
738 distMap.constructSize(),
740 distMap.constructMap(),
748 forAll(allTracks_, trackI)
750 n += allTracks_[trackI].size();
753 Info<<
" Tracks:" << allTracks_.size() <<
nl 754 <<
" Total samples:" << n <<
endl;
767 ? runTime.
path()/
".."/
"postProcessing"/
"sets"/
name()
768 : runTime.
path()/
"postProcessing"/
"sets"/
name()
772 vtkPath = vtkPath/mesh.
name();
781 forAll(allTracks_, trackI)
792 tracks[trackI].transfer(allTracks_[trackI]);
797 if (allScalars_.size() > 0)
801 forAll(allScalars_, scalarI)
804 allScalars_[scalarI];
805 scalarValues[scalarI].
setSize(allTrackVals.
size());
807 forAll(allTrackVals, trackI)
810 scalarValues[scalarI][trackI].
transfer(trackVals);
817 / scalarFormatterPtr_().getFileName
826 scalarFormatterPtr_().
write 838 if (allVectors_.size() > 0)
842 forAll(allVectors_, vectorI)
845 allVectors_[vectorI];
846 vectorValues[vectorI].
setSize(allTrackVals.
size());
848 forAll(allTrackVals, trackI)
851 vectorValues[vectorI][trackI].
transfer(trackVals);
858 / vectorFormatterPtr_().getFileName
867 vectorFormatterPtr_().write
dimensionedScalar sqrt(const dimensionedScalar &ds)
static bool & parRun()
Is this a parallel run?
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
static autoPtr< writer > New(const word &writeFormat)
Return a reference to the selected writer.
void transfer(List< T > &)
Transfer contents of the argument List into this.
static const char *const typeName
Mesh data needed to do the Finite Volume discretisation.
const word & name() const
Return reference to name.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
vector point
Point is a vector.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
fileName path() const
Return path.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const labelListList &constructMap, List< T > &, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for Pstream::scheduled.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Holds list of sampling positions.
word name(const complex &)
Return a string representation of a complex.
A cell is defined as a list of faces with extra functionality.
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
static const meshSearchMeshObject & New(const polyMesh &mesh)
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
Class containing processor-to-processor mapping information.
virtual void execute()
Execute the averaging.
static const scalar minTetQuality
Minimum tetrahedron quality.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
static bool checkFaceTets(const polyMesh &mesh, scalar tol=minTetQuality, const bool report=false, labelHashSet *setPtr=NULL)
Check face-decomposition tet volume.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const cellList & cells() const
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
label nextLabel(const label i) const
Next vertex on face.
fileName path() const
Return directory path name (part before last /)
virtual ~wallBoundedStreamLine()
Destructor.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
#define IOWarningIn(functionName, ios)
Report an IO warning using Foam::Warning.
triangle< point, const point & > triPointRef
const Time & time() const
Return the top-level database.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual void write()
Calculate the field average data and write.
A face is a list of labels corresponding to mesh vertices.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const double e
Elementary charge.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
void clear()
Clear all entries from table.
wordList ReadFields(const Mesh &mesh, const IOobjectList &objects, PtrList< GeoField > &fields, const bool syncPar=true)
Helper routine to read fields.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
virtual Ostream & write(const token &)=0
Write next token to stream.
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
void setSize(const label)
Alter the addressed list size.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
errorManip< error > abort(error &err)
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Helper routine to read fields.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
GeometricField< vector, fvPatchField, volMesh > volVectorField
static word defaultRegion
Return the default region name.
Mesh consisting of general polyhedral cells.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Registry of regIOobjects.
List< label > labelList
A List of labels.
A class for handling file names.
static bool master(const label communicator=0)
Am I the master process.
bool read(const char *, int32_t &)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
const Time & time() const
Return time.
virtual const faceList & faces() const
Return raw faces.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
static autoPtr< interpolation< scalar > > New(const word &interpolationType, const GeometricField< scalar, fvPatchField, volMesh > &psi)
Return a reference to the specified interpolation scheme.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual void end()
Execute the averaging at the final time-loop, currently does nothing.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
virtual void read(const dictionary &)
Read the field average data.