43 NamedEnum<surfaceDisplacementPointPatchVectorField::projectMode, 3>::
52 surfaceDisplacementPointPatchVectorField::projectModeNames_;
57 void surfaceDisplacementPointPatchVectorField::calcProjection
63 const pointField& localPoints = patch().localPoints();
64 const labelList& meshPoints = patch().meshPoints();
79 projectVec = projectLen*
n;
86 if (frozenPointsZone_.size() > 0)
90 zonePtr = &pZones[frozenPointsZone_];
92 Pout<<
"surfaceDisplacementPointPatchVectorField : Fixing all " 93 << zonePtr->
size() <<
" points in pointZone " << zonePtr->
name()
99 refCast<const dynamicMotionSolverFvMesh>(
mesh).motion();
103 refCast<const displacementMotionSolver>(motion).points0();
108 start[i] = points0[meshPoints[i]] + displacement[i];
111 label nNotProjected = 0;
127 if (zonePtr && (zonePtr->
whichPoint(meshPoints[i]) >= 0))
130 displacement[i] = points0[meshPoints[i]] - localPoints[i];
132 else if (nearest[i].hit())
135 nearest[i].hitPoint()
136 - points0[meshPoints[i]];
144 Pout<<
" point:" << meshPoints[i]
145 <<
" coord:" << localPoints[i]
146 <<
" did not find any surface within " << projectLen
175 projectVecs = projectLen*patch().pointNormals();
184 offset[i] = start[i][wedgePlane_];
185 start[i][wedgePlane_] = 0;
186 projectVecs[i][wedgePlane_] = 0;
217 if (zonePtr && (zonePtr->
whichPoint(meshPoints[i]) >= 0))
220 displacement[i] = points0[meshPoints[i]] - localPoints[i];
222 else if (nearest[i].hit())
226 nearest[i].hitPoint()
227 - points0[meshPoints[i]];
233 if (rightHit[i].hit())
235 if (leftHit[i].hit())
239 magSqr(rightHit[i].hitPoint()-start[i])
240 <
magSqr(leftHit[i].hitPoint()-start[i])
243 interPt = rightHit[i];
247 interPt = leftHit[i];
252 interPt = rightHit[i];
257 if (leftHit[i].hit())
259 interPt = leftHit[i];
268 interPt.
rawPoint()[wedgePlane_] += offset[i];
270 displacement[i] = interPt.
rawPoint()-points0[meshPoints[i]];
278 Pout<<
" point:" << meshPoints[i]
279 <<
" coord:" << localPoints[i]
280 <<
" did not find any intersection between" 281 <<
" ray from " << start[i]-projectVecs[i]
282 <<
" to " << start[i]+projectVecs[i] <<
endl;
291 if (nNotProjected > 0)
293 Info<<
"surfaceDisplacement :" 294 <<
" on patch " << patch().name()
295 <<
" did not project " << nNotProjected
297 <<
" points." <<
endl;
311 fixedValuePointPatchVectorField(p, iF),
327 fixedValuePointPatchVectorField(p, iF, dict),
328 velocity_(dict.
lookup(
"velocity")),
329 surfacesDict_(dict.
subDict(
"geometry")),
330 projectMode_(projectModeNames_.
read(dict.
lookup(
"projectMode"))),
331 projectDir_(dict.
lookup(
"projectDirection")),
335 if (velocity_.
x() < 0 || velocity_.
y() < 0 || velocity_.
z() < 0)
338 <<
"All components of velocity have to be positive : " 340 <<
"Set velocity components to a great value if no clipping" 355 fixedValuePointPatchVectorField(ppf, p, iF, mapper),
356 velocity_(ppf.velocity_),
357 surfacesDict_(ppf.surfacesDict_),
358 projectMode_(ppf.projectMode_),
359 projectDir_(ppf.projectDir_),
360 wedgePlane_(ppf.wedgePlane_),
361 frozenPointsZone_(ppf.frozenPointsZone_)
372 fixedValuePointPatchVectorField(ppf, iF),
373 velocity_(ppf.velocity_),
374 surfacesDict_(ppf.surfacesDict_),
375 projectMode_(ppf.projectMode_),
376 projectDir_(ppf.projectDir_),
377 wedgePlane_(ppf.wedgePlane_),
378 frozenPointsZone_(ppf.frozenPointsZone_)
387 if (surfacesPtr_.empty())
396 db().time().constant(),
407 return surfacesPtr_();
420 vectorField currentDisplacement(this->patchInternalField());
424 calcProjection(displacement);
427 vectorField offset(displacement-currentDisplacement);
432 const vector clipVelocity = velocity_*deltaT;
442 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
446 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
453 fixedValuePointPatchVectorField::updateCoeffs();
462 writeEntry(os,
"projectMode", projectModeNames_[projectMode_]);
463 writeEntry(os,
"projectDirection", projectDir_);
467 writeEntry(os,
"frozenPointsZone", frozenPointsZone_);
476 fixedValuePointPatchVectorField,
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::pointPatchFieldMapper.
Ostream & endl(Ostream &os)
Add newline and flush stream.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Virtual base class for mesh motion solver.
virtual void write(Ostream &) const
Write.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Initialise the NamedEnum HashTable from the static list of names.
Macros for easy insertion into run-time selection tables.
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
const meshPointZones & pointZones() const
Return point zones.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
static const direction nComponents
Number of components in this vector space.
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.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
scalar deltaTValue() const
Return time step value.
bool hit() const
Is there a hit.
static const word null
An empty word.
Container for searchableSurfaces.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
const word & name() const
Return name.
label whichPoint(const label globalPointID) const
Helper function to re-direct to zone::localID(...)
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
const Point & rawPoint() const
Return point with no checking.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const Time & time() const
Return time.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const point & max() const
Maximum describing the bounding box.
const boundBox & bounds() const
Return mesh bounding box.
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() list...
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Basic pointPatch represents a set of points from the mesh.
prefixOSstream Pout(cout, "Pout")
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
dimensioned< scalar > mag(const dimensioned< Type > &)
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
const point & min() const
Minimum describing the bounding box.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
IOporosityModelList pZones(mesh)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.