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 fvMeshMovers::motionSolver>
101 refCast<const fvMesh>(
mesh).mover()
106 refCast<const displacementMotionSolver>(motion).points0();
111 start[i] = points0[meshPoints[i]] + displacement[i];
114 label nNotProjected = 0;
130 if (zonePtr && (zonePtr->
whichPoint(meshPoints[i]) >= 0))
133 displacement[i] = points0[meshPoints[i]] - localPoints[i];
135 else if (nearest[i].hit())
138 nearest[i].hitPoint()
139 - points0[meshPoints[i]];
147 Pout<<
" point:" << meshPoints[i]
148 <<
" coord:" << localPoints[i]
149 <<
" did not find any surface within " << projectLen
178 projectVecs = projectLen*patch().pointNormals();
187 offset[i] = start[i][wedgePlane_];
188 start[i][wedgePlane_] = 0;
189 projectVecs[i][wedgePlane_] = 0;
220 if (zonePtr && (zonePtr->
whichPoint(meshPoints[i]) >= 0))
223 displacement[i] = points0[meshPoints[i]] - localPoints[i];
225 else if (nearest[i].hit())
229 nearest[i].hitPoint()
230 - points0[meshPoints[i]];
236 if (rightHit[i].hit())
238 if (leftHit[i].hit())
242 magSqr(rightHit[i].hitPoint()-start[i])
243 <
magSqr(leftHit[i].hitPoint()-start[i])
246 interPt = rightHit[i];
250 interPt = leftHit[i];
255 interPt = rightHit[i];
260 if (leftHit[i].hit())
262 interPt = leftHit[i];
271 interPt.
rawPoint()[wedgePlane_] += offset[i];
273 displacement[i] = interPt.
rawPoint()-points0[meshPoints[i]];
281 Pout<<
" point:" << meshPoints[i]
282 <<
" coord:" << localPoints[i]
283 <<
" did not find any intersection between" 284 <<
" ray from " << start[i]-projectVecs[i]
285 <<
" to " << start[i]+projectVecs[i] <<
endl;
294 if (nNotProjected > 0)
296 Info<<
"surfaceDisplacement :" 297 <<
" on patch " << patch().name()
298 <<
" did not project " << nNotProjected
300 <<
" points." <<
endl;
314 fixedValuePointPatchVectorField(p, iF),
330 fixedValuePointPatchVectorField(p, iF, dict),
331 velocity_(dict.
lookup(
"velocity")),
332 surfacesDict_(dict.
subDict(
"geometry")),
333 projectMode_(projectModeNames_.
read(dict.
lookup(
"projectMode"))),
334 projectDir_(dict.
lookup(
"projectDirection")),
338 if (velocity_.
x() < 0 || velocity_.
y() < 0 || velocity_.
z() < 0)
341 <<
"All components of velocity have to be positive : " 343 <<
"Set velocity components to a great value if no clipping" 358 fixedValuePointPatchVectorField(ppf, p, iF, mapper),
359 velocity_(ppf.velocity_),
360 surfacesDict_(ppf.surfacesDict_),
361 projectMode_(ppf.projectMode_),
362 projectDir_(ppf.projectDir_),
363 wedgePlane_(ppf.wedgePlane_),
364 frozenPointsZone_(ppf.frozenPointsZone_)
375 fixedValuePointPatchVectorField(ppf, iF),
376 velocity_(ppf.velocity_),
377 surfacesDict_(ppf.surfacesDict_),
378 projectMode_(ppf.projectMode_),
379 projectDir_(ppf.projectDir_),
380 wedgePlane_(ppf.wedgePlane_),
381 frozenPointsZone_(ppf.frozenPointsZone_)
390 if (surfacesPtr_.empty())
399 db().time().constant(),
410 return surfacesPtr_();
423 vectorField currentDisplacement(this->patchInternalField());
427 calcProjection(displacement);
430 vectorField offset(displacement-currentDisplacement);
435 const vector clipVelocity = velocity_*deltaT;
445 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
449 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
456 fixedValuePointPatchVectorField::updateCoeffs();
465 writeEntry(os,
"projectMode", projectModeNames_[projectMode_]);
466 writeEntry(os,
"projectDirection", projectDir_);
470 writeEntry(os,
"frozenPointsZone", frozenPointsZone_);
479 fixedValuePointPatchVectorField,
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
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...
#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.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const point & max() const
Maximum point defining 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 point defining 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.