36 static const scalar perturbFactor = 1
e-6;
43 const lagrangian::Cloud<passiveParticle>& cloud,
51 const polyMesh&
mesh = cloud.pMesh();
64 meshSearch meshSearcher
70 label facei = meshSearcher.findNearestBoundaryFace(pt);
76 const point perturbPt = (1-perturbFactor)*pt+perturbFactor*cc;
94 const labelList& cellAddressing = meshToMesh0Interp.cellAddressing();
104 const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
105 const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
123 meshSource.time().name(),
127 IOobject* positionsPtr =
objects.lookup(
"positions");
131 Info<<
nl <<
" processing cloud " << cloudDirs[cloudI] <<
endl;
134 passiveParticleCloud sourceParcels
140 Info<<
" read " << sourceParcels.size()
141 <<
" parcels from source mesh." <<
endl;
144 passiveParticleCloud targetParcels
148 IDLList<passiveParticle>()
151 passiveParticle::trackingData td(targetParcels);
153 label sourceParticleI = 0;
156 DynamicList<label> addParticles(sourceParcels.size());
169 lagrangian::Cloud<passiveParticle>,
174 bool foundCell =
false;
177 if (iter().
cell() >= 0)
180 sourceToTargets[iter().cell()];
189 autoPtr<passiveParticle> newPtr
196 meshTarget.cells()[targetCells[i]][0],
200 passiveParticle& newP = newPtr();
206 - newP.position(meshTarget),
214 addParticles.append(sourceParticleI);
215 targetParcels.addParticle(newPtr.ptr());
224 unmappedSource.insert(sourceParticleI);
230 Info<<
" after meshToMesh0 addressing found "
231 << targetParcels.size()
232 <<
" parcels in target mesh." <<
endl;
238 if (unmappedSource.size())
244 lagrangian::Cloud<passiveParticle>,
249 if (unmappedSource.found(sourceParticleI))
260 label nLocateBoundaryHits = 0;
261 autoPtr<passiveParticle> pPtr
272 if (nLocateBoundaryHits == 0)
274 unmappedSource.erase(sourceParticleI);
275 addParticles.append(sourceParticleI);
276 targetParcels.addParticle(pPtr.ptr());
277 sourceParcels.remove(&iter());
284 addParticles.shrink();
286 Info<<
" after additional mesh searching found "
287 << targetParcels.size() <<
" parcels in target mesh." <<
endl;
289 if (addParticles.size())
291 IOPosition<passiveParticleCloud>(targetParcels).
write();
299 MapLagrangianFields<label>
300 (cloudDirs[cloudI],
objects, meshToMesh0Interp, addParticles);
301 MapLagrangianFields<scalar>
302 (cloudDirs[cloudI],
objects, meshToMesh0Interp, addParticles);
303 MapLagrangianFields<vector>
304 (cloudDirs[cloudI],
objects, meshToMesh0Interp, addParticles);
305 MapLagrangianFields<sphericalTensor>
306 (cloudDirs[cloudI],
objects, meshToMesh0Interp, addParticles);
307 MapLagrangianFields<symmTensor>
308 (cloudDirs[cloudI],
objects, meshToMesh0Interp, addParticles);
309 MapLagrangianFields<tensor>
310 (cloudDirs[cloudI],
objects, meshToMesh0Interp, addParticles);
Gets the indices of (source)particles that have been appended to the target cloud and maps the lagran...
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
virtual Ostream & write(const char)=0
Write character.
static const word prefix
The prefix to local: lagrangian.
void findCellFacePt(const point &p, label &celli, label &tetFacei, label &tetPti) const
Find the cell, tetFacei and tetPti for point p.
virtual const labelList & faceOwner() const
Return face owner.
const vectorField & cellCentres() const
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
point position(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the position given the coordinates and tet topology.
List< fileName > fileNameList
A List of fileNames.
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
vector point
Point is a vector.
List< labelList > labelListList
A List of labelList.
void mapLagrangian(const meshToMesh0 &meshToMesh0Interp)
Maps lagrangian positions and fields.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.