Go to the documentation of this file.
42 Foam::surfaceSlipDisplacementPointPatchVectorField::projectModeNames_
44 { projectMode::NEAREST,
"nearest" },
45 { projectMode::POINTNORMAL,
"pointNormal" },
46 { projectMode::FIXEDNORMAL,
"fixedNormal" },
52 void Foam::surfaceSlipDisplacementPointPatchVectorField::calcProjection
67 const scalar projectLen =
mag(
mesh.bounds().max()-
mesh.bounds().min());
70 vector projectVec(0, 0, 0);
74 projectVec = projectLen*
n;
79 const pointZone* zonePtr =
nullptr;
81 if (frozenPointsZone_.size() > 0)
85 zonePtr = &
pZones[frozenPointsZone_];
87 Pout<<
"surfaceSlipDisplacementPointPatchVectorField : 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;
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<<
"surfaceSlipDisplacement :"
289 <<
" did not project " << nNotProjected
290 <<
" out of " <<
returnReduce(localPoints.size(), sumOp<label>())
291 <<
" points." <<
endl;
306 projectMode_(NEAREST),
322 projectMode_(projectModeNames_.get(
"projectMode",
dict)),
339 surfacesDict_(ppf.surfacesDict_),
340 projectMode_(ppf.projectMode_),
341 projectDir_(ppf.projectDir_),
342 wedgePlane_(ppf.wedgePlane_),
343 frozenPointsZone_(ppf.frozenPointsZone_)
354 surfacesDict_(ppf.surfacesDict_),
355 projectMode_(ppf.projectMode_),
356 projectDir_(ppf.projectDir_),
357 wedgePlane_(ppf.wedgePlane_),
358 frozenPointsZone_(ppf.frozenPointsZone_)
370 surfacesDict_(ppf.surfacesDict_),
371 projectMode_(ppf.projectMode_),
372 projectDir_(ppf.projectDir_),
373 wedgePlane_(ppf.wedgePlane_),
374 frozenPointsZone_(ppf.frozenPointsZone_)
404 return *surfacesPtr_;
413 vectorField displacement(this->patchInternalField());
416 calcProjection(displacement);
422 setInInternalField(iF, displacement);
435 os.
writeEntry(
"projectMode", projectModeNames_[projectMode_]);
int debug
Static debugging option.
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)
static constexpr const zero Zero
Global zero (0)
virtual const vectorField & pointNormals() const =0
Return point normals.
virtual const vectorField & localPoints() const =0
Return mesh points.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual void write(Ostream &) const
Write.
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
OSstream wrapped stdout (std::cout) with parallel prefix.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
Abstract base class for point-mesh patch fields.
const pointMesh & mesh() const noexcept
Return the mesh reference.
const pointPatch & patch() const
Return patch.
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)
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
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)
surfaceSlipDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
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 (stdout output on master, null elsewhere)
virtual const fileName & name() const
Get the name of the stream.
virtual void write(Ostream &) const
Write.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
Macros for easy insertion into run-time selection tables.
virtual const word & name() const =0
Return name.
Vector< scalar > vector
A scalar version of the templated Vector.
commsTypes
Types of communications.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Update the patch field.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
virtual const labelList & meshPoints() const =0
Return mesh points.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const pointBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
static const word null
An empty word.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
pointPatchField< vector > pointPatchVectorField
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.
Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...