51 <<
"addressing (" << addr.
size()
52 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 58 intf[addr[faceI]] += pf[faceI];
68 const tmp<Field<Type2>>& tpf,
72 addToInternalField(addr, tpf(), intf);
89 <<
"addressing (" << addr.
size()
90 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 96 intf[addr[faceI]] -= pf[faceI];
102 template<
class Type2>
106 const tmp<Field<Type2>>& tpf,
110 subtractFromInternalField(addr, tpf(), intf);
122 forAll(internalCoeffs_, patchI)
126 lduAddr().patchAddr(patchI),
127 internalCoeffs_[patchI].
component(solveCmpt),
137 forAll(internalCoeffs_, patchI)
141 lduAddr().patchAddr(patchI),
142 cmptAv(internalCoeffs_[patchI]),
156 forAll(psi_.boundaryField(), patchI)
158 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
159 const Field<Type>& pbc = boundaryCoeffs_[patchI];
163 addToInternalField(lduAddr().patchAddr(patchI), pbc, source);
167 tmp<Field<Type>> tpnf = ptf.patchNeighbourField();
168 const Field<Type>& pnf = tpnf();
170 const labelUList& addr = lduAddr().patchAddr(patchI);
174 source[addr[facei]] +=
cmptMultiply(pbc[facei], pnf[facei]);
196 faceFluxCorrectionPtr_(nullptr)
199 <<
"constructing faMatrix<Type> for field " << psi_.
name()
220 const_cast<GeometricField<Type, faPatchField, areaMesh>&
>(psi_);
222 const label currentStatePsi = psiRef.eventNo();
223 psiRef.boundaryFieldRef().updateCoeffs();
224 psiRef.eventNo() = currentStatePsi;
233 dimensions_(
fam.dimensions_),
234 source_(
fam.source_),
235 internalCoeffs_(
fam.internalCoeffs_),
236 boundaryCoeffs_(
fam.boundaryCoeffs_),
237 faceFluxCorrectionPtr_(nullptr)
240 <<
"Copying faMatrix<Type> for field " << psi_.
name() <<
endl;
242 if (
fam.faceFluxCorrectionPtr_)
244 faceFluxCorrectionPtr_ =
247 *(
fam.faceFluxCorrectionPtr_)
256 lduMatrix(tmat.constCast(), tmat.movable()),
258 dimensions_(tmat().dimensions_),
259 source_(tmat.constCast().source_, tmat.movable()),
260 internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
261 boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable()),
262 faceFluxCorrectionPtr_(nullptr)
265 <<
"Copy/Move faMatrix<Type> for field " << psi_.
name() <<
endl;
267 if (tmat().faceFluxCorrectionPtr_)
271 faceFluxCorrectionPtr_ = tmat().faceFluxCorrectionPtr_;
272 tmat().faceFluxCorrectionPtr_ =
nullptr;
276 faceFluxCorrectionPtr_ =
277 new GeometricField<Type, faePatchField, edgeMesh>
279 *(tmat().faceFluxCorrectionPtr_)
294 <<
"Destroying faMatrix<Type> for field " << psi_.name() <<
endl;
303 template<
template<
class>
class ListType>
307 const ListType<Type>&
values 312 for (
const label i : faceLabels)
314 this->eliminatedEqns().insert(i);
337 if (symmetric() || asymmetric())
341 const label facei = faceLabels[i];
342 const Type& value =
values[i];
344 for (
const label edgei : edges[facei])
346 if (
mesh.isInternalEdge(edgei))
350 if (facei == own[edgei])
352 source_[nei[edgei]] -=
upper()[edgei]*value;
356 source_[own[edgei]] -=
upper()[edgei]*value;
359 upper()[edgei] = 0.0;
363 if (facei == own[edgei])
365 source_[nei[edgei]] -=
lower()[edgei]*value;
369 source_[own[edgei]] -=
upper()[edgei]*value;
372 upper()[edgei] = 0.0;
373 lower()[edgei] = 0.0;
380 if (internalCoeffs_[patchi].size())
382 const label patchEdgei =
385 internalCoeffs_[patchi][patchEdgei] =
Zero;
386 boundaryCoeffs_[patchi][patchEdgei] =
Zero;
397 const label facei = faceLabels[i];
398 const Type& value =
values[i];
401 source_[facei] = value*Diag[facei];
424 this->setValuesFromList(faceLabels,
values);
435 this->setValuesFromList(faceLabels,
values);
444 const bool forceReference
447 if ((forceReference || psi_.needReference()) && facei >= 0)
451 source()[facei] +=
diag()[facei]*value;
463 const bool forceReference
466 if (forceReference || psi_.needReference())
470 const label
faceId = faceLabels[facei];
485 const UList<Type>&
values,
486 const bool forceReference
489 if (forceReference || psi_.needReference())
493 const label
faceId = faceLabels[facei];
512 Field<Type>& S = source();
520 sumMagOffDiag(sumOff);
523 forAll(psi_.boundaryField(), patchI)
525 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
529 const labelUList& pa = lduAddr().patchAddr(patchI);
530 Field<Type>& iCoeffs = internalCoeffs_[patchI];
534 const Field<Type>& pCoeffs = boundaryCoeffs_[patchI];
552 Type iCoeff0 = iCoeffs[face];
553 iCoeffs[face] =
cmptMag(iCoeffs[face]);
554 sumOff[pa[face]] -=
cmptMin(iCoeffs[face]);
555 iCoeffs[face] /=
alpha;
570 forAll(psi_.boundaryField(), patchI)
572 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
576 const labelUList& pa = lduAddr().patchAddr(patchI);
577 Field<Type>& iCoeffs = internalCoeffs_[patchI];
590 S += (
D - D0)*psi_.primitiveField();
597 if (psi_.mesh().relaxEquation(psi_.name()))
599 relax(psi_.mesh().equationRelaxationFactor(psi_.name()));
604 <<
"Relaxation factor for field " << psi_.name()
605 <<
" not found. Relaxation will not be used." <<
endl;
614 addCmptAvBoundaryDiag(tdiag.ref());
628 "A("+psi_.name()+
')',
633 dimensions_/psi_.dimensions()/
dimArea,
634 zeroGradientFaPatchScalarField::typeName
638 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().S();
639 tAphi.ref().correctBoundaryConditions();
655 "H("+psi_.name()+
')',
661 zeroGradientFaPatchScalarField::typeName
667 for (
direction cmpt=0; cmpt<Type::nComponents; ++cmpt)
669 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
672 addBoundaryDiag(boundaryDiagCmpt, cmpt);
673 boundaryDiagCmpt.negate();
674 addCmptAvBoundaryDiag(boundaryDiagCmpt);
693 if (!psi_.mesh().fluxRequired(psi_.name()))
696 <<
"flux requested but " << psi_.name()
697 <<
" not specified in the fluxRequired sub-dictionary of faSchemes" 702 tmp<GeometricField<Type, faePatchField, edgeMesh>> tfieldFlux
704 new GeometricField<Type, faePatchField, edgeMesh>
708 "flux("+psi_.name()+
')',
716 GeometricField<Type, faePatchField, edgeMesh>& fieldFlux =
719 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
721 fieldFlux.primitiveFieldRef().replace
728 FieldField<Field, Type> InternalContrib = internalCoeffs_;
730 forAll(InternalContrib, patchI)
732 InternalContrib[patchI] =
735 InternalContrib[patchI],
736 psi_.boundaryField()[patchI].patchInternalField()
740 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
742 forAll(NeighbourContrib, patchI)
744 if (psi_.boundaryField()[patchI].coupled())
746 NeighbourContrib[patchI] =
749 NeighbourContrib[patchI],
750 psi_.boundaryField()[patchI].patchNeighbourField()
755 forAll(fieldFlux.boundaryField(), patchI)
757 fieldFlux.boundaryFieldRef()[patchI] =
758 InternalContrib[patchI] - NeighbourContrib[patchI];
761 if (faceFluxCorrectionPtr_)
763 fieldFlux += *faceFluxCorrectionPtr_;
780 if (&psi_ != &(famv.psi_))
783 <<
"different fields" 788 source_ = famv.source_;
789 internalCoeffs_ = famv.internalCoeffs_;
790 boundaryCoeffs_ = famv.boundaryCoeffs_;
792 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
794 *faceFluxCorrectionPtr_ = *famv.faceFluxCorrectionPtr_;
796 else if (famv.faceFluxCorrectionPtr_)
798 faceFluxCorrectionPtr_ =
800 (*famv.faceFluxCorrectionPtr_);
818 internalCoeffs_.negate();
819 boundaryCoeffs_.negate();
821 if (faceFluxCorrectionPtr_)
823 faceFluxCorrectionPtr_->negate();
833 dimensions_ += famv.dimensions_;
835 source_ += famv.source_;
836 internalCoeffs_ += famv.internalCoeffs_;
837 boundaryCoeffs_ += famv.boundaryCoeffs_;
839 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
841 *faceFluxCorrectionPtr_ += *famv.faceFluxCorrectionPtr_;
843 else if (famv.faceFluxCorrectionPtr_)
845 faceFluxCorrectionPtr_ =
new 846 GeometricField<Type, faePatchField, edgeMesh>
848 *famv.faceFluxCorrectionPtr_
867 dimensions_ -= famv.dimensions_;
869 source_ -= famv.source_;
870 internalCoeffs_ -= famv.internalCoeffs_;
871 boundaryCoeffs_ -= famv.boundaryCoeffs_;
873 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
875 *faceFluxCorrectionPtr_ -= *famv.faceFluxCorrectionPtr_;
877 else if (famv.faceFluxCorrectionPtr_)
879 faceFluxCorrectionPtr_ =
881 (-*famv.faceFluxCorrectionPtr_);
901 source() -= su.mesh().S()*su.field();
934 source() += su.mesh().S()*su.field();
966 source() -=
psi().
mesh().S()*su;
976 source() +=
psi().
mesh().S()*su;
996 dimensions_ *= dsf.dimensions();
998 source_ *= dsf.field();
1000 forAll(boundaryCoeffs_, patchi)
1004 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1006 internalCoeffs_[patchi] *= pisf;
1007 boundaryCoeffs_[patchi] *= pisf;
1010 if (faceFluxCorrectionPtr_)
1013 <<
"cannot scale a matrix containing a faceFluxCorrection" 1019 template<
class Type>
1022 const tmp<areaScalarField::Internal>& tfld
1030 template<
class Type>
1041 template<
class Type>
1047 dimensions_ *= ds.dimensions();
1049 source_ *= ds.value();
1050 internalCoeffs_ *= ds.value();
1051 boundaryCoeffs_ *= ds.value();
1053 if (faceFluxCorrectionPtr_)
1055 *faceFluxCorrectionPtr_ *= ds.value();
1062 template<
class Type>
1065 const faMatrix<Type>& mat1,
1066 const faMatrix<Type>& mat2,
1070 if (&mat1.psi() != &mat2.psi())
1073 <<
"Incompatible fields for operation\n " 1074 <<
"[" << mat1.psi().name() <<
"] " 1076 <<
" [" << mat2.psi().name() <<
"]" 1083 && mat1.dimensions() != mat2.dimensions()
1087 <<
"Incompatible dimensions for operation\n " 1088 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimArea <<
" ] " 1090 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimArea <<
" ]" 1096 template<
class Type>
1099 const faMatrix<Type>& mat,
1100 const DimensionedField<Type, areaMesh>&
fld,
1107 && mat.dimensions()/
dimArea !=
fld.dimensions()
1111 <<
"Incompatible dimensions for operation\n " 1112 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1114 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1120 template<
class Type>
1123 const faMatrix<Type>& mat,
1124 const dimensioned<Type>& dt,
1131 && mat.dimensions()/
dimArea != dt.dimensions()
1135 <<
"Incompatible dimensions for operation\n " 1136 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1138 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1144 template<
class Type>
1147 faMatrix<Type>&
fam,
1148 const dictionary& solverControls
1151 return fam.solve(solverControls);
1155 template<
class Type>
1158 const tmp<faMatrix<Type>>& tmat,
1159 const dictionary& solverControls
1162 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1170 template<
class Type>
1177 template<
class Type>
1180 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1190 template<
class Type>
1193 const faMatrix<Type>&
A,
1194 const faMatrix<Type>&
B 1198 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1204 template<
class Type>
1207 const tmp<faMatrix<Type>>& tA,
1208 const faMatrix<Type>&
B 1212 tmp<faMatrix<Type>> tC(tA.
ptr());
1218 template<
class Type>
1221 const faMatrix<Type>&
A,
1222 const tmp<faMatrix<Type>>& tB
1226 tmp<faMatrix<Type>> tC(tB.ptr());
1232 template<
class Type>
1235 const tmp<faMatrix<Type>>& tA,
1236 const tmp<faMatrix<Type>>& tB
1240 tmp<faMatrix<Type>> tC(tA.
ptr());
1247 template<
class Type>
1250 const faMatrix<Type>&
A 1253 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1259 template<
class Type>
1262 const tmp<faMatrix<Type>>& tA
1265 tmp<faMatrix<Type>> tC(tA.
ptr());
1271 template<
class Type>
1274 const faMatrix<Type>&
A,
1275 const faMatrix<Type>&
B 1279 tmp<faMatrix<Type>> tC(
new faMatrix<Type>(
A));
1285 template<
class Type>
1288 const tmp<faMatrix<Type>>& tA,
1289 const faMatrix<Type>&
B 1293 tmp<faMatrix<Type>> tC(tA.
ptr());
1299 template<
class Type>
1302 const faMatrix<Type>&
A,
1303 const tmp<faMatrix<Type>>& tB
1307 tmp<faMatrix<Type>> tC(tB.ptr());
1314 template<
class Type>
1317 const tmp<faMatrix<Type>>& tA,
1318 const tmp<faMatrix<Type>>& tB
1322 tmp<faMatrix<Type>> tC(tA.
ptr());
1329 template<
class Type>
1332 const faMatrix<Type>&
A,
1333 const faMatrix<Type>&
B 1341 template<
class Type>
1344 const tmp<faMatrix<Type>>& tA,
1345 const faMatrix<Type>&
B 1353 template<
class Type>
1356 const faMatrix<Type>&
A,
1357 const tmp<faMatrix<Type>>& tB
1365 template<
class Type>
1368 const tmp<faMatrix<Type>>& tA,
1369 const tmp<faMatrix<Type>>& tB
1377 template<
class Type>
1380 const faMatrix<Type>&
A,
1381 const DimensionedField<Type, areaMesh>& su
1386 tC.ref().source() -= su.mesh().S()*su.field();
1391 template<
class Type>
1394 const faMatrix<Type>&
A,
1395 const tmp<DimensionedField<Type, areaMesh>>& tsu
1400 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1406 template<
class Type>
1409 const faMatrix<Type>&
A,
1410 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1415 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1421 template<
class Type>
1424 const tmp<faMatrix<Type>>& tA,
1425 const DimensionedField<Type, areaMesh>& su
1429 tmp<faMatrix<Type>> tC(tA.
ptr());
1430 tC.ref().source() -= su.mesh().S()*su.field();
1435 template<
class Type>
1438 const tmp<faMatrix<Type>>& tA,
1439 const tmp<DimensionedField<Type, areaMesh>>& tsu
1443 tmp<faMatrix<Type>> tC(tA.
ptr());
1444 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1450 template<
class Type>
1453 const tmp<faMatrix<Type>>& tA,
1454 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1458 tmp<faMatrix<Type>> tC(tA.
ptr());
1459 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1465 template<
class Type>
1468 const DimensionedField<Type, areaMesh>& su,
1469 const faMatrix<Type>&
A 1474 tC.ref().source() -= su.mesh().S()*su.field();
1479 template<
class Type>
1482 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1483 const faMatrix<Type>&
A 1488 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1494 template<
class Type>
1497 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1498 const faMatrix<Type>&
A 1503 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1509 template<
class Type>
1512 const DimensionedField<Type, areaMesh>& su,
1513 const tmp<faMatrix<Type>>& tA
1517 tmp<faMatrix<Type>> tC(tA.
ptr());
1518 tC.ref().source() -= su.mesh().S()*su.field();
1523 template<
class Type>
1526 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1527 const tmp<faMatrix<Type>>& tA
1531 tmp<faMatrix<Type>> tC(tA.
ptr());
1532 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1538 template<
class Type>
1541 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1542 const tmp<faMatrix<Type>>& tA
1546 tmp<faMatrix<Type>> tC(tA.
ptr());
1547 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1553 template<
class Type>
1556 const faMatrix<Type>&
A,
1557 const DimensionedField<Type, areaMesh>& su
1562 tC.ref().source() += su.mesh().S()*su.field();
1567 template<
class Type>
1570 const faMatrix<Type>&
A,
1571 const tmp<DimensionedField<Type, areaMesh>>& tsu
1576 tC.ref().source() += tsu().mesh().S()*tsu().field();
1582 template<
class Type>
1585 const faMatrix<Type>&
A,
1586 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1591 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1597 template<
class Type>
1600 const tmp<faMatrix<Type>>& tA,
1601 const DimensionedField<Type, areaMesh>& su
1605 tmp<faMatrix<Type>> tC(tA.
ptr());
1606 tC.ref().source() += su.mesh().S()*su.field();
1611 template<
class Type>
1614 const tmp<faMatrix<Type>>& tA,
1615 const tmp<DimensionedField<Type, areaMesh>>& tsu
1619 tmp<faMatrix<Type>> tC(tA.
ptr());
1620 tC.ref().source() += tsu().mesh().S()*tsu().field();
1626 template<
class Type>
1629 const tmp<faMatrix<Type>>& tA,
1630 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1634 tmp<faMatrix<Type>> tC(tA.
ptr());
1635 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1641 template<
class Type>
1644 const DimensionedField<Type, areaMesh>& su,
1645 const faMatrix<Type>&
A 1651 tC.ref().source() -= su.mesh().S()*su.field();
1656 template<
class Type>
1659 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1660 const faMatrix<Type>&
A 1666 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1672 template<
class Type>
1675 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1676 const faMatrix<Type>&
A 1682 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1688 template<
class Type>
1691 const DimensionedField<Type, areaMesh>& su,
1692 const tmp<faMatrix<Type>>& tA
1696 tmp<faMatrix<Type>> tC(tA.
ptr());
1698 tC.ref().source() -= su.mesh().S()*su.field();
1703 template<
class Type>
1706 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1707 const tmp<faMatrix<Type>>& tA
1711 tmp<faMatrix<Type>> tC(tA.
ptr());
1713 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1719 template<
class Type>
1722 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1723 const tmp<faMatrix<Type>>& tA
1727 tmp<faMatrix<Type>> tC(tA.
ptr());
1729 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1735 template<
class Type>
1738 const faMatrix<Type>&
A,
1739 const dimensioned<Type>& su
1744 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1749 template<
class Type>
1752 const tmp<faMatrix<Type>>& tA,
1753 const dimensioned<Type>& su
1757 tmp<faMatrix<Type>> tC(tA.
ptr());
1758 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1763 template<
class Type>
1766 const dimensioned<Type>& su,
1767 const faMatrix<Type>&
A 1772 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1777 template<
class Type>
1780 const dimensioned<Type>& su,
1781 const tmp<faMatrix<Type>>& tA
1785 tmp<faMatrix<Type>> tC(tA.
ptr());
1786 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1791 template<
class Type>
1794 const faMatrix<Type>&
A,
1795 const dimensioned<Type>& su
1800 tC.ref().source() += su.value()*tC().psi().mesh().S();
1805 template<
class Type>
1808 const tmp<faMatrix<Type>>& tA,
1809 const dimensioned<Type>& su
1813 tmp<faMatrix<Type>> tC(tA.
ptr());
1814 tC.ref().source() += su.value()*tC().psi().mesh().S();
1819 template<
class Type>
1822 const dimensioned<Type>& su,
1823 const faMatrix<Type>&
A 1829 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1834 template<
class Type>
1837 const dimensioned<Type>& su,
1838 const tmp<faMatrix<Type>>& tA
1842 tmp<faMatrix<Type>> tC(tA.
ptr());
1844 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1849 template<
class Type>
1852 const faMatrix<Type>&
A,
1853 const DimensionedField<Type, areaMesh>& su
1858 tC.ref().source() += su.mesh().S()*su.field();
1863 template<
class Type>
1866 const faMatrix<Type>&
A,
1867 const tmp<DimensionedField<Type, areaMesh>>& tsu
1872 tC.ref().source() += tsu().mesh().S()*tsu().field();
1878 template<
class Type>
1881 const faMatrix<Type>&
A,
1882 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1887 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1893 template<
class Type>
1896 const tmp<faMatrix<Type>>& tA,
1897 const DimensionedField<Type, areaMesh>& su
1901 tmp<faMatrix<Type>> tC(tA.ptr());
1902 tC.ref().source() += su.mesh().S()*su.field();
1907 template<
class Type>
1910 const tmp<faMatrix<Type>>& tA,
1911 const tmp<DimensionedField<Type, areaMesh>>& tsu
1915 tmp<faMatrix<Type>> tC(tA.ptr());
1916 tC.ref().source() += tsu().mesh().S()*tsu().field();
1922 template<
class Type>
1925 const tmp<faMatrix<Type>>& tA,
1926 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1930 tmp<faMatrix<Type>> tC(tA.ptr());
1931 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1937 template<
class Type>
1940 const faMatrix<Type>&
A,
1941 const dimensioned<Type>& su
1946 tC.ref().source() +=
A.psi().mesh().S()*su.value();
1951 template<
class Type>
1954 const tmp<faMatrix<Type>>& tA,
1955 const dimensioned<Type>& su
1959 tmp<faMatrix<Type>> tC(tA.ptr());
1960 tC.ref().source() += tC().psi().mesh().S()*su.value();
1965 template<
class Type>
1968 const faMatrix<Type>&
A,
1976 template<
class Type>
1979 const tmp<faMatrix<Type>>& tA,
1987 template<
class Type>
1991 const faMatrix<Type>&
A 2000 template<
class Type>
2003 const tmp<areaScalarField::Internal>& tdsf,
2004 const faMatrix<Type>&
A 2013 template<
class Type>
2016 const tmp<areaScalarField>& tvsf,
2017 const faMatrix<Type>&
A 2026 template<
class Type>
2030 const tmp<faMatrix<Type>>& tA
2033 tmp<faMatrix<Type>> tC(tA.ptr());
2039 template<
class Type>
2042 const tmp<areaScalarField::Internal>& tdsf,
2043 const tmp<faMatrix<Type>>& tA
2046 tmp<faMatrix<Type>> tC(tA.ptr());
2052 template<
class Type>
2055 const tmp<areaScalarField>& tvsf,
2056 const tmp<faMatrix<Type>>& tA
2059 tmp<faMatrix<Type>> tC(tA.ptr());
2065 template<
class Type>
2068 const dimensioned<scalar>& ds,
2069 const faMatrix<Type>&
A 2078 template<
class Type>
2081 const dimensioned<scalar>& ds,
2082 const tmp<faMatrix<Type>>& tA
2085 tmp<faMatrix<Type>> tC(tA.ptr());
2091 template<
class Type>
2095 const faMatrix<Type>&
M,
2096 const DimensionedField<Type, areaMesh>&
psi 2099 auto tMphi = tmp<GeometricField<Type, faPatchField, areaMesh>>
::New 2112 auto& Mphi = tMphi.ref();
2117 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
2121 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2122 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2127 Mphi.primitiveFieldRef() =
Zero;
2130 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2131 M.addBoundarySource(Mphi.primitiveFieldRef());
2133 Mphi.primitiveFieldRef() /= -
psi.
mesh().S();
2134 Mphi.correctBoundaryConditions();
2140 template<
class Type>
2144 const faMatrix<Type>&
M,
2145 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2148 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2154 template<
class Type>
2158 const faMatrix<Type>&
M,
2159 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2162 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2168 template<
class Type>
2172 const tmp<faMatrix<Type>>& tM,
2173 const DimensionedField<Type, areaMesh>&
psi 2176 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() &
psi;
2182 template<
class Type>
2186 const tmp<faMatrix<Type>>& tM,
2187 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2190 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2197 template<
class Type>
2201 const tmp<faMatrix<Type>>& tM,
2202 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2205 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2214 template<
class Type>
2217 os << static_cast<const lduMatrix&>(
fam) <<
nl 2218 <<
fam.dimensions_ <<
nl 2219 <<
fam.source_ <<
nl 2220 <<
fam.internalCoeffs_ <<
nl 2221 <<
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.
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.
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()
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
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 *)
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)
Am I the master rank.
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.
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)
Defines the attributes of an object for which implicit objectRegistry management is supported...
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)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
const dimensionSet dimArea(sqr(dimLength))
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
static constexpr const zero Zero
Global zero (0)
virtual ~faMatrix()
Destructor.