53 for (
label i=0; i<Un; i++)
63 scale +=
mag(U_(
k, i));
71 s += U_(
k, i)*U_(
k, i);
79 for (
label j=l-1; j<Un; j++)
84 s += U_(
k, i)*U_(
k, j);
90 U_(
k, j) +=
f*U_(
k, i);
105 if (i+1 <= Um && i != Un)
109 scale +=
mag(U_(i,
k));
117 s += U_(i,
k)*U_(i,
k);
120 scalar
f = U_(i, l-1);
130 for (
label j=l-1; j<Um; j++)
135 s += U_(j,
k)*U_(i,
k);
140 U_(j,
k) +=
s*rv1[
k];
150 anorm =
max(anorm,
mag(S_[i]) +
mag(rv1[i]));
155 for (
label i=Un-1; i >= 0; i--)
161 for (
label j=l; j<Un; j++)
163 V_(j, i) = (U_(i, j)/U_(i, l))/g;
166 for (
label j=l; j<Un; j++)
171 s += U_(i,
k)*V_(
k, j);
176 V_(
k, j) +=
s*V_(
k, i);
181 for (
label j=l; j<Un;j++)
183 V_(i, j) = V_(j, i) = 0;
192 for (
label i=
min(Un, Um) - 1; i>=0; i--)
197 for (
label j=l; j<Un; j++)
206 for (
label j=l; j<Un; j++)
211 s += U_(
k, i)*U_(
k, j);
214 scalar
f = (
s/U_(i, i))*g;
218 U_(
k, j) +=
f*U_(
k, i);
222 for (
label j=i; j<Um; j++)
229 for (
label j=i; j<Um; j++)
240 for (
label its = 0; its < 30; its++)
245 for (l =
k; l >= 0; l--)
249 if (l == 0 ||
mag(rv1[l]) <= anorm)
255 if (
mag(S_[mn]) <= anorm)
265 for (
label i=l; i<
k+1; i++)
282 for (
label j=0; j<Um; j++)
284 scalar
y = U_(j, mn);
286 U_(j, mn) =
y*
c + z*
s;
287 U_(j, i) = z*
c -
y*
s;
299 for (
label j=0; j<Un; j++)
301 V_(j,
k) = -V_(j,
k);
317 scalar
f = ((
y - z)*(
y + z) + (g -
h)*(g +
h))/(2*
h*
y);
319 f = ((
x - z)*(
x + z) +
h*((
y/(
f + sign(g,
f))) -
h))/
x;
323 for (
label j=l; j <= mn; j++)
339 for (
label jj = 0; jj < Un; jj++)
343 V_(jj, j) =
x*
c + z*
s;
344 V_(jj, i) = z*
c -
x*
s;
358 for (
label jj=0; jj < Um; jj++)
362 U_(jj, j) =
y*
c + z*
s;
363 U_(jj, i) = z*
c -
y*
s;
373 const scalar minS = minCondition*S_[
findMax(S_)];
static const Foam::dimensionedScalar A("A", Foam::dimPressure, 611.21)
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
label n() const
Return the number of columns.
label m() const
Return the number of rows.
scalarRectangularMatrix VSinvUt() const
Return the matrix product V S^(-1) U^T (the pseudo inverse)
SVD(const scalarRectangularMatrix &A, const scalar minCondition=0)
Construct from a rectangular Matrix.
dimensioned< Type > T() const
Return transpose.
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const dimensionedScalar c
Speed of light in a vacuum.
const dimensionedScalar h
Planck constant.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
label findMax(const ListType &, const label start=0)
Find index of max element (and larger than given element).
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Scalar sqrtSumSqr(const Scalar a, const Scalar b)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)