41 const NamedEnum<surfaceDisplacementPointPatchVectorField::projectMode, 3>
42 surfaceDisplacementPointPatchVectorField::projectModeNames_
52 void surfaceDisplacementPointPatchVectorField::calcProjection
57 const polyMesh&
mesh = patch().mesh()();
58 const pointField& localPoints = patch().localPoints();
59 const labelList& meshPoints = patch().meshPoints();
74 projectVec = projectLen*
n;
79 const pointZone* zonePtr =
nullptr;
81 if (frozenPointsZone_.size() > 0)
85 zonePtr = &
pZones[frozenPointsZone_];
87 Pout<<
"surfaceDisplacementPointPatchVectorField : Fixing all "
88 << zonePtr->size() <<
" points in pointZone " << zonePtr->
name()
94 refCast<const pointMeshMovers::displacement>
95 (refCast<const fvMesh>(
mesh).mover()).points0();
100 start[i] = points0[meshPoints[i]] + displacement[i];
103 label nNotProjected = 0;
119 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
122 displacement[i] = points0[meshPoints[i]] - localPoints[i];
124 else if (nearest[i].hit())
127 nearest[i].hitPoint()
128 - points0[meshPoints[i]];
136 Pout<<
" point:" << meshPoints[i]
137 <<
" coord:" << localPoints[i]
138 <<
" did not find any surface within " << projectLen
167 projectVecs = projectLen*patch().pointNormals();
176 offset[i] = start[i][wedgePlane_];
177 start[i][wedgePlane_] = 0;
178 projectVecs[i][wedgePlane_] = 0;
209 if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
212 displacement[i] = points0[meshPoints[i]] - localPoints[i];
214 else if (nearest[i].hit())
218 nearest[i].hitPoint()
219 - points0[meshPoints[i]];
225 if (rightHit[i].hit())
227 if (leftHit[i].hit())
231 magSqr(rightHit[i].hitPoint()-start[i])
232 <
magSqr(leftHit[i].hitPoint()-start[i])
235 interPt = rightHit[i];
239 interPt = leftHit[i];
244 interPt = rightHit[i];
249 if (leftHit[i].hit())
251 interPt = leftHit[i];
260 interPt.rawPoint()[wedgePlane_] +=
offset[i];
262 displacement[i] = interPt.rawPoint()-points0[meshPoints[i]];
270 Pout<<
" point:" << meshPoints[i]
271 <<
" coord:" << localPoints[i]
272 <<
" did not find any intersection between"
273 <<
" ray from " << start[i]-projectVecs[i]
274 <<
" to " << start[i]+projectVecs[i] <<
endl;
281 reduce(nNotProjected, sumOp<label>());
283 if (nNotProjected > 0)
285 Info<<
"surfaceDisplacement :"
286 <<
" on patch " << patch().name()
287 <<
" did not project " << nNotProjected
288 <<
" out of " <<
returnReduce(localPoints.size(), sumOp<label>())
289 <<
" points." <<
endl;
304 fixedValuePointPatchVectorField(
p, iF,
dict),
306 surfacesDict_(
dict.subDict(
"geometry")),
309 wedgePlane_(
dict.lookupOrDefault(
"wedgePlane", -1)),
310 frozenPointsZone_(
dict.lookupOrDefault(
"frozenPointsZone",
word::null))
312 if (velocity_.
x() < 0 || velocity_.
y() < 0 || velocity_.
z() < 0)
315 <<
"All components of velocity have to be positive : "
317 <<
"Set velocity components to a great value if no clipping"
332 fixedValuePointPatchVectorField(ppf,
p, iF, mapper),
333 velocity_(ppf.velocity_),
334 surfacesDict_(ppf.surfacesDict_),
335 projectMode_(ppf.projectMode_),
336 projectDir_(ppf.projectDir_),
337 wedgePlane_(ppf.wedgePlane_),
338 frozenPointsZone_(ppf.frozenPointsZone_)
349 fixedValuePointPatchVectorField(ppf, iF),
350 velocity_(ppf.velocity_),
351 surfacesDict_(ppf.surfacesDict_),
352 projectMode_(ppf.projectMode_),
353 projectDir_(ppf.projectDir_),
354 wedgePlane_(ppf.wedgePlane_),
355 frozenPointsZone_(ppf.frozenPointsZone_)
364 if (surfacesPtr_.empty())
384 return surfacesPtr_();
397 vectorField currentDisplacement(this->patchInternalField());
401 calcProjection(displacement);
409 const vector clipVelocity = velocity_*deltaT;
419 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
423 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
430 fixedValuePointPatchVectorField::updateCoeffs();
439 writeEntry(os,
"projectMode", projectModeNames_[projectMode_]);
440 writeEntry(os,
"projectDirection", projectDir_);
444 writeEntry(os,
"frozenPointsZone", frozenPointsZone_);
453 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...
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Abstract base class for field mapping.
const Time & time() const
Return the top-level database.
Motion of the mesh specified as a list of pointMeshMovers.
Basic pointPatch represents a set of points from the mesh.
Mesh consisting of general polyhedral cells.
const pointZoneList & pointZones() const
Return point zones.
const boundBox & bounds() const
Return mesh bounding box.
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.
static const word & geometryDir()
Return the geometry directory name.
Displacement fixed by projection onto triSurface. Use in a pointMeshMovers::displacement as a bc on t...
const searchableSurfaceList & 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)
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
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)
const dimensionSet & dimless
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.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
PointIndexHit< point > pointIndexHit
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const dimensionSet & dimVelocity
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Field< vector > vectorField
Specialisation of Field<T> for vector.
prefixOSstream Pout(cout, "Pout")
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void offset(label &lst, const label o)
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)