40 const NamedEnum<surfaceSlipDisplacementPointPatchVectorField::projectMode, 3>
41 surfaceSlipDisplacementPointPatchVectorField::projectModeNames_
51 void surfaceSlipDisplacementPointPatchVectorField::calcProjection
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()
92 const motionSolver& motion =
93 refCast<const fvMeshMovers::motionSolver>
95 refCast<const fvMesh>(
mesh).mover()
100 refCast<const displacementMotionSolver>(motion).points0();
105 start[i] = points0[meshPoints[i]] + displacement[i];
108 label nNotProjected = 0;
112 List<pointIndexHit> nearest;
124 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
127 displacement[i] = points0[meshPoints[i]] - localPoints[i];
129 else if (nearest[i].hit())
132 nearest[i].hitPoint()
133 - points0[meshPoints[i]];
141 Pout<<
" point:" << meshPoints[i]
142 <<
" coord:" << localPoints[i]
143 <<
" did not find any surface within " << projectLen
154 List<pointIndexHit> nearest;
181 offset[i] = start[i][wedgePlane_];
182 start[i][wedgePlane_] = 0;
183 projectVecs[i][wedgePlane_] = 0;
187 List<pointIndexHit> rightHit;
199 List<pointIndexHit> leftHit;
214 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
217 displacement[i] = points0[meshPoints[i]] - localPoints[i];
219 else if (nearest[i].hit())
223 nearest[i].hitPoint()
224 - points0[meshPoints[i]];
230 if (rightHit[i].hit())
232 if (leftHit[i].hit())
236 magSqr(rightHit[i].hitPoint()-start[i])
237 <
magSqr(leftHit[i].hitPoint()-start[i])
240 interPt = rightHit[i];
244 interPt = leftHit[i];
249 interPt = rightHit[i];
254 if (leftHit[i].hit())
256 interPt = leftHit[i];
265 interPt.rawPoint()[wedgePlane_] +=
offset[i];
267 displacement[i] = interPt.rawPoint()-points0[meshPoints[i]];
275 Pout<<
" point:" << meshPoints[i]
276 <<
" coord:" << localPoints[i]
277 <<
" did not find any intersection between"
278 <<
" ray from " << start[i]-projectVecs[i]
279 <<
" to " << start[i]+projectVecs[i] <<
endl;
286 reduce(nNotProjected, sumOp<label>());
288 if (nNotProjected > 0)
290 Info<<
"surfaceSlipDisplacement :"
292 <<
" did not project " << nNotProjected
293 <<
" out of " <<
returnReduce(localPoints.size(), sumOp<label>())
294 <<
" points." <<
endl;
310 surfacesDict_(
dict.subDict(
"geometry")),
311 projectMode_(projectModeNames_.
read(
dict.lookup(
"projectMode"))),
313 wedgePlane_(
dict.lookupOrDefault(
"wedgePlane", -1)),
314 frozenPointsZone_(
dict.lookupOrDefault(
"frozenPointsZone",
word::null))
328 surfacesDict_(ppf.surfacesDict_),
329 projectMode_(ppf.projectMode_),
330 projectDir_(ppf.projectDir_),
331 wedgePlane_(ppf.wedgePlane_),
332 frozenPointsZone_(ppf.frozenPointsZone_)
344 surfacesDict_(ppf.surfacesDict_),
345 projectMode_(ppf.projectMode_),
346 projectDir_(ppf.projectDir_),
347 wedgePlane_(ppf.wedgePlane_),
348 frozenPointsZone_(ppf.frozenPointsZone_)
357 if (surfacesPtr_.empty())
366 db().time().constant(),
377 return surfacesPtr_();
389 calcProjection(displacement);
405 writeEntry(os,
"projectMode", projectModeNames_[projectMode_]);
406 writeEntry(os,
"projectDirection", projectDir_);
410 writeEntry(os,
"frozenPointsZone", frozenPointsZone_);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual const fileName & name() const
Return the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
commsTypes
Types of communications.
static const direction nComponents
Number of components in this vector space.
const point & min() const
Minimum point defining the bounding box.
const point & max() const
Maximum point defining the bounding box.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Abstract base class for field mapping.
const pointMesh & mesh() const
Return the mesh reference.
Abstract base class for point-mesh patch fields.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual void write(Ostream &) const
Write.
tmp< Field< Type > > patchInternalField() const
Return field created from appropriate internal field values.
const Field< Type > & primitiveField() const
Return internal field reference.
const objectRegistry & db() const
Return local objectRegistry.
const pointPatch & patch() const
Return patch.
void setInternalField(Field< Type1 > &iF, const Field< Type1 > &pF, const labelList &meshPoints) const
Given the internal field and a patch field,.
Basic pointPatch represents a set of points from the mesh.
virtual const word & name() const =0
Return name.
virtual const vectorField & pointNormals() const =0
Return point normals.
virtual const labelList & meshPoints() const =0
Return mesh points.
const pointBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
virtual const vectorField & localPoints() const =0
Return mesh points.
const pointZoneList & pointZones() const
Return point zones.
const boundBox & bounds() const
Return mesh bounding box.
Container for searchableSurfaces.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
void findNearest(const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest. Return -1 (and a miss()) or surface and nearest.
static const word & geometryDir()
Return the geometry directory name.
Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement...
const searchableSurfaceList & surfaces() const
Surface to follow. Demand loads surfaceNames.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Update the patch field.
virtual void write(Ostream &) const
Write.
surfaceSlipDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
A class for handling words, derived from string.
static const word null
An empty word.
IOporosityModelList pZones(mesh)
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
makePointPatchTypeField(pointPatchVectorField, angularOscillatingDisplacementPointPatchVectorField)
bool read(const char *, int32_t &)
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.
PointIndexHit< point > pointIndexHit
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
vectorField pointField
pointField is a vectorField.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Field< vector > vectorField
Specialisation of Field<T> for vector.
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
prefixOSstream Pout(cout, "Pout")
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
void offset(label &lst, const label o)