Go to the documentation of this file.
36 Info<<
"immersedBoundaryFvPatch::makeInvDirichletMatrices() : "
37 <<
"making immersed boundary inverse matrices"
47 "void immersedBoundaryFvPatch::makeInvDirichletMatrices()"
48 ) <<
"immersed boundary inverse least squares matrices already exist"
67 scalar maxRowSum = 0.0;
80 const labelList& interpCells = ibcc[cellI];
86 + interpProcCells.
size(),
94 "void immersedBoundaryFvPatch::makeInvDirichletMatrices()"
95 ) <<
"allPoints.size() < " << nCoeffs <<
" : "
102 for (
label i = 0; i < interpCells.
size(); i++)
108 for (
label i = 0; i < interpProcCells.
size(); i++)
113 interpProcCells[i].first()
116 interpProcCells[i].second()
177 for (
label i = 0; i <
M.n(); i++)
179 for (
label j = 0; j <
M.m(); j++)
187 for (
label i = 0; i < lsM.
n(); i++)
189 for (
label j = 0; j < lsM.
m(); j++)
193 lsM[i][j] +=
M[
k][i]*
M[
k][j];
203 for (
label i = 0; i < lsM.
n(); i++)
205 scalar curRowSum = 0.0;
207 for (
label j = 0; j < lsM.
m(); j++)
209 curRowSum += lsM[i][j];
212 if (curRowSum > maxRowSum)
214 maxRowSum = curRowSum;
218 conditionNumber[cellI] = maxRowSum;
224 for (
label i = 0; i < lsM.
n(); i++)
226 for (
label j = 0; j <
M.n(); j++)
230 curMatrix[i][j] += invLsM[i][
k]*
M[j][
k]*W[j];
240 for (
label i = 0; i < lsM.
n(); i++)
242 scalar curRowSum = 0.0;
244 for (
label j = 0; j < lsM.
m(); j++)
246 curRowSum += invLsM[i][j];
249 if (curRowSum > maxRowSum)
251 maxRowSum = curRowSum;
255 conditionNumber[cellI] *= maxRowSum;
259 "void immersedBoundaryFvPatch::"
260 "makeInvDirichletMatrices() const"
261 ) <<
"Max Dirichlet matrix condition number: "
272 Info<<
"immersedBoundaryFvPatch::makeInvNeumannMatrices() : "
273 <<
"making immersed boundary inverse least sqares matrices"
279 if (invNeumannMatricesPtr_)
281 FatalErrorIn(
"immersedBoundaryFvPatch::makeInvNeumannMatrices()")
282 <<
"immersed boundary inverse least squares matrices already exist"
297 invNeumannMatricesPtr_ =
306 scalar maxRowSum = 0.0;
312 if (mesh_.nGeometricD() == 3)
319 const labelList& interpCells = ibcc[cellI];
324 interpCells.
size() + 1
325 + interpProcCells.
size(),
332 for (
label i = 0; i < interpCells.
size(); i++)
341 for (
label i = 0; i < interpProcCells.
size(); i++)
346 interpProcCells[i].first()
349 interpProcCells[i].second()
384 for (
label i = 0; i < interpCells.
size(); i++)
386 scalar X =
allPoints[pointID].x() - origin.
x();
393 M[pointID][4] =
sqr(X);
394 M[pointID][5] =
sqr(
Y);
396 if (mesh_.nGeometricD() == 3)
398 scalar Z =
allPoints[pointID].z() - origin.
z();
403 M[pointID][9] =
sqr(Z);
409 scalar X =
allPoints[pointID].x() - origin.
x();
413 M[pointID][1] = -ibn[cellI].x();
414 M[pointID][2] = -ibn[cellI].y();
420 M[pointID][4] = -2*ibn[cellI].x()*X;
421 M[pointID][5] = -2*ibn[cellI].y()*
Y;
423 if (mesh_.nGeometricD() == 3)
425 scalar Z =
allPoints[pointID].z() - origin.
z();
427 M[pointID][6] = -ibn[cellI].z();
438 M[pointID][9] = -2*ibn[cellI].z()*Z;
443 for(
label i = 0; i < interpProcCells.
size(); i++)
445 scalar X =
allPoints[pointID].x() - origin.
x();
452 M[pointID][4] =
sqr(X);
453 M[pointID][5] =
sqr(
Y);
455 if (mesh_.nGeometricD() == 3)
457 scalar Z =
allPoints[pointID].z() - origin.
z();
462 M[pointID][9] =
sqr(Z);
468 for (
label i = 0; i <
M.n(); i++)
470 for (
label j = 0; j <
M.m(); j++)
478 for (
label i = 0; i < lsM.
n(); i++)
480 for (
label j = 0; j < lsM.
m(); j++)
484 lsM[i][j] +=
M[
k][i]*
M[
k][j];
494 for (
label i = 0; i < lsM.
n(); i++)
496 scalar curRowSum = 0.0;
498 for (
label j = 0; j < lsM.
m(); j++)
500 curRowSum += lsM[i][j];
503 if (curRowSum > maxRowSum)
505 maxRowSum = curRowSum;
509 conditionNumber[cellI] = maxRowSum;
515 for (
label i = 0; i < lsM.
n(); i++)
517 for (
label j = 0; j <
M.n(); j++)
521 curMatrix[i][j] += invLsM[i][
k]*
M[j][
k]*W[j];
531 for (
label i = 0; i < lsM.
n(); i++)
533 scalar curRowSum = 0.0;
535 for (
label j = 0; j < lsM.
m(); j++)
537 curRowSum += invLsM[i][j];
540 if (curRowSum > maxRowSum)
542 maxRowSum = curRowSum;
546 conditionNumber[cellI] *= maxRowSum;
548 if (conditionNumber[cellI] > 1e6)
553 Info<<
"Condition = " << conditionNumber[cellI] <<
nl
554 <<
"cell cells: " << CC
561 "void immersedBoundaryFvPatch::makeInvNeumannMatrices() const"
562 ) <<
"Max Neumann matrix condition number: "
572 if (!invDirichletMatricesPtr_)
574 makeInvDirichletMatrices();
577 return *invDirichletMatricesPtr_;
584 if (!invNeumannMatricesPtr_)
586 makeInvNeumannMatrices();
589 return *invNeumannMatricesPtr_;
label m() const
Return the number of columns.
#define InfoIn(functionName)
Report a information message using Foam::Info.
#define forAll(list, i)
Loop across all elements in list.
const List< List< labelPair > > & ibCellProcCells() const
Return neighbour cell addressing.
label nGeometricD() const
Return the number of valid geometric dimensions in the mesh.
const fvMesh & mesh_
Finite volume mesh reference.
const PtrList< scalarRectangularMatrix > & invNeumannMatrices() const
Get inverse Neumann interpolation matrix.
PtrList< scalarRectangularMatrix > * invDirichletMatricesPtr_
Inverse interpolation matrices for Dirichlet BC at the IB.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
label n() const
Return the number of rows.
bool set(const label) const
Is element set.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
const labelList & ibCells() const
Return list of fluid cells next to immersed boundary (IB cells)
InternalField & internalField()
Return internal field.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void makeInvDirichletMatrices() const
Make inverse Dirichlet interpolation matrices.
errorManip< error > abort(error &err)
void makeInvNeumannMatrices() const
Make inverse Neumann interpolation matrices.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const labelListList & ibCellCells() const
Return IB cell extended stencil.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const volVectorField & C() const
Return cell centres as volVectorField.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label k
Boltzmann constant.
const vectorField & ibPoints() const
Return IB points.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Graphite solid properties.
Type gMax(const FieldField< Field, Type > &f)
PtrList< volScalarField > & Y
const FieldField< Field, vector > & ibProcCentres() const
Return neighbour proc centres.
const PtrList< scalarRectangularMatrix > & invDirichletMatrices() const
Get inverse Dirichlet interpolation matrix.
dimensionedScalar cos(const dimensionedScalar &ds)