43 displacementInterpolationMotionSolver,
48 const word IOList<Tuple2<scalar, vector> >::typeName(
"scalarVectorTable");
56 Foam::displacementInterpolationMotionSolver::
57 displacementInterpolationMotionSolver
70 coeffDict().
lookup(
"interpolationTables")
76 displacements_.setSize(fZones.
size());
80 const word& zoneName = faceZoneToTable[i][0];
87 "displacementInterpolationMotionSolver::" 88 "displacementInterpolationMotionSolver(const polyMesh&," 90 ) <<
"Cannot find zone " << zoneName <<
endl 95 const word& tableName = faceZoneToTable[i][1];
112 times_[zoneI].setSize(table.
size());
113 displacements_[zoneI].setSize(table.
size());
117 times_[zoneI][j] = table[j].
first();
118 displacements_[zoneI][j] = table[j].second();
133 forAll(faceZoneToTable, i)
135 const word& zoneName = faceZoneToTable[i][0];
136 const faceZone& fz = fZones[zoneName];
138 scalar minCoord = VGREAT;
139 scalar maxCoord = -VGREAT;
141 forAll(fz().meshPoints(), localI)
143 label pointI = fz().meshPoints()[localI];
144 const scalar coord = points0()[pointI][dir];
145 minCoord =
min(minCoord, coord);
146 maxCoord =
max(maxCoord, coord);
154 Pout<<
"direction " << dir <<
" : " 155 <<
"zone " << zoneName
156 <<
" ranges from coordinate " << zoneCoordinates[2*i]
157 <<
" to " << zoneCoordinates[2*i+1]
161 zoneCoordinates.sort();
164 zoneCoordinates[0] -= SMALL;
165 zoneCoordinates.last() += SMALL;
170 scalar minCoord =
gMin(meshCoords);
171 scalar maxCoord =
gMax(meshCoords);
175 Pout<<
"direction " << dir <<
" : " 176 <<
"mesh ranges from coordinate " << minCoord <<
" to " 184 labelList& rangeZone = rangeToZone_[dir];
189 rangeZone.
setSize(zoneCoordinates.size());
192 if (minCoord < zoneCoordinates[0])
195 rangeToCoord.setSize(sz+1);
197 rangeToCoord[rangeI] = minCoord-SMALL;
198 rangeZone[rangeI] = -1;
202 Pout<<
"direction " << dir <<
" : " 203 <<
"range " << rangeI <<
" at coordinate " 204 << rangeToCoord[rangeI] <<
" from min of mesh " 205 << rangeZone[rangeI] <<
endl;
209 forAll(zoneCoordinates, i)
211 rangeToCoord[rangeI] = zoneCoordinates[i];
212 rangeZone[rangeI] = zoneCoordinates.indices()[i]/2;
216 Pout<<
"direction " << dir <<
" : " 217 <<
"range " << rangeI <<
" at coordinate " 218 << rangeToCoord[rangeI]
219 <<
" from zone " << rangeZone[rangeI] <<
endl;
223 if (maxCoord > zoneCoordinates.last())
225 label sz = rangeToCoord.size();
226 rangeToCoord.setSize(sz+1);
228 rangeToCoord[sz] = maxCoord+SMALL;
233 Pout<<
"direction " << dir <<
" : " 234 <<
"range " << rangeI <<
" at coordinate " 235 << rangeToCoord[sz] <<
" from max of mesh " 236 << rangeZone[sz] <<
endl;
245 labelList nRangePoints(rangeToCoord.size(), 0);
247 forAll(meshCoords, pointI)
251 if (rangeI == -1 || rangeI == rangeToCoord.size()-1)
255 "displacementInterpolationMotionSolver::" 256 "displacementInterpolationMotionSolver" 257 "(const polyMesh&, Istream&)" 258 ) <<
"Did not find point " << points0()[pointI]
259 <<
" coordinate " << meshCoords[pointI]
260 <<
" in ranges " << rangeToCoord
263 nRangePoints[rangeI]++;
268 for (
label rangeI = 0; rangeI < rangeToCoord.size()-1; rangeI++)
271 Pout<<
"direction " << dir <<
" : " 272 <<
"range from " << rangeToCoord[rangeI]
273 <<
" to " << rangeToCoord[rangeI+1]
274 <<
" contains " << nRangePoints[rangeI]
275 <<
" points." <<
endl;
280 rangePoints.
setSize(nRangePoints.size());
281 rangeWeights.
setSize(nRangePoints.size());
282 forAll(rangePoints, rangeI)
284 rangePoints[rangeI].
setSize(nRangePoints[rangeI]);
285 rangeWeights[rangeI].
setSize(nRangePoints[rangeI]);
288 forAll(meshCoords, pointI)
292 rangePoints[rangeI][
nPoints] = pointI;
293 rangeWeights[rangeI][
nPoints] =
294 (meshCoords[pointI]-rangeToCoord[rangeI])
295 / (rangeToCoord[rangeI+1]-rangeToCoord[rangeI]);
318 "displacementInterpolationMotionSolver::curPoints() const" 319 ) <<
"The number of points in the mesh seems to have changed." <<
endl 320 <<
"In constant/polyMesh there are " << points0().size()
321 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
332 if (times_[zoneI].size())
336 mesh().time().value(),
338 displacements_[zoneI]
344 Pout<<
"Zone displacements:" << zoneDisp <<
endl;
351 const labelList& rangeZone = rangeToZone_[dir];
355 for (
label rangeI = 0; rangeI < rangeZone.
size()-1; rangeI++)
357 const labelList& rPoints = rangePoints[rangeI];
358 const scalarField& rWeights = rangeWeights[rangeI];
361 label minZoneI = rangeZone[rangeI];
364 scalar minDisp = (minZoneI == -1 ? 0.0 : zoneDisp[minZoneI][dir]);
365 label maxZoneI = rangeZone[rangeI+1];
368 scalar maxDisp = (maxZoneI == -1 ? 0.0 : zoneDisp[maxZoneI][dir]);
372 label pointI = rPoints[i];
373 scalar w = rWeights[i];
375 curPoints[pointI][dir] += (1.0-w)*minDisp+w*maxDisp;
const faceZoneMesh & faceZones() const
Return face zone mesh.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
label size() const
Return the number of elements in the PtrList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A subset of mesh faces organised as a primitive patch.
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.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
T & first()
Return the first element of the list.
const word & constant() const
Return constant name.
vectorField pointField
pointField is a vectorField.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Number of components in this vector space.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
stressControl lookup("compactNormalStress") >> compactNormalStress
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A list that is sorted upon construction or when explicitly requested with the sort() method...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
~displacementInterpolationMotionSolver()
Destructor.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Macros for easy insertion into run-time selection tables.
label findLower(const ListType &, typename ListType::const_reference, const label stary, const BinaryOp &bop)
Find last element < given value in sorted list and return index,.
errorManip< error > abort(error &err)
Type gMin(const FieldField< Field, Type > &f)
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
Mesh consisting of general polyhedral cells.
A List of objects of type <T> with automated input and output.
Interpolates y values from one curve to another with a different x distribution.
label findZoneID(const word &zoneName) const
Find zone index given a name.
const Time & time() const
Return time.
wordList names() const
Return a list of zone names.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Type gMax(const FieldField< Field, Type > &f)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
A class for managing temporary objects.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
Virtual base class for displacement motion solver.