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];
86 <<
"Cannot find zone " << zoneName <<
endl 91 const word& tableName = faceZoneToTable[i][1];
108 times_[zoneI].setSize(table.
size());
109 displacements_[zoneI].setSize(table.
size());
113 times_[zoneI][j] = table[j].
first();
114 displacements_[zoneI][j] = table[j].second();
129 forAll(faceZoneToTable, i)
131 const word& zoneName = faceZoneToTable[i][0];
132 const faceZone& fz = fZones[zoneName];
134 scalar minCoord = VGREAT;
135 scalar maxCoord = -VGREAT;
137 forAll(fz().meshPoints(), localI)
139 label pointi = fz().meshPoints()[localI];
140 const scalar coord = points0()[pointi][dir];
141 minCoord =
min(minCoord, coord);
142 maxCoord =
max(maxCoord, coord);
150 Pout<<
"direction " << dir <<
" : " 151 <<
"zone " << zoneName
152 <<
" ranges from coordinate " << zoneCoordinates[2*i]
153 <<
" to " << zoneCoordinates[2*i+1]
157 zoneCoordinates.sort();
160 zoneCoordinates[0] -= SMALL;
161 zoneCoordinates.last() += SMALL;
166 scalar minCoord =
gMin(meshCoords);
167 scalar maxCoord =
gMax(meshCoords);
171 Pout<<
"direction " << dir <<
" : " 172 <<
"mesh ranges from coordinate " << minCoord <<
" to " 180 labelList& rangeZone = rangeToZone_[dir];
185 rangeZone.
setSize(zoneCoordinates.size());
188 if (minCoord < zoneCoordinates[0])
191 rangeToCoord.setSize(sz+1);
193 rangeToCoord[rangeI] = minCoord-SMALL;
194 rangeZone[rangeI] = -1;
198 Pout<<
"direction " << dir <<
" : " 199 <<
"range " << rangeI <<
" at coordinate " 200 << rangeToCoord[rangeI] <<
" from min of mesh " 201 << rangeZone[rangeI] <<
endl;
205 forAll(zoneCoordinates, i)
207 rangeToCoord[rangeI] = zoneCoordinates[i];
208 rangeZone[rangeI] = zoneCoordinates.indices()[i]/2;
212 Pout<<
"direction " << dir <<
" : " 213 <<
"range " << rangeI <<
" at coordinate " 214 << rangeToCoord[rangeI]
215 <<
" from zone " << rangeZone[rangeI] <<
endl;
219 if (maxCoord > zoneCoordinates.last())
221 label sz = rangeToCoord.size();
222 rangeToCoord.setSize(sz+1);
224 rangeToCoord[sz] = maxCoord+SMALL;
229 Pout<<
"direction " << dir <<
" : " 230 <<
"range " << rangeI <<
" at coordinate " 231 << rangeToCoord[sz] <<
" from max of mesh " 232 << rangeZone[sz] <<
endl;
241 labelList nRangePoints(rangeToCoord.size(), 0);
243 forAll(meshCoords, pointi)
247 if (rangeI == -1 || rangeI == rangeToCoord.size()-1)
250 <<
"Did not find point " << points0()[pointi]
251 <<
" coordinate " << meshCoords[pointi]
252 <<
" in ranges " << rangeToCoord
255 nRangePoints[rangeI]++;
260 for (
label rangeI = 0; rangeI < rangeToCoord.size()-1; rangeI++)
263 Pout<<
"direction " << dir <<
" : " 264 <<
"range from " << rangeToCoord[rangeI]
265 <<
" to " << rangeToCoord[rangeI+1]
266 <<
" contains " << nRangePoints[rangeI]
267 <<
" points." <<
endl;
272 rangePoints.
setSize(nRangePoints.size());
273 rangeWeights.
setSize(nRangePoints.size());
274 forAll(rangePoints, rangeI)
276 rangePoints[rangeI].
setSize(nRangePoints[rangeI]);
277 rangeWeights[rangeI].
setSize(nRangePoints[rangeI]);
280 forAll(meshCoords, pointi)
284 rangePoints[rangeI][
nPoints] = pointi;
285 rangeWeights[rangeI][
nPoints] =
286 (meshCoords[pointi]-rangeToCoord[rangeI])
287 / (rangeToCoord[rangeI+1]-rangeToCoord[rangeI]);
309 <<
"The number of points in the mesh seems to have changed." <<
endl 310 <<
"In constant/polyMesh there are " << points0().size()
311 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
322 if (times_[zoneI].size())
326 mesh().time().value(),
328 displacements_[zoneI]
334 Pout<<
"Zone displacements:" << zoneDisp <<
endl;
341 const labelList& rangeZone = rangeToZone_[dir];
345 for (
label rangeI = 0; rangeI < rangeZone.
size()-1; rangeI++)
347 const labelList& rPoints = rangePoints[rangeI];
348 const scalarField& rWeights = rangeWeights[rangeI];
351 label minZoneI = rangeZone[rangeI];
354 scalar minDisp = (minZoneI == -1 ? 0.0 : zoneDisp[minZoneI][dir]);
355 label maxZoneI = rangeZone[rangeI+1];
358 scalar maxDisp = (maxZoneI == -1 ? 0.0 : zoneDisp[maxZoneI][dir]);
362 label pointi = rPoints[i];
363 scalar w = rWeights[i];
365 curPoints[pointi][dir] += (1.0-w)*minDisp+w*maxDisp;
const Time & time() const
Return time.
Virtual base class for displacement motion solver.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list that is sorted upon construction or when explicitly requested with the sort() method...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A List of objects of type <T> with automated input and output.
T & first()
Return the first element of the list.
Macros for easy insertion into run-time selection tables.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
label findZoneID(const word &zoneName) const
Find zone index given a name.
static const direction nComponents
Number of components in this vector space.
vectorField pointField
pointField is a vectorField.
stressControl lookup("compactNormalStress") >> compactNormalStress
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
A class for handling words, derived from string.
wordList names() const
Return a list of zone names.
Interpolates y values from one curve to another with a different x distribution.
const word & constant() const
Return constant name.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
~displacementInterpolationMotionSolver()
Destructor.
errorManip< error > abort(error &err)
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
prefixOSstream Pout(cout,"Pout")
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void setSize(const label)
Reset size of List.
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,.
const faceZoneMesh & faceZones() const
Return face zone mesh.
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 subset of mesh faces organised as a primitive patch.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
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)
label size() const
Return the number of elements in the UPtrList.