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;
84 const pointZone* zonePtr = NULL;
86 if (frozenPointsZone_.size() > 0)
90 zonePtr = &pZones[pZones.findZoneID(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;
114 List<pointIndexHit> nearest;
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
156 List<pointIndexHit> nearest;
174 projectVecs = projectLen*patch().pointNormals();
183 offset[i] = start[i][wedgePlane_];
184 start[i][wedgePlane_] = 0;
185 projectVecs[i][wedgePlane_] = 0;
189 List<pointIndexHit> rightHit;
201 List<pointIndexHit> leftHit;
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;
288 reduce(nNotProjected, sumOp<label>());
290 if (nNotProjected > 0)
292 Info<<
"surfaceDisplacement :"
293 <<
" on patch " << patch().name()
294 <<
" did not project " << nNotProjected
296 <<
" points." <<
endl;
310 fixedValuePointPatchVectorField(p, iF),
312 projectMode_(NEAREST),
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())
419 db().time().constant(),
429 return surfacesPtr_();
442 vectorField currentDisplacement = this->patchInternalField();
446 calcProjection(displacement);
449 vectorField offset = displacement-currentDisplacement;
454 const vector clipVelocity = velocity_*deltaT;
464 d[cmpt] =
max(d[cmpt], -clipVelocity[cmpt]);
468 d[cmpt] =
min(d[cmpt], clipVelocity[cmpt]);
486 os.
writeKeyword(
"projectMode") << projectModeNames_[projectMode_]
494 os.
writeKeyword(
"frozenPointsZone") << frozenPointsZone_
504 fixedValuePointPatchVectorField,