43 displacementInterpolationMotionSolver,
48 const word IOList<Tuple2<scalar, vector>>::typeName(
"scalarVectorTable");
54 Foam::displacementInterpolationMotionSolver::
55 displacementInterpolationMotionSolver
68 coeffDict().
lookup(
"interpolationTables")
74 displacements_.setSize(fZones.
size());
78 const word& zoneName = faceZoneToTable[i][0];
84 <<
"Cannot find zone " << zoneName <<
endl 89 const word& tableName = faceZoneToTable[i][1];
106 times_[zoneI].setSize(table.
size());
107 displacements_[zoneI].setSize(table.
size());
111 times_[zoneI][j] = table[j].
first();
112 displacements_[zoneI][j] = table[j].second();
127 forAll(faceZoneToTable, i)
129 const word& zoneName = faceZoneToTable[i][0];
130 const faceZone& fz = fZones[zoneName];
132 scalar minCoord = vGreat;
133 scalar maxCoord = -vGreat;
135 forAll(fz().meshPoints(), localI)
137 label pointi = fz().meshPoints()[localI];
138 const scalar coord = points0()[pointi][dir];
139 minCoord =
min(minCoord, coord);
140 maxCoord =
max(maxCoord, coord);
148 Pout<<
"direction " << dir <<
" : " 149 <<
"zone " << zoneName
150 <<
" ranges from coordinate " << zoneCoordinates[2*i]
151 <<
" to " << zoneCoordinates[2*i+1]
155 zoneCoordinates.sort();
158 zoneCoordinates[0] -= small;
159 zoneCoordinates.last() += small;
164 scalar minCoord =
gMin(meshCoords);
165 scalar maxCoord =
gMax(meshCoords);
169 Pout<<
"direction " << dir <<
" : " 170 <<
"mesh ranges from coordinate " << minCoord <<
" to " 178 labelList& rangeZone = rangeToZone_[dir];
183 rangeZone.
setSize(zoneCoordinates.size());
186 if (minCoord < zoneCoordinates[0])
189 rangeToCoord.setSize(sz+1);
191 rangeToCoord[rangeI] = minCoord-small;
192 rangeZone[rangeI] = -1;
196 Pout<<
"direction " << dir <<
" : " 197 <<
"range " << rangeI <<
" at coordinate " 198 << rangeToCoord[rangeI] <<
" from min of mesh " 199 << rangeZone[rangeI] <<
endl;
203 forAll(zoneCoordinates, i)
205 rangeToCoord[rangeI] = zoneCoordinates[i];
206 rangeZone[rangeI] = zoneCoordinates.indices()[i]/2;
210 Pout<<
"direction " << dir <<
" : " 211 <<
"range " << rangeI <<
" at coordinate " 212 << rangeToCoord[rangeI]
213 <<
" from zone " << rangeZone[rangeI] <<
endl;
217 if (maxCoord > zoneCoordinates.last())
219 label sz = rangeToCoord.size();
220 rangeToCoord.setSize(sz+1);
222 rangeToCoord[sz] = maxCoord+small;
227 Pout<<
"direction " << dir <<
" : " 228 <<
"range " << rangeI <<
" at coordinate " 229 << rangeToCoord[sz] <<
" from max of mesh " 230 << rangeZone[sz] <<
endl;
239 labelList nRangePoints(rangeToCoord.size(), 0);
241 forAll(meshCoords, pointi)
245 if (rangeI == -1 || rangeI == rangeToCoord.size()-1)
248 <<
"Did not find point " << points0()[pointi]
249 <<
" coordinate " << meshCoords[pointi]
250 <<
" in ranges " << rangeToCoord
253 nRangePoints[rangeI]++;
258 for (
label rangeI = 0; rangeI < rangeToCoord.size()-1; rangeI++)
261 Pout<<
"direction " << dir <<
" : " 262 <<
"range from " << rangeToCoord[rangeI]
263 <<
" to " << rangeToCoord[rangeI+1]
264 <<
" contains " << nRangePoints[rangeI]
265 <<
" points." <<
endl;
270 rangePoints.
setSize(nRangePoints.size());
271 rangeWeights.
setSize(nRangePoints.size());
272 forAll(rangePoints, rangeI)
274 rangePoints[rangeI].
setSize(nRangePoints[rangeI]);
275 rangeWeights[rangeI].
setSize(nRangePoints[rangeI]);
278 forAll(meshCoords, pointi)
282 rangePoints[rangeI][
nPoints] = pointi;
283 rangeWeights[rangeI][
nPoints] =
284 (meshCoords[pointi]-rangeToCoord[rangeI])
285 / (rangeToCoord[rangeI+1]-rangeToCoord[rangeI]);
307 <<
"The number of points in the mesh seems to have changed." <<
endl 308 <<
"In constant/polyMesh there are " << points0().size()
309 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
320 if (times_[zoneI].size())
324 mesh().time().value(),
326 displacements_[zoneI]
332 Pout<<
"Zone displacements:" << zoneDisp <<
endl;
339 const labelList& rangeZone = rangeToZone_[dir];
343 for (
label rangeI = 0; rangeI < rangeZone.
size()-1; rangeI++)
345 const labelList& rPoints = rangePoints[rangeI];
346 const scalarField& rWeights = rangeWeights[rangeI];
349 label minZoneI = rangeZone[rangeI];
352 scalar minDisp = (minZoneI == -1 ? 0.0 : zoneDisp[minZoneI][dir]);
353 label maxZoneI = rangeZone[rangeI+1];
356 scalar maxDisp = (maxZoneI == -1 ? 0.0 : zoneDisp[maxZoneI][dir]);
360 label pointi = rPoints[i];
361 scalar w = rWeights[i];
363 curPoints[pointi][dir] += (1.0-w)*minDisp+w*maxDisp;
#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.
const faceZoneMesh & faceZones() const
Return face zone mesh.
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...
T & ref() const
Return non-const reference or generate a fatal error.
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...
static const direction nComponents
Number of components in this vector space.
vectorField pointField
pointField is a vectorField.
stressControl lookup("compactNormalStress") >> compactNormalStress
label findZoneID(const word &zoneName) const
Find zone index given a name.
A class for handling words, derived from string.
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.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Type gMax(const FieldField< Field, Type > &f)
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
prefixOSstream Pout(cout, "Pout")
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Virtual base class for displacement motion solvers.
wordList names() const
Return a list of zone names.
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,.
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.
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)