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;
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;
583 && psi_.mesh().solution().relaxEquation(psi_.name() +
"Final")
586 return psi_.mesh().solution().equationRelaxationFactor
588 psi_.name() +
"Final"
591 else if (psi_.mesh().solution().relaxEquation(psi_.name()))
593 return psi_.mesh().solution().equationRelaxationFactor(psi_.name());
613 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
624 sumMagOffDiag(sumOff);
669 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
674 maxNon =
max(maxNon, d);
703 <<
"Matrix dominance test for " << psi_.name() <<
nl
704 <<
" number of non-dominant cells : " << nNon <<
nl
705 <<
" maximum relative non-dominance : " << maxNon <<
nl
706 <<
" average relative non-dominance : " << sumNon <<
nl
715 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
749 S += (
D - D0)*psi_.primitiveField();
756 relax(relaxationFactor());
769 bFields[
patchi].manipulateMatrix(*
this);
778 addCmptAvBoundaryDiag(tdiag.
ref());
796 lduAddr().patchAddr(
patchi),
814 "A(" + psi_.name() +
')',
817 extrapolatedCalculatedFvPatchScalarField::typeName
821 tAphi.
ref().primitiveFieldRef() =
D()/psi_.mesh().V();
822 tAphi.
ref().correctBoundaryConditions();
835 "Su(" +psi_.name() +
')',
838 -source()/psi_.mesh().V()
853 "Sp(" + psi_.name() +
')',
857 ?
diag()/psi_.mesh().V()
874 "H(" + psi_.name() +
')',
877 extrapolatedCalculatedFvPatchScalarField::typeName
883 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
885 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
888 addBoundaryDiag(boundaryDiagCmpt, cmpt);
889 boundaryDiagCmpt.
negate();
890 addCmptAvBoundaryDiag(boundaryDiagCmpt);
901 typename Type::labelType validComponents
903 psi_.mesh().template validComponents<Type>()
906 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
908 if (validComponents[cmpt] == -1)
931 dimensions_/(
dimVolume*psi_.dimensions()),
932 extrapolatedCalculatedFvPatchScalarField::typeName
947 lduAddr().patchAddr(
patchi),
966 if (!psi_.mesh().schemes().fluxRequired(psi_.name()))
969 <<
"flux requested but " << psi_.name()
970 <<
" not specified in the fluxRequired sub-dictionary"
980 "flux(" + psi_.name() +
')',
988 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
1001 InternalContrib[
patchi] =
1005 psi_.boundaryField()[
patchi].patchInternalField()
1013 if (psi_.boundaryField()[
patchi].coupled())
1015 NeighbourContrib[
patchi] =
1018 NeighbourContrib[
patchi],
1019 psi_.boundaryField()[
patchi].patchNeighbourField()
1032 if (faceFluxCorrectionPtr_)
1034 fieldFlux += *faceFluxCorrectionPtr_;
1043 template<
class Type>
1049 <<
"attempted assignment to self"
1053 if (&psi_ != &(fvmv.psi_))
1056 <<
"different fields"
1060 dimensions_ = fvmv.dimensions_;
1062 source_ = fvmv.source_;
1063 internalCoeffs_ = fvmv.internalCoeffs_;
1064 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1066 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1068 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1070 else if (fvmv.faceFluxCorrectionPtr_)
1072 faceFluxCorrectionPtr_ =
1074 (*fvmv.faceFluxCorrectionPtr_);
1079 template<
class Type>
1087 template<
class Type>
1092 internalCoeffs_.negate();
1093 boundaryCoeffs_.negate();
1095 if (faceFluxCorrectionPtr_)
1097 faceFluxCorrectionPtr_->negate();
1102 template<
class Type>
1107 dimensions_ += fvmv.dimensions_;
1109 source_ += fvmv.source_;
1110 internalCoeffs_ += fvmv.internalCoeffs_;
1111 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1113 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1115 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1117 else if (fvmv.faceFluxCorrectionPtr_)
1119 faceFluxCorrectionPtr_ =
new
1122 *fvmv.faceFluxCorrectionPtr_
1128 template<
class Type>
1131 operator+=(tfvmv());
1136 template<
class Type>
1141 dimensions_ -= fvmv.dimensions_;
1143 source_ -= fvmv.source_;
1144 internalCoeffs_ -= fvmv.internalCoeffs_;
1145 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1147 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1149 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1151 else if (fvmv.faceFluxCorrectionPtr_)
1153 faceFluxCorrectionPtr_ =
1155 (-*fvmv.faceFluxCorrectionPtr_);
1160 template<
class Type>
1163 operator-=(tfvmv());
1168 template<
class Type>
1175 source() -= su.mesh().V()*su.primitiveField();
1179 template<
class Type>
1190 template<
class Type>
1201 template<
class Type>
1208 source() += su.mesh().V()*su.primitiveField();
1212 template<
class Type>
1223 template<
class Type>
1234 template<
class Type>
1240 source() -=
psi().
mesh().V()*su;
1244 template<
class Type>
1250 source() +=
psi().
mesh().V()*su;
1254 template<
class Type>
1262 template<
class Type>
1270 template<
class Type>
1276 dimensions_ *= dsf.dimensions();
1278 source_ *= dsf.primitiveField();
1284 dsf.mesh().boundary()[
patchi].patchInternalField
1286 dsf.primitiveField()
1290 internalCoeffs_[
patchi] *= pisf;
1291 boundaryCoeffs_[
patchi] *= pisf;
1294 if (faceFluxCorrectionPtr_)
1297 <<
"cannot scale a matrix containing a faceFluxCorrection"
1303 template<
class Type>
1314 template<
class Type>
1325 template<
class Type>
1331 dimensions_ *= ds.dimensions();
1333 source_ *= ds.value();
1334 internalCoeffs_ *= ds.value();
1335 boundaryCoeffs_ *= ds.value();
1337 if (faceFluxCorrectionPtr_)
1339 *faceFluxCorrectionPtr_ *= ds.value();
1344 template<
class Type>
1350 dimensions_ /= dsf.dimensions();
1352 source_ /= dsf.primitiveField();
1358 dsf.mesh().boundary()[
patchi].patchInternalField
1360 dsf.primitiveField()
1364 internalCoeffs_[
patchi] /= pisf;
1365 boundaryCoeffs_[
patchi] /= pisf;
1368 if (faceFluxCorrectionPtr_)
1371 <<
"cannot scale a matrix containing a faceFluxCorrection"
1377 template<
class Type>
1388 template<
class Type>
1399 template<
class Type>
1405 dimensions_ /= ds.dimensions();
1407 source_ /= ds.value();
1408 internalCoeffs_ /= ds.value();
1409 boundaryCoeffs_ /= ds.value();
1411 if (faceFluxCorrectionPtr_)
1413 *faceFluxCorrectionPtr_ /= ds.value();
1420 template<
class Type>
1428 if (&fvm1.
psi() != &fvm2.
psi())
1431 <<
"incompatible fields for operation "
1433 <<
"[" << fvm1.
psi().name() <<
"] "
1435 <<
" [" << fvm2.
psi().name() <<
"]"
1442 <<
"incompatible dimensions for operation "
1452 template<
class Type>
1472 template<
class Type>
1483 <<
"incompatible dimensions for operation "
1493 template<
class Type>
1496 const fvMatrix<Type>&
A
1499 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
1509 template<
class Type>
1512 const tmp<fvMatrix<Type>>& tA
1515 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
1527 template<
class Type>
1530 const fvMatrix<Type>&
A,
1531 const fvMatrix<Type>&
B
1538 template<
class Type>
1541 const tmp<fvMatrix<Type>>& tA,
1542 const fvMatrix<Type>&
B
1549 template<
class Type>
1552 const fvMatrix<Type>&
A,
1553 const tmp<fvMatrix<Type>>& tB
1560 template<
class Type>
1563 const tmp<fvMatrix<Type>>& tA,
1564 const tmp<fvMatrix<Type>>& tB
1571 template<
class Type>
1574 const fvMatrix<Type>&
A,
1575 const DimensionedField<Type, volMesh>& su
1579 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1580 tC.ref().source() += su.mesh().V()*su.primitiveField();
1584 template<
class Type>
1587 const fvMatrix<Type>&
A,
1588 const tmp<DimensionedField<Type, volMesh>>& tsu
1592 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1593 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1598 template<
class Type>
1601 const fvMatrix<Type>&
A,
1602 const tmp<VolField<Type>>& tsu
1606 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1607 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1612 template<
class Type>
1615 const tmp<fvMatrix<Type>>& tA,
1616 const DimensionedField<Type, volMesh>& su
1620 tmp<fvMatrix<Type>> tC(tA.ptr());
1621 tC.ref().source() += su.mesh().V()*su.primitiveField();
1625 template<
class Type>
1628 const tmp<fvMatrix<Type>>& tA,
1629 const tmp<DimensionedField<Type, volMesh>>& tsu
1633 tmp<fvMatrix<Type>> tC(tA.ptr());
1634 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1639 template<
class Type>
1642 const tmp<fvMatrix<Type>>& tA,
1643 const tmp<VolField<Type>>& tsu
1647 tmp<fvMatrix<Type>> tC(tA.ptr());
1648 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
1653 template<
class Type>
1656 const fvMatrix<Type>&
A,
1657 const dimensioned<Type>& su
1661 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1662 tC.ref().source() +=
A.psi().mesh().V()*su.value();
1666 template<
class Type>
1669 const tmp<fvMatrix<Type>>& tA,
1670 const dimensioned<Type>& su
1674 tmp<fvMatrix<Type>> tC(tA.ptr());
1675 tC.ref().source() += tC().psi().mesh().V()*su.value();
1679 template<
class Type>
1682 const fvMatrix<Type>&
A,
1690 template<
class Type>
1693 const tmp<fvMatrix<Type>>& tA,
1701 template<
class Type>
1704 const fvMatrix<Type>&
A
1707 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1712 template<
class Type>
1715 const tmp<fvMatrix<Type>>& tA
1718 tmp<fvMatrix<Type>> tC(tA.ptr());
1724 template<
class Type>
1727 const fvMatrix<Type>&
A,
1728 const fvMatrix<Type>&
B
1732 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1737 template<
class Type>
1740 const tmp<fvMatrix<Type>>& tA,
1741 const fvMatrix<Type>&
B
1745 tmp<fvMatrix<Type>> tC(tA.
ptr());
1750 template<
class Type>
1753 const fvMatrix<Type>&
A,
1754 const tmp<fvMatrix<Type>>& tB
1758 tmp<fvMatrix<Type>> tC(tB.ptr());
1763 template<
class Type>
1766 const tmp<fvMatrix<Type>>& tA,
1767 const tmp<fvMatrix<Type>>& tB
1771 tmp<fvMatrix<Type>> tC(tA.
ptr());
1777 template<
class Type>
1780 const fvMatrix<Type>&
A,
1781 const DimensionedField<Type, volMesh>& su
1785 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1786 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1790 template<
class Type>
1793 const fvMatrix<Type>&
A,
1794 const tmp<DimensionedField<Type, volMesh>>& tsu
1798 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1799 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1804 template<
class Type>
1807 const fvMatrix<Type>&
A,
1808 const tmp<VolField<Type>>& tsu
1812 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1813 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1818 template<
class Type>
1821 const tmp<fvMatrix<Type>>& tA,
1822 const DimensionedField<Type, volMesh>& su
1826 tmp<fvMatrix<Type>> tC(tA.
ptr());
1827 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1831 template<
class Type>
1834 const tmp<fvMatrix<Type>>& tA,
1835 const tmp<DimensionedField<Type, volMesh>>& tsu
1839 tmp<fvMatrix<Type>> tC(tA.
ptr());
1840 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1845 template<
class Type>
1848 const tmp<fvMatrix<Type>>& tA,
1849 const tmp<VolField<Type>>& tsu
1853 tmp<fvMatrix<Type>> tC(tA.
ptr());
1854 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1859 template<
class Type>
1862 const DimensionedField<Type, volMesh>& su,
1863 const fvMatrix<Type>&
A
1867 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1868 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1872 template<
class Type>
1875 const tmp<DimensionedField<Type, volMesh>>& tsu,
1876 const fvMatrix<Type>&
A
1880 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1881 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1886 template<
class Type>
1889 const tmp<VolField<Type>>& tsu,
1890 const fvMatrix<Type>&
A
1894 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1895 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1900 template<
class Type>
1903 const DimensionedField<Type, volMesh>& su,
1904 const tmp<fvMatrix<Type>>& tA
1908 tmp<fvMatrix<Type>> tC(tA.
ptr());
1909 tC.ref().source() -= su.mesh().V()*su.primitiveField();
1913 template<
class Type>
1916 const tmp<DimensionedField<Type, volMesh>>& tsu,
1917 const tmp<fvMatrix<Type>>& tA
1921 tmp<fvMatrix<Type>> tC(tA.
ptr());
1922 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1927 template<
class Type>
1930 const tmp<VolField<Type>>& tsu,
1931 const tmp<fvMatrix<Type>>& tA
1935 tmp<fvMatrix<Type>> tC(tA.
ptr());
1936 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
1942 template<
class Type>
1945 const fvMatrix<Type>&
A,
1946 const fvMatrix<Type>&
B
1950 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
1955 template<
class Type>
1958 const tmp<fvMatrix<Type>>& tA,
1959 const fvMatrix<Type>&
B
1963 tmp<fvMatrix<Type>> tC(tA.
ptr());
1968 template<
class Type>
1971 const fvMatrix<Type>&
A,
1972 const tmp<fvMatrix<Type>>& tB
1976 tmp<fvMatrix<Type>> tC(tB.ptr());
1982 template<
class Type>
1985 const tmp<fvMatrix<Type>>& tA,
1986 const tmp<fvMatrix<Type>>& tB
1990 tmp<fvMatrix<Type>> tC(tA.
ptr());
1996 template<
class Type>
1999 const fvMatrix<Type>&
A,
2000 const DimensionedField<Type, volMesh>& su
2004 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2005 tC.ref().source() += su.mesh().V()*su.primitiveField();
2009 template<
class Type>
2012 const fvMatrix<Type>&
A,
2013 const tmp<DimensionedField<Type, volMesh>>& tsu
2017 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2018 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2023 template<
class Type>
2026 const fvMatrix<Type>&
A,
2027 const tmp<VolField<Type>>& tsu
2031 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2032 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2037 template<
class Type>
2040 const tmp<fvMatrix<Type>>& tA,
2041 const DimensionedField<Type, volMesh>& su
2045 tmp<fvMatrix<Type>> tC(tA.
ptr());
2046 tC.ref().source() += su.mesh().V()*su.primitiveField();
2050 template<
class Type>
2053 const tmp<fvMatrix<Type>>& tA,
2054 const tmp<DimensionedField<Type, volMesh>>& tsu
2058 tmp<fvMatrix<Type>> tC(tA.
ptr());
2059 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2064 template<
class Type>
2067 const tmp<fvMatrix<Type>>& tA,
2068 const tmp<VolField<Type>>& tsu
2072 tmp<fvMatrix<Type>> tC(tA.
ptr());
2073 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2078 template<
class Type>
2081 const DimensionedField<Type, volMesh>& su,
2082 const fvMatrix<Type>&
A
2086 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2088 tC.ref().source() -= su.mesh().V()*su.primitiveField();
2092 template<
class Type>
2095 const tmp<DimensionedField<Type, volMesh>>& tsu,
2096 const fvMatrix<Type>&
A
2100 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2102 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2107 template<
class Type>
2110 const tmp<VolField<Type>>& tsu,
2111 const fvMatrix<Type>&
A
2115 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2117 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2122 template<
class Type>
2125 const DimensionedField<Type, volMesh>& su,
2126 const tmp<fvMatrix<Type>>& tA
2130 tmp<fvMatrix<Type>> tC(tA.
ptr());
2132 tC.ref().source() -= su.mesh().V()*su.primitiveField();
2136 template<
class Type>
2139 const tmp<DimensionedField<Type, volMesh>>& tsu,
2140 const tmp<fvMatrix<Type>>& tA
2144 tmp<fvMatrix<Type>> tC(tA.
ptr());
2146 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2151 template<
class Type>
2154 const tmp<VolField<Type>>& tsu,
2155 const tmp<fvMatrix<Type>>& tA
2159 tmp<fvMatrix<Type>> tC(tA.
ptr());
2161 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2166 template<
class Type>
2169 const fvMatrix<Type>&
A,
2170 const dimensioned<Type>& su
2174 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2175 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2179 template<
class Type>
2182 const tmp<fvMatrix<Type>>& tA,
2183 const dimensioned<Type>& su
2187 tmp<fvMatrix<Type>> tC(tA.
ptr());
2188 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2192 template<
class Type>
2195 const dimensioned<Type>& su,
2196 const fvMatrix<Type>&
A
2200 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2201 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2205 template<
class Type>
2208 const dimensioned<Type>& su,
2209 const tmp<fvMatrix<Type>>& tA
2213 tmp<fvMatrix<Type>> tC(tA.
ptr());
2214 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2218 template<
class Type>
2221 const fvMatrix<Type>&
A,
2222 const dimensioned<Type>& su
2226 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2227 tC.ref().source() += su.value()*tC().psi().mesh().V();
2231 template<
class Type>
2234 const tmp<fvMatrix<Type>>& tA,
2235 const dimensioned<Type>& su
2239 tmp<fvMatrix<Type>> tC(tA.
ptr());
2240 tC.ref().source() += su.value()*tC().psi().mesh().V();
2244 template<
class Type>
2247 const dimensioned<Type>& su,
2248 const fvMatrix<Type>&
A
2252 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2254 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2258 template<
class Type>
2261 const dimensioned<Type>& su,
2262 const tmp<fvMatrix<Type>>& tA
2266 tmp<fvMatrix<Type>> tC(tA.
ptr());
2268 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2273 template<
class Type>
2277 const fvMatrix<Type>&
A
2280 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2285 template<
class Type>
2288 const tmp<volScalarField::Internal>& tdsf,
2289 const fvMatrix<Type>&
A
2292 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2297 template<
class Type>
2300 const tmp<volScalarField>& tvsf,
2301 const fvMatrix<Type>&
A
2304 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2309 template<
class Type>
2313 const tmp<fvMatrix<Type>>& tA
2316 tmp<fvMatrix<Type>> tC(tA.
ptr());
2321 template<
class Type>
2324 const tmp<volScalarField::Internal>& tdsf,
2325 const tmp<fvMatrix<Type>>& tA
2328 tmp<fvMatrix<Type>> tC(tA.
ptr());
2333 template<
class Type>
2336 const tmp<volScalarField>& tvsf,
2337 const tmp<fvMatrix<Type>>& tA
2340 tmp<fvMatrix<Type>> tC(tA.
ptr());
2345 template<
class Type>
2348 const dimensioned<scalar>& ds,
2349 const fvMatrix<Type>&
A
2352 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2357 template<
class Type>
2360 const dimensioned<scalar>& ds,
2361 const tmp<fvMatrix<Type>>& tA
2364 tmp<fvMatrix<Type>> tC(tA.
ptr());
2370 template<
class Type>
2373 const fvMatrix<Type>&
A,
2377 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2382 template<
class Type>
2385 const fvMatrix<Type>&
A,
2386 const tmp<volScalarField::Internal>& tdsf
2389 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2394 template<
class Type>
2397 const fvMatrix<Type>&
A,
2398 const tmp<volScalarField>& tvsf
2401 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2406 template<
class Type>
2409 const tmp<fvMatrix<Type>>& tA,
2413 tmp<fvMatrix<Type>> tC(tA.ptr());
2418 template<
class Type>
2421 const tmp<fvMatrix<Type>>& tA,
2422 const tmp<volScalarField::Internal>& tdsf
2425 tmp<fvMatrix<Type>> tC(tA.ptr());
2430 template<
class Type>
2433 const tmp<fvMatrix<Type>>& tA,
2434 const tmp<volScalarField>& tvsf
2437 tmp<fvMatrix<Type>> tC(tA.ptr());
2442 template<
class Type>
2445 const fvMatrix<Type>&
A,
2446 const dimensioned<scalar>& ds
2449 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2454 template<
class Type>
2457 const tmp<fvMatrix<Type>>& tA,
2458 const dimensioned<scalar>& ds
2461 tmp<fvMatrix<Type>> tC(tA.ptr());
2467 template<
class Type>
2471 const fvMatrix<Type>&
M,
2472 const DimensionedField<Type, volMesh>&
psi
2475 tmp<VolField<Type>> tMphi
2482 extrapolatedCalculatedFvPatchScalarField::typeName
2485 VolField<Type>& Mphi = tMphi.ref();
2490 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
2494 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2495 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2500 Mphi.primitiveFieldRef() =
Zero;
2503 Mphi.primitiveFieldRef() +=
2505 M.addBoundarySource(Mphi.primitiveFieldRef());
2507 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2508 Mphi.correctBoundaryConditions();
2513 template<
class Type>
2517 const fvMatrix<Type>&
M,
2518 const tmp<DimensionedField<Type, volMesh>>& tpsi
2521 tmp<VolField<Type>> tMpsi =
M & tpsi();
2526 template<
class Type>
2530 const fvMatrix<Type>&
M,
2531 const tmp<VolField<Type>>& tpsi
2534 tmp<VolField<Type>> tMpsi =
M & tpsi();
2539 template<
class Type>
2543 const tmp<fvMatrix<Type>>& tM,
2544 const DimensionedField<Type, volMesh>&
psi
2547 tmp<VolField<Type>> tMpsi = tM() &
psi;
2552 template<
class Type>
2556 const tmp<fvMatrix<Type>>& tM,
2557 const tmp<DimensionedField<Type, volMesh>>& tpsi
2560 tmp<VolField<Type>> tMpsi = tM() & tpsi();
2566 template<
class Type>
2570 const tmp<fvMatrix<Type>>& tM,
2571 const tmp<VolField<Type>>& tpsi
2574 tmp<VolField<Type>> tMpsi = tM() & tpsi();
2583 template<
class Type>
2586 os << static_cast<const lduMatrix&>(fvm) <<
nl
2587 << fvm.dimensions_ <<
nl
2588 << fvm.source_ <<
nl
2589 << fvm.internalCoeffs_ <<
nl
2590 << fvm.boundaryCoeffs_ <<
endl;
2592 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.
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.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
void updateCoeffs()
Update the boundary condition coefficients.
Generic GeometricField class.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
DimensionedField< Type, GeoMesh > Internal
Type of the internal field from which this GeometricField is derived.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
void replace(const direction, const GeometricField< cmptType, PatchField, GeoMesh > &)
void correctBoundaryConditions()
Correct boundary field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, 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.
const polyMesh & mesh() const
Return reference to polyMesh.
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.
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...
#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)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
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)
void deleteDemandDrivenData(DataType *&dataPtr)
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 *)
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)
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 > &)
typename VolField< Type >::Internal VolInternalField
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 &os, const fvConstraints &constraints)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary fractions(initialConditions.subDict("fractions"))
faceListList boundary(nPatches)
conserve primitiveFieldRef()+