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()
93 refCast<const pointMeshMovers::displacement>
94 (refCast<const fvMesh>(
mesh).mover()).points0();
99 start[i] = points0[meshPoints[i]] + displacement[i];
102 label nNotProjected = 0;
118 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
121 displacement[i] = points0[meshPoints[i]] - localPoints[i];
123 else if (nearest[i].hit())
126 nearest[i].hitPoint()
127 - points0[meshPoints[i]];
135 Pout<<
" point:" << meshPoints[i]
136 <<
" coord:" << localPoints[i]
137 <<
" did not find any surface within " << projectLen
175 offset[i] = start[i][wedgePlane_];
176 start[i][wedgePlane_] = 0;
177 projectVecs[i][wedgePlane_] = 0;
208 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
211 displacement[i] = points0[meshPoints[i]] - localPoints[i];
213 else if (nearest[i].hit())
217 nearest[i].hitPoint()
218 - points0[meshPoints[i]];
224 if (rightHit[i].hit())
226 if (leftHit[i].hit())
230 magSqr(rightHit[i].hitPoint()-start[i])
231 <
magSqr(leftHit[i].hitPoint()-start[i])
234 interPt = rightHit[i];
238 interPt = leftHit[i];
243 interPt = rightHit[i];
248 if (leftHit[i].hit())
250 interPt = leftHit[i];
259 interPt.rawPoint()[wedgePlane_] +=
offset[i];
261 displacement[i] = interPt.rawPoint()-points0[meshPoints[i]];
269 Pout<<
" point:" << meshPoints[i]
270 <<
" coord:" << localPoints[i]
271 <<
" did not find any intersection between"
272 <<
" ray from " << start[i]-projectVecs[i]
273 <<
" to " << start[i]+projectVecs[i] <<
endl;
280 reduce(nNotProjected, sumOp<label>());
282 if (nNotProjected > 0)
284 Info<<
"surfaceSlipDisplacement :"
286 <<
" did not project " << nNotProjected
287 <<
" out of " <<
returnReduce(localPoints.size(), sumOp<label>())
288 <<
" points." <<
endl;
304 surfacesDict_(
dict.subDict(
"geometry")),
307 wedgePlane_(
dict.lookupOrDefault(
"wedgePlane", -1)),
308 frozenPointsZone_(
dict.lookupOrDefault(
"frozenPointsZone",
word::null))
322 surfacesDict_(ppf.surfacesDict_),
323 projectMode_(ppf.projectMode_),
324 projectDir_(ppf.projectDir_),
325 wedgePlane_(ppf.wedgePlane_),
326 frozenPointsZone_(ppf.frozenPointsZone_)
338 surfacesDict_(ppf.surfacesDict_),
339 projectMode_(ppf.projectMode_),
340 projectDir_(ppf.projectDir_),
341 wedgePlane_(ppf.wedgePlane_),
342 frozenPointsZone_(ppf.frozenPointsZone_)
351 if (surfacesPtr_.empty())
371 return surfacesPtr_();
383 calcProjection(displacement);
399 writeEntry(os,
"projectMode", projectModeNames_[projectMode_]);
400 writeEntry(os,
"projectDirection", projectDir_);
404 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.
Motion of the mesh specified as a list of pointMeshMovers.
Abstract base class for point-mesh patch fields.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
const Time & time() const
Return time.
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 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.
virtual const vectorField & localPoints() const =0
Return mesh points.
const pointMesh & mesh() const
Return mesh reference.
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 pointMeshMovers::displacement as a bc on the pointDisplac...
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)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
makePointPatchTypeField(pointPatchVectorField, angularOscillatingDisplacementPointPatchVectorField)
const dimensionSet & dimless
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.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
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.
prefixOSstream Pout(cout, "Pout")
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void offset(label &lst, const label o)
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)