56 if (geometry[i].
name() == name)
63 <<
"Cannot find surface " << name <<
" in geometry" 80 void Foam::blockFaces::projectFace::calcLambdas
99 lambdaI[ij] = lambdaI[iMin1j] +
mag(points[ij] - points[iMin1j]);
102 lambdaJ[ij] = lambdaJ[ijMin1] +
mag(points[ij] - points[ijMin1]);
112 lambdaJ[ij] /= lambdaJ[ijLast];
121 lambdaI[ij] /= lambdaI[iLastj];
138 surface_(lookupSurface(geometry, is))
147 const label blockFacei,
152 static label fIter = 0;
162 <<
" with verts:" << desc.
vertices()
163 <<
" writing lines from start points" 164 <<
" to projected points to " << debugStr().name() <<
endl;
201 calcLambdas(n, points, lambdaI, lambdaJ);
205 const label maxIter = 10;
208 const scalar relTol = 0.1;
209 const scalar absTol = 1
e-4;
211 scalar initialResidual = 0;
213 for (
label iter = 0; iter < maxIter; iter++)
223 surface_.findNearest(points, nearestDistSqr, hits);
229 const point& hitPt = hits[i].hitPoint();
230 if (debugStr.
valid())
256 +
mag(points[ij] - points[iMin1j]);
258 projLambdas /= projLambdas.last();
266 interpolator.
valueWeights(lambdaI[ij], indices, weights);
271 const label ptIndex =
273 predicted += weights[indexi]*points[ptIndex];
275 residual[ij] = predicted - points[ij];
279 if (debugStr.
valid())
283 const point predicted(points[i] + residual[i]);
288 scalar scalarResidual =
sum(
mag(residual));
308 +
mag(points[ij] - points[ijMin1]);
311 projLambdas /= projLambdas.last();
319 interpolator.
valueWeights(lambdaJ[ij], indices, weights);
324 const label ptIndex =
326 predicted += weights[indexi]*points[ptIndex];
328 residual[ij] = predicted - points[ij];
332 if (debugStr.
valid())
336 const point predicted(points[i] + residual[i]);
341 scalarResidual +=
sum(
mag(residual));
345 Pout<<
"Iter:" << iter <<
" initialResidual:" << initialResidual
346 <<
" scalarResidual:" << scalarResidual <<
endl;
349 if (scalarResidual < absTol*lambdaI.
size())
355 initialResidual = scalarResidual;
357 else if (scalarResidual/initialResidual < relTol)
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
const Vector< label > & density() const
Return the mesh density (number of cells) in the i,j,k directions.
A list of keyword definitions, which are a keyword followed by any number of values (e...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
defineTypeNameAndDebug(projectFace, 0)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Takes the description of the block and the list of curved edges and creates a list of points on edges...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const cellShape & blockShape() const
Return the block shape.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
An ordered pair of two objects of type <T> with first() and second() elements.
line< point, const point & > linePointRef
Line using referred points.
A class for handling words, derived from string.
virtual void project(const blockDescriptor &, const label blockFacei, pointField &points) const
Project the given points onto the surface.
Container for searchableSurfaces.
Pair< label > labelPair
Label pair.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
OFstream which keeps track of vertices.
word name(const complex &)
Return a string representation of a complex.
const pointField & vertices() const
Reference to point field defining the block mesh.
const Type & second() const
Return second.
void setSize(const label)
Reset size of List.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
prefixOSstream Pout(cout, "Pout")
Projects the given set of face points onto the selected surface of the geometry provided as a searcha...
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const doubleScalar e
Elementary charge.
addToRunTimeSelectionTable(blockFace, projectFace, Istream)
const Type & first() const
Return first.
projectFace(const dictionary &dict, const label index, const searchableSurfaces &geometry, Istream &)
Construct from Istream setting pointsList.
static const Vector< scalar > zero