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 interpolationTable<vector> timeSeries(dict);
238 fld = timeSeries(
mesh().time().timeOutputValue());
240 else if (
type ==
"slip")
242 if ((patchI % 2) != 1)
246 "displacementLayeredMotionMotionSolver::faceZoneEvaluate" 250 "const dictionary&, " 251 "const PtrList<pointVectorField>&, " 255 ) <<
"slip can only be used on second faceZone patch of pair. " 256 <<
"FaceZone:" << fz.name()
260 fld =
vectorField(patchDisp[patchI - 1], meshPoints);
262 else if (
type ==
"follow")
267 else if (
type ==
"uniformFollow")
271 const word patchName(dict.lookup(
"patch"));
275 pointDisplacement_.boundaryField()[patchID].patchInternalField()
283 "displacementLayeredMotionMotionSolver::faceZoneEvaluate" 287 "const dictionary&, " 288 "const PtrList<pointVectorField>&, " 292 ) <<
"Unknown faceZonePatch type " <<
type <<
" for faceZone " 299 void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve
301 const label cellZoneI,
302 const dictionary& zoneDict
306 PackedBoolList isZoneEdge(
mesh().nEdges());
307 calcZoneMask(cellZoneI, isZonePoint, isZoneEdge);
309 const dictionary& patchesDict = zoneDict.subDict(
"boundaryField");
311 if (patchesDict.size() != 2)
315 "displacementLayeredMotionMotionSolver::" 316 "cellZoneSolve(const label, const dictionary&)",
318 ) <<
"Two faceZones (patches) must be specifed per cellZone. " 319 <<
" cellZone:" << cellZoneI
320 <<
" patches:" << patchesDict.toc()
324 PtrList<scalarField> patchDist(patchesDict.size());
325 PtrList<pointVectorField> patchDisp(patchesDict.size());
331 const word& faceZoneName = patchIter().keyword();
337 "displacementLayeredMotionMotionSolver::" 338 "cellZoneSolve(const label, const dictionary&)",
340 ) <<
"Cannot find faceZone " << faceZoneName
356 mesh().cellZones()[cellZoneI].
name() +
"_" + fz.name(),
377 pointDisplacement_.correctBoundaryConditions();
382 const word& faceZoneName = patchIter().keyword();
383 const dictionary& faceZoneDict = patchIter().dict();
387 const labelList& fzMeshPoints = fz().meshPoints();
388 DynamicList<label> meshPoints(fzMeshPoints.size());
391 if (isZonePoint[fzMeshPoints[i]])
393 meshPoints.append(fzMeshPoints[i]);
398 tmp<vectorField> tseed = faceZoneEvaluate
409 Info<<
"For cellZone:" << cellZoneI
410 <<
" for faceZone:" << fz.name()
411 <<
" nPoints:" << tseed().size()
412 <<
" have patchField:" 413 <<
" max:" <<
gMax(tseed())
414 <<
" min:" <<
gMin(tseed())
433 patchDisp[patchI].correctBoundaryConditions();
449 mesh().cellZones()[cellZoneI].
name() +
":distance",
462 scalar d1 = patchDist[0][pointI];
463 scalar d2 = patchDist[1][pointI];
466 scalar
s = d1/(d1 + d2);
467 distance[pointI] =
s;
472 << distance.name() <<
" to " 478 const word interpolationScheme = zoneDict.lookup(
"interpolationScheme");
480 if (interpolationScheme ==
"oneSided")
482 forAll(pointDisplacement_, pointI)
484 if (isZonePoint[pointI])
486 pointDisplacement_[pointI] = patchDisp[0][pointI];
490 else if (interpolationScheme ==
"linear")
492 forAll(pointDisplacement_, pointI)
494 if (isZonePoint[pointI])
496 scalar d1 = patchDist[0][pointI];
497 scalar d2 = patchDist[1][pointI];
498 scalar
s = d1/(d1 + d2 + VSMALL);
500 const vector& pd1 = patchDisp[0][pointI];
501 const vector& pd2 = patchDisp[1][pointI];
503 pointDisplacement_[pointI] = (1 -
s)*pd1 + s*pd2;
511 "displacementLayeredMotionMotionSolver::" 512 "cellZoneSolve(const label, const dictionary&)" 514 <<
"Invalid interpolationScheme: " << interpolationScheme
515 <<
". Valid schemes are 'oneSided' and 'linear'" 523 Foam::displacementLayeredMotionMotionSolver::
524 displacementLayeredMotionMotionSolver
548 points0() + pointDisplacement_.internalField()
561 pointDisplacement_.boundaryField().updateCoeffs();
567 const word& cellZoneName = regionIter().keyword();
568 const dictionary& regionDict = regionIter().dict();
572 Info<<
"solving for zone: " << cellZoneName <<
endl;
578 "displacementLayeredMotionMotionSolver::solve()",
580 ) <<
"Cannot find cellZone " << cellZoneName
585 cellZoneSolve(zoneI, regionDict);
602 const vectorField displacement(this->newPoints() - points0_);
612 if ((masterPointI != pointI))
618 points0_[pointI] -= displacement[pointI];
const cellZoneMesh & cellZones() const
Return cell zone mesh.
const labelListList & cellPoints() const
const pointField & points
const faceZoneMesh & faceZones() const
Return face zone mesh.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
static const char *const typeName
bool set(const label) const
Is element set.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
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 ))
word name(const complex &)
Return a string representation of a complex.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
static const pointMesh & New(const polyMesh &mesh)
virtual void updateMesh(const mapPolyMesh &)
Update topology.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static void syncEdgeList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh edges.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
vectorField pointField
pointField is a vectorField.
const labelListList & cellEdges() const
scalar distance(const vector &p1, const vector &p2)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Time & time() const
Return the top-level database.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Field< vector > vectorField
Specialisation of Field<T> for vector.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual Ostream & write(const token &)=0
Write next token to stream.
Macros for easy insertion into run-time selection tables.
Type gMin(const FieldField< Field, Type > &f)
virtual void solve()
Solve for motion.
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
~displacementLayeredMotionMotionSolver()
Destructor.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Mesh consisting of general polyhedral cells.
Type gAverage(const FieldField< Field, Type > &f)
List< label > labelList
A List of labels.
const labelList & pointMap() const
Old point map.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
label findZoneID(const word &zoneName) const
Find zone index given a name.
Vector< scalar > vector
A scalar version of the templated Vector.
wordList names() const
Return a list of zone names.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
label findPatchID(const word &patchName) const
Find patch index given a name.
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Application of (multi-)patch point contraints.
Type gMax(const FieldField< Field, Type > &f)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
defineTypeNameAndDebug(combustionModel, 0)
Virtual base class for displacement motion solver.