45 displacementLayeredMotionMotionSolver,
53 void Foam::displacementLayeredMotionMotionSolver::calcZoneMask
55 const label cellZoneI,
56 PackedBoolList& isZonePoint,
57 PackedBoolList& isZoneEdge
65 isZoneEdge.setSize(
mesh().nEdges());
78 if (!isZonePoint[cPoints[cPointi]])
80 isZonePoint[cPoints[cPointi]] = 1;
89 orEqOp<unsigned int>(),
101 if (!isZoneEdge[cEdges[cEdgeI]])
103 isZoneEdge[cEdges[cEdgeI]] = 1;
112 orEqOp<unsigned int>(),
118 Info<<
"On cellZone " << cz.name()
120 <<
" points and " <<
returnReduce(nEdges, sumOp<label>())
121 <<
" edges." <<
endl;
128 void Foam::displacementLayeredMotionMotionSolver::walkStructured
130 const label cellZoneI,
131 const PackedBoolList& isZonePoint,
132 const PackedBoolList& isZoneEdge,
139 List<pointEdgeStructuredWalk> seedInfo(seedPoints.size());
143 seedInfo[i] = pointEdgeStructuredWalk
145 points0()[seedPoints[i]],
146 points0()[seedPoints[i]],
153 List<pointEdgeStructuredWalk> allPointInfo(
mesh().
nPoints());
158 forAll(isZonePoint, pointi)
160 if (isZonePoint[pointi])
162 allPointInfo[pointi] = pointEdgeStructuredWalk
173 List<pointEdgeStructuredWalk> allEdgeInfo(
mesh().nEdges());
178 if (isZoneEdge[edgeI])
180 allEdgeInfo[edgeI] = pointEdgeStructuredWalk
182 mesh().edges()[edgeI].centre(points0()),
191 PointEdgeWave<pointEdgeStructuredWalk> wallCalc
199 mesh().globalData().nTotalPoints()
203 forAll(allPointInfo, pointi)
205 if (isZonePoint[pointi])
207 distance[pointi] = allPointInfo[pointi].dist();
208 data[pointi] = allPointInfo[pointi].data();
216 Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate
220 const dictionary& dict,
221 const PtrList<pointVectorField>& patchDisp,
225 tmp<vectorField> tfld(
new vectorField(meshPoints.size()));
228 const word
type(dict.lookup(
"type"));
230 if (
type ==
"fixedValue")
232 fld =
vectorField(
"value", dict, meshPoints.size());
234 else if (
type ==
"timeVaryingUniformFixedValue")
236 Function1s::Table<vector> timeSeries(
word::null, dict);
238 fld = timeSeries.value(
mesh().time().timeOutputValue());
240 else if (
type ==
"slip")
242 if ((patchi % 2) != 1)
245 <<
"FaceZone:" << fz.name()
249 fld =
vectorField(patchDisp[patchi - 1], meshPoints);
251 else if (
type ==
"follow")
256 else if (
type ==
"uniformFollow")
260 const word patchName(dict.lookup(
"patch"));
264 pointDisplacement_.boundaryField()[patchID].patchInternalField()
271 <<
"Unknown faceZonePatch type " <<
type <<
" for faceZone " 278 void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve
280 const label cellZoneI,
281 const dictionary& zoneDict
285 PackedBoolList isZoneEdge(
mesh().nEdges());
286 calcZoneMask(cellZoneI, isZonePoint, isZoneEdge);
288 const dictionary& patchesDict = zoneDict.subDict(
"boundaryField");
290 if (patchesDict.size() != 2)
293 <<
"Two faceZones (patches) must be specified per cellZone. " 294 <<
" cellZone:" << cellZoneI
295 <<
" patches:" << patchesDict.toc()
299 PtrList<scalarField> patchDist(patchesDict.size());
300 PtrList<pointVectorField> patchDisp(patchesDict.size());
306 const word& faceZoneName = patchiter().keyword();
311 <<
"Cannot find faceZone " << faceZoneName
327 mesh().cellZones()[cellZoneI].
name() +
"_" + fz.name(),
348 pointDisplacement_.correctBoundaryConditions();
353 const word& faceZoneName = patchiter().keyword();
354 const dictionary& faceZoneDict = patchiter().dict();
358 const labelList& fzMeshPoints = fz().meshPoints();
359 DynamicList<label> meshPoints(fzMeshPoints.size());
362 if (isZonePoint[fzMeshPoints[i]])
364 meshPoints.append(fzMeshPoints[i]);
369 tmp<vectorField> tseed = faceZoneEvaluate
380 Info<<
"For cellZone:" << cellZoneI
381 <<
" for faceZone:" << fz.name()
382 <<
" nPoints:" << tseed().size()
383 <<
" have patchField:" 384 <<
" max:" <<
gMax(tseed())
385 <<
" min:" <<
gMin(tseed())
404 patchDisp[
patchi].correctBoundaryConditions();
420 mesh().cellZones()[cellZoneI].
name() +
":distance",
433 scalar d1 = patchDist[0][pointi];
434 scalar d2 = patchDist[1][pointi];
437 scalar
s = d1/(d1 + d2);
438 distance[pointi] =
s;
443 << distance.name() <<
" to " 449 const word interpolationScheme = zoneDict.lookup(
"interpolationScheme");
451 if (interpolationScheme ==
"oneSided")
453 forAll(pointDisplacement_, pointi)
455 if (isZonePoint[pointi])
457 pointDisplacement_[pointi] = patchDisp[0][pointi];
461 else if (interpolationScheme ==
"linear")
463 forAll(pointDisplacement_, pointi)
465 if (isZonePoint[pointi])
467 scalar d1 = patchDist[0][pointi];
468 scalar d2 = patchDist[1][pointi];
469 scalar
s = d1/(d1 + d2 + vSmall);
471 const vector& pd1 = patchDisp[0][pointi];
472 const vector& pd2 = patchDisp[1][pointi];
474 pointDisplacement_[pointi] = (1 -
s)*pd1 + s*pd2;
481 <<
"Invalid interpolationScheme: " << interpolationScheme
482 <<
". Valid schemes are 'oneSided' and 'linear'" 515 points0() + pointDisplacement_.primitiveField()
528 pointDisplacement_.boundaryFieldRef().updateCoeffs();
534 const word& cellZoneName = regionIter().keyword();
535 const dictionary& regionDict = regionIter().dict();
539 Info<<
"solving for zone: " << cellZoneName <<
endl;
544 <<
"Cannot find cellZone " << cellZoneName
549 cellZoneSolve(zoneI, regionDict);
565 <<
"Probably inconsistent with points0MotionSolver" <<
nl 566 <<
" Needs to be updated and tested." 571 const vectorField displacement(this->newPoints() - points0_);
581 if ((masterPointi != pointi))
587 points0_[pointi] -= displacement[pointi];
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const labelListList & cellEdges() const
label findZoneID(const word &zoneName) const
Find zone index given a name.
Virtual base class for displacement motion solver.
#define forAll(list, i)
Loop across all elements in list.
const labelList & reversePointMap() const
Reverse point map.
virtual Ostream & write(const char)=0
Write character.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool set(const label) const
Is element set.
static const Vector< scalar > max
errorManipArg< error, int > exit(error &err, const int errNo=1)
const meshCellZones & cellZones() const
Return cell zones.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
static const char *const typeName
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label findPatchID(const word &patchName) const
Find patch index given a name.
displacementLayeredMotionMotionSolver(const polyMesh &, const dictionary &)
Construct from polyMesh and dictionary.
scalar distance(const vector &p1, const vector &p2)
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Vector< scalar > vector
A scalar version of the templated Vector.
const Time & time() const
Return the top-level database.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
const dimensionSet dimLength
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
wordList names() const
Return a list of zone names.
Application of (multi-)patch point constraints.
~displacementLayeredMotionMotionSolver()
Destructor.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
vectorField pointField
pointField is a vectorField.
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static const word null
An empty word.
virtual void updateMesh(const mapPolyMesh &)
Update topology.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
List< label > labelList
A List of labels.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
const labelList & pointMap() const
Old point map.
static pointMesh & New(polyMesh &mesh)
word name(const complex &)
Return a string representation of a complex.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Type gAverage(const FieldField< Field, Type > &f)
const meshFaceZones & faceZones() const
Return face zones.
virtual void solve()
Solve for motion.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
A class for managing temporary objects.
const labelListList & cellPoints() const