52 surfaceDisplacementPointPatchVectorField::projectModeNames_;
57 void surfaceDisplacementPointPatchVectorField::calcProjection
63 const pointField& localPoints = patch().localPoints();
64 const labelList& meshPoints = patch().meshPoints();
79 projectVec = projectLen*
n;
84 const pointZone* zonePtr =
nullptr;
86 if (frozenPointsZone_.size() > 0)
90 zonePtr = &
pZones[frozenPointsZone_];
92 Pout<<
"surfaceDisplacementPointPatchVectorField : Fixing all "
93 << zonePtr->size() <<
" points in pointZone " << zonePtr->
name()
98 const motionSolver& motion =
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;
118 List<pointIndexHit> nearest;
130 if (zonePtr && (zonePtr->localIndex(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
160 List<pointIndexHit> nearest;
178 projectVecs = projectLen*patch().pointNormals();
187 offset[i] = start[i][wedgePlane_];
188 start[i][wedgePlane_] = 0;
189 projectVecs[i][wedgePlane_] = 0;
193 List<pointIndexHit> rightHit;
205 List<pointIndexHit> leftHit;
220 if (zonePtr && (zonePtr->localIndex(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;
292 reduce(nNotProjected, sumOp<label>());
294 if (nNotProjected > 0)
296 Info<<
"surfaceDisplacement :"
297 <<
" on patch " << patch().name()
298 <<
" did not project " << nNotProjected
300 <<
" points." <<
endl;
315 fixedValuePointPatchVectorField(
p, iF,
dict),
317 surfacesDict_(
dict.subDict(
"geometry")),
318 projectMode_(projectModeNames_.
read(
dict.lookup(
"projectMode"))),
320 wedgePlane_(
dict.lookupOrDefault(
"wedgePlane", -1)),
321 frozenPointsZone_(
dict.lookupOrDefault(
"frozenPointsZone",
word::null))
323 if (velocity_.
x() < 0 || velocity_.
y() < 0 || velocity_.
z() < 0)
326 <<
"All components of velocity have to be positive : "
328 <<
"Set velocity components to a great value if no clipping"
343 fixedValuePointPatchVectorField(ppf,
p, iF, mapper),
344 velocity_(ppf.velocity_),
345 surfacesDict_(ppf.surfacesDict_),
346 projectMode_(ppf.projectMode_),
347 projectDir_(ppf.projectDir_),
348 wedgePlane_(ppf.wedgePlane_),
349 frozenPointsZone_(ppf.frozenPointsZone_)
360 fixedValuePointPatchVectorField(ppf, iF),
361 velocity_(ppf.velocity_),
362 surfacesDict_(ppf.surfacesDict_),
363 projectMode_(ppf.projectMode_),
364 projectDir_(ppf.projectDir_),
365 wedgePlane_(ppf.wedgePlane_),
366 frozenPointsZone_(ppf.frozenPointsZone_)
375 if (surfacesPtr_.empty())
384 db().time().constant(),
395 return surfacesPtr_();
408 vectorField currentDisplacement(this->patchInternalField());
412 calcProjection(displacement);
420 const vector clipVelocity = velocity_*deltaT;
430 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
434 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
441 fixedValuePointPatchVectorField::updateCoeffs();
450 writeEntry(os,
"projectMode", projectModeNames_[projectMode_]);
451 writeEntry(os,
"projectDirection", projectDir_);
455 writeEntry(os,
"frozenPointsZone", frozenPointsZone_);
464 fixedValuePointPatchVectorField,
#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,...
scalar deltaTValue() const
Return time step value.
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 Time & time() const
Return time.
Basic pointPatch represents a set of points from the mesh.
const polyMesh & mesh() const
Return the mesh reference.
Mesh consisting of general polyhedral cells.
const pointZoneList & pointZones() const
Return point zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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 fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
virtual void write(Ostream &) const
Write.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from string.
static const word null
An empty word.
IOporosityModelList pZones(mesh)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
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.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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 > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Field< vector > vectorField
Specialisation of Field<T> for vector.
prefixOSstream Pout(cout, "Pout")
const dimensionSet dimVelocity
void offset(label &lst, const label o)
dimensioned< scalar > magSqr(const dimensioned< Type > &)