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()
107 start[i] = points0[meshPoints[i]] + displacement[i];
110 label nNotProjected = 0;
126 if (zonePtr && (zonePtr->
whichPoint(meshPoints[i]) >= 0))
129 displacement[i] = points0[meshPoints[i]] - localPoints[i];
131 else if (nearest[i].hit())
134 nearest[i].hitPoint()
135 - points0[meshPoints[i]];
143 Pout<<
" point:" << meshPoints[i]
144 <<
" coord:" << localPoints[i]
145 <<
" did not find any surface within " << projectLen
174 projectVecs = projectLen*patch().pointNormals();
183 offset[i] = start[i][wedgePlane_];
184 start[i][wedgePlane_] = 0;
185 projectVecs[i][wedgePlane_] = 0;
216 if (zonePtr && (zonePtr->
whichPoint(meshPoints[i]) >= 0))
219 displacement[i] = points0[meshPoints[i]] - localPoints[i];
221 else if (nearest[i].hit())
225 nearest[i].hitPoint()
226 - points0[meshPoints[i]];
232 if (rightHit[i].hit())
234 if (leftHit[i].hit())
238 magSqr(rightHit[i].hitPoint()-start[i])
239 <
magSqr(leftHit[i].hitPoint()-start[i])
242 interPt = rightHit[i];
246 interPt = leftHit[i];
251 interPt = rightHit[i];
256 if (leftHit[i].hit())
258 interPt = leftHit[i];
267 interPt.
rawPoint()[wedgePlane_] += offset[i];
269 displacement[i] = interPt.
rawPoint()-points0[meshPoints[i]];
277 Pout<<
" point:" << meshPoints[i]
278 <<
" coord:" << localPoints[i]
279 <<
" did not find any intersection between" 280 <<
" ray from " << start[i]-projectVecs[i]
281 <<
" to " << start[i]+projectVecs[i] <<
endl;
290 if (nNotProjected > 0)
292 Info<<
"surfaceDisplacement :" 293 <<
" on patch " << patch().name()
294 <<
" did not project " << nNotProjected
296 <<
" points." <<
endl;
310 fixedValuePointPatchVectorField(p, iF),
326 fixedValuePointPatchVectorField(p, iF, dict),
327 velocity_(dict.
lookup(
"velocity")),
328 surfacesDict_(dict.
subDict(
"geometry")),
329 projectMode_(projectModeNames_.
read(dict.
lookup(
"projectMode"))),
330 projectDir_(dict.
lookup(
"projectDirection")),
334 if (velocity_.
x() < 0 || velocity_.
y() < 0 || velocity_.
z() < 0)
338 "surfaceDisplacementPointPatchVectorField::\n" 339 "surfaceDisplacementPointPatchVectorField\n" 341 " const pointPatch& p,\n" 342 " const DimensionedField<vector, pointMesh>& iF,\n" 343 " const dictionary& dict\n" 345 ) <<
"All components of velocity have to be positive : " 347 <<
"Set velocity components to a great value if no clipping" 362 fixedValuePointPatchVectorField(ppf, p, iF, mapper),
363 velocity_(ppf.velocity_),
364 surfacesDict_(ppf.surfacesDict_),
365 projectMode_(ppf.projectMode_),
366 projectDir_(ppf.projectDir_),
367 wedgePlane_(ppf.wedgePlane_),
368 frozenPointsZone_(ppf.frozenPointsZone_)
378 fixedValuePointPatchVectorField(ppf),
379 velocity_(ppf.velocity_),
380 surfacesDict_(ppf.surfacesDict_),
381 projectMode_(ppf.projectMode_),
382 projectDir_(ppf.projectDir_),
383 wedgePlane_(ppf.wedgePlane_),
384 frozenPointsZone_(ppf.frozenPointsZone_)
395 fixedValuePointPatchVectorField(ppf, iF),
396 velocity_(ppf.velocity_),
397 surfacesDict_(ppf.surfacesDict_),
398 projectMode_(ppf.projectMode_),
399 projectDir_(ppf.projectDir_),
400 wedgePlane_(ppf.wedgePlane_),
401 frozenPointsZone_(ppf.frozenPointsZone_)
410 if (surfacesPtr_.empty())
430 return surfacesPtr_();
443 vectorField currentDisplacement(this->patchInternalField());
447 calcProjection(displacement);
450 vectorField offset(displacement-currentDisplacement);
455 const vector clipVelocity = velocity_*deltaT;
465 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
469 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
476 fixedValuePointPatchVectorField::updateCoeffs();
487 os.
writeKeyword(
"projectMode") << projectModeNames_[projectMode_]
495 os.
writeKeyword(
"frozenPointsZone") << frozenPointsZone_
505 fixedValuePointPatchVectorField,
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void findNearest(const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest. Return -1 (and a miss()) or surface and nearest.
Basic pointPatch represents a set of points from the mesh.
const point & min() const
Minimum describing the bounding box.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const Point & rawPoint() const
Return point with no checking.
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() 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.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const pointZoneMesh & pointZones() const
Return point zone mesh.
bool hit() const
Is there a hit.
IOporosityModelList pZones(mesh)
A list of keyword definitions, which are a keyword followed by any number of values (e...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Number of components in this vector space.
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
scalar deltaTValue() const
Return time step value.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Spatial transformation functions for primitive fields.
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Macros for easy insertion into run-time selection tables.
const point & max() const
Maximum describing the bounding box.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
const word & name() const
Return name.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Foam::pointPatchFieldMapper.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Mesh consisting of general polyhedral cells.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Constant dispersed-phase particle diameter model.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const boundBox & bounds() const
Return mesh bounding box.
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Container for searchableSurfaces.
const Time & time() const
Return time.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual void write(Ostream &) const
Write.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
static const word null
An empty word.
prefixOSstream Pout(cout,"Pout")
label whichPoint(const label globalPointID) const
Helper function to re-direct to zone::localID(...)
Virtual base class for displacement motion solver.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.