49 <<
"addressing (" << addr.
size()
50 <<
") and field (" << pf.
size() <<
") are different sizes" 56 intf[addr[faceI]] += pf[faceI];
66 const tmp<Field<Type2>>& tpf,
70 addToInternalField(addr, tpf(), intf);
87 <<
"addressing (" << addr.
size()
88 <<
") and field (" << pf.
size() <<
") are different sizes" 94 intf[addr[faceI]] -= pf[faceI];
100 template<
class Type2>
104 const tmp<Field<Type2>>& tpf,
108 subtractFromInternalField(addr, tpf(), intf);
120 forAll(internalCoeffs_, patchI)
124 lduAddr().patchAddr(patchI),
125 internalCoeffs_[patchI].
component(solveCmpt),
135 forAll(internalCoeffs_, patchI)
139 lduAddr().patchAddr(patchI),
140 cmptAv(internalCoeffs_[patchI]),
154 forAll(psi_.boundaryField(), patchI)
156 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
157 const Field<Type>& pbc = boundaryCoeffs_[patchI];
161 addToInternalField(lduAddr().patchAddr(patchI), pbc, source);
165 tmp<Field<Type>> tpnf = ptf.patchNeighbourField();
166 const Field<Type>& pnf = tpnf();
168 const labelUList& addr = lduAddr().patchAddr(patchI);
172 source[addr[facei]] +=
cmptMultiply(pbc[facei], pnf[facei]);
196 <<
"constructing faMatrix<Type> for field " << psi_.
name()
218 const label currentStatePsi = psiRef.
eventNo();
219 psiRef.boundaryFieldRef().updateCoeffs();
220 psiRef.eventNo() = currentStatePsi;
229 dimensions_(
fam.dimensions_),
230 source_(
fam.source_),
231 internalCoeffs_(
fam.internalCoeffs_),
232 boundaryCoeffs_(
fam.boundaryCoeffs_)
235 <<
"Copying faMatrix<Type> for field " << psi_.
name() <<
endl;
237 if (
fam.faceFluxCorrectionPtr_)
239 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
241 *(
fam.faceFluxCorrectionPtr_)
250 lduMatrix(tmat.constCast(), tmat.movable()),
252 dimensions_(tmat().dimensions_),
253 source_(tmat.constCast().source_, tmat.movable()),
254 internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
255 boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable())
258 <<
"Copy/Move faMatrix<Type> for field " << psi_.
name() <<
endl;
260 if (tmat().faceFluxCorrectionPtr_)
264 faceFluxCorrectionPtr_ =
265 std::move(tmat.constCast().faceFluxCorrectionPtr_);
267 else if (tmat().faceFluxCorrectionPtr_)
269 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
271 *(tmat().faceFluxCorrectionPtr_)
286 <<
"Destroying faMatrix<Type> for field " << psi_.name() <<
endl;
293 template<
template<
class>
class ListType>
297 const ListType<Type>&
values 304 this->eliminatedEqns().insert(i);
323 if (symmetric() || asymmetric())
328 const Type& value =
values[i];
330 for (
const label edgei : edges[facei])
332 if (
mesh.isInternalEdge(edgei))
336 if (facei == own[edgei])
338 source_[nei[edgei]] -=
upper()[edgei]*value;
342 source_[own[edgei]] -=
upper()[edgei]*value;
345 upper()[edgei] = 0.0;
349 if (facei == own[edgei])
351 source_[nei[edgei]] -=
lower()[edgei]*value;
355 source_[own[edgei]] -=
upper()[edgei]*value;
358 upper()[edgei] = 0.0;
359 lower()[edgei] = 0.0;
366 if (internalCoeffs_[patchi].size())
368 const label patchEdgei =
371 internalCoeffs_[patchi][patchEdgei] =
Zero;
372 boundaryCoeffs_[patchi][patchEdgei] =
Zero;
384 const Type& value =
values[i];
387 source_[facei] = value*Diag[facei];
430 const bool forceReference
433 if ((forceReference || psi_.needReference()) && facei >= 0)
437 source()[facei] +=
diag()[facei]*value;
449 const bool forceReference
452 if (forceReference || psi_.needReference())
471 const UList<Type>&
values,
472 const bool forceReference
475 if (forceReference || psi_.needReference())
498 Field<Type>& S = source();
506 sumMagOffDiag(sumOff);
509 forAll(psi_.boundaryField(), patchI)
511 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
515 const labelUList& pa = lduAddr().patchAddr(patchI);
516 Field<Type>& iCoeffs = internalCoeffs_[patchI];
520 const Field<Type>& pCoeffs = boundaryCoeffs_[patchI];
538 Type iCoeff0 = iCoeffs[face];
539 iCoeffs[face] =
cmptMag(iCoeffs[face]);
540 sumOff[pa[face]] -=
cmptMin(iCoeffs[face]);
541 iCoeffs[face] /=
alpha;
556 forAll(psi_.boundaryField(), patchI)
558 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
562 const labelUList& pa = lduAddr().patchAddr(patchI);
563 Field<Type>& iCoeffs = internalCoeffs_[patchI];
576 S += (
D - D0)*psi_.primitiveField();
583 scalar relaxCoeff = 0;
585 if (psi_.mesh().relaxEquation(psi_.name(), relaxCoeff))
592 <<
"No relaxation specified for field " << psi_.name() <<
nl;
601 addCmptAvBoundaryDiag(tdiag.ref());
611 "A(" + psi_.name() +
')',
613 dimensions_/psi_.dimensions()/
dimArea,
617 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().S();
618 tAphi.ref().correctBoundaryConditions();
630 "H(" + psi_.name() +
')',
635 auto& Hphi = tHphi.ref();
640 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
643 addBoundaryDiag(boundaryDiagCmpt, cmpt);
644 boundaryDiagCmpt.negate();
645 addCmptAvBoundaryDiag(boundaryDiagCmpt);
664 if (!psi_.mesh().fluxRequired(psi_.name()))
667 <<
"flux requested but " << psi_.name()
668 <<
" not specified in the fluxRequired sub-dictionary of faSchemes" 674 "flux(" + psi_.name() +
')',
678 auto& fieldFlux = tfieldFlux.ref();
682 fieldFlux.primitiveFieldRef().replace
689 FieldField<Field, Type> InternalContrib = internalCoeffs_;
691 forAll(InternalContrib, patchI)
693 InternalContrib[patchI] =
696 InternalContrib[patchI],
697 psi_.boundaryField()[patchI].patchInternalField()
701 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
703 forAll(NeighbourContrib, patchI)
705 if (psi_.boundaryField()[patchI].coupled())
707 NeighbourContrib[patchI] =
710 NeighbourContrib[patchI],
711 psi_.boundaryField()[patchI].patchNeighbourField()
716 forAll(fieldFlux.boundaryField(), patchI)
718 fieldFlux.boundaryFieldRef()[patchI] =
719 InternalContrib[patchI] - NeighbourContrib[patchI];
722 if (faceFluxCorrectionPtr_)
724 fieldFlux += *faceFluxCorrectionPtr_;
737 return psi_.mesh().solverDict(
name);
744 return psi_.mesh().solverDict
761 if (&psi_ != &(famv.psi_))
764 <<
"different fields" 769 source_ = famv.source_;
770 internalCoeffs_ = famv.internalCoeffs_;
771 boundaryCoeffs_ = famv.boundaryCoeffs_;
773 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
775 *faceFluxCorrectionPtr_ = *famv.faceFluxCorrectionPtr_;
777 else if (famv.faceFluxCorrectionPtr_)
779 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
781 *famv.faceFluxCorrectionPtr_
800 internalCoeffs_.negate();
801 boundaryCoeffs_.negate();
803 if (faceFluxCorrectionPtr_)
805 faceFluxCorrectionPtr_->negate();
815 dimensions_ += famv.dimensions_;
817 source_ += famv.source_;
818 internalCoeffs_ += famv.internalCoeffs_;
819 boundaryCoeffs_ += famv.boundaryCoeffs_;
821 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
823 *faceFluxCorrectionPtr_ += *famv.faceFluxCorrectionPtr_;
825 else if (famv.faceFluxCorrectionPtr_)
827 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
829 *famv.faceFluxCorrectionPtr_
848 dimensions_ -= famv.dimensions_;
850 source_ -= famv.source_;
851 internalCoeffs_ -= famv.internalCoeffs_;
852 boundaryCoeffs_ -= famv.boundaryCoeffs_;
854 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
856 *faceFluxCorrectionPtr_ -= *famv.faceFluxCorrectionPtr_;
858 else if (famv.faceFluxCorrectionPtr_)
860 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
862 -*famv.faceFluxCorrectionPtr_
883 source() -= su.mesh().S()*su.field();
916 source() += su.mesh().S()*su.field();
948 source() -=
psi().
mesh().S()*su;
958 source() +=
psi().
mesh().S()*su;
968 dimensions_ *= dsf.dimensions();
970 source_ *= dsf.field();
972 forAll(boundaryCoeffs_, patchi)
976 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
978 internalCoeffs_[patchi] *= pisf;
979 boundaryCoeffs_[patchi] *= pisf;
982 if (faceFluxCorrectionPtr_)
985 <<
"cannot scale a matrix containing a faceFluxCorrection" 994 const tmp<areaScalarField::Internal>& tfld
1002 template<
class Type>
1013 template<
class Type>
1019 dimensions_ *= ds.dimensions();
1021 source_ *= ds.value();
1022 internalCoeffs_ *= ds.value();
1023 boundaryCoeffs_ *= ds.value();
1025 if (faceFluxCorrectionPtr_)
1027 *faceFluxCorrectionPtr_ *= ds.value();
1034 template<
class Type>
1037 const faMatrix<Type>& mat1,
1038 const faMatrix<Type>& mat2,
1042 if (&mat1.psi() != &mat2.psi())
1045 <<
"Incompatible fields for operation\n " 1046 <<
"[" << mat1.psi().name() <<
"] " 1048 <<
" [" << mat2.psi().name() <<
"]" 1055 && mat1.dimensions() != mat2.dimensions()
1059 <<
"Incompatible dimensions for operation\n " 1060 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimArea <<
" ] " 1062 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimArea <<
" ]" 1068 template<
class Type>
1071 const faMatrix<Type>& mat,
1072 const DimensionedField<Type, areaMesh>&
fld,
1079 && mat.dimensions()/
dimArea !=
fld.dimensions()
1083 <<
"Incompatible dimensions for operation\n " 1084 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1086 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1092 template<
class Type>
1095 const faMatrix<Type>& mat,
1096 const dimensioned<Type>& dt,
1103 && mat.dimensions()/
dimArea != dt.dimensions()
1107 <<
"Incompatible dimensions for operation\n " 1108 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1110 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1116 template<
class Type>
1119 faMatrix<Type>& mat,
1123 return mat.solve(solverControls);
1127 template<
class Type>
1130 const tmp<faMatrix<Type>>& tmat,
1134 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1142 template<
class Type>
1145 faMatrix<Type>& mat,
1149 return mat.solve(
name);
1153 template<
class Type>
1156 const tmp<faMatrix<Type>>& tmat,
1160 SolverPerformance<Type> solverPerf(tmat.constCast().solve(
name));
1168 template<
class Type>
1175 template<
class Type>
1178 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1188 template<
class Type>
1191 const faMatrix<Type>&
A,
1192 const faMatrix<Type>&
B 1196 auto tC = tmp<faMatrix<Type>>
::New(
A);
1202 template<
class Type>
1205 const tmp<faMatrix<Type>>& tA,
1206 const faMatrix<Type>&
B 1210 tmp<faMatrix<Type>> tC(tA.
ptr());
1216 template<
class Type>
1219 const faMatrix<Type>&
A,
1220 const tmp<faMatrix<Type>>& tB
1224 tmp<faMatrix<Type>> tC(tB.ptr());
1230 template<
class Type>
1233 const tmp<faMatrix<Type>>& tA,
1234 const tmp<faMatrix<Type>>& tB
1238 tmp<faMatrix<Type>> tC(tA.
ptr());
1245 template<
class Type>
1248 const faMatrix<Type>&
A 1251 auto tC = tmp<faMatrix<Type>>
::New(
A);
1257 template<
class Type>
1260 const tmp<faMatrix<Type>>& tA
1263 tmp<faMatrix<Type>> tC(tA.
ptr());
1269 template<
class Type>
1272 const faMatrix<Type>&
A,
1273 const faMatrix<Type>&
B 1277 auto tC = tmp<faMatrix<Type>>
::New(
A);
1283 template<
class Type>
1286 const tmp<faMatrix<Type>>& tA,
1287 const faMatrix<Type>&
B 1291 tmp<faMatrix<Type>> tC(tA.
ptr());
1297 template<
class Type>
1300 const faMatrix<Type>&
A,
1301 const tmp<faMatrix<Type>>& tB
1305 tmp<faMatrix<Type>> tC(tB.ptr());
1312 template<
class Type>
1315 const tmp<faMatrix<Type>>& tA,
1316 const tmp<faMatrix<Type>>& tB
1320 tmp<faMatrix<Type>> tC(tA.
ptr());
1327 template<
class Type>
1330 const faMatrix<Type>&
A,
1331 const faMatrix<Type>&
B 1339 template<
class Type>
1342 const tmp<faMatrix<Type>>& tA,
1343 const faMatrix<Type>&
B 1351 template<
class Type>
1354 const faMatrix<Type>&
A,
1355 const tmp<faMatrix<Type>>& tB
1363 template<
class Type>
1366 const tmp<faMatrix<Type>>& tA,
1367 const tmp<faMatrix<Type>>& tB
1375 template<
class Type>
1378 const faMatrix<Type>&
A,
1379 const DimensionedField<Type, areaMesh>& su
1384 tC.ref().source() -= su.mesh().S()*su.field();
1389 template<
class Type>
1392 const faMatrix<Type>&
A,
1393 const tmp<DimensionedField<Type, areaMesh>>& tsu
1398 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1404 template<
class Type>
1407 const faMatrix<Type>&
A,
1408 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1413 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1419 template<
class Type>
1422 const tmp<faMatrix<Type>>& tA,
1423 const DimensionedField<Type, areaMesh>& su
1427 tmp<faMatrix<Type>> tC(tA.
ptr());
1428 tC.ref().source() -= su.mesh().S()*su.field();
1433 template<
class Type>
1436 const tmp<faMatrix<Type>>& tA,
1437 const tmp<DimensionedField<Type, areaMesh>>& tsu
1441 tmp<faMatrix<Type>> tC(tA.
ptr());
1442 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1448 template<
class Type>
1451 const tmp<faMatrix<Type>>& tA,
1452 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1456 tmp<faMatrix<Type>> tC(tA.
ptr());
1457 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1463 template<
class Type>
1466 const DimensionedField<Type, areaMesh>& su,
1467 const faMatrix<Type>&
A 1472 tC.ref().source() -= su.mesh().S()*su.field();
1477 template<
class Type>
1480 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1481 const faMatrix<Type>&
A 1486 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1492 template<
class Type>
1495 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1496 const faMatrix<Type>&
A 1501 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1507 template<
class Type>
1510 const DimensionedField<Type, areaMesh>& su,
1511 const tmp<faMatrix<Type>>& tA
1515 tmp<faMatrix<Type>> tC(tA.
ptr());
1516 tC.ref().source() -= su.mesh().S()*su.field();
1521 template<
class Type>
1524 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1525 const tmp<faMatrix<Type>>& tA
1529 tmp<faMatrix<Type>> tC(tA.
ptr());
1530 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1536 template<
class Type>
1539 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1540 const tmp<faMatrix<Type>>& tA
1544 tmp<faMatrix<Type>> tC(tA.
ptr());
1545 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1551 template<
class Type>
1554 const faMatrix<Type>&
A,
1555 const DimensionedField<Type, areaMesh>& su
1560 tC.ref().source() += su.mesh().S()*su.field();
1565 template<
class Type>
1568 const faMatrix<Type>&
A,
1569 const tmp<DimensionedField<Type, areaMesh>>& tsu
1574 tC.ref().source() += tsu().mesh().S()*tsu().field();
1580 template<
class Type>
1583 const faMatrix<Type>&
A,
1584 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1589 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1595 template<
class Type>
1598 const tmp<faMatrix<Type>>& tA,
1599 const DimensionedField<Type, areaMesh>& su
1603 tmp<faMatrix<Type>> tC(tA.
ptr());
1604 tC.ref().source() += su.mesh().S()*su.field();
1609 template<
class Type>
1612 const tmp<faMatrix<Type>>& tA,
1613 const tmp<DimensionedField<Type, areaMesh>>& tsu
1617 tmp<faMatrix<Type>> tC(tA.
ptr());
1618 tC.ref().source() += tsu().mesh().S()*tsu().field();
1624 template<
class Type>
1627 const tmp<faMatrix<Type>>& tA,
1628 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1632 tmp<faMatrix<Type>> tC(tA.
ptr());
1633 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1639 template<
class Type>
1642 const DimensionedField<Type, areaMesh>& su,
1643 const faMatrix<Type>&
A 1649 tC.ref().source() -= su.mesh().S()*su.field();
1654 template<
class Type>
1657 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1658 const faMatrix<Type>&
A 1664 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1670 template<
class Type>
1673 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1674 const faMatrix<Type>&
A 1680 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1686 template<
class Type>
1689 const DimensionedField<Type, areaMesh>& su,
1690 const tmp<faMatrix<Type>>& tA
1694 tmp<faMatrix<Type>> tC(tA.
ptr());
1696 tC.ref().source() -= su.mesh().S()*su.field();
1701 template<
class Type>
1704 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1705 const tmp<faMatrix<Type>>& tA
1709 tmp<faMatrix<Type>> tC(tA.
ptr());
1711 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1717 template<
class Type>
1720 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1721 const tmp<faMatrix<Type>>& tA
1725 tmp<faMatrix<Type>> tC(tA.
ptr());
1727 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1733 template<
class Type>
1736 const faMatrix<Type>&
A,
1737 const dimensioned<Type>& su
1742 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1747 template<
class Type>
1750 const tmp<faMatrix<Type>>& tA,
1751 const dimensioned<Type>& su
1755 tmp<faMatrix<Type>> tC(tA.
ptr());
1756 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1761 template<
class Type>
1764 const dimensioned<Type>& su,
1765 const faMatrix<Type>&
A 1770 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1775 template<
class Type>
1778 const dimensioned<Type>& su,
1779 const tmp<faMatrix<Type>>& tA
1783 tmp<faMatrix<Type>> tC(tA.
ptr());
1784 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1789 template<
class Type>
1792 const faMatrix<Type>&
A,
1793 const dimensioned<Type>& su
1798 tC.ref().source() += su.value()*tC().psi().mesh().S();
1803 template<
class Type>
1806 const tmp<faMatrix<Type>>& tA,
1807 const dimensioned<Type>& su
1811 tmp<faMatrix<Type>> tC(tA.
ptr());
1812 tC.ref().source() += su.value()*tC().psi().mesh().S();
1817 template<
class Type>
1820 const dimensioned<Type>& su,
1821 const faMatrix<Type>&
A 1827 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1832 template<
class Type>
1835 const dimensioned<Type>& su,
1836 const tmp<faMatrix<Type>>& tA
1840 tmp<faMatrix<Type>> tC(tA.
ptr());
1842 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1847 template<
class Type>
1850 const faMatrix<Type>&
A,
1851 const DimensionedField<Type, areaMesh>& su
1856 tC.ref().source() += su.mesh().S()*su.field();
1861 template<
class Type>
1864 const faMatrix<Type>&
A,
1865 const tmp<DimensionedField<Type, areaMesh>>& tsu
1870 tC.ref().source() += tsu().mesh().S()*tsu().field();
1876 template<
class Type>
1879 const faMatrix<Type>&
A,
1880 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1885 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1891 template<
class Type>
1894 const tmp<faMatrix<Type>>& tA,
1895 const DimensionedField<Type, areaMesh>& su
1899 tmp<faMatrix<Type>> tC(tA.ptr());
1900 tC.ref().source() += su.mesh().S()*su.field();
1905 template<
class Type>
1908 const tmp<faMatrix<Type>>& tA,
1909 const tmp<DimensionedField<Type, areaMesh>>& tsu
1913 tmp<faMatrix<Type>> tC(tA.ptr());
1914 tC.ref().source() += tsu().mesh().S()*tsu().field();
1920 template<
class Type>
1923 const tmp<faMatrix<Type>>& tA,
1924 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1928 tmp<faMatrix<Type>> tC(tA.ptr());
1929 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1935 template<
class Type>
1938 const faMatrix<Type>&
A,
1939 const dimensioned<Type>& su
1944 tC.ref().source() +=
A.psi().mesh().S()*su.value();
1949 template<
class Type>
1952 const tmp<faMatrix<Type>>& tA,
1953 const dimensioned<Type>& su
1957 tmp<faMatrix<Type>> tC(tA.ptr());
1958 tC.ref().source() += tC().psi().mesh().S()*su.value();
1963 template<
class Type>
1966 const faMatrix<Type>&
A,
1974 template<
class Type>
1977 const tmp<faMatrix<Type>>& tA,
1985 template<
class Type>
1989 const faMatrix<Type>&
A 1998 template<
class Type>
2001 const tmp<areaScalarField::Internal>& tdsf,
2002 const faMatrix<Type>&
A 2011 template<
class Type>
2014 const tmp<areaScalarField>& tvsf,
2015 const faMatrix<Type>&
A 2024 template<
class Type>
2028 const tmp<faMatrix<Type>>& tA
2031 tmp<faMatrix<Type>> tC(tA.ptr());
2037 template<
class Type>
2040 const tmp<areaScalarField::Internal>& tdsf,
2041 const tmp<faMatrix<Type>>& tA
2044 tmp<faMatrix<Type>> tC(tA.ptr());
2050 template<
class Type>
2053 const tmp<areaScalarField>& tvsf,
2054 const tmp<faMatrix<Type>>& tA
2057 tmp<faMatrix<Type>> tC(tA.ptr());
2063 template<
class Type>
2066 const dimensioned<scalar>& ds,
2067 const faMatrix<Type>&
A 2076 template<
class Type>
2079 const dimensioned<scalar>& ds,
2080 const tmp<faMatrix<Type>>& tA
2083 tmp<faMatrix<Type>> tC(tA.ptr());
2089 template<
class Type>
2093 const faMatrix<Type>&
M,
2094 const DimensionedField<Type, areaMesh>&
psi 2104 auto& Mphi = tMphi.ref();
2113 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2114 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2119 Mphi.primitiveFieldRef() =
Zero;
2122 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2123 M.addBoundarySource(Mphi.primitiveFieldRef());
2125 Mphi.primitiveFieldRef() /= -
psi.
mesh().S();
2126 Mphi.correctBoundaryConditions();
2132 template<
class Type>
2136 const faMatrix<Type>&
M,
2137 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2140 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2146 template<
class Type>
2150 const faMatrix<Type>&
M,
2151 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2154 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2160 template<
class Type>
2164 const tmp<faMatrix<Type>>& tM,
2165 const DimensionedField<Type, areaMesh>&
psi 2168 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() &
psi;
2174 template<
class Type>
2178 const tmp<faMatrix<Type>>& tM,
2179 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2182 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2189 template<
class Type>
2193 const tmp<faMatrix<Type>>& tM,
2194 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2197 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2206 template<
class Type>
2209 os << static_cast<const lduMatrix&>(
fam) <<
nl 2210 <<
fam.dimensions_ <<
nl 2211 <<
fam.source_ <<
nl 2212 <<
fam.internalCoeffs_ <<
nl 2213 <<
fam.boundaryCoeffs_ <<
endl;
void negate()
Inplace negate.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
void setValues(const labelUList &faceLabels, const Type &value)
Set solution in given faces to the specified value and eliminate the corresponding equations from the...
void operator-=(const faMatrix< Type > &)
tmp< Field< Type > > faceH(const Field< Type > &) const
tmp< scalarField > D() const
Return the matrix diagonal.
void size(const label n)
Older name for setAddressableSize.
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &f1)
void operator+=(const faMatrix< Type > &)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dictionary & solverDict() const
Return the solver dictionary for psi.
faMatrix(const GeometricField< Type, faPatchField, areaMesh > &psi, const dimensionSet &ds)
Construct given a field to solve for.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const labelListList & faceEdges() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
const word & name() const noexcept
Return the object name.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
label eventNo() const noexcept
Event number at last update.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
void setReferences(const labelUList &faceLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
Generic GeometricField class.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Generic dimensioned Type class.
labelList faceLabels(nFaceLabels)
DimensionedField< scalar, areaMesh > Internal
The internal field type from which this GeometricField is derived.
void addBoundarySource(Field< Type > &source, const bool couples=true) const
UList< label > labelUList
A UList of labels.
const labelUList & neighbour() const
Internal face neighbour.
#define forAll(list, i)
Loop across all elements in list.
tmp< GeometricField< Type, faePatchField, edgeMesh > > flux() const
Return the face-flux field from the matrix.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void relax()
Relax matrix (for steady-state solution).
void operator=(const faMatrix< Type > &)
Generic templated field type.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define DebugInFunction
Report an information message using Foam::Info.
void checkMethod(const faMatrix< Type > &, const faMatrix< Type > &, const char *)
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
tmp< GeometricField< Type, faPatchField, areaMesh > > H() const
Return the H operation source.
errorManip< error > abort(error &err)
void setValuesFromList(const labelUList &faceLabels, const ListType< Type > &values)
Set solution in given faces to the specified values.
void operator=(const lduMatrix &)
Copy assignment.
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
static tmp< GeometricField< scalar, faPatchField, areaMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=faPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void operator*=(const scalarField &)
this_type & constCast() const noexcept
Return non-const reference to this field.
OBJstream os(runTime.globalPath()/outputName)
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
tmp< areaScalarField > A() const
Return the central coefficient.
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
void setReference(const label facei, const Type &value, const bool forceReference=false)
Set reference level for solution.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Finite-Area matrix basic solvers.
static bool checking() noexcept
True if dimension checking is enabled (the usual default)
A List with indirect addressing. Like IndirectList but does not store addressing. ...
const Field< Type > & field() const noexcept
Return const-reference to the primitive field values.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Mesh & mesh() const noexcept
Return const reference to mesh.
A special matrix type and solver, designed for finite area solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
void correctBoundaryConditions()
Correct boundary field.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const GeometricField< Type, faPatchField, areaMesh > & psi() const
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
const volScalarField & psi
tmp< Field< Type > > H(const Field< Type > &) const
const dimensionedScalar & D
void operator-=(const lduMatrix &)
void addCmptAvBoundaryDiag(scalarField &diag) const
void operator+=(const lduMatrix &)
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing temporary objects.
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Calculate the matrix for the second temporal derivative.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
const dimensionSet dimArea(sqr(dimLength))
static constexpr const zero Zero
Global zero (0)
virtual ~faMatrix()
Destructor.