49 <<
"sizes of addressing and field are different"
55 intf[addr[facei]] += pf[facei];
69 addToInternalField(addr, tpf(), intf);
86 <<
"sizes of addressing and field are different"
92 intf[addr[facei]] -= pf[facei];
106 subtractFromInternalField(addr, tpf(), intf);
122 lduAddr().patchAddr(
patchi),
137 lduAddr().patchAddr(
patchi),
159 addToInternalField(lduAddr().patchAddr(
patchi), pbc, source);
170 source[addr[facei]] +=
cmptMultiply(pbc[facei], pnf[facei]);
197 source_[celli] = value*Diag[celli];
199 if (symmetric() || asymmetric())
211 if (celli == own[facei])
213 source_[nei[facei]] -= upper()[facei]*value;
217 source_[own[facei]] -= upper()[facei]*value;
220 upper()[facei] = 0.0;
224 if (celli == own[facei])
226 source_[nei[facei]] -= lower()[facei]*value;
230 source_[own[facei]] -= upper()[facei]*value;
233 upper()[facei] = 0.0;
234 lower()[facei] = 0.0;
274 *(
diag()[celli] - ddtDiag[celli]);
276 diag()[celli] += coeff;
277 source()[celli] += coeff*value;
296 faceFluxCorrectionPtr_(nullptr)
301 <<
"Constructing fvMatrix<Type> for field " << psi_.name() <<
endl;
331 const uint64_t currentStatePsi = psiRef.
eventNo();
333 psiRef.
eventNo() = currentStatePsi;
343 dimensions_(fvm.dimensions_),
344 source_(fvm.source_),
345 internalCoeffs_(fvm.internalCoeffs_),
346 boundaryCoeffs_(fvm.boundaryCoeffs_),
347 faceFluxCorrectionPtr_(nullptr)
352 <<
"Copying fvMatrix<Type> for field " << psi_.name() <<
endl;
355 if (fvm.faceFluxCorrectionPtr_)
357 faceFluxCorrectionPtr_ =
new
360 *(fvm.faceFluxCorrectionPtr_)
371 const_cast<
fvMatrix<Type>&>(tfvm()),
375 dimensions_(tfvm().dimensions_),
378 const_cast<
fvMatrix<Type>&>(tfvm()).source_,
383 const_cast<
fvMatrix<Type>&>(tfvm()).internalCoeffs_,
388 const_cast<
fvMatrix<Type>&>(tfvm()).boundaryCoeffs_,
391 faceFluxCorrectionPtr_(nullptr)
396 <<
"Copying fvMatrix<Type> for field " << psi_.name() <<
endl;
399 if (tfvm().faceFluxCorrectionPtr_)
403 faceFluxCorrectionPtr_ = tfvm().faceFluxCorrectionPtr_;
404 tfvm().faceFluxCorrectionPtr_ =
nullptr;
408 faceFluxCorrectionPtr_ =
new
411 *(tfvm().faceFluxCorrectionPtr_)
433 faceFluxCorrectionPtr_(nullptr)
438 <<
"Constructing fvMatrix<Type> for field " << psi_.name() <<
endl;
486 <<
"Destroying fvMatrix<Type> for field " << psi_.name() <<
endl;
489 if (faceFluxCorrectionPtr_)
491 delete faceFluxCorrectionPtr_;
499 template<
template<
class>
class ListType>
503 const ListType<Type>& values
509 setValue(cellLabels[i], values[i]);
515 template<
template<
class>
class ListType>
519 const ListType<Type>& values,
526 const scalar
alpha = relaxationFactor();
536 ddtDiag += ddtEqn.
diag();
549 setValue(cellLabels[i], values[i]);
554 setValue(cellLabels[i], values[i],
fractions[i], ddtDiag);
565 const bool forceReference
568 if ((forceReference || psi_.needReference()) && celli >= 0)
570 source()[celli] +=
diag()[celli]*value;
582 && psi_.mesh().solution().relaxEquation(psi_.name() +
"Final")
585 return psi_.mesh().solution().equationRelaxationFactor
587 psi_.name() +
"Final"
590 else if (psi_.mesh().solution().relaxEquation(psi_.name()))
592 return psi_.mesh().solution().equationRelaxationFactor(psi_.name());
612 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
623 sumMagOffDiag(sumOff);
668 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
673 maxNon =
max(maxNon, d);
702 <<
"Matrix dominance test for " << psi_.name() <<
nl
703 <<
" number of non-dominant cells : " << nNon <<
nl
704 <<
" maximum relative non-dominance : " << maxNon <<
nl
705 <<
" average relative non-dominance : " << sumNon <<
nl
714 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
748 S += (
D - D0)*psi_.primitiveField();
755 relax(relaxationFactor());
768 bFields[
patchi].manipulateMatrix(*
this);
777 addCmptAvBoundaryDiag(tdiag.
ref());
795 lduAddr().patchAddr(
patchi),
813 "A(" + psi_.name() +
')',
820 tAphi.
ref().primitiveFieldRef() =
D()/psi_.mesh().V();
821 tAphi.
ref().correctBoundaryConditions();
834 "Su(" +psi_.name() +
')',
837 -source()/psi_.mesh().V()
852 "Sp(" + psi_.name() +
')',
856 ?
diag()/psi_.mesh().V()
873 "H(" + psi_.name() +
')',
882 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
884 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
887 addBoundaryDiag(boundaryDiagCmpt, cmpt);
888 boundaryDiagCmpt.
negate();
889 addCmptAvBoundaryDiag(boundaryDiagCmpt);
900 typename Type::labelType validComponents
902 psi_.mesh().template validComponents<Type>()
905 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
907 if (validComponents[cmpt] == -1)
930 dimensions_/(
dimVolume*psi_.dimensions()),
946 lduAddr().patchAddr(
patchi),
965 if (!psi_.mesh().schemes().fluxRequired(psi_.name()))
968 <<
"flux requested but " << psi_.name()
969 <<
" not specified in the fluxRequired sub-dictionary"
979 "flux(" + psi_.name() +
')',
987 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
1000 InternalContrib[
patchi] =
1004 psi_.boundaryField()[
patchi].patchInternalField()
1012 if (psi_.boundaryField()[
patchi].coupled())
1014 NeighbourContrib[
patchi] =
1017 NeighbourContrib[
patchi],
1018 psi_.boundaryField()[
patchi].patchNeighbourField()
1031 if (faceFluxCorrectionPtr_)
1033 fieldFlux += *faceFluxCorrectionPtr_;
1042 template<
class Type>
1048 <<
"attempted assignment to self"
1052 if (&psi_ != &(fvmv.psi_))
1055 <<
"different fields"
1059 dimensions_ = fvmv.dimensions_;
1061 source_ = fvmv.source_;
1062 internalCoeffs_ = fvmv.internalCoeffs_;
1063 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1065 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1067 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1069 else if (fvmv.faceFluxCorrectionPtr_)
1071 faceFluxCorrectionPtr_ =
1073 (*fvmv.faceFluxCorrectionPtr_);
1078 template<
class Type>
1086 template<
class Type>
1091 internalCoeffs_.negate();
1092 boundaryCoeffs_.negate();
1094 if (faceFluxCorrectionPtr_)
1096 faceFluxCorrectionPtr_->negate();
1101 template<
class Type>
1106 dimensions_ += fvmv.dimensions_;
1108 source_ += fvmv.source_;
1109 internalCoeffs_ += fvmv.internalCoeffs_;
1110 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1112 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1114 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1116 else if (fvmv.faceFluxCorrectionPtr_)
1118 faceFluxCorrectionPtr_ =
new
1121 *fvmv.faceFluxCorrectionPtr_
1127 template<
class Type>
1135 template<
class Type>
1140 dimensions_ -= fvmv.dimensions_;
1142 source_ -= fvmv.source_;
1143 internalCoeffs_ -= fvmv.internalCoeffs_;
1144 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1146 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1148 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1150 else if (fvmv.faceFluxCorrectionPtr_)
1152 faceFluxCorrectionPtr_ =
1154 (-*fvmv.faceFluxCorrectionPtr_);
1159 template<
class Type>
1167 template<
class Type>
1174 source() -= su.mesh().V()*su.primitiveField();
1178 template<
class Type>
1189 template<
class Type>
1200 template<
class Type>
1207 source() += su.mesh().V()*su.primitiveField();
1211 template<
class Type>
1222 template<
class Type>
1233 template<
class Type>
1239 source() -=
psi().
mesh().V()*su;
1243 template<
class Type>
1249 source() +=
psi().
mesh().V()*su;
1253 template<
class Type>
1261 template<
class Type>
1269 template<
class Type>
1275 dimensions_ *= dsf.dimensions();
1277 source_ *= dsf.primitiveField();
1283 dsf.mesh().boundary()[
patchi].patchInternalField
1285 dsf.primitiveField()
1289 internalCoeffs_[
patchi] *= pisf;
1290 boundaryCoeffs_[
patchi] *= pisf;
1293 if (faceFluxCorrectionPtr_)
1296 <<
"cannot scale a matrix containing a faceFluxCorrection"
1302 template<
class Type>
1313 template<
class Type>
1324 template<
class Type>
1330 dimensions_ *= ds.dimensions();
1332 source_ *= ds.value();
1333 internalCoeffs_ *= ds.value();
1334 boundaryCoeffs_ *= ds.value();
1336 if (faceFluxCorrectionPtr_)
1338 *faceFluxCorrectionPtr_ *= ds.value();
1343 template<
class Type>
1349 dimensions_ /= dsf.dimensions();
1351 source_ /= dsf.primitiveField();
1357 dsf.mesh().boundary()[
patchi].patchInternalField
1359 dsf.primitiveField()
1363 internalCoeffs_[
patchi] /= pisf;
1364 boundaryCoeffs_[
patchi] /= pisf;
1367 if (faceFluxCorrectionPtr_)
1370 <<
"cannot scale a matrix containing a faceFluxCorrection"
1376 template<
class Type>
1387 template<
class Type>
1398 template<
class Type>
1404 dimensions_ /= ds.dimensions();
1406 source_ /= ds.value();
1407 internalCoeffs_ /= ds.value();
1408 boundaryCoeffs_ /= ds.value();
1410 if (faceFluxCorrectionPtr_)
1412 *faceFluxCorrectionPtr_ /= ds.value();
1419 template<
class Type>
1427 if (&fvm1.
psi() != &fvm2.
psi())
1430 <<
"incompatible fields for operation "
1432 <<
"[" << fvm1.
psi().name() <<
"] "
1434 <<
" [" << fvm2.
psi().name() <<
"]"
1441 <<
"incompatible dimensions for operation "
1451 template<
class Type>
1471 template<
class Type>
1482 <<
"incompatible dimensions for operation "
1492 template<
class Type>
1495 const fvMatrix<Type>&
A
1498 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
1508 template<
class Type>
1511 const tmp<fvMatrix<Type>>& tA
1514 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
1526 template<
class Type>
1529 const fvMatrix<Type>&
A,
1530 const fvMatrix<Type>&
B
1537 template<
class Type>
1540 const tmp<fvMatrix<Type>>& tA,
1541 const fvMatrix<Type>&
B
1548 template<
class Type>
1551 const fvMatrix<Type>&
A,
1552 const tmp<fvMatrix<Type>>& tB
1559 template<
class Type>
1562 const tmp<fvMatrix<Type>>& tA,
1563 const tmp<fvMatrix<Type>>& tB
1570 template<
class Type>
1573 const fvMatrix<Type>&
A,
1574 const DimensionedField<Type, fvMesh>& su
1578 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1579 tC.ref().source() += su.mesh().V()*su.primitiveField();
1583 template<
class Type>
1586 const fvMatrix<Type>&
A,
1587 const tmp<DimensionedField<Type, fvMesh>>& tsu
1591 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1592 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1597 template<
class Type>
1600 const fvMatrix<Type>&
A,
1601 const tmp<VolField<Type>>& tsu
1605 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1606 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1611 template<
class Type>
1614 const tmp<fvMatrix<Type>>& tA,
1615 const DimensionedField<Type, fvMesh>& su
1619 tmp<fvMatrix<Type>> tC(tA.ptr());
1620 tC.ref().source() += su.mesh().V()*su.primitiveField();
1624 template<
class Type>
1627 const tmp<fvMatrix<Type>>& tA,
1628 const tmp<DimensionedField<Type, fvMesh>>& tsu
1632 tmp<fvMatrix<Type>> tC(tA.ptr());
1633 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1638 template<
class Type>
1641 const tmp<fvMatrix<Type>>& tA,
1642 const tmp<VolField<Type>>& tsu
1646 tmp<fvMatrix<Type>> tC(tA.ptr());
1647 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1652 template<
class Type>
1655 const fvMatrix<Type>&
A,
1656 const dimensioned<Type>& su
1660 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1661 tC.ref().source() +=
A.psi().mesh().V()*su.value();
1665 template<
class Type>
1668 const tmp<fvMatrix<Type>>& tA,
1669 const dimensioned<Type>& su
1673 tmp<fvMatrix<Type>> tC(tA.ptr());
1674 tC.ref().source() += tC().psi().mesh().V()*su.value();
1678 template<
class Type>
1681 const fvMatrix<Type>&
A,
1689 template<
class Type>
1692 const tmp<fvMatrix<Type>>& tA,
1700 template<
class Type>
1703 const fvMatrix<Type>&
A
1706 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1711 template<
class Type>
1714 const tmp<fvMatrix<Type>>& tA
1717 tmp<fvMatrix<Type>> tC(tA.ptr());
1723 template<
class Type>
1726 const fvMatrix<Type>&
A,
1727 const fvMatrix<Type>&
B
1731 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1736 template<
class Type>
1739 const tmp<fvMatrix<Type>>& tA,
1740 const fvMatrix<Type>&
B
1744 tmp<fvMatrix<Type>> tC(tA.
ptr());
1749 template<
class Type>
1752 const fvMatrix<Type>&
A,
1753 const tmp<fvMatrix<Type>>& tB
1757 tmp<fvMatrix<Type>> tC(tB.ptr());
1762 template<
class Type>
1765 const tmp<fvMatrix<Type>>& tA,
1766 const tmp<fvMatrix<Type>>& tB
1770 tmp<fvMatrix<Type>> tC(tA.
ptr());
1776 template<
class Type>
1779 const fvMatrix<Type>&
A,
1780 const DimensionedField<Type, fvMesh>& su
1784 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1785 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1789 template<
class Type>
1792 const fvMatrix<Type>&
A,
1793 const tmp<DimensionedField<Type, fvMesh>>& tsu
1797 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1798 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1803 template<
class Type>
1806 const fvMatrix<Type>&
A,
1807 const tmp<VolField<Type>>& tsu
1811 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1812 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1817 template<
class Type>
1820 const tmp<fvMatrix<Type>>& tA,
1821 const DimensionedField<Type, fvMesh>& su
1825 tmp<fvMatrix<Type>> tC(tA.
ptr());
1826 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1830 template<
class Type>
1833 const tmp<fvMatrix<Type>>& tA,
1834 const tmp<DimensionedField<Type, fvMesh>>& tsu
1838 tmp<fvMatrix<Type>> tC(tA.
ptr());
1839 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1844 template<
class Type>
1847 const tmp<fvMatrix<Type>>& tA,
1848 const tmp<VolField<Type>>& tsu
1852 tmp<fvMatrix<Type>> tC(tA.
ptr());
1853 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1858 template<
class Type>
1861 const DimensionedField<Type, fvMesh>& su,
1862 const fvMatrix<Type>&
A
1866 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1867 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1871 template<
class Type>
1874 const tmp<DimensionedField<Type, fvMesh>>& tsu,
1875 const fvMatrix<Type>&
A
1879 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1880 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1885 template<
class Type>
1888 const tmp<VolField<Type>>& tsu,
1889 const fvMatrix<Type>&
A
1893 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1894 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1899 template<
class Type>
1902 const DimensionedField<Type, fvMesh>& su,
1903 const tmp<fvMatrix<Type>>& tA
1907 tmp<fvMatrix<Type>> tC(tA.
ptr());
1908 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1912 template<
class Type>
1915 const tmp<DimensionedField<Type, fvMesh>>& tsu,
1916 const tmp<fvMatrix<Type>>& tA
1920 tmp<fvMatrix<Type>> tC(tA.
ptr());
1921 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1926 template<
class Type>
1929 const tmp<VolField<Type>>& tsu,
1930 const tmp<fvMatrix<Type>>& tA
1934 tmp<fvMatrix<Type>> tC(tA.
ptr());
1935 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1941 template<
class Type>
1944 const fvMatrix<Type>&
A,
1945 const fvMatrix<Type>&
B
1949 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1954 template<
class Type>
1957 const tmp<fvMatrix<Type>>& tA,
1958 const fvMatrix<Type>&
B
1962 tmp<fvMatrix<Type>> tC(tA.
ptr());
1967 template<
class Type>
1970 const fvMatrix<Type>&
A,
1971 const tmp<fvMatrix<Type>>& tB
1975 tmp<fvMatrix<Type>> tC(tB.ptr());
1981 template<
class Type>
1984 const tmp<fvMatrix<Type>>& tA,
1985 const tmp<fvMatrix<Type>>& tB
1989 tmp<fvMatrix<Type>> tC(tA.
ptr());
1995 template<
class Type>
1998 const fvMatrix<Type>&
A,
1999 const DimensionedField<Type, fvMesh>& su
2003 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2004 tC.ref().source() += su.mesh().V()*su.primitiveField();
2008 template<
class Type>
2011 const fvMatrix<Type>&
A,
2012 const tmp<DimensionedField<Type, fvMesh>>& tsu
2016 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2017 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2022 template<
class Type>
2025 const fvMatrix<Type>&
A,
2026 const tmp<VolField<Type>>& tsu
2030 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2031 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2036 template<
class Type>
2039 const tmp<fvMatrix<Type>>& tA,
2040 const DimensionedField<Type, fvMesh>& su
2044 tmp<fvMatrix<Type>> tC(tA.
ptr());
2045 tC.ref().source() += su.mesh().V()*su.primitiveField();
2049 template<
class Type>
2052 const tmp<fvMatrix<Type>>& tA,
2053 const tmp<DimensionedField<Type, fvMesh>>& tsu
2057 tmp<fvMatrix<Type>> tC(tA.
ptr());
2058 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2063 template<
class Type>
2066 const tmp<fvMatrix<Type>>& tA,
2067 const tmp<VolField<Type>>& tsu
2071 tmp<fvMatrix<Type>> tC(tA.
ptr());
2072 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2077 template<
class Type>
2080 const DimensionedField<Type, fvMesh>& su,
2081 const fvMatrix<Type>&
A
2085 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2087 tC.ref().source() -= su.mesh().V()*su.primitiveField();
2091 template<
class Type>
2094 const tmp<DimensionedField<Type, fvMesh>>& tsu,
2095 const fvMatrix<Type>&
A
2099 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2101 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2106 template<
class Type>
2109 const tmp<VolField<Type>>& tsu,
2110 const fvMatrix<Type>&
A
2114 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2116 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2121 template<
class Type>
2124 const DimensionedField<Type, fvMesh>& su,
2125 const tmp<fvMatrix<Type>>& tA
2129 tmp<fvMatrix<Type>> tC(tA.
ptr());
2131 tC.ref().source() -= su.mesh().V()*su.primitiveField();
2135 template<
class Type>
2138 const tmp<DimensionedField<Type, fvMesh>>& tsu,
2139 const tmp<fvMatrix<Type>>& tA
2143 tmp<fvMatrix<Type>> tC(tA.
ptr());
2145 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2150 template<
class Type>
2153 const tmp<VolField<Type>>& tsu,
2154 const tmp<fvMatrix<Type>>& tA
2158 tmp<fvMatrix<Type>> tC(tA.
ptr());
2160 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2165 template<
class Type>
2168 const fvMatrix<Type>&
A,
2169 const dimensioned<Type>& su
2173 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2174 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2178 template<
class Type>
2181 const tmp<fvMatrix<Type>>& tA,
2182 const dimensioned<Type>& su
2186 tmp<fvMatrix<Type>> tC(tA.
ptr());
2187 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2191 template<
class Type>
2194 const dimensioned<Type>& su,
2195 const fvMatrix<Type>&
A
2199 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2200 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2204 template<
class Type>
2207 const dimensioned<Type>& su,
2208 const tmp<fvMatrix<Type>>& tA
2212 tmp<fvMatrix<Type>> tC(tA.
ptr());
2213 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2217 template<
class Type>
2220 const fvMatrix<Type>&
A,
2221 const dimensioned<Type>& su
2225 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2226 tC.ref().source() += su.value()*tC().psi().mesh().V();
2230 template<
class Type>
2233 const tmp<fvMatrix<Type>>& tA,
2234 const dimensioned<Type>& su
2238 tmp<fvMatrix<Type>> tC(tA.
ptr());
2239 tC.ref().source() += su.value()*tC().psi().mesh().V();
2243 template<
class Type>
2246 const dimensioned<Type>& su,
2247 const fvMatrix<Type>&
A
2251 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2253 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2257 template<
class Type>
2260 const dimensioned<Type>& su,
2261 const tmp<fvMatrix<Type>>& tA
2265 tmp<fvMatrix<Type>> tC(tA.
ptr());
2267 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2272 template<
class Type>
2276 const fvMatrix<Type>&
A
2279 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2284 template<
class Type>
2287 const tmp<volScalarField::Internal>& tdsf,
2288 const fvMatrix<Type>&
A
2291 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2296 template<
class Type>
2299 const tmp<volScalarField>& tvsf,
2300 const fvMatrix<Type>&
A
2303 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2308 template<
class Type>
2312 const tmp<fvMatrix<Type>>& tA
2315 tmp<fvMatrix<Type>> tC(tA.
ptr());
2320 template<
class Type>
2323 const tmp<volScalarField::Internal>& tdsf,
2324 const tmp<fvMatrix<Type>>& tA
2327 tmp<fvMatrix<Type>> tC(tA.
ptr());
2332 template<
class Type>
2335 const tmp<volScalarField>& tvsf,
2336 const tmp<fvMatrix<Type>>& tA
2339 tmp<fvMatrix<Type>> tC(tA.
ptr());
2344 template<
class Type>
2347 const dimensioned<scalar>& ds,
2348 const fvMatrix<Type>&
A
2351 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2356 template<
class Type>
2359 const dimensioned<scalar>& ds,
2360 const tmp<fvMatrix<Type>>& tA
2363 tmp<fvMatrix<Type>> tC(tA.
ptr());
2369 template<
class Type>
2372 const fvMatrix<Type>&
A,
2376 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2381 template<
class Type>
2384 const fvMatrix<Type>&
A,
2385 const tmp<volScalarField::Internal>& tdsf
2388 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2393 template<
class Type>
2396 const fvMatrix<Type>&
A,
2397 const tmp<volScalarField>& tvsf
2400 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2405 template<
class Type>
2408 const tmp<fvMatrix<Type>>& tA,
2412 tmp<fvMatrix<Type>> tC(tA.ptr());
2417 template<
class Type>
2420 const tmp<fvMatrix<Type>>& tA,
2421 const tmp<volScalarField::Internal>& tdsf
2424 tmp<fvMatrix<Type>> tC(tA.ptr());
2429 template<
class Type>
2432 const tmp<fvMatrix<Type>>& tA,
2433 const tmp<volScalarField>& tvsf
2436 tmp<fvMatrix<Type>> tC(tA.ptr());
2441 template<
class Type>
2444 const fvMatrix<Type>&
A,
2445 const dimensioned<scalar>& ds
2448 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2453 template<
class Type>
2456 const tmp<fvMatrix<Type>>& tA,
2457 const dimensioned<scalar>& ds
2460 tmp<fvMatrix<Type>> tC(tA.ptr());
2466 template<
class Type>
2470 const fvMatrix<Type>&
M,
2471 const DimensionedField<Type, fvMesh>&
psi
2474 tmp<VolField<Type>> tMphi
2484 VolField<Type>& Mphi = tMphi.ref();
2489 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
2493 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2494 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2499 Mphi.primitiveFieldRef() =
Zero;
2502 Mphi.primitiveFieldRef() +=
2504 M.addBoundarySource(Mphi.primitiveFieldRef());
2506 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2507 Mphi.correctBoundaryConditions();
2512 template<
class Type>
2516 const fvMatrix<Type>&
M,
2517 const tmp<DimensionedField<Type, fvMesh>>& tpsi
2520 tmp<VolField<Type>> tMpsi =
M & tpsi();
2525 template<
class Type>
2529 const fvMatrix<Type>&
M,
2530 const tmp<VolField<Type>>& tpsi
2533 tmp<VolField<Type>> tMpsi =
M & tpsi();
2538 template<
class Type>
2542 const tmp<fvMatrix<Type>>& tM,
2543 const DimensionedField<Type, fvMesh>&
psi
2546 tmp<VolField<Type>> tMpsi = tM() &
psi;
2551 template<
class Type>
2555 const tmp<fvMatrix<Type>>& tM,
2556 const tmp<DimensionedField<Type, fvMesh>>& tpsi
2559 tmp<VolField<Type>> tMpsi = tM() & tpsi();
2565 template<
class Type>
2569 const tmp<fvMatrix<Type>>& tM,
2570 const tmp<VolField<Type>>& tpsi
2573 tmp<VolField<Type>> tMpsi = tM() & tpsi();
2582 template<
class Type>
2585 os << static_cast<const lduMatrix&>(fvm) <<
nl
2586 << fvm.dimensions_ <<
nl
2587 << fvm.source_ <<
nl
2588 << fvm.internalCoeffs_ <<
nl
2589 << fvm.boundaryCoeffs_ <<
endl;
2591 os.
check(
"Ostream& operator<<(Ostream&, fvMatrix<Type>&");
#define forAll(list, i)
Loop across all elements in list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
const dimensionSet & dimensions() const
Return dimensions.
const GeoMesh & mesh() const
Return mesh.
Pre-declare SubField and related Field type.
void negate()
Negate this field.
void updateCoeffs()
Update the boundary condition coefficients.
Generic GeometricField class.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
DimensionedField< Type, GeoMesh, PrimitiveField > Internal
Type of the internal field from which this GeometricField is derived.
void replace(const direction, const GeometricField< cmptType, GeoMesh, PrimitiveField2 > &)
Replace a component field of the field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
void correctBoundaryConditions()
Correct boundary field.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
const word & name() const
Return name.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
label size() const
Return the number of elements in the UList.
static int & msgType()
Message tag of standard messages.
A cell is defined as a list of faces with extra functionality.
Dimension set for the base types.
Generic dimensioned Type class.
const dimensionSet & dimensions() const
Return const reference to dimensions.
const word & name() const
Return const reference to name.
A face is a list of labels corresponding to mesh vertices.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
void operator-=(const fvMatrix< Type > &)
tmp< Field< Type > > DD() const
Return the matrix Type diagonal.
tmp< volScalarField > A() const
Return the central coefficient.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
void setValue(const label celli, const Type &value)
Set solution in the given cell to the specified value.
void boundaryManipulate(typename VolField< Type >::Boundary &values)
Manipulate based on a boundary field.
void relax()
Relax matrix (for steady-state solution).
tmp< volScalarField > H1() const
Return H(1)
tmp< VolField< Type > > H() const
Return the H operation source.
void operator+=(const fvMatrix< Type > &)
virtual ~fvMatrix()
Destructor.
tmp< SurfaceField< Type > > flux() const
Return the face-flux field from the matrix.
void addCmptAvBoundaryDiag(scalarField &diag) const
void addBoundarySource(Field< Type > &source, const bool couples=true) const
fvMatrix(const VolField< Type > &, const dimensionSet &)
Construct given a field to solve for.
tmp< volScalarField::Internal > Sp() const
Return the implicit source.
void setReference(const label celli, const Type &value, const bool forceReference=false)
Set reference level for solution.
scalar relaxationFactor() const
Return the relaxation factor for this equation.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
void setValues(const labelUList &cells, const ListType< Type > &values)
Set solution in given cells to the specified values.
tmp< fvMatrix< Type > > clone() const
Clone.
tmp< VolInternalField< Type > > Su() const
Return the explicit source.
tmp< scalarField > D() const
Return the matrix scalar diagonal.
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
const dimensionSet & dimensions() const
void operator=(const fvMatrix< Type > &)
Mesh data needed to do the Finite Volume discretisation.
const labelUList & owner() const
Internal face owner.
const UCompactListList< label > & polyBFacePatches() const
Return poly-bFace-patch addressing.
const UCompactListList< label > & polyBFacePatchFaces() const
Return poly-bFace-patch-face addressing.
const labelUList & neighbour() const
Internal face neighbour.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual bool coupled() const
Return true if this patch field is coupled.
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking) const
Return patchField on the opposite patch of a coupled patch.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
tmp< scalarField > H1() const
tmp< Field< Type > > faceH(const Field< Type > &) const
void operator=(const lduMatrix &)
tmp< Field< Type > > H(const Field< Type > &) const
void operator*=(const scalarField &)
void operator/=(const scalarField &)
void operator+=(const lduMatrix &)
void operator-=(const lduMatrix &)
Traits class for primitives.
label nInternalFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const cellList & cells() const
Reference counter for various OpenFOAM components.
uint64_t eventNo() const
Event number at last update.
static bool finalIteration(const objectRegistry ®istry)
Lookup solutionControl from the objectRegistry and return finalIter.
A class for managing temporary objects.
T * ptr() const
Return tmp pointer for reuse.
void clear() const
If object pointer points to valid object:
T & ref() const
Return non-const reference or generate a fatal error.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Calculate the matrix for the first temporal derivative.
const fvPatchList & patches
const volScalarField & psi
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
#define InfoInFunction
Report an information message using Foam::Info.
const dimensionedScalar c
Speed of light in a vacuum.
tmp< fvMatrix< Type > > S(const Pair< tmp< volScalarField::Internal >> &, const VolField< Type > &)
tmp< fvMatrix< Type > > ddt(const VolField< Type > &vf)
static const coefficient D("D", dimTemperature, 257.14)
static const coefficient B("B", dimless, 18.678)
static const coefficient A("A", dimPressure, 611.21)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< Type, GeoMesh, Field > > cmptMultiply(const DimensionedField< Type, GeoMesh, PrimitiveField1 > &df1, const DimensionedField< Type, GeoMesh, PrimitiveField2 > &df2)
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
void deleteDemandDrivenData(DataType *&dataPtr)
errorManip< error > abort(error &err)
const dimensionSet & dimVolume
void checkMethod(const fvMatrix< Type > &, const fvMatrix< Type > &, const char *)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void cmptMax(Field< typename Field< Type >::cmptType > &res, const UList< Type > &f)
void component(GeometricField< typename GeometricField< Type, GeoMesh, PrimitiveField1 >::cmptType, GeoMesh, PrimitiveField1 > &gcf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf, const direction d)
void operator*=(Other &, const oneOrTmp< Type > &)
Multiply-assign with an object.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
typename VolField< Type >::Internal VolInternalField
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
void cmptMin(Field< typename Field< Type >::cmptType > &res, const UList< Type > &f)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh, PrimitiveField >::cmptType, GeoMesh, Field >> cmptAv(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
tmp< DimensionedField< Type, GeoMesh, Field > > cmptMag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void operator+=(fvMatrix< Type > &fvEqn, const CarrierEqn< Type > &cEqn)
Add to a finite-volume equation.
void operator-=(fvMatrix< Type > &fvEqn, const CarrierEqn< Type > &cEqn)
Subtract from a finite-volume equation.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary fractions(initialConditions.subDict("fractions"))
faceListList boundary(nPatches)
conserve primitiveFieldRef()+