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 if (psi_.mesh().relaxEquation(psi_.name()))
600 relax(psi_.mesh().equationRelaxationFactor(psi_.name()));
605 <<
"Relaxation factor for field " << psi_.name()
606 <<
" not found. Relaxation will not be used." <<
endl;
615 addCmptAvBoundaryDiag(tdiag.ref());
625 "A(" + psi_.name() +
')',
627 dimensions_/psi_.dimensions()/
dimArea,
631 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().S();
632 tAphi.ref().correctBoundaryConditions();
644 "H(" + psi_.name() +
')',
649 auto& Hphi = tHphi.ref();
652 for (
direction cmpt=0; cmpt<Type::nComponents; ++cmpt)
654 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
657 addBoundaryDiag(boundaryDiagCmpt, cmpt);
658 boundaryDiagCmpt.negate();
659 addCmptAvBoundaryDiag(boundaryDiagCmpt);
678 if (!psi_.mesh().fluxRequired(psi_.name()))
681 <<
"flux requested but " << psi_.name()
682 <<
" not specified in the fluxRequired sub-dictionary of faSchemes" 688 "flux(" + psi_.name() +
')',
692 auto& fieldFlux = tfieldFlux.ref();
694 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
696 fieldFlux.primitiveFieldRef().replace
703 FieldField<Field, Type> InternalContrib = internalCoeffs_;
705 forAll(InternalContrib, patchI)
707 InternalContrib[patchI] =
710 InternalContrib[patchI],
711 psi_.boundaryField()[patchI].patchInternalField()
715 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
717 forAll(NeighbourContrib, patchI)
719 if (psi_.boundaryField()[patchI].coupled())
721 NeighbourContrib[patchI] =
724 NeighbourContrib[patchI],
725 psi_.boundaryField()[patchI].patchNeighbourField()
730 forAll(fieldFlux.boundaryField(), patchI)
732 fieldFlux.boundaryFieldRef()[patchI] =
733 InternalContrib[patchI] - NeighbourContrib[patchI];
736 if (faceFluxCorrectionPtr_)
738 fieldFlux += *faceFluxCorrectionPtr_;
755 if (&psi_ != &(famv.psi_))
758 <<
"different fields" 763 source_ = famv.source_;
764 internalCoeffs_ = famv.internalCoeffs_;
765 boundaryCoeffs_ = famv.boundaryCoeffs_;
767 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
769 *faceFluxCorrectionPtr_ = *famv.faceFluxCorrectionPtr_;
771 else if (famv.faceFluxCorrectionPtr_)
773 faceFluxCorrectionPtr_ =
775 (*famv.faceFluxCorrectionPtr_);
793 internalCoeffs_.negate();
794 boundaryCoeffs_.negate();
796 if (faceFluxCorrectionPtr_)
798 faceFluxCorrectionPtr_->negate();
808 dimensions_ += famv.dimensions_;
810 source_ += famv.source_;
811 internalCoeffs_ += famv.internalCoeffs_;
812 boundaryCoeffs_ += famv.boundaryCoeffs_;
814 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
816 *faceFluxCorrectionPtr_ += *famv.faceFluxCorrectionPtr_;
818 else if (famv.faceFluxCorrectionPtr_)
820 faceFluxCorrectionPtr_ =
new 821 GeometricField<Type, faePatchField, edgeMesh>
823 *famv.faceFluxCorrectionPtr_
842 dimensions_ -= famv.dimensions_;
844 source_ -= famv.source_;
845 internalCoeffs_ -= famv.internalCoeffs_;
846 boundaryCoeffs_ -= famv.boundaryCoeffs_;
848 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
850 *faceFluxCorrectionPtr_ -= *famv.faceFluxCorrectionPtr_;
852 else if (famv.faceFluxCorrectionPtr_)
854 faceFluxCorrectionPtr_ =
856 (-*famv.faceFluxCorrectionPtr_);
876 source() -= su.mesh().S()*su.field();
909 source() += su.mesh().S()*su.field();
941 source() -=
psi().
mesh().S()*su;
951 source() +=
psi().
mesh().S()*su;
971 dimensions_ *= dsf.dimensions();
973 source_ *= dsf.field();
975 forAll(boundaryCoeffs_, patchi)
979 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
981 internalCoeffs_[patchi] *= pisf;
982 boundaryCoeffs_[patchi] *= pisf;
985 if (faceFluxCorrectionPtr_)
988 <<
"cannot scale a matrix containing a faceFluxCorrection" 997 const tmp<areaScalarField::Internal>& tfld
1005 template<
class Type>
1016 template<
class Type>
1022 dimensions_ *= ds.dimensions();
1024 source_ *= ds.value();
1025 internalCoeffs_ *= ds.value();
1026 boundaryCoeffs_ *= ds.value();
1028 if (faceFluxCorrectionPtr_)
1030 *faceFluxCorrectionPtr_ *= ds.value();
1037 template<
class Type>
1040 const faMatrix<Type>& mat1,
1041 const faMatrix<Type>& mat2,
1045 if (&mat1.psi() != &mat2.psi())
1048 <<
"Incompatible fields for operation\n " 1049 <<
"[" << mat1.psi().name() <<
"] " 1051 <<
" [" << mat2.psi().name() <<
"]" 1058 && mat1.dimensions() != mat2.dimensions()
1062 <<
"Incompatible dimensions for operation\n " 1063 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimArea <<
" ] " 1065 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimArea <<
" ]" 1071 template<
class Type>
1074 const faMatrix<Type>& mat,
1075 const DimensionedField<Type, areaMesh>&
fld,
1082 && mat.dimensions()/
dimArea !=
fld.dimensions()
1086 <<
"Incompatible dimensions for operation\n " 1087 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1089 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1095 template<
class Type>
1098 const faMatrix<Type>& mat,
1099 const dimensioned<Type>& dt,
1106 && mat.dimensions()/
dimArea != dt.dimensions()
1110 <<
"Incompatible dimensions for operation\n " 1111 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1113 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1119 template<
class Type>
1122 faMatrix<Type>&
fam,
1123 const dictionary& solverControls
1126 return fam.solve(solverControls);
1130 template<
class Type>
1133 const tmp<faMatrix<Type>>& tmat,
1134 const dictionary& solverControls
1137 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1145 template<
class Type>
1152 template<
class Type>
1155 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1165 template<
class Type>
1168 const faMatrix<Type>&
A,
1169 const faMatrix<Type>&
B 1173 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1179 template<
class Type>
1182 const tmp<faMatrix<Type>>& tA,
1183 const faMatrix<Type>&
B 1187 tmp<faMatrix<Type>> tC(tA.
ptr());
1193 template<
class Type>
1196 const faMatrix<Type>&
A,
1197 const tmp<faMatrix<Type>>& tB
1201 tmp<faMatrix<Type>> tC(tB.ptr());
1207 template<
class Type>
1210 const tmp<faMatrix<Type>>& tA,
1211 const tmp<faMatrix<Type>>& tB
1215 tmp<faMatrix<Type>> tC(tA.
ptr());
1222 template<
class Type>
1225 const faMatrix<Type>&
A 1228 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1234 template<
class Type>
1237 const tmp<faMatrix<Type>>& tA
1240 tmp<faMatrix<Type>> tC(tA.
ptr());
1246 template<
class Type>
1249 const faMatrix<Type>&
A,
1250 const faMatrix<Type>&
B 1254 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1260 template<
class Type>
1263 const tmp<faMatrix<Type>>& tA,
1264 const faMatrix<Type>&
B 1268 tmp<faMatrix<Type>> tC(tA.
ptr());
1274 template<
class Type>
1277 const faMatrix<Type>&
A,
1278 const tmp<faMatrix<Type>>& tB
1282 tmp<faMatrix<Type>> tC(tB.ptr());
1289 template<
class Type>
1292 const tmp<faMatrix<Type>>& tA,
1293 const tmp<faMatrix<Type>>& tB
1297 tmp<faMatrix<Type>> tC(tA.
ptr());
1304 template<
class Type>
1307 const faMatrix<Type>&
A,
1308 const faMatrix<Type>&
B 1316 template<
class Type>
1319 const tmp<faMatrix<Type>>& tA,
1320 const faMatrix<Type>&
B 1328 template<
class Type>
1331 const faMatrix<Type>&
A,
1332 const tmp<faMatrix<Type>>& tB
1340 template<
class Type>
1343 const tmp<faMatrix<Type>>& tA,
1344 const tmp<faMatrix<Type>>& tB
1352 template<
class Type>
1355 const faMatrix<Type>&
A,
1356 const DimensionedField<Type, areaMesh>& su
1361 tC.ref().source() -= su.mesh().S()*su.field();
1366 template<
class Type>
1369 const faMatrix<Type>&
A,
1370 const tmp<DimensionedField<Type, areaMesh>>& tsu
1375 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1381 template<
class Type>
1384 const faMatrix<Type>&
A,
1385 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1390 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1396 template<
class Type>
1399 const tmp<faMatrix<Type>>& tA,
1400 const DimensionedField<Type, areaMesh>& su
1404 tmp<faMatrix<Type>> tC(tA.
ptr());
1405 tC.ref().source() -= su.mesh().S()*su.field();
1410 template<
class Type>
1413 const tmp<faMatrix<Type>>& tA,
1414 const tmp<DimensionedField<Type, areaMesh>>& tsu
1418 tmp<faMatrix<Type>> tC(tA.
ptr());
1419 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1425 template<
class Type>
1428 const tmp<faMatrix<Type>>& tA,
1429 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1433 tmp<faMatrix<Type>> tC(tA.
ptr());
1434 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1440 template<
class Type>
1443 const DimensionedField<Type, areaMesh>& su,
1444 const faMatrix<Type>&
A 1449 tC.ref().source() -= su.mesh().S()*su.field();
1454 template<
class Type>
1457 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1458 const faMatrix<Type>&
A 1463 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1469 template<
class Type>
1472 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1473 const faMatrix<Type>&
A 1478 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1484 template<
class Type>
1487 const DimensionedField<Type, areaMesh>& su,
1488 const tmp<faMatrix<Type>>& tA
1492 tmp<faMatrix<Type>> tC(tA.
ptr());
1493 tC.ref().source() -= su.mesh().S()*su.field();
1498 template<
class Type>
1501 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1502 const tmp<faMatrix<Type>>& tA
1506 tmp<faMatrix<Type>> tC(tA.
ptr());
1507 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1513 template<
class Type>
1516 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1517 const tmp<faMatrix<Type>>& tA
1521 tmp<faMatrix<Type>> tC(tA.
ptr());
1522 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1528 template<
class Type>
1531 const faMatrix<Type>&
A,
1532 const DimensionedField<Type, areaMesh>& su
1537 tC.ref().source() += su.mesh().S()*su.field();
1542 template<
class Type>
1545 const faMatrix<Type>&
A,
1546 const tmp<DimensionedField<Type, areaMesh>>& tsu
1551 tC.ref().source() += tsu().mesh().S()*tsu().field();
1557 template<
class Type>
1560 const faMatrix<Type>&
A,
1561 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1566 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1572 template<
class Type>
1575 const tmp<faMatrix<Type>>& tA,
1576 const DimensionedField<Type, areaMesh>& su
1580 tmp<faMatrix<Type>> tC(tA.
ptr());
1581 tC.ref().source() += su.mesh().S()*su.field();
1586 template<
class Type>
1589 const tmp<faMatrix<Type>>& tA,
1590 const tmp<DimensionedField<Type, areaMesh>>& tsu
1594 tmp<faMatrix<Type>> tC(tA.
ptr());
1595 tC.ref().source() += tsu().mesh().S()*tsu().field();
1601 template<
class Type>
1604 const tmp<faMatrix<Type>>& tA,
1605 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1609 tmp<faMatrix<Type>> tC(tA.
ptr());
1610 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1616 template<
class Type>
1619 const DimensionedField<Type, areaMesh>& su,
1620 const faMatrix<Type>&
A 1626 tC.ref().source() -= su.mesh().S()*su.field();
1631 template<
class Type>
1634 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1635 const faMatrix<Type>&
A 1641 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1647 template<
class Type>
1650 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1651 const faMatrix<Type>&
A 1657 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1663 template<
class Type>
1666 const DimensionedField<Type, areaMesh>& su,
1667 const tmp<faMatrix<Type>>& tA
1671 tmp<faMatrix<Type>> tC(tA.
ptr());
1673 tC.ref().source() -= su.mesh().S()*su.field();
1678 template<
class Type>
1681 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1682 const tmp<faMatrix<Type>>& tA
1686 tmp<faMatrix<Type>> tC(tA.
ptr());
1688 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1694 template<
class Type>
1697 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1698 const tmp<faMatrix<Type>>& tA
1702 tmp<faMatrix<Type>> tC(tA.
ptr());
1704 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1710 template<
class Type>
1713 const faMatrix<Type>&
A,
1714 const dimensioned<Type>& su
1719 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1724 template<
class Type>
1727 const tmp<faMatrix<Type>>& tA,
1728 const dimensioned<Type>& su
1732 tmp<faMatrix<Type>> tC(tA.
ptr());
1733 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1738 template<
class Type>
1741 const dimensioned<Type>& su,
1742 const faMatrix<Type>&
A 1747 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1752 template<
class Type>
1755 const dimensioned<Type>& su,
1756 const tmp<faMatrix<Type>>& tA
1760 tmp<faMatrix<Type>> tC(tA.
ptr());
1761 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1766 template<
class Type>
1769 const faMatrix<Type>&
A,
1770 const dimensioned<Type>& su
1775 tC.ref().source() += su.value()*tC().psi().mesh().S();
1780 template<
class Type>
1783 const tmp<faMatrix<Type>>& tA,
1784 const dimensioned<Type>& su
1788 tmp<faMatrix<Type>> tC(tA.
ptr());
1789 tC.ref().source() += su.value()*tC().psi().mesh().S();
1794 template<
class Type>
1797 const dimensioned<Type>& su,
1798 const faMatrix<Type>&
A 1804 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1809 template<
class Type>
1812 const dimensioned<Type>& su,
1813 const tmp<faMatrix<Type>>& tA
1817 tmp<faMatrix<Type>> tC(tA.
ptr());
1819 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1824 template<
class Type>
1827 const faMatrix<Type>&
A,
1828 const DimensionedField<Type, areaMesh>& su
1833 tC.ref().source() += su.mesh().S()*su.field();
1838 template<
class Type>
1841 const faMatrix<Type>&
A,
1842 const tmp<DimensionedField<Type, areaMesh>>& tsu
1847 tC.ref().source() += tsu().mesh().S()*tsu().field();
1853 template<
class Type>
1856 const faMatrix<Type>&
A,
1857 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1862 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1868 template<
class Type>
1871 const tmp<faMatrix<Type>>& tA,
1872 const DimensionedField<Type, areaMesh>& su
1876 tmp<faMatrix<Type>> tC(tA.ptr());
1877 tC.ref().source() += su.mesh().S()*su.field();
1882 template<
class Type>
1885 const tmp<faMatrix<Type>>& tA,
1886 const tmp<DimensionedField<Type, areaMesh>>& tsu
1890 tmp<faMatrix<Type>> tC(tA.ptr());
1891 tC.ref().source() += tsu().mesh().S()*tsu().field();
1897 template<
class Type>
1900 const tmp<faMatrix<Type>>& tA,
1901 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1905 tmp<faMatrix<Type>> tC(tA.ptr());
1906 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1912 template<
class Type>
1915 const faMatrix<Type>&
A,
1916 const dimensioned<Type>& su
1921 tC.ref().source() +=
A.psi().mesh().S()*su.value();
1926 template<
class Type>
1929 const tmp<faMatrix<Type>>& tA,
1930 const dimensioned<Type>& su
1934 tmp<faMatrix<Type>> tC(tA.ptr());
1935 tC.ref().source() += tC().psi().mesh().S()*su.value();
1940 template<
class Type>
1943 const faMatrix<Type>&
A,
1951 template<
class Type>
1954 const tmp<faMatrix<Type>>& tA,
1962 template<
class Type>
1966 const faMatrix<Type>&
A 1975 template<
class Type>
1978 const tmp<areaScalarField::Internal>& tdsf,
1979 const faMatrix<Type>&
A 1988 template<
class Type>
1991 const tmp<areaScalarField>& tvsf,
1992 const faMatrix<Type>&
A 2001 template<
class Type>
2005 const tmp<faMatrix<Type>>& tA
2008 tmp<faMatrix<Type>> tC(tA.ptr());
2014 template<
class Type>
2017 const tmp<areaScalarField::Internal>& tdsf,
2018 const tmp<faMatrix<Type>>& tA
2021 tmp<faMatrix<Type>> tC(tA.ptr());
2027 template<
class Type>
2030 const tmp<areaScalarField>& tvsf,
2031 const tmp<faMatrix<Type>>& tA
2034 tmp<faMatrix<Type>> tC(tA.ptr());
2040 template<
class Type>
2043 const dimensioned<scalar>& ds,
2044 const faMatrix<Type>&
A 2053 template<
class Type>
2056 const dimensioned<scalar>& ds,
2057 const tmp<faMatrix<Type>>& tA
2060 tmp<faMatrix<Type>> tC(tA.ptr());
2066 template<
class Type>
2070 const faMatrix<Type>&
M,
2071 const DimensionedField<Type, areaMesh>&
psi 2074 auto tMphi = tmp<GeometricField<Type, faPatchField, areaMesh>>
::New 2087 auto& Mphi = tMphi.ref();
2092 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
2096 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2097 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2102 Mphi.primitiveFieldRef() =
Zero;
2105 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2106 M.addBoundarySource(Mphi.primitiveFieldRef());
2108 Mphi.primitiveFieldRef() /= -
psi.
mesh().S();
2109 Mphi.correctBoundaryConditions();
2115 template<
class Type>
2119 const faMatrix<Type>&
M,
2120 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2123 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2129 template<
class Type>
2133 const faMatrix<Type>&
M,
2134 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2137 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2143 template<
class Type>
2147 const tmp<faMatrix<Type>>& tM,
2148 const DimensionedField<Type, areaMesh>&
psi 2151 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() &
psi;
2157 template<
class Type>
2161 const tmp<faMatrix<Type>>& tM,
2162 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2165 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2172 template<
class Type>
2176 const tmp<faMatrix<Type>>& tM,
2177 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2180 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2189 template<
class Type>
2192 os << static_cast<const lduMatrix&>(
fam) <<
nl 2193 <<
fam.dimensions_ <<
nl 2194 <<
fam.source_ <<
nl 2195 <<
fam.internalCoeffs_ <<
nl 2196 <<
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.
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
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)
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...
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.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
void setReferences(const labelUList &faceLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Generic GeometricField class.
Generic dimensioned Type class.
Ignore writing from objectRegistry::writeObject()
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.
void relax()
Relax matrix (for steady-state solution).
void operator=(const faMatrix< Type > &)
Generic templated field type.
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 &)
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 fileName & instance() const noexcept
Read access to instance path component.
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)
static tmp< GeometricField< scalar, faPatchField, areaMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=faPatchField< scalar >::calculatedType())
Return tmp field from name, mesh, dimensions and patch type.
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.