38 void Foam::pointAttractionDisplacementPointPatchVectorField::calcProjection
52 const scalar projectLen =
mesh.bounds().mag();
57 const pointZone* zonePtr =
nullptr;
59 if (frozenPointsZone_.size() > 0)
63 zonePtr = &
pZones[frozenPointsZone_];
65 Pout<<
"pointAttractionDisplacementPointPatchVectorField : Fixing all " 66 << zonePtr->size() <<
" points in pointZone " << zonePtr->
name()
80 start[i] =
points0[meshPoints[i]] + displacement[i];
85 label nNotProjected = 0;
88 const label meshPointi = meshPoints[i];
89 const point& pt =
mesh.points()[meshPointi];
91 if (zonePtr && (zonePtr->whichPoint(meshPointi) >= 0))
94 displacement[i] =
points0[meshPointi] - pt;
101 displacement[i] = nearest.point() -
points0[meshPointi];
109 Pout<<
" point:" << meshPointi
111 <<
" did not find any surface within " << projectLen
118 reduce(nNotProjected, sumOp<label>());
120 if (nNotProjected > 0)
122 Info<<
"pointAttractionDisplacement :" 124 <<
" did not project " << nNotProjected
125 <<
" out of " <<
returnReduce(meshPoints.size(), sumOp<label>())
126 <<
" points." <<
endl;
156 frozenPointsZone_(
dict.getOrDefault(
"frozenPointsZone",
word::null))
177 velocity_(ppf.velocity_),
178 featFileName_(ppf.featFileName_),
179 frozenPointsZone_(ppf.frozenPointsZone_)
190 velocity_(ppf.velocity_),
191 featFileName_(ppf.featFileName_),
192 frozenPointsZone_(ppf.frozenPointsZone_)
204 velocity_(ppf.velocity_),
205 featFileName_(ppf.featFileName_),
206 frozenPointsZone_(ppf.frozenPointsZone_)
217 const Time& tm = this->
patch().boundaryMesh().mesh().time();
246 return pointTreePtr_();
257 const vectorField currentDisplacement(this->patchInternalField());
261 calcProjection(displacement);
265 vectorField offset(displacement-currentDisplacement);
269 const Time& tm = this->
patch().boundaryMesh().mesh().time();
270 const scalar deltaT = tm.deltaTValue();
271 const vector clipVelocity = velocity_*deltaT;
277 const scalar magD(
mag(d));
278 if (magD > ROOTVSMALL)
281 d *=
min(magD,
mag(clipVelocity));
286 Field<vector>& iF =
const_cast<Field<vector>&
>(this->primitiveField());
288 setInInternalField(iF, (currentDisplacement+offset)());
319 pointAttractionDisplacementPointPatchVectorField
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
A class for handling keywords in dictionaries.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
A class for handling file names.
Holds (reference to) pointField. Encapsulation of data needed for octree searches. Used for searching for nearest point. No bounding boxes around points. Only overlaps and calcNearest are implemented, rest makes little sense.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const pointPatch & patch() const noexcept
Return the patch.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
void inflate(const scalar factor)
Expand box by factor*mag(span) in all dimensions.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Foam::pointPatchFieldMapper.
Ostream & endl(Ostream &os)
Add newline and flush stream.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
virtual void write(Ostream &os) const
Write.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
const pointMesh & mesh() const noexcept
Return the mesh reference.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
Displacement by attraction to nearest point. Use in a displacementMotionSolver as a bc on the pointDi...
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
#define forAll(list, i)
Loop across all elements in list.
pointAttractionDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
A class for handling words, derived from Foam::string.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Tree tree(triangles.begin(), triangles.end())
static const word null
An empty word.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
static void read(const objectRegistry &obr, const dictionary &dict)
Read (& store) geometry. Exposed so point attraction can reuse it.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
const word & name() const noexcept
The patch name.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
Mesh data needed to do the Finite Area discretisation.
pointPatchField< vector > pointPatchVectorField
const pointBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
virtual void write(Ostream &) const
Write.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER)))
vector point
Point is a vector.
const indexedOctree< treeDataPoint > & pointTree() const
Basic pointPatch represents a set of points from the mesh.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
Standard boundBox with extra functionality for use in octree.
messageStream Info
Information stream (stdout output on master, null elsewhere)
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
virtual const labelList & meshPoints() const =0
Return mesh points.
IOporosityModelList pZones(mesh)
static constexpr const zero Zero
Global zero (0)