Go to the documentation of this file.
41 Foam::surfaceDisplacementPointPatchVectorField::projectModeNames_
43 { projectMode::NEAREST,
"nearest" },
44 { projectMode::POINTNORMAL,
"pointNormal" },
45 { projectMode::FIXEDNORMAL,
"fixedNormal" },
51 void Foam::surfaceDisplacementPointPatchVectorField::calcProjection
56 const polyMesh&
mesh =
patch().boundaryMesh().mesh()();
66 const scalar projectLen =
mag(
mesh.bounds().max()-
mesh.bounds().min());
73 projectVec = projectLen*
n;
78 const pointZone* zonePtr =
nullptr;
80 if (frozenPointsZone_.size() > 0)
84 zonePtr = &
pZones[frozenPointsZone_];
86 Pout<<
"surfaceDisplacementPointPatchVectorField : Fixing all "
87 << zonePtr->size() <<
" points in pointZone " << zonePtr->
name()
104 label nNotProjected = 0;
108 List<pointIndexHit> nearest;
120 if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0))
123 displacement[i] =
points0[meshPoints[i]] - localPoints[i];
125 else if (nearest[i].hit())
128 nearest[i].hitPoint()
137 Pout<<
" point:" << meshPoints[i]
138 <<
" coord:" << localPoints[i]
139 <<
" did not find any surface within " << projectLen
150 List<pointIndexHit> nearest;
168 projectVecs = projectLen*
patch().pointNormals();
177 offset[i] =
start[i][wedgePlane_];
178 start[i][wedgePlane_] = 0;
179 projectVecs[i][wedgePlane_] = 0;
183 List<pointIndexHit> rightHit;
195 List<pointIndexHit> leftHit;
210 if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0))
213 displacement[i] =
points0[meshPoints[i]] - localPoints[i];
215 else if (nearest[i].hit())
219 nearest[i].hitPoint()
226 if (rightHit[i].hit())
228 if (leftHit[i].hit())
236 interPt = rightHit[i];
240 interPt = leftHit[i];
245 interPt = rightHit[i];
250 if (leftHit[i].hit())
252 interPt = leftHit[i];
261 interPt.rawPoint()[wedgePlane_] += offset[i];
263 displacement[i] = interPt.rawPoint()-
points0[meshPoints[i]];
271 Pout<<
" point:" << meshPoints[i]
272 <<
" coord:" << localPoints[i]
273 <<
" did not find any intersection between"
274 <<
" ray from " <<
start[i]-projectVecs[i]
275 <<
" to " <<
start[i]+projectVecs[i] <<
endl;
282 reduce(nNotProjected, sumOp<label>());
284 if (nNotProjected > 0)
286 Info<<
"surfaceDisplacement :"
287 <<
" on patch " <<
patch().name()
288 <<
" did not project " << nNotProjected
289 <<
" out of " <<
returnReduce(localPoints.size(), sumOp<label>())
290 <<
" points." <<
endl;
304 fixedValuePointPatchVectorField(
p, iF),
306 projectMode_(NEAREST),
320 fixedValuePointPatchVectorField(
p, iF,
dict),
323 projectMode_(projectModeNames_.get(
"projectMode",
dict)),
328 if (velocity_.x() < 0 || velocity_.y() < 0 || velocity_.z() < 0)
331 <<
"All components of velocity have to be positive : "
333 <<
"Set velocity components to a great value if no clipping"
348 fixedValuePointPatchVectorField(ppf,
p, iF, mapper),
349 velocity_(ppf.velocity_),
350 surfacesDict_(ppf.surfacesDict_),
351 projectMode_(ppf.projectMode_),
352 projectDir_(ppf.projectDir_),
353 wedgePlane_(ppf.wedgePlane_),
354 frozenPointsZone_(ppf.frozenPointsZone_)
364 fixedValuePointPatchVectorField(ppf),
365 velocity_(ppf.velocity_),
366 surfacesDict_(ppf.surfacesDict_),
367 projectMode_(ppf.projectMode_),
368 projectDir_(ppf.projectDir_),
369 wedgePlane_(ppf.wedgePlane_),
370 frozenPointsZone_(ppf.frozenPointsZone_)
381 fixedValuePointPatchVectorField(ppf, iF),
382 velocity_(ppf.velocity_),
383 surfacesDict_(ppf.surfacesDict_),
384 projectMode_(ppf.projectMode_),
385 projectDir_(ppf.projectDir_),
386 wedgePlane_(ppf.wedgePlane_),
387 frozenPointsZone_(ppf.frozenPointsZone_)
396 if (surfacesPtr_.empty())
417 return *surfacesPtr_;
430 vectorField currentDisplacement(this->patchInternalField());
434 calcProjection(displacement);
437 vectorField offset(displacement-currentDisplacement);
442 const vector clipVelocity = velocity_*deltaT;
452 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
456 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
463 fixedValuePointPatchVectorField::updateCoeffs();
472 os.
writeEntry(
"projectMode", projectModeNames_[projectMode_]);
473 os.
writeEntry(
"projectDirection", projectDir_);
492 fixedValuePointPatchVectorField,
int debug
Static debugging option.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static constexpr const zero Zero
Global zero.
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Basic pointPatch represents a set of points from the mesh.
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
Foam::pointPatchFieldMapper.
#define forAll(list, i)
Loop across all elements in list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
IOporosityModelList pZones(mesh)
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
void findNearest(const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest. Return -1 (and a miss()) or surface and nearest.
messageStream Info
Information stream (uses stdout - output is on the master only)
virtual const fileName & name() const
Return the name of the stream.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
const std::string patch
OpenFOAM patch number as a std::string.
scalar deltaTValue() const
Return time step value.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label ListType::const_reference const label start
static const word null
An empty word.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
const Time & time() const
Return the top-level database.
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
constant condensation/saturation model.
static constexpr direction nComponents
Number of components in this vector space.
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void write(Ostream &) const
Write.