52 <<
"addressing (" << addr.
size()
53 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 59 intf[addr[faceI]] += pf[faceI];
69 const tmp<Field<Type2>>& tpf,
73 addToInternalField(addr, tpf(), intf);
90 <<
"addressing (" << addr.
size()
91 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 97 intf[addr[faceI]] -= pf[faceI];
103 template<
class Type2>
107 const tmp<Field<Type2>>& tpf,
111 subtractFromInternalField(addr, tpf(), intf);
123 forAll(internalCoeffs_, patchI)
127 lduAddr().patchAddr(patchI),
128 internalCoeffs_[patchI].
component(solveCmpt),
138 forAll(internalCoeffs_, patchI)
142 lduAddr().patchAddr(patchI),
143 cmptAv(internalCoeffs_[patchI]),
157 forAll(psi_.boundaryField(), patchI)
159 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
160 const Field<Type>& pbc = boundaryCoeffs_[patchI];
164 addToInternalField(lduAddr().patchAddr(patchI), pbc, source);
168 tmp<Field<Type>> tpnf = ptf.patchNeighbourField();
169 const Field<Type>& pnf = tpnf();
171 const labelUList& addr = lduAddr().patchAddr(patchI);
175 source[addr[facei]] +=
cmptMultiply(pbc[facei], pnf[facei]);
197 faceFluxCorrectionPtr_(nullptr)
200 <<
"constructing faMatrix<Type> for field " << psi_.
name()
221 const_cast<GeometricField<Type, faPatchField, areaMesh>&
>(psi_);
223 const label currentStatePsi = psiRef.eventNo();
224 psiRef.boundaryFieldRef().updateCoeffs();
225 psiRef.eventNo() = currentStatePsi;
234 dimensions_(
fam.dimensions_),
235 source_(
fam.source_),
236 internalCoeffs_(
fam.internalCoeffs_),
237 boundaryCoeffs_(
fam.boundaryCoeffs_),
238 faceFluxCorrectionPtr_(nullptr)
241 <<
"Copying faMatrix<Type> for field " << psi_.
name() <<
endl;
243 if (
fam.faceFluxCorrectionPtr_)
245 faceFluxCorrectionPtr_ =
248 *(
fam.faceFluxCorrectionPtr_)
257 lduMatrix(tmat.constCast(), tmat.movable()),
259 dimensions_(tmat().dimensions_),
260 source_(tmat.constCast().source_, tmat.movable()),
261 internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
262 boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable()),
263 faceFluxCorrectionPtr_(nullptr)
266 <<
"Copy/Move faMatrix<Type> for field " << psi_.
name() <<
endl;
268 if (tmat().faceFluxCorrectionPtr_)
272 faceFluxCorrectionPtr_ = tmat().faceFluxCorrectionPtr_;
273 tmat().faceFluxCorrectionPtr_ =
nullptr;
277 faceFluxCorrectionPtr_ =
278 new GeometricField<Type, faePatchField, edgeMesh>
280 *(tmat().faceFluxCorrectionPtr_)
295 <<
"Destroying faMatrix<Type> for field " << psi_.name() <<
endl;
304 template<
template<
class>
class ListType>
308 const ListType<Type>&
values 315 this->eliminatedEqns().insert(i);
338 if (symmetric() || asymmetric())
343 const Type& value =
values[i];
345 for (
const label edgei : edges[facei])
347 if (
mesh.isInternalEdge(edgei))
351 if (facei == own[edgei])
353 source_[nei[edgei]] -=
upper()[edgei]*value;
357 source_[own[edgei]] -=
upper()[edgei]*value;
360 upper()[edgei] = 0.0;
364 if (facei == own[edgei])
366 source_[nei[edgei]] -=
lower()[edgei]*value;
370 source_[own[edgei]] -=
upper()[edgei]*value;
373 upper()[edgei] = 0.0;
374 lower()[edgei] = 0.0;
381 if (internalCoeffs_[patchi].size())
383 const label patchEdgei =
386 internalCoeffs_[patchi][patchEdgei] =
Zero;
387 boundaryCoeffs_[patchi][patchEdgei] =
Zero;
399 const Type& value =
values[i];
402 source_[facei] = value*Diag[facei];
445 const bool forceReference
448 if ((forceReference || psi_.needReference()) && facei >= 0)
452 source()[facei] +=
diag()[facei]*value;
464 const bool forceReference
467 if (forceReference || psi_.needReference())
486 const UList<Type>&
values,
487 const bool forceReference
490 if (forceReference || psi_.needReference())
513 Field<Type>& S = source();
521 sumMagOffDiag(sumOff);
524 forAll(psi_.boundaryField(), patchI)
526 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
530 const labelUList& pa = lduAddr().patchAddr(patchI);
531 Field<Type>& iCoeffs = internalCoeffs_[patchI];
535 const Field<Type>& pCoeffs = boundaryCoeffs_[patchI];
553 Type iCoeff0 = iCoeffs[face];
554 iCoeffs[face] =
cmptMag(iCoeffs[face]);
555 sumOff[pa[face]] -=
cmptMin(iCoeffs[face]);
556 iCoeffs[face] /=
alpha;
571 forAll(psi_.boundaryField(), patchI)
573 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
577 const labelUList& pa = lduAddr().patchAddr(patchI);
578 Field<Type>& iCoeffs = internalCoeffs_[patchI];
591 S += (
D - D0)*psi_.primitiveField();
598 scalar relaxCoeff = 0;
600 if (psi_.mesh().relaxEquation(psi_.name(), relaxCoeff))
607 <<
"No relaxation specified for field " << psi_.name() <<
nl;
616 addCmptAvBoundaryDiag(tdiag.ref());
626 "A(" + psi_.name() +
')',
628 dimensions_/psi_.dimensions()/
dimArea,
632 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().S();
633 tAphi.ref().correctBoundaryConditions();
645 "H(" + psi_.name() +
')',
650 auto& Hphi = tHphi.ref();
655 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
658 addBoundaryDiag(boundaryDiagCmpt, cmpt);
659 boundaryDiagCmpt.negate();
660 addCmptAvBoundaryDiag(boundaryDiagCmpt);
679 if (!psi_.mesh().fluxRequired(psi_.name()))
682 <<
"flux requested but " << psi_.name()
683 <<
" not specified in the fluxRequired sub-dictionary of faSchemes" 689 "flux(" + psi_.name() +
')',
693 auto& fieldFlux = tfieldFlux.ref();
697 fieldFlux.primitiveFieldRef().replace
704 FieldField<Field, Type> InternalContrib = internalCoeffs_;
706 forAll(InternalContrib, patchI)
708 InternalContrib[patchI] =
711 InternalContrib[patchI],
712 psi_.boundaryField()[patchI].patchInternalField()
716 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
718 forAll(NeighbourContrib, patchI)
720 if (psi_.boundaryField()[patchI].coupled())
722 NeighbourContrib[patchI] =
725 NeighbourContrib[patchI],
726 psi_.boundaryField()[patchI].patchNeighbourField()
731 forAll(fieldFlux.boundaryField(), patchI)
733 fieldFlux.boundaryFieldRef()[patchI] =
734 InternalContrib[patchI] - NeighbourContrib[patchI];
737 if (faceFluxCorrectionPtr_)
739 fieldFlux += *faceFluxCorrectionPtr_;
752 return psi_.mesh().solverDict(
name);
759 return psi_.mesh().solverDict
776 if (&psi_ != &(famv.psi_))
779 <<
"different fields" 784 source_ = famv.source_;
785 internalCoeffs_ = famv.internalCoeffs_;
786 boundaryCoeffs_ = famv.boundaryCoeffs_;
788 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
790 *faceFluxCorrectionPtr_ = *famv.faceFluxCorrectionPtr_;
792 else if (famv.faceFluxCorrectionPtr_)
794 faceFluxCorrectionPtr_ =
796 (*famv.faceFluxCorrectionPtr_);
814 internalCoeffs_.negate();
815 boundaryCoeffs_.negate();
817 if (faceFluxCorrectionPtr_)
819 faceFluxCorrectionPtr_->negate();
829 dimensions_ += famv.dimensions_;
831 source_ += famv.source_;
832 internalCoeffs_ += famv.internalCoeffs_;
833 boundaryCoeffs_ += famv.boundaryCoeffs_;
835 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
837 *faceFluxCorrectionPtr_ += *famv.faceFluxCorrectionPtr_;
839 else if (famv.faceFluxCorrectionPtr_)
841 faceFluxCorrectionPtr_ =
new 842 GeometricField<Type, faePatchField, edgeMesh>
844 *famv.faceFluxCorrectionPtr_
863 dimensions_ -= famv.dimensions_;
865 source_ -= famv.source_;
866 internalCoeffs_ -= famv.internalCoeffs_;
867 boundaryCoeffs_ -= famv.boundaryCoeffs_;
869 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
871 *faceFluxCorrectionPtr_ -= *famv.faceFluxCorrectionPtr_;
873 else if (famv.faceFluxCorrectionPtr_)
875 faceFluxCorrectionPtr_ =
877 (-*famv.faceFluxCorrectionPtr_);
897 source() -= su.mesh().S()*su.field();
930 source() += su.mesh().S()*su.field();
962 source() -=
psi().
mesh().S()*su;
972 source() +=
psi().
mesh().S()*su;
982 dimensions_ *= dsf.dimensions();
984 source_ *= dsf.field();
986 forAll(boundaryCoeffs_, patchi)
990 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
992 internalCoeffs_[patchi] *= pisf;
993 boundaryCoeffs_[patchi] *= pisf;
996 if (faceFluxCorrectionPtr_)
999 <<
"cannot scale a matrix containing a faceFluxCorrection" 1005 template<
class Type>
1008 const tmp<areaScalarField::Internal>& tfld
1016 template<
class Type>
1027 template<
class Type>
1033 dimensions_ *= ds.dimensions();
1035 source_ *= ds.value();
1036 internalCoeffs_ *= ds.value();
1037 boundaryCoeffs_ *= ds.value();
1039 if (faceFluxCorrectionPtr_)
1041 *faceFluxCorrectionPtr_ *= ds.value();
1048 template<
class Type>
1051 const faMatrix<Type>& mat1,
1052 const faMatrix<Type>& mat2,
1056 if (&mat1.psi() != &mat2.psi())
1059 <<
"Incompatible fields for operation\n " 1060 <<
"[" << mat1.psi().name() <<
"] " 1062 <<
" [" << mat2.psi().name() <<
"]" 1069 && mat1.dimensions() != mat2.dimensions()
1073 <<
"Incompatible dimensions for operation\n " 1074 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimArea <<
" ] " 1076 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimArea <<
" ]" 1082 template<
class Type>
1085 const faMatrix<Type>& mat,
1086 const DimensionedField<Type, areaMesh>&
fld,
1093 && mat.dimensions()/
dimArea !=
fld.dimensions()
1097 <<
"Incompatible dimensions for operation\n " 1098 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1100 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1106 template<
class Type>
1109 const faMatrix<Type>& mat,
1110 const dimensioned<Type>& dt,
1117 && mat.dimensions()/
dimArea != dt.dimensions()
1121 <<
"Incompatible dimensions for operation\n " 1122 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1124 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1130 template<
class Type>
1133 faMatrix<Type>& mat,
1137 return mat.solve(solverControls);
1141 template<
class Type>
1144 const tmp<faMatrix<Type>>& tmat,
1148 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1156 template<
class Type>
1159 faMatrix<Type>& mat,
1163 return mat.solve(
name);
1167 template<
class Type>
1170 const tmp<faMatrix<Type>>& tmat,
1174 SolverPerformance<Type> solverPerf(tmat.constCast().solve(
name));
1182 template<
class Type>
1189 template<
class Type>
1192 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1202 template<
class Type>
1205 const faMatrix<Type>&
A,
1206 const faMatrix<Type>&
B 1210 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1216 template<
class Type>
1219 const tmp<faMatrix<Type>>& tA,
1220 const faMatrix<Type>&
B 1224 tmp<faMatrix<Type>> tC(tA.
ptr());
1230 template<
class Type>
1233 const faMatrix<Type>&
A,
1234 const tmp<faMatrix<Type>>& tB
1238 tmp<faMatrix<Type>> tC(tB.ptr());
1244 template<
class Type>
1247 const tmp<faMatrix<Type>>& tA,
1248 const tmp<faMatrix<Type>>& tB
1252 tmp<faMatrix<Type>> tC(tA.
ptr());
1259 template<
class Type>
1262 const faMatrix<Type>&
A 1265 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1271 template<
class Type>
1274 const tmp<faMatrix<Type>>& tA
1277 tmp<faMatrix<Type>> tC(tA.
ptr());
1283 template<
class Type>
1286 const faMatrix<Type>&
A,
1287 const faMatrix<Type>&
B 1291 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1297 template<
class Type>
1300 const tmp<faMatrix<Type>>& tA,
1301 const faMatrix<Type>&
B 1305 tmp<faMatrix<Type>> tC(tA.
ptr());
1311 template<
class Type>
1314 const faMatrix<Type>&
A,
1315 const tmp<faMatrix<Type>>& tB
1319 tmp<faMatrix<Type>> tC(tB.ptr());
1326 template<
class Type>
1329 const tmp<faMatrix<Type>>& tA,
1330 const tmp<faMatrix<Type>>& tB
1334 tmp<faMatrix<Type>> tC(tA.
ptr());
1341 template<
class Type>
1344 const faMatrix<Type>&
A,
1345 const faMatrix<Type>&
B 1353 template<
class Type>
1356 const tmp<faMatrix<Type>>& tA,
1357 const faMatrix<Type>&
B 1365 template<
class Type>
1368 const faMatrix<Type>&
A,
1369 const tmp<faMatrix<Type>>& tB
1377 template<
class Type>
1380 const tmp<faMatrix<Type>>& tA,
1381 const tmp<faMatrix<Type>>& tB
1389 template<
class Type>
1392 const faMatrix<Type>&
A,
1393 const DimensionedField<Type, areaMesh>& su
1398 tC.ref().source() -= su.mesh().S()*su.field();
1403 template<
class Type>
1406 const faMatrix<Type>&
A,
1407 const tmp<DimensionedField<Type, areaMesh>>& tsu
1412 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1418 template<
class Type>
1421 const faMatrix<Type>&
A,
1422 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1427 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1433 template<
class Type>
1436 const tmp<faMatrix<Type>>& tA,
1437 const DimensionedField<Type, areaMesh>& su
1441 tmp<faMatrix<Type>> tC(tA.
ptr());
1442 tC.ref().source() -= su.mesh().S()*su.field();
1447 template<
class Type>
1450 const tmp<faMatrix<Type>>& tA,
1451 const tmp<DimensionedField<Type, areaMesh>>& tsu
1455 tmp<faMatrix<Type>> tC(tA.
ptr());
1456 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1462 template<
class Type>
1465 const tmp<faMatrix<Type>>& tA,
1466 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1470 tmp<faMatrix<Type>> tC(tA.
ptr());
1471 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1477 template<
class Type>
1480 const DimensionedField<Type, areaMesh>& su,
1481 const faMatrix<Type>&
A 1486 tC.ref().source() -= su.mesh().S()*su.field();
1491 template<
class Type>
1494 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1495 const faMatrix<Type>&
A 1500 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1506 template<
class Type>
1509 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1510 const faMatrix<Type>&
A 1515 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1521 template<
class Type>
1524 const DimensionedField<Type, areaMesh>& su,
1525 const tmp<faMatrix<Type>>& tA
1529 tmp<faMatrix<Type>> tC(tA.
ptr());
1530 tC.ref().source() -= su.mesh().S()*su.field();
1535 template<
class Type>
1538 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1539 const tmp<faMatrix<Type>>& tA
1543 tmp<faMatrix<Type>> tC(tA.
ptr());
1544 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1550 template<
class Type>
1553 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1554 const tmp<faMatrix<Type>>& tA
1558 tmp<faMatrix<Type>> tC(tA.
ptr());
1559 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1565 template<
class Type>
1568 const faMatrix<Type>&
A,
1569 const DimensionedField<Type, areaMesh>& su
1574 tC.ref().source() += su.mesh().S()*su.field();
1579 template<
class Type>
1582 const faMatrix<Type>&
A,
1583 const tmp<DimensionedField<Type, areaMesh>>& tsu
1588 tC.ref().source() += tsu().mesh().S()*tsu().field();
1594 template<
class Type>
1597 const faMatrix<Type>&
A,
1598 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1603 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1609 template<
class Type>
1612 const tmp<faMatrix<Type>>& tA,
1613 const DimensionedField<Type, areaMesh>& su
1617 tmp<faMatrix<Type>> tC(tA.
ptr());
1618 tC.ref().source() += su.mesh().S()*su.field();
1623 template<
class Type>
1626 const tmp<faMatrix<Type>>& tA,
1627 const tmp<DimensionedField<Type, areaMesh>>& tsu
1631 tmp<faMatrix<Type>> tC(tA.
ptr());
1632 tC.ref().source() += tsu().mesh().S()*tsu().field();
1638 template<
class Type>
1641 const tmp<faMatrix<Type>>& tA,
1642 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1646 tmp<faMatrix<Type>> tC(tA.
ptr());
1647 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1653 template<
class Type>
1656 const DimensionedField<Type, areaMesh>& su,
1657 const faMatrix<Type>&
A 1663 tC.ref().source() -= su.mesh().S()*su.field();
1668 template<
class Type>
1671 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1672 const faMatrix<Type>&
A 1678 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1684 template<
class Type>
1687 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1688 const faMatrix<Type>&
A 1694 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1700 template<
class Type>
1703 const DimensionedField<Type, areaMesh>& su,
1704 const tmp<faMatrix<Type>>& tA
1708 tmp<faMatrix<Type>> tC(tA.
ptr());
1710 tC.ref().source() -= su.mesh().S()*su.field();
1715 template<
class Type>
1718 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1719 const tmp<faMatrix<Type>>& tA
1723 tmp<faMatrix<Type>> tC(tA.
ptr());
1725 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1731 template<
class Type>
1734 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1735 const tmp<faMatrix<Type>>& tA
1739 tmp<faMatrix<Type>> tC(tA.
ptr());
1741 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1747 template<
class Type>
1750 const faMatrix<Type>&
A,
1751 const dimensioned<Type>& su
1756 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1761 template<
class Type>
1764 const tmp<faMatrix<Type>>& tA,
1765 const dimensioned<Type>& su
1769 tmp<faMatrix<Type>> tC(tA.
ptr());
1770 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1775 template<
class Type>
1778 const dimensioned<Type>& su,
1779 const faMatrix<Type>&
A 1784 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1789 template<
class Type>
1792 const dimensioned<Type>& su,
1793 const tmp<faMatrix<Type>>& tA
1797 tmp<faMatrix<Type>> tC(tA.
ptr());
1798 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1803 template<
class Type>
1806 const faMatrix<Type>&
A,
1807 const dimensioned<Type>& su
1812 tC.ref().source() += su.value()*tC().psi().mesh().S();
1817 template<
class Type>
1820 const tmp<faMatrix<Type>>& tA,
1821 const dimensioned<Type>& su
1825 tmp<faMatrix<Type>> tC(tA.
ptr());
1826 tC.ref().source() += su.value()*tC().psi().mesh().S();
1831 template<
class Type>
1834 const dimensioned<Type>& su,
1835 const faMatrix<Type>&
A 1841 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1846 template<
class Type>
1849 const dimensioned<Type>& su,
1850 const tmp<faMatrix<Type>>& tA
1854 tmp<faMatrix<Type>> tC(tA.
ptr());
1856 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1861 template<
class Type>
1864 const faMatrix<Type>&
A,
1865 const DimensionedField<Type, areaMesh>& su
1870 tC.ref().source() += su.mesh().S()*su.field();
1875 template<
class Type>
1878 const faMatrix<Type>&
A,
1879 const tmp<DimensionedField<Type, areaMesh>>& tsu
1884 tC.ref().source() += tsu().mesh().S()*tsu().field();
1890 template<
class Type>
1893 const faMatrix<Type>&
A,
1894 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1899 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1905 template<
class Type>
1908 const tmp<faMatrix<Type>>& tA,
1909 const DimensionedField<Type, areaMesh>& su
1913 tmp<faMatrix<Type>> tC(tA.ptr());
1914 tC.ref().source() += su.mesh().S()*su.field();
1919 template<
class Type>
1922 const tmp<faMatrix<Type>>& tA,
1923 const tmp<DimensionedField<Type, areaMesh>>& tsu
1927 tmp<faMatrix<Type>> tC(tA.ptr());
1928 tC.ref().source() += tsu().mesh().S()*tsu().field();
1934 template<
class Type>
1937 const tmp<faMatrix<Type>>& tA,
1938 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1942 tmp<faMatrix<Type>> tC(tA.ptr());
1943 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1949 template<
class Type>
1952 const faMatrix<Type>&
A,
1953 const dimensioned<Type>& su
1958 tC.ref().source() +=
A.psi().mesh().S()*su.value();
1963 template<
class Type>
1966 const tmp<faMatrix<Type>>& tA,
1967 const dimensioned<Type>& su
1971 tmp<faMatrix<Type>> tC(tA.ptr());
1972 tC.ref().source() += tC().psi().mesh().S()*su.value();
1977 template<
class Type>
1980 const faMatrix<Type>&
A,
1988 template<
class Type>
1991 const tmp<faMatrix<Type>>& tA,
1999 template<
class Type>
2003 const faMatrix<Type>&
A 2012 template<
class Type>
2015 const tmp<areaScalarField::Internal>& tdsf,
2016 const faMatrix<Type>&
A 2025 template<
class Type>
2028 const tmp<areaScalarField>& tvsf,
2029 const faMatrix<Type>&
A 2038 template<
class Type>
2042 const tmp<faMatrix<Type>>& tA
2045 tmp<faMatrix<Type>> tC(tA.ptr());
2051 template<
class Type>
2054 const tmp<areaScalarField::Internal>& tdsf,
2055 const tmp<faMatrix<Type>>& tA
2058 tmp<faMatrix<Type>> tC(tA.ptr());
2064 template<
class Type>
2067 const tmp<areaScalarField>& tvsf,
2068 const tmp<faMatrix<Type>>& tA
2071 tmp<faMatrix<Type>> tC(tA.ptr());
2077 template<
class Type>
2080 const dimensioned<scalar>& ds,
2081 const faMatrix<Type>&
A 2090 template<
class Type>
2093 const dimensioned<scalar>& ds,
2094 const tmp<faMatrix<Type>>& tA
2097 tmp<faMatrix<Type>> tC(tA.ptr());
2103 template<
class Type>
2107 const faMatrix<Type>&
M,
2108 const DimensionedField<Type, areaMesh>&
psi 2118 auto& Mphi = tMphi.ref();
2127 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2128 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2133 Mphi.primitiveFieldRef() =
Zero;
2136 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2137 M.addBoundarySource(Mphi.primitiveFieldRef());
2139 Mphi.primitiveFieldRef() /= -
psi.
mesh().S();
2140 Mphi.correctBoundaryConditions();
2146 template<
class Type>
2150 const faMatrix<Type>&
M,
2151 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2154 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2160 template<
class Type>
2164 const faMatrix<Type>&
M,
2165 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2168 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2174 template<
class Type>
2178 const tmp<faMatrix<Type>>& tM,
2179 const DimensionedField<Type, areaMesh>&
psi 2182 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() &
psi;
2188 template<
class Type>
2192 const tmp<faMatrix<Type>>& tM,
2193 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2196 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2203 template<
class Type>
2207 const tmp<faMatrix<Type>>& tM,
2208 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2211 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2220 template<
class Type>
2223 os << static_cast<const lduMatrix&>(
fam) <<
nl 2224 <<
fam.dimensions_ <<
nl 2225 <<
fam.source_ <<
nl 2226 <<
fam.internalCoeffs_ <<
nl 2227 <<
fam.boundaryCoeffs_ <<
endl;
void negate()
Inplace negate.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
void setValues(const labelUList &faceLabels, const Type &value)
Set solution in given faces to the specified value and eliminate the corresponding equations from the...
void operator-=(const faMatrix< Type > &)
tmp< Field< Type > > faceH(const Field< Type > &) const
tmp< scalarField > D() const
Return the matrix diagonal.
void size(const label n)
Older name for setAddressableSize.
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &f1)
void operator+=(const faMatrix< Type > &)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dictionary & solverDict() const
Return the solver dictionary for psi.
faMatrix(const GeometricField< Type, faPatchField, areaMesh > &psi, const dimensionSet &ds)
Construct given a field to solve for.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const labelListList & faceEdges() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
const word & name() const noexcept
Return the object name.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
void setReferences(const labelUList &faceLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Generic GeometricField class.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Generic dimensioned Type class.
labelList faceLabels(nFaceLabels)
DimensionedField< scalar, areaMesh > Internal
The internal field type from which this GeometricField is derived.
void addBoundarySource(Field< Type > &source, const bool couples=true) const
conserve primitiveFieldRef()+
UList< label > labelUList
A UList of labels.
const labelUList & neighbour() const
Internal face neighbour.
#define forAll(list, i)
Loop across all elements in list.
tmp< GeometricField< Type, faePatchField, edgeMesh > > flux() const
Return the face-flux field from the matrix.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void relax()
Relax matrix (for steady-state solution).
void operator=(const faMatrix< Type > &)
Generic templated field type.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define DebugInFunction
Report an information message using Foam::Info.
void checkMethod(const faMatrix< Type > &, const faMatrix< Type > &, const char *)
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
tmp< GeometricField< Type, faPatchField, areaMesh > > H() const
Return the H operation source.
errorManip< error > abort(error &err)
void setValuesFromList(const labelUList &faceLabels, const ListType< Type > &values)
Set solution in given faces to the specified values.
void operator=(const lduMatrix &)
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
static tmp< GeometricField< scalar, faPatchField, areaMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=faPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
const Mesh & mesh() const noexcept
Return mesh.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void operator*=(const scalarField &)
OBJstream os(runTime.globalPath()/outputName)
tmp< areaScalarField > A() const
Return the central coefficient.
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
void setReference(const label facei, const Type &value, const bool forceReference=false)
Set reference level for solution.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const Field< Type > & field() const noexcept
Return const-reference to the field values.
Template functions to aid in the implementation of demand driven data.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Finite-Area matrix basic solvers.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
static bool checking() noexcept
True if dimension checking is enabled (the usual default)
A List with indirect addressing. Like IndirectList but does not store addressing. ...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A special matrix type and solver, designed for finite area solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
void correctBoundaryConditions()
Correct boundary field.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const GeometricField< Type, faPatchField, areaMesh > & psi() const
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
const volScalarField & psi
tmp< Field< Type > > H(const Field< Type > &) const
const dimensionedScalar & D
void operator-=(const lduMatrix &)
void addCmptAvBoundaryDiag(scalarField &diag) const
void operator+=(const lduMatrix &)
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing temporary objects.
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
void deleteDemandDrivenData(DataPtr &dataPtr)
Calculate the matrix for the second temporal derivative.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
const dimensionSet dimArea(sqr(dimLength))
static constexpr const zero Zero
Global zero (0)
virtual ~faMatrix()
Destructor.