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]);
184 const fvMesh& mesh = psi_.mesh();
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;
262 const scalar fraction,
270 psi[celli] = (1 - fraction)*
psi[celli] + fraction*value;
273 fraction/(1 - fraction)
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;
334 psiRef.
eventNo() = currentStatePsi;
344 dimensions_(fvm.dimensions_),
345 source_(fvm.source_),
346 internalCoeffs_(fvm.internalCoeffs_),
347 boundaryCoeffs_(fvm.boundaryCoeffs_),
348 faceFluxCorrectionPtr_(nullptr)
353 <<
"Copying fvMatrix<Type> for field " << psi_.name() <<
endl;
356 if (fvm.faceFluxCorrectionPtr_)
358 faceFluxCorrectionPtr_ =
new
361 *(fvm.faceFluxCorrectionPtr_)
372 const_cast<
fvMatrix<Type>&>(tfvm()),
376 dimensions_(tfvm().dimensions_),
379 const_cast<
fvMatrix<Type>&>(tfvm()).source_,
384 const_cast<
fvMatrix<Type>&>(tfvm()).internalCoeffs_,
389 const_cast<
fvMatrix<Type>&>(tfvm()).boundaryCoeffs_,
392 faceFluxCorrectionPtr_(nullptr)
397 <<
"Copying fvMatrix<Type> for field " << psi_.name() <<
endl;
400 if (tfvm().faceFluxCorrectionPtr_)
404 faceFluxCorrectionPtr_ = tfvm().faceFluxCorrectionPtr_;
405 tfvm().faceFluxCorrectionPtr_ =
nullptr;
409 faceFluxCorrectionPtr_ =
new
412 *(tfvm().faceFluxCorrectionPtr_)
434 faceFluxCorrectionPtr_(nullptr)
439 <<
"Constructing fvMatrix<Type> for field " << psi_.name() <<
endl;
487 <<
"Destroying fvMatrix<Type> for field " << psi_.name() <<
endl;
490 if (faceFluxCorrectionPtr_)
492 delete faceFluxCorrectionPtr_;
500 template<
template<
class>
class ListType>
504 const ListType<Type>& values
510 setValue(cellLabels[i], values[i]);
516 template<
template<
class>
class ListType>
520 const ListType<Type>& values,
527 const scalar
alpha = relaxationFactor();
537 ddtDiag += ddtEqn.
diag();
550 setValue(cellLabels[i], values[i]);
555 setValue(cellLabels[i], values[i],
fractions[i], ddtDiag);
566 const bool forceReference
569 if ((forceReference || psi_.needReference()) && celli >= 0)
571 source()[celli] +=
diag()[celli]*value;
582 psi_.mesh().data::template lookupOrDefault<bool>
583 (
"finalIteration",
false)
584 && psi_.mesh().solution().relaxEquation(psi_.name() +
"Final")
587 return psi_.mesh().solution().equationRelaxationFactor
589 psi_.name() +
"Final"
592 else if (psi_.mesh().solution().relaxEquation(psi_.name()))
594 return psi_.mesh().solution().equationRelaxationFactor(psi_.name());
614 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
625 sumMagOffDiag(sumOff);
670 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
675 maxNon =
max(maxNon, d);
704 <<
"Matrix dominance test for " << psi_.name() <<
nl
705 <<
" number of non-dominant cells : " << nNon <<
nl
706 <<
" maximum relative non-dominance : " << maxNon <<
nl
707 <<
" average relative non-dominance : " << sumNon <<
nl
716 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
750 S += (
D - D0)*psi_.primitiveField();
757 relax(relaxationFactor());
770 bFields[
patchi].manipulateMatrix(*
this);
779 addCmptAvBoundaryDiag(tdiag.
ref());
797 lduAddr().patchAddr(
patchi),
815 "A(" + psi_.name() +
')',
817 dimensions_/psi_.dimensions()/
dimVol,
818 extrapolatedCalculatedFvPatchScalarField::typeName
822 tAphi.
ref().primitiveFieldRef() =
D()/psi_.mesh().V();
823 tAphi.
ref().correctBoundaryConditions();
836 "Su(" +psi_.name() +
')',
839 -source()/psi_.mesh().V()
854 "Sp(" + psi_.name() +
')',
856 dimensions_/psi_.dimensions()/
dimVol,
857 diag()/psi_.mesh().V()
873 "H(" + psi_.name() +
')',
876 extrapolatedCalculatedFvPatchScalarField::typeName
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_/(
dimVol*psi_.dimensions()),
931 extrapolatedCalculatedFvPatchScalarField::typeName
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>
1130 operator+=(tfvmv());
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>
1162 operator-=(tfvmv());
1167 template<
class Type>
1174 source() -= su.mesh().V()*su.field();
1178 template<
class Type>
1189 template<
class Type>
1200 template<
class Type>
1207 source() += su.mesh().V()*su.field();
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.field();
1283 dsf.mesh().boundary()[
patchi].patchInternalField(dsf.field())
1286 internalCoeffs_[
patchi] *= pisf;
1287 boundaryCoeffs_[
patchi] *= pisf;
1290 if (faceFluxCorrectionPtr_)
1293 <<
"cannot scale a matrix containing a faceFluxCorrection"
1299 template<
class Type>
1310 template<
class Type>
1321 template<
class Type>
1327 dimensions_ *= ds.dimensions();
1329 source_ *= ds.value();
1330 internalCoeffs_ *= ds.value();
1331 boundaryCoeffs_ *= ds.value();
1333 if (faceFluxCorrectionPtr_)
1335 *faceFluxCorrectionPtr_ *= ds.value();
1340 template<
class Type>
1346 dimensions_ /= dsf.dimensions();
1348 source_ /= dsf.field();
1354 dsf.mesh().boundary()[
patchi].patchInternalField(dsf.field())
1357 internalCoeffs_[
patchi] /= pisf;
1358 boundaryCoeffs_[
patchi] /= pisf;
1361 if (faceFluxCorrectionPtr_)
1364 <<
"cannot scale a matrix containing a faceFluxCorrection"
1370 template<
class Type>
1381 template<
class Type>
1392 template<
class Type>
1398 dimensions_ /= ds.dimensions();
1400 source_ /= ds.value();
1401 internalCoeffs_ /= ds.value();
1402 boundaryCoeffs_ /= ds.value();
1404 if (faceFluxCorrectionPtr_)
1406 *faceFluxCorrectionPtr_ /= ds.value();
1413 template<
class Type>
1421 if (&fvm1.
psi() != &fvm2.
psi())
1424 <<
"incompatible fields for operation "
1426 <<
"[" << fvm1.
psi().name() <<
"] "
1428 <<
" [" << fvm2.
psi().name() <<
"]"
1435 <<
"incompatible dimensions for operation "
1445 template<
class Type>
1465 template<
class Type>
1476 <<
"incompatible dimensions for operation "
1486 template<
class Type>
1489 const fvMatrix<Type>&
A
1492 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
1502 template<
class Type>
1505 const tmp<fvMatrix<Type>>& tA
1508 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
1520 template<
class Type>
1523 const fvMatrix<Type>&
A,
1524 const fvMatrix<Type>&
B
1531 template<
class Type>
1534 const tmp<fvMatrix<Type>>& tA,
1535 const fvMatrix<Type>&
B
1542 template<
class Type>
1545 const fvMatrix<Type>&
A,
1546 const tmp<fvMatrix<Type>>& tB
1553 template<
class Type>
1556 const tmp<fvMatrix<Type>>& tA,
1557 const tmp<fvMatrix<Type>>& tB
1564 template<
class Type>
1567 const fvMatrix<Type>&
A,
1568 const DimensionedField<Type, volMesh>& su
1572 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1573 tC.ref().source() += su.mesh().V()*su.field();
1577 template<
class Type>
1580 const fvMatrix<Type>&
A,
1581 const tmp<DimensionedField<Type, volMesh>>& tsu
1585 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1586 tC.ref().source() += tsu().mesh().V()*tsu().field();
1591 template<
class Type>
1594 const fvMatrix<Type>&
A,
1595 const tmp<VolField<Type>>& tsu
1599 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1600 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1605 template<
class Type>
1608 const tmp<fvMatrix<Type>>& tA,
1609 const DimensionedField<Type, volMesh>& su
1613 tmp<fvMatrix<Type>> tC(tA.ptr());
1614 tC.ref().source() += su.mesh().V()*su.field();
1618 template<
class Type>
1621 const tmp<fvMatrix<Type>>& tA,
1622 const tmp<DimensionedField<Type, volMesh>>& tsu
1626 tmp<fvMatrix<Type>> tC(tA.ptr());
1627 tC.ref().source() += tsu().mesh().V()*tsu().field();
1632 template<
class Type>
1635 const tmp<fvMatrix<Type>>& tA,
1636 const tmp<VolField<Type>>& tsu
1640 tmp<fvMatrix<Type>> tC(tA.ptr());
1641 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1646 template<
class Type>
1649 const fvMatrix<Type>&
A,
1650 const dimensioned<Type>& su
1654 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1655 tC.ref().source() +=
A.psi().mesh().V()*su.value();
1659 template<
class Type>
1662 const tmp<fvMatrix<Type>>& tA,
1663 const dimensioned<Type>& su
1667 tmp<fvMatrix<Type>> tC(tA.ptr());
1668 tC.ref().source() += tC().psi().mesh().V()*su.value();
1672 template<
class Type>
1675 const fvMatrix<Type>&
A,
1683 template<
class Type>
1686 const tmp<fvMatrix<Type>>& tA,
1694 template<
class Type>
1697 const fvMatrix<Type>&
A
1700 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1705 template<
class Type>
1708 const tmp<fvMatrix<Type>>& tA
1711 tmp<fvMatrix<Type>> tC(tA.ptr());
1717 template<
class Type>
1720 const fvMatrix<Type>&
A,
1721 const fvMatrix<Type>&
B
1725 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1730 template<
class Type>
1733 const tmp<fvMatrix<Type>>& tA,
1734 const fvMatrix<Type>&
B
1738 tmp<fvMatrix<Type>> tC(tA.
ptr());
1743 template<
class Type>
1746 const fvMatrix<Type>&
A,
1747 const tmp<fvMatrix<Type>>& tB
1751 tmp<fvMatrix<Type>> tC(tB.ptr());
1756 template<
class Type>
1759 const tmp<fvMatrix<Type>>& tA,
1760 const tmp<fvMatrix<Type>>& tB
1764 tmp<fvMatrix<Type>> tC(tA.
ptr());
1770 template<
class Type>
1773 const fvMatrix<Type>&
A,
1774 const DimensionedField<Type, volMesh>& su
1778 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1779 tC.ref().source() -= su.mesh().V()*su.field();
1783 template<
class Type>
1786 const fvMatrix<Type>&
A,
1787 const tmp<DimensionedField<Type, volMesh>>& tsu
1791 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1792 tC.ref().source() -= tsu().mesh().V()*tsu().field();
1797 template<
class Type>
1800 const fvMatrix<Type>&
A,
1801 const tmp<VolField<Type>>& tsu
1805 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1806 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1811 template<
class Type>
1814 const tmp<fvMatrix<Type>>& tA,
1815 const DimensionedField<Type, volMesh>& su
1819 tmp<fvMatrix<Type>> tC(tA.
ptr());
1820 tC.ref().source() -= su.mesh().V()*su.field();
1824 template<
class Type>
1827 const tmp<fvMatrix<Type>>& tA,
1828 const tmp<DimensionedField<Type, volMesh>>& tsu
1832 tmp<fvMatrix<Type>> tC(tA.
ptr());
1833 tC.ref().source() -= tsu().mesh().V()*tsu().field();
1838 template<
class Type>
1841 const tmp<fvMatrix<Type>>& tA,
1842 const tmp<VolField<Type>>& tsu
1846 tmp<fvMatrix<Type>> tC(tA.
ptr());
1847 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1852 template<
class Type>
1855 const DimensionedField<Type, volMesh>& su,
1856 const fvMatrix<Type>&
A
1860 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1861 tC.ref().source() -= su.mesh().V()*su.field();
1865 template<
class Type>
1868 const tmp<DimensionedField<Type, volMesh>>& tsu,
1869 const fvMatrix<Type>&
A
1873 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1874 tC.ref().source() -= tsu().mesh().V()*tsu().field();
1879 template<
class Type>
1882 const tmp<VolField<Type>>& tsu,
1883 const fvMatrix<Type>&
A
1887 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1888 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1893 template<
class Type>
1896 const DimensionedField<Type, volMesh>& su,
1897 const tmp<fvMatrix<Type>>& tA
1901 tmp<fvMatrix<Type>> tC(tA.
ptr());
1902 tC.ref().source() -= su.mesh().V()*su.field();
1906 template<
class Type>
1909 const tmp<DimensionedField<Type, volMesh>>& tsu,
1910 const tmp<fvMatrix<Type>>& tA
1914 tmp<fvMatrix<Type>> tC(tA.
ptr());
1915 tC.ref().source() -= tsu().mesh().V()*tsu().field();
1920 template<
class Type>
1923 const tmp<VolField<Type>>& tsu,
1924 const tmp<fvMatrix<Type>>& tA
1928 tmp<fvMatrix<Type>> tC(tA.
ptr());
1929 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1935 template<
class Type>
1938 const fvMatrix<Type>&
A,
1939 const fvMatrix<Type>&
B
1943 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1948 template<
class Type>
1951 const tmp<fvMatrix<Type>>& tA,
1952 const fvMatrix<Type>&
B
1956 tmp<fvMatrix<Type>> tC(tA.
ptr());
1961 template<
class Type>
1964 const fvMatrix<Type>&
A,
1965 const tmp<fvMatrix<Type>>& tB
1969 tmp<fvMatrix<Type>> tC(tB.ptr());
1975 template<
class Type>
1978 const tmp<fvMatrix<Type>>& tA,
1979 const tmp<fvMatrix<Type>>& tB
1983 tmp<fvMatrix<Type>> tC(tA.
ptr());
1989 template<
class Type>
1992 const fvMatrix<Type>&
A,
1993 const DimensionedField<Type, volMesh>& su
1997 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1998 tC.ref().source() += su.mesh().V()*su.field();
2002 template<
class Type>
2005 const fvMatrix<Type>&
A,
2006 const tmp<DimensionedField<Type, volMesh>>& tsu
2010 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2011 tC.ref().source() += tsu().mesh().V()*tsu().field();
2016 template<
class Type>
2019 const fvMatrix<Type>&
A,
2020 const tmp<VolField<Type>>& tsu
2024 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2025 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2030 template<
class Type>
2033 const tmp<fvMatrix<Type>>& tA,
2034 const DimensionedField<Type, volMesh>& su
2038 tmp<fvMatrix<Type>> tC(tA.
ptr());
2039 tC.ref().source() += su.mesh().V()*su.field();
2043 template<
class Type>
2046 const tmp<fvMatrix<Type>>& tA,
2047 const tmp<DimensionedField<Type, volMesh>>& tsu
2051 tmp<fvMatrix<Type>> tC(tA.
ptr());
2052 tC.ref().source() += tsu().mesh().V()*tsu().field();
2057 template<
class Type>
2060 const tmp<fvMatrix<Type>>& tA,
2061 const tmp<VolField<Type>>& tsu
2065 tmp<fvMatrix<Type>> tC(tA.
ptr());
2066 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2071 template<
class Type>
2074 const DimensionedField<Type, volMesh>& su,
2075 const fvMatrix<Type>&
A
2079 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2081 tC.ref().source() -= su.mesh().V()*su.field();
2085 template<
class Type>
2088 const tmp<DimensionedField<Type, volMesh>>& tsu,
2089 const fvMatrix<Type>&
A
2093 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2095 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2100 template<
class Type>
2103 const tmp<VolField<Type>>& tsu,
2104 const fvMatrix<Type>&
A
2108 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2110 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2115 template<
class Type>
2118 const DimensionedField<Type, volMesh>& su,
2119 const tmp<fvMatrix<Type>>& tA
2123 tmp<fvMatrix<Type>> tC(tA.
ptr());
2125 tC.ref().source() -= su.mesh().V()*su.field();
2129 template<
class Type>
2132 const tmp<DimensionedField<Type, volMesh>>& tsu,
2133 const tmp<fvMatrix<Type>>& tA
2137 tmp<fvMatrix<Type>> tC(tA.
ptr());
2139 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2144 template<
class Type>
2147 const tmp<VolField<Type>>& tsu,
2148 const tmp<fvMatrix<Type>>& tA
2152 tmp<fvMatrix<Type>> tC(tA.
ptr());
2154 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2159 template<
class Type>
2162 const fvMatrix<Type>&
A,
2163 const dimensioned<Type>& su
2167 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2168 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2172 template<
class Type>
2175 const tmp<fvMatrix<Type>>& tA,
2176 const dimensioned<Type>& su
2180 tmp<fvMatrix<Type>> tC(tA.
ptr());
2181 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2185 template<
class Type>
2188 const dimensioned<Type>& su,
2189 const fvMatrix<Type>&
A
2193 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2194 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2198 template<
class Type>
2201 const dimensioned<Type>& su,
2202 const tmp<fvMatrix<Type>>& tA
2206 tmp<fvMatrix<Type>> tC(tA.
ptr());
2207 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2211 template<
class Type>
2214 const fvMatrix<Type>&
A,
2215 const dimensioned<Type>& su
2219 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2220 tC.ref().source() += su.value()*tC().psi().mesh().V();
2224 template<
class Type>
2227 const tmp<fvMatrix<Type>>& tA,
2228 const dimensioned<Type>& su
2232 tmp<fvMatrix<Type>> tC(tA.
ptr());
2233 tC.ref().source() += su.value()*tC().psi().mesh().V();
2237 template<
class Type>
2240 const dimensioned<Type>& su,
2241 const fvMatrix<Type>&
A
2245 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2247 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2251 template<
class Type>
2254 const dimensioned<Type>& su,
2255 const tmp<fvMatrix<Type>>& tA
2259 tmp<fvMatrix<Type>> tC(tA.
ptr());
2261 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2266 template<
class Type>
2270 const fvMatrix<Type>&
A
2273 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2278 template<
class Type>
2281 const tmp<volScalarField::Internal>& tdsf,
2282 const fvMatrix<Type>&
A
2285 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2290 template<
class Type>
2293 const tmp<volScalarField>& tvsf,
2294 const fvMatrix<Type>&
A
2297 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2302 template<
class Type>
2306 const tmp<fvMatrix<Type>>& tA
2309 tmp<fvMatrix<Type>> tC(tA.
ptr());
2314 template<
class Type>
2317 const tmp<volScalarField::Internal>& tdsf,
2318 const tmp<fvMatrix<Type>>& tA
2321 tmp<fvMatrix<Type>> tC(tA.
ptr());
2326 template<
class Type>
2329 const tmp<volScalarField>& tvsf,
2330 const tmp<fvMatrix<Type>>& tA
2333 tmp<fvMatrix<Type>> tC(tA.
ptr());
2338 template<
class Type>
2341 const dimensioned<scalar>& ds,
2342 const fvMatrix<Type>&
A
2345 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2350 template<
class Type>
2353 const dimensioned<scalar>& ds,
2354 const tmp<fvMatrix<Type>>& tA
2357 tmp<fvMatrix<Type>> tC(tA.
ptr());
2363 template<
class Type>
2366 const fvMatrix<Type>&
A,
2370 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2375 template<
class Type>
2378 const fvMatrix<Type>&
A,
2379 const tmp<volScalarField::Internal>& tdsf
2382 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2387 template<
class Type>
2390 const fvMatrix<Type>&
A,
2391 const tmp<volScalarField>& tvsf
2394 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2399 template<
class Type>
2402 const tmp<fvMatrix<Type>>& tA,
2406 tmp<fvMatrix<Type>> tC(tA.ptr());
2411 template<
class Type>
2414 const tmp<fvMatrix<Type>>& tA,
2415 const tmp<volScalarField::Internal>& tdsf
2418 tmp<fvMatrix<Type>> tC(tA.ptr());
2423 template<
class Type>
2426 const tmp<fvMatrix<Type>>& tA,
2427 const tmp<volScalarField>& tvsf
2430 tmp<fvMatrix<Type>> tC(tA.ptr());
2435 template<
class Type>
2438 const fvMatrix<Type>&
A,
2439 const dimensioned<scalar>& ds
2442 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2447 template<
class Type>
2450 const tmp<fvMatrix<Type>>& tA,
2451 const dimensioned<scalar>& ds
2454 tmp<fvMatrix<Type>> tC(tA.ptr());
2460 template<
class Type>
2464 const fvMatrix<Type>&
M,
2465 const DimensionedField<Type, volMesh>&
psi
2468 tmp<VolField<Type>> tMphi
2475 extrapolatedCalculatedFvPatchScalarField::typeName
2478 VolField<Type>& Mphi = tMphi.ref();
2483 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
2487 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2488 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2493 Mphi.primitiveFieldRef() =
Zero;
2496 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2497 M.addBoundarySource(Mphi.primitiveFieldRef());
2499 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2500 Mphi.correctBoundaryConditions();
2505 template<
class Type>
2509 const fvMatrix<Type>&
M,
2510 const tmp<DimensionedField<Type, volMesh>>& tpsi
2513 tmp<VolField<Type>> tMpsi =
M & tpsi();
2518 template<
class Type>
2522 const fvMatrix<Type>&
M,
2523 const tmp<VolField<Type>>& tpsi
2526 tmp<VolField<Type>> tMpsi =
M & tpsi();
2531 template<
class Type>
2535 const tmp<fvMatrix<Type>>& tM,
2536 const DimensionedField<Type, volMesh>&
psi
2539 tmp<VolField<Type>> tMpsi = tM() &
psi;
2544 template<
class Type>
2548 const tmp<fvMatrix<Type>>& tM,
2549 const tmp<DimensionedField<Type, volMesh>>& tpsi
2552 tmp<VolField<Type>> tMpsi = tM() & tpsi();
2558 template<
class Type>
2562 const tmp<fvMatrix<Type>>& tM,
2563 const tmp<VolField<Type>>& tpsi
2566 tmp<VolField<Type>> tMpsi = tM() & tpsi();
2575 template<
class Type>
2578 os << static_cast<const lduMatrix&>(fvm) <<
nl
2579 << fvm.dimensions_ <<
nl
2580 << fvm.source_ <<
nl
2581 << fvm.internalCoeffs_ <<
nl
2582 << fvm.boundaryCoeffs_ <<
endl;
2584 os.
check(
"Ostream& operator<<(Ostream&, fvMatrix<Type>&");
static const Foam::dimensionedScalar A("A", Foam::dimPressure, 611.21)
static const Foam::dimensionedScalar B("B", Foam::dimless, 18.678)
static const Foam::dimensionedScalar D("D", Foam::dimTemperature, 257.14)
#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...
const dimensionSet & dimensions() const
Return dimensions.
const Mesh & mesh() const
Return mesh.
const Field< Type > & field() const
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &, const Field< Type > &)
Return a temporary field constructed from name, mesh,.
Pre-declare SubField and related Field type.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
void negate()
Negate this field.
void updateCoeffs()
Update the boundary condition coefficients.
Generic GeometricField class.
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
DimensionedField< Type, GeoMesh > Internal
Type of the internal field from which this GeometricField is derived.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &)
Return a temporary field constructed from name,.
void replace(const direction, const GeometricField< cmptType, PatchField, GeoMesh > &)
void correctBoundaryConditions()
Correct boundary field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
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::Internal > Su() const
Return the explicit source.
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< 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.
label eventNo() const
Event number at last update.
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...
#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)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
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.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
errorManip< error > abort(error &err)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
void checkMethod(const fvMatrix< Type > &, const fvMatrix< Type > &, const char *)
void deleteDemandDrivenData(DataPtr &dataPtr)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const dimensionSet dimVol
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)
const dimensionSet dimVolume
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionSet cmptMag(const dimensionSet &)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Ostream & operator<<(Ostream &, const ensightPart &)
dictionary fractions(initialConditions.subDict("fractions"))
faceListList boundary(nPatches)
conserve primitiveFieldRef()+