Go to the documentation of this file.
42 Foam::surfaceDisplacementPointPatchVectorField::projectModeNames_
44 { projectMode::NEAREST,
"nearest" },
45 { projectMode::POINTNORMAL,
"pointNormal" },
46 { projectMode::FIXEDNORMAL,
"fixedNormal" },
52 void Foam::surfaceDisplacementPointPatchVectorField::calcProjection
57 const polyMesh&
mesh =
patch().boundaryMesh().mesh()();
67 const scalar projectLen =
mag(
mesh.bounds().max()-
mesh.bounds().min());
74 projectVec = projectLen*
n;
79 const pointZone* zonePtr =
nullptr;
81 if (frozenPointsZone_.size() > 0)
85 zonePtr = &
pZones[frozenPointsZone_];
87 Pout<<
"surfaceDisplacementPointPatchVectorField : Fixing all "
88 << zonePtr->size() <<
" points in pointZone " << zonePtr->
name()
102 start[i] =
points0[meshPoints[i]] + displacement[i];
105 label nNotProjected = 0;
109 List<pointIndexHit> nearest;
121 if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0))
124 displacement[i] =
points0[meshPoints[i]] - localPoints[i];
126 else if (nearest[i].hit())
129 nearest[i].hitPoint()
138 Pout<<
" point:" << meshPoints[i]
139 <<
" coord:" << localPoints[i]
140 <<
" did not find any surface within " << projectLen
151 List<pointIndexHit> nearest;
169 projectVecs = projectLen*
patch().pointNormals();
178 offset[i] = start[i][wedgePlane_];
179 start[i][wedgePlane_] = 0;
180 projectVecs[i][wedgePlane_] = 0;
184 List<pointIndexHit> rightHit;
196 List<pointIndexHit> leftHit;
211 if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0))
214 displacement[i] =
points0[meshPoints[i]] - localPoints[i];
216 else if (nearest[i].hit())
220 nearest[i].hitPoint()
227 if (rightHit[i].hit())
229 if (leftHit[i].hit())
233 magSqr(rightHit[i].hitPoint()-start[i])
234 <
magSqr(leftHit[i].hitPoint()-start[i])
237 interPt = rightHit[i];
241 interPt = leftHit[i];
246 interPt = rightHit[i];
251 if (leftHit[i].hit())
253 interPt = leftHit[i];
262 interPt.rawPoint()[wedgePlane_] += offset[i];
264 displacement[i] = interPt.rawPoint()-
points0[meshPoints[i]];
272 Pout<<
" point:" << meshPoints[i]
273 <<
" coord:" << localPoints[i]
274 <<
" did not find any intersection between"
275 <<
" ray from " << start[i]-projectVecs[i]
276 <<
" to " << start[i]+projectVecs[i] <<
endl;
283 reduce(nNotProjected, sumOp<label>());
285 if (nNotProjected > 0)
287 Info<<
"surfaceDisplacement :"
288 <<
" on patch " <<
patch().name()
289 <<
" did not project " << nNotProjected
290 <<
" out of " <<
returnReduce(localPoints.size(), sumOp<label>())
291 <<
" points." <<
endl;
305 fixedValuePointPatchVectorField(
p, iF),
307 projectMode_(NEAREST),
321 fixedValuePointPatchVectorField(
p, iF,
dict),
324 projectMode_(projectModeNames_.get(
"projectMode",
dict)),
329 if (velocity_.x() < 0 || velocity_.y() < 0 || velocity_.z() < 0)
332 <<
"All components of velocity have to be positive : "
334 <<
"Set velocity components to a great value if no clipping"
349 fixedValuePointPatchVectorField(ppf,
p, iF, mapper),
350 velocity_(ppf.velocity_),
351 surfacesDict_(ppf.surfacesDict_),
352 projectMode_(ppf.projectMode_),
353 projectDir_(ppf.projectDir_),
354 wedgePlane_(ppf.wedgePlane_),
355 frozenPointsZone_(ppf.frozenPointsZone_)
365 fixedValuePointPatchVectorField(ppf),
366 velocity_(ppf.velocity_),
367 surfacesDict_(ppf.surfacesDict_),
368 projectMode_(ppf.projectMode_),
369 projectDir_(ppf.projectDir_),
370 wedgePlane_(ppf.wedgePlane_),
371 frozenPointsZone_(ppf.frozenPointsZone_)
382 fixedValuePointPatchVectorField(ppf, iF),
383 velocity_(ppf.velocity_),
384 surfacesDict_(ppf.surfacesDict_),
385 projectMode_(ppf.projectMode_),
386 projectDir_(ppf.projectDir_),
387 wedgePlane_(ppf.wedgePlane_),
388 frozenPointsZone_(ppf.frozenPointsZone_)
397 if (surfacesPtr_.empty())
418 return *surfacesPtr_;
431 vectorField currentDisplacement(this->patchInternalField());
435 calcProjection(displacement);
438 vectorField offset(displacement-currentDisplacement);
443 const vector clipVelocity = velocity_*deltaT;
453 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
457 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
464 fixedValuePointPatchVectorField::updateCoeffs();
473 os.
writeEntry(
"projectMode", projectModeNames_[projectMode_]);
474 os.
writeEntry(
"projectDirection", projectDir_);
493 fixedValuePointPatchVectorField,
int debug
Static debugging option.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static constexpr const zero Zero
Global zero (0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Basic pointPatch represents a set of points from the mesh.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
Foam::pointPatchFieldMapper.
#define forAll(list, i)
Loop across all elements in list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
IOporosityModelList pZones(mesh)
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
void findNearest(const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest. Return -1 (and a miss()) or surface and nearest.
messageStream Info
Information stream (uses stdout - output is on the master only)
virtual const fileName & name() const
Return the name of the stream.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
const std::string patch
OpenFOAM patch number as a std::string.
scalar deltaTValue() const
Return time step value.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static const word null
An empty word.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
const Time & time() const
Return the top-level database.
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
constant condensation/saturation model.
static constexpr direction nComponents
Number of components in this vector space.
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void write(Ostream &) const
Write.