53 label nPatchFaces = 0;
60 const globalIndex globalWalls(nPatchFaces);
72 const fvPatch&
patch =
mesh_.boundary()[patchi];
81 label meshFacei =
patch.start()+patchFacei;
98 const label celli = faceCells[patchFacei];
103 const face&
f =
mesh_.faces()[meshFacei];
105 label tetFacei = meshFacei;
106 label tetPti = (startInfo.index()+1) %
f.size();
108 start = startInfo.point();
111 tetIndices tet(celli, tetFacei, tetPti);
113 (1.0 - 1
e-6)*startInfo.point()
114 + 1
e-6*tet.tet(
mesh_).centre();
117 mesh_.findTetFacePt(celli, start, tetFacei, tetPti);
120 start = faceCellCentres[patchFacei];
126 start = faceCellCentres[patchFacei];
144 globalWalls.toGlobal(nPatchFaces)
160 /
"wantedTracks_" +
mesh_.time().timeName() +
".obj"
164 for (
const findCellParticle& tp : cloud)
166 str.writeLine(tp.position(), tp.end());
180 scalar maxTrackLen = 2.0*
mesh_.bounds().mag();
187 start.setSize(nPatchFaces);
189 for (
const findCellParticle& tp : cloud)
191 start[nPatchFaces++] = tp.position();
196 cloud.move(cloud,
td, maxTrackLen);
200 List<Map<label>> compactMap;
220 /
"obtainedTracks_" +
mesh_.time().timeName() +
".obj"
230 str.writeLine(ends[i], start[cData[i]]);
262 dict.readEntry(
"fields", fieldSet_);
263 dict.readEntry(
"distance", distance_);
266 patchIDs_ =
pbm.patchSet(
dict.get<
wordRes>(
"patches")).sortedToc();
276 reverseFieldMap_.clear();
282 fieldMap_.reserve(fieldSet_.size());
283 reverseFieldMap_.reserve(fieldSet_.size());
286 const word& fldName = fieldSet_[seti].first();
287 const word& sampleFldName = fieldSet_[seti].second();
289 fieldMap_.insert(fldName, sampleFldName);
290 reverseFieldMap_.insert(sampleFldName, fldName);
294 <<
": Sampling " << fieldMap_.size() <<
" fields" <<
endl;
312 && vSpheretf_.empty()
318 <<
": Creating " << fieldMap_.size() <<
" fields" <<
endl;
322 createFields(vSpheretf_);
323 createFields(vSymmtf_);
331 <<
" Sampling fields to " << time_.timeName()
336 sampleFields(vSpheretf_);
348 Log <<
" Writing sampled fields to " << time_.timeName()
361 vSpheretf_[i].write();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const polyBoundaryMesh & pbm
Base cloud calls templated on particle type.
SubField< vector > subField
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files.
Ostream & writeLine(const point &p0, const point &p1)
Write line joining two points.
virtual const fileName & name() const override
Read/write access to the name of the stream.
label index() const noexcept
Return the hit index.
bool hit() const noexcept
Is there a hit?
const point_type & point() const noexcept
Return point, no checks.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
label size() const noexcept
The number of entries in the list.
A cloud is a registry collection of lagrangian particles.
static word defaultName
The default cloud name: defaultCloud.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Smooth ATC in cells next to a set of patches supplied by type.
A face is a list of labels corresponding to mesh vertices.
Class used to pass tracking data to the trackToFace function.
Particle class that finds cells by tracking.
Abstract base-class for Time/database function objects.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
static int debug
Flag to execute debug content.
virtual bool end()
Called when Time::run() determines that the time-loop exits.
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Samples near-patch volume fields within an input distance range.
scalar distance_
Distance away from wall.
HashTable< word > reverseFieldMap_
From resulting back to original field.
autoPtr< mapDistribute > getPatchDataMapPtr_
Map from cell based data back to patch based data.
PtrList< volScalarField > vsf_
List< Tuple2< word, word > > fieldSet_
Fields to process (input-name output-name).
List< List< point > > cellToSamples_
From cell to tracked end point.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
labelListList cellToWalls_
From cell to seed patch faces.
void calcAddressing()
Calculate addressing from cells back to patch faces.
void createFields(PtrList< GeometricField< Type, fvPatchField, volMesh > > &) const
Create the local fields.
PtrList< volTensorField > vtf_
void sampleFields(PtrList< GeometricField< Type, fvPatchField, volMesh > > &) const
Sample the fields.
PtrList< volSymmTensorField > vSymmtf_
nearWallFields(const word &name, const Time &runTime, const dictionary &dict)
Construct for given objectRegistry and dictionary.
PtrList< volVectorField > vvf_
virtual bool execute()
Execute the function-object operations.
PtrList< volSphericalTensorField > vSpheretf_
virtual bool write()
Write the function-object results.
labelList patchIDs_
Patches to sample.
HashTable< word > fieldMap_
From original field to sampled result.
const Time & time_
Reference to the time database.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label totalSize() const noexcept
The total addressed size, which corresponds to the end offset and also the sum of all localSizes.
label toGlobal(const label proci, const label i) const
From local to global on proci.
Class containing processor-to-processor mapping information.
static pointIndexHit facePoint(const polyMesh &, const label facei, const polyMesh::cellDecomposition)
Get a point on the face given a face decomposition method:
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
tetPointRef tet(const polyMesh &mesh) const
The tet geometry for this tet, where point0 is the cell centre.
Point centre() const
Return centre (centroid).
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
#define DebugInFunction
Report an information message using Foam::Info.
#define InfoInFunction
Report an information message using Foam::Info.
Namespace for handling debugging switches.
const std::string patch
OpenFOAM patch number as a std::string.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.