51 surfaceSlipDisplacementPointPatchVectorField::projectModeNames_;
56 void surfaceSlipDisplacementPointPatchVectorField::calcProjection
74 vector projectVec(0, 0, 0);
78 projectVec = projectLen*
n;
83 const pointZone* zonePtr =
nullptr;
85 if (frozenPointsZone_.size() > 0)
89 zonePtr = &
pZones[frozenPointsZone_];
91 Pout<<
"surfaceSlipDisplacementPointPatchVectorField : Fixing all "
92 << zonePtr->size() <<
" points in pointZone " << zonePtr->
name()
97 const motionSolver& motion =
98 refCast<const fvMeshMovers::motionSolver>
100 refCast<const fvMesh>(mesh).mover()
105 refCast<const displacementMotionSolver>(motion).points0();
110 start[i] = points0[meshPoints[i]] + displacement[i];
113 label nNotProjected = 0;
117 List<pointIndexHit> nearest;
129 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
132 displacement[i] = points0[meshPoints[i]] - localPoints[i];
134 else if (nearest[i].hit())
137 nearest[i].hitPoint()
138 - points0[meshPoints[i]];
146 Pout<<
" point:" << meshPoints[i]
147 <<
" coord:" << localPoints[i]
148 <<
" did not find any surface within " << projectLen
159 List<pointIndexHit> nearest;
186 offset[i] = start[i][wedgePlane_];
187 start[i][wedgePlane_] = 0;
188 projectVecs[i][wedgePlane_] = 0;
192 List<pointIndexHit> rightHit;
204 List<pointIndexHit> leftHit;
219 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
222 displacement[i] = points0[meshPoints[i]] - localPoints[i];
224 else if (nearest[i].hit())
228 nearest[i].hitPoint()
229 - points0[meshPoints[i]];
235 if (rightHit[i].hit())
237 if (leftHit[i].hit())
241 magSqr(rightHit[i].hitPoint()-start[i])
242 <
magSqr(leftHit[i].hitPoint()-start[i])
245 interPt = rightHit[i];
249 interPt = leftHit[i];
254 interPt = rightHit[i];
259 if (leftHit[i].hit())
261 interPt = leftHit[i];
270 interPt.rawPoint()[wedgePlane_] +=
offset[i];
272 displacement[i] = interPt.rawPoint()-points0[meshPoints[i]];
280 Pout<<
" point:" << meshPoints[i]
281 <<
" coord:" << localPoints[i]
282 <<
" did not find any intersection between"
283 <<
" ray from " << start[i]-projectVecs[i]
284 <<
" to " << start[i]+projectVecs[i] <<
endl;
291 reduce(nNotProjected, sumOp<label>());
293 if (nNotProjected > 0)
295 Info<<
"surfaceSlipDisplacement :"
297 <<
" did not project " << nNotProjected
299 <<
" points." <<
endl;
315 surfacesDict_(
dict.subDict(
"geometry")),
316 projectMode_(projectModeNames_.
read(
dict.lookup(
"projectMode"))),
318 wedgePlane_(
dict.lookupOrDefault(
"wedgePlane", -1)),
319 frozenPointsZone_(
dict.lookupOrDefault(
"frozenPointsZone",
word::null))
333 surfacesDict_(ppf.surfacesDict_),
334 projectMode_(ppf.projectMode_),
335 projectDir_(ppf.projectDir_),
336 wedgePlane_(ppf.wedgePlane_),
337 frozenPointsZone_(ppf.frozenPointsZone_)
349 surfacesDict_(ppf.surfacesDict_),
350 projectMode_(ppf.projectMode_),
351 projectDir_(ppf.projectDir_),
352 wedgePlane_(ppf.wedgePlane_),
353 frozenPointsZone_(ppf.frozenPointsZone_)
362 if (surfacesPtr_.empty())
371 db().time().constant(),
382 return surfacesPtr_();
394 calcProjection(displacement);
410 writeEntry(os,
"projectMode", projectModeNames_[projectMode_]);
411 writeEntry(os,
"projectDirection", projectDir_);
415 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...
void size(const label)
Override size to be inconsistent with allocated storage.
Initialise the NamedEnum HashTable from the static list of names.
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 keyword definitions, which are a keyword followed by any number of values (e....
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.
Mesh consisting of general polyhedral cells.
const pointZoneList & pointZones() const
Return point zones.
const boundBox & bounds() const
Return mesh bounding box.
static const word & geometryDir()
Return the geometry directory name.
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.
Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement...
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Update the patch field.
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
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)
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
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)
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
prefixOSstream Pout(cout, "Pout")
void offset(label &lst, const label o)
dimensioned< scalar > magSqr(const dimensioned< Type > &)