Go to the documentation of this file.
41 Foam::surfaceSlipDisplacementPointPatchVectorField::projectModeNames_
43 { projectMode::NEAREST,
"nearest" },
44 { projectMode::POINTNORMAL,
"pointNormal" },
45 { projectMode::FIXEDNORMAL,
"fixedNormal" },
51 void Foam::surfaceSlipDisplacementPointPatchVectorField::calcProjection
66 const scalar projectLen =
mag(
mesh.bounds().max()-
mesh.bounds().min());
69 vector projectVec(0, 0, 0);
73 projectVec = projectLen*
n;
78 const pointZone* zonePtr =
nullptr;
80 if (frozenPointsZone_.size() > 0)
84 zonePtr = &
pZones[frozenPointsZone_];
86 Pout<<
"surfaceSlipDisplacementPointPatchVectorField : Fixing all "
87 << zonePtr->size() <<
" points in pointZone " << zonePtr->
name()
104 label nNotProjected = 0;
108 List<pointIndexHit> nearest;
120 if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0))
123 displacement[i] =
points0[meshPoints[i]] - localPoints[i];
125 else if (nearest[i].hit())
128 nearest[i].hitPoint()
137 Pout<<
" point:" << meshPoints[i]
138 <<
" coord:" << localPoints[i]
139 <<
" did not find any surface within " << projectLen
150 List<pointIndexHit> nearest;
177 offset[i] =
start[i][wedgePlane_];
178 start[i][wedgePlane_] = 0;
179 projectVecs[i][wedgePlane_] = 0;
183 List<pointIndexHit> rightHit;
195 List<pointIndexHit> leftHit;
210 if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0))
213 displacement[i] =
points0[meshPoints[i]] - localPoints[i];
215 else if (nearest[i].hit())
219 nearest[i].hitPoint()
226 if (rightHit[i].hit())
228 if (leftHit[i].hit())
236 interPt = rightHit[i];
240 interPt = leftHit[i];
245 interPt = rightHit[i];
250 if (leftHit[i].hit())
252 interPt = leftHit[i];
261 interPt.rawPoint()[wedgePlane_] += offset[i];
263 displacement[i] = interPt.rawPoint()-
points0[meshPoints[i]];
271 Pout<<
" point:" << meshPoints[i]
272 <<
" coord:" << localPoints[i]
273 <<
" did not find any intersection between"
274 <<
" ray from " <<
start[i]-projectVecs[i]
275 <<
" to " <<
start[i]+projectVecs[i] <<
endl;
282 reduce(nNotProjected, sumOp<label>());
284 if (nNotProjected > 0)
286 Info<<
"surfaceSlipDisplacement :"
288 <<
" did not project " << nNotProjected
289 <<
" out of " <<
returnReduce(localPoints.size(), sumOp<label>())
290 <<
" points." <<
endl;
305 projectMode_(NEAREST),
321 projectMode_(projectModeNames_.get(
"projectMode",
dict)),
338 surfacesDict_(ppf.surfacesDict_),
339 projectMode_(ppf.projectMode_),
340 projectDir_(ppf.projectDir_),
341 wedgePlane_(ppf.wedgePlane_),
342 frozenPointsZone_(ppf.frozenPointsZone_)
353 surfacesDict_(ppf.surfacesDict_),
354 projectMode_(ppf.projectMode_),
355 projectDir_(ppf.projectDir_),
356 wedgePlane_(ppf.wedgePlane_),
357 frozenPointsZone_(ppf.frozenPointsZone_)
369 surfacesDict_(ppf.surfacesDict_),
370 projectMode_(ppf.projectMode_),
371 projectDir_(ppf.projectDir_),
372 wedgePlane_(ppf.wedgePlane_),
373 frozenPointsZone_(ppf.frozenPointsZone_)
382 if (surfacesPtr_.empty())
403 return *surfacesPtr_;
412 vectorField displacement(this->patchInternalField());
415 calcProjection(displacement);
421 setInInternalField(iF, displacement);
434 os.
writeEntry(
"projectMode", projectModeNames_[projectMode_]);
435 os.
writeEntry(
"projectDirection", projectDir_);
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.
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.
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
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)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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 (uses stdout - output is on the master only)
virtual const fileName & name() const
Return 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.
const pointMesh & mesh() const
Return the mesh reference.
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.
virtual const word & name() const =0
Return name.
Vector< scalar > vector
A scalar version of the templated Vector.
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)))
commsTypes
Types of communications.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
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)
label ListType::const_reference const label start
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,...
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...