38 VSinvUt_(A.m(), A.
n()),
53 for (
label i = 0; i < Um; i++)
63 scale +=
mag(U_[
k][i]);
71 s += U_[
k][i]*U_[
k][i];
79 for (
label j = l-1; j < Um; j++)
84 s += U_[
k][i]*U_[
k][j];
90 U_[
k][j] += f*U_[
k][i];
105 if (i+1 <= Un && i != Um)
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 < Un; 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]));
153 for (
label i = Um-1; i >= 0; i--)
159 for (
label j = l; j < Um; j++)
161 V_[j][i] = (U_[i][j]/U_[i][l])/g;
164 for (
label j=l; j < Um; j++)
169 s += U_[i][
k]*V_[
k][j];
174 V_[
k][j] += s*V_[
k][i];
179 for (
label j = l; j < Um;j++)
181 V_[i][j] = V_[j][i] = 0.0;
190 for (
label i =
min(Um, Un) - 1; i >= 0; i--)
195 for (
label j = l; j < Um; j++)
204 for (
label j = l; j < Um; j++)
209 s += U_[
k][i]*U_[
k][j];
212 scalar
f = (s/U_[i][i])*g;
216 U_[
k][j] += f*U_[
k][i];
220 for (
label j = i; j < Un; j++)
227 for (
label j = i; j < Un; j++)
238 for (
label its = 0; its < 35; its++)
243 for (l =
k; l >= 0; l--)
246 if (
mag(rv1[l]) + anorm == anorm)
251 if (
mag(S_[nm]) + anorm == anorm)
break;
258 for (
label i = l; i <
k+1; i++)
263 if (
mag(f) + anorm == anorm)
break;
272 for (
label j = 0; j < Un; j++)
274 scalar
y = U_[j][nm];
276 U_[j][nm] = y*c + z*
s;
277 U_[j][i] = z*c - y*
s;
290 for (
label j = 0; j < Um; j++) V_[j][
k] = -V_[j][
k];
299 "(scalarRectangularMatrix& A, const scalar minCondition)" 300 ) <<
"no convergence in 35 SVD iterations" 309 scalar
f = ((y - z)*(y + z) + (g -
h)*(g + h))/(2.0*h*y);
311 f = ((x - z)*(x + z) + h*((y/(f + sign(g, f))) -
h))/
x;
315 for (
label j = l; j <= nm; j++)
331 for (
label jj = 0; jj < Um; jj++)
335 V_[jj][j] = x*c + z*
s;
336 V_[jj][i] = z*c - x*
s;
350 for (
label jj=0; jj < Un; jj++)
354 U_[jj][j] = y*c + z*
s;
355 U_[jj][i] = z*c - y*
s;
365 const scalar minS = minCondition*S_[
findMax(S_)];
dimensionedScalar sqrt(const dimensionedScalar &ds)
Scalar sqrtSumSqr(const Scalar a, const Scalar b)
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.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
dimensioned< scalar > mag(const dimensioned< Type > &)
label n() const
Return the number of rows.
label findMax(const ListType &, const label start=0)
Find index of max element (and larger than given element).
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Various functions to operate on Lists.
Form T() const
Return the transpose of the matrix.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
label k
Boltzmann constant.
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
const dimensionedVector & g
const dimensionedScalar c
Speed of light in a vacuum.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
label m() const
Return the number of columns.
const dimensionedScalar h
Planck constant.