49 <<
"addressing (" << addr.
size()
50 <<
") and field (" << pf.
size() <<
") are different sizes" 56 intf[addr[faceI]] += pf[faceI];
66 const tmp<Field<Type2>>& tpf,
70 addToInternalField(addr, tpf(), intf);
87 <<
"addressing (" << addr.
size()
88 <<
") and field (" << pf.
size() <<
") are different sizes" 94 intf[addr[faceI]] -= pf[faceI];
100 template<
class Type2>
104 const tmp<Field<Type2>>& tpf,
108 subtractFromInternalField(addr, tpf(), intf);
120 forAll(internalCoeffs_, patchI)
124 lduAddr().patchAddr(patchI),
125 internalCoeffs_[patchI].
component(solveCmpt),
135 forAll(internalCoeffs_, patchI)
139 lduAddr().patchAddr(patchI),
140 cmptAv(internalCoeffs_[patchI]),
154 forAll(psi_.boundaryField(), patchI)
156 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
157 const Field<Type>& pbc = boundaryCoeffs_[patchI];
161 addToInternalField(lduAddr().patchAddr(patchI), pbc, source);
165 tmp<Field<Type>> tpnf = ptf.patchNeighbourField();
166 const Field<Type>& pnf = tpnf();
168 const labelUList& addr = lduAddr().patchAddr(patchI);
172 source[addr[facei]] +=
cmptMultiply(pbc[facei], pnf[facei]);
196 <<
"constructing faMatrix<Type> for field " << psi_.
name()
217 const_cast<GeometricField<Type, faPatchField, areaMesh>&
>(psi_);
219 const label currentStatePsi = psiRef.eventNo();
220 psiRef.boundaryFieldRef().updateCoeffs();
221 psiRef.eventNo() = currentStatePsi;
230 dimensions_(
fam.dimensions_),
231 source_(
fam.source_),
232 internalCoeffs_(
fam.internalCoeffs_),
233 boundaryCoeffs_(
fam.boundaryCoeffs_)
236 <<
"Copying faMatrix<Type> for field " << psi_.
name() <<
endl;
238 if (
fam.faceFluxCorrectionPtr_)
240 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
242 *(
fam.faceFluxCorrectionPtr_)
251 lduMatrix(tmat.constCast(), tmat.movable()),
253 dimensions_(tmat().dimensions_),
254 source_(tmat.constCast().source_, tmat.movable()),
255 internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
256 boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable())
259 <<
"Copy/Move faMatrix<Type> for field " << psi_.
name() <<
endl;
261 if (tmat().faceFluxCorrectionPtr_)
265 faceFluxCorrectionPtr_ =
266 std::move(tmat.constCast().faceFluxCorrectionPtr_);
268 else if (tmat().faceFluxCorrectionPtr_)
270 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
272 *(tmat().faceFluxCorrectionPtr_)
287 <<
"Destroying faMatrix<Type> for field " << psi_.name() <<
endl;
294 template<
template<
class>
class ListType>
298 const ListType<Type>&
values 305 this->eliminatedEqns().insert(i);
328 if (symmetric() || asymmetric())
333 const Type& value =
values[i];
335 for (
const label edgei : edges[facei])
337 if (
mesh.isInternalEdge(edgei))
341 if (facei == own[edgei])
343 source_[nei[edgei]] -=
upper()[edgei]*value;
347 source_[own[edgei]] -=
upper()[edgei]*value;
350 upper()[edgei] = 0.0;
354 if (facei == own[edgei])
356 source_[nei[edgei]] -=
lower()[edgei]*value;
360 source_[own[edgei]] -=
upper()[edgei]*value;
363 upper()[edgei] = 0.0;
364 lower()[edgei] = 0.0;
371 if (internalCoeffs_[patchi].size())
373 const label patchEdgei =
376 internalCoeffs_[patchi][patchEdgei] =
Zero;
377 boundaryCoeffs_[patchi][patchEdgei] =
Zero;
389 const Type& value =
values[i];
392 source_[facei] = value*Diag[facei];
435 const bool forceReference
438 if ((forceReference || psi_.needReference()) && facei >= 0)
442 source()[facei] +=
diag()[facei]*value;
454 const bool forceReference
457 if (forceReference || psi_.needReference())
476 const UList<Type>&
values,
477 const bool forceReference
480 if (forceReference || psi_.needReference())
503 Field<Type>& S = source();
511 sumMagOffDiag(sumOff);
514 forAll(psi_.boundaryField(), patchI)
516 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
520 const labelUList& pa = lduAddr().patchAddr(patchI);
521 Field<Type>& iCoeffs = internalCoeffs_[patchI];
525 const Field<Type>& pCoeffs = boundaryCoeffs_[patchI];
543 Type iCoeff0 = iCoeffs[face];
544 iCoeffs[face] =
cmptMag(iCoeffs[face]);
545 sumOff[pa[face]] -=
cmptMin(iCoeffs[face]);
546 iCoeffs[face] /=
alpha;
561 forAll(psi_.boundaryField(), patchI)
563 const faPatchField<Type>& ptf = psi_.boundaryField()[patchI];
567 const labelUList& pa = lduAddr().patchAddr(patchI);
568 Field<Type>& iCoeffs = internalCoeffs_[patchI];
581 S += (
D - D0)*psi_.primitiveField();
588 scalar relaxCoeff = 0;
590 if (psi_.mesh().relaxEquation(psi_.name(), relaxCoeff))
597 <<
"No relaxation specified for field " << psi_.name() <<
nl;
606 addCmptAvBoundaryDiag(tdiag.ref());
616 "A(" + psi_.name() +
')',
618 dimensions_/psi_.dimensions()/
dimArea,
622 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().S();
623 tAphi.ref().correctBoundaryConditions();
635 "H(" + psi_.name() +
')',
640 auto& Hphi = tHphi.ref();
645 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
648 addBoundaryDiag(boundaryDiagCmpt, cmpt);
649 boundaryDiagCmpt.negate();
650 addCmptAvBoundaryDiag(boundaryDiagCmpt);
669 if (!psi_.mesh().fluxRequired(psi_.name()))
672 <<
"flux requested but " << psi_.name()
673 <<
" not specified in the fluxRequired sub-dictionary of faSchemes" 679 "flux(" + psi_.name() +
')',
683 auto& fieldFlux = tfieldFlux.ref();
687 fieldFlux.primitiveFieldRef().replace
694 FieldField<Field, Type> InternalContrib = internalCoeffs_;
696 forAll(InternalContrib, patchI)
698 InternalContrib[patchI] =
701 InternalContrib[patchI],
702 psi_.boundaryField()[patchI].patchInternalField()
706 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
708 forAll(NeighbourContrib, patchI)
710 if (psi_.boundaryField()[patchI].coupled())
712 NeighbourContrib[patchI] =
715 NeighbourContrib[patchI],
716 psi_.boundaryField()[patchI].patchNeighbourField()
721 forAll(fieldFlux.boundaryField(), patchI)
723 fieldFlux.boundaryFieldRef()[patchI] =
724 InternalContrib[patchI] - NeighbourContrib[patchI];
727 if (faceFluxCorrectionPtr_)
729 fieldFlux += *faceFluxCorrectionPtr_;
742 return psi_.mesh().solverDict(
name);
749 return psi_.mesh().solverDict
766 if (&psi_ != &(famv.psi_))
769 <<
"different fields" 774 source_ = famv.source_;
775 internalCoeffs_ = famv.internalCoeffs_;
776 boundaryCoeffs_ = famv.boundaryCoeffs_;
778 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
780 *faceFluxCorrectionPtr_ = *famv.faceFluxCorrectionPtr_;
782 else if (famv.faceFluxCorrectionPtr_)
784 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
786 *famv.faceFluxCorrectionPtr_
805 internalCoeffs_.negate();
806 boundaryCoeffs_.negate();
808 if (faceFluxCorrectionPtr_)
810 faceFluxCorrectionPtr_->negate();
820 dimensions_ += famv.dimensions_;
822 source_ += famv.source_;
823 internalCoeffs_ += famv.internalCoeffs_;
824 boundaryCoeffs_ += famv.boundaryCoeffs_;
826 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
828 *faceFluxCorrectionPtr_ += *famv.faceFluxCorrectionPtr_;
830 else if (famv.faceFluxCorrectionPtr_)
832 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
834 *famv.faceFluxCorrectionPtr_
853 dimensions_ -= famv.dimensions_;
855 source_ -= famv.source_;
856 internalCoeffs_ -= famv.internalCoeffs_;
857 boundaryCoeffs_ -= famv.boundaryCoeffs_;
859 if (faceFluxCorrectionPtr_ && famv.faceFluxCorrectionPtr_)
861 *faceFluxCorrectionPtr_ -= *famv.faceFluxCorrectionPtr_;
863 else if (famv.faceFluxCorrectionPtr_)
865 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
867 -*famv.faceFluxCorrectionPtr_
888 source() -= su.mesh().S()*su.field();
921 source() += su.mesh().S()*su.field();
953 source() -=
psi().
mesh().S()*su;
963 source() +=
psi().
mesh().S()*su;
973 dimensions_ *= dsf.dimensions();
975 source_ *= dsf.field();
977 forAll(boundaryCoeffs_, patchi)
981 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
983 internalCoeffs_[patchi] *= pisf;
984 boundaryCoeffs_[patchi] *= pisf;
987 if (faceFluxCorrectionPtr_)
990 <<
"cannot scale a matrix containing a faceFluxCorrection" 999 const tmp<areaScalarField::Internal>& tfld
1007 template<
class Type>
1018 template<
class Type>
1024 dimensions_ *= ds.dimensions();
1026 source_ *= ds.value();
1027 internalCoeffs_ *= ds.value();
1028 boundaryCoeffs_ *= ds.value();
1030 if (faceFluxCorrectionPtr_)
1032 *faceFluxCorrectionPtr_ *= ds.value();
1039 template<
class Type>
1042 const faMatrix<Type>& mat1,
1043 const faMatrix<Type>& mat2,
1047 if (&mat1.psi() != &mat2.psi())
1050 <<
"Incompatible fields for operation\n " 1051 <<
"[" << mat1.psi().name() <<
"] " 1053 <<
" [" << mat2.psi().name() <<
"]" 1060 && mat1.dimensions() != mat2.dimensions()
1064 <<
"Incompatible dimensions for operation\n " 1065 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimArea <<
" ] " 1067 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimArea <<
" ]" 1073 template<
class Type>
1076 const faMatrix<Type>& mat,
1077 const DimensionedField<Type, areaMesh>&
fld,
1084 && mat.dimensions()/
dimArea !=
fld.dimensions()
1088 <<
"Incompatible dimensions for operation\n " 1089 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1091 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1097 template<
class Type>
1100 const faMatrix<Type>& mat,
1101 const dimensioned<Type>& dt,
1108 && mat.dimensions()/
dimArea != dt.dimensions()
1112 <<
"Incompatible dimensions for operation\n " 1113 <<
"[" << mat.psi().name() << mat.dimensions()/
dimArea <<
" ] " 1115 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1121 template<
class Type>
1124 faMatrix<Type>& mat,
1128 return mat.solve(solverControls);
1132 template<
class Type>
1135 const tmp<faMatrix<Type>>& tmat,
1139 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1147 template<
class Type>
1150 faMatrix<Type>& mat,
1154 return mat.solve(
name);
1158 template<
class Type>
1161 const tmp<faMatrix<Type>>& tmat,
1165 SolverPerformance<Type> solverPerf(tmat.constCast().solve(
name));
1173 template<
class Type>
1180 template<
class Type>
1183 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1193 template<
class Type>
1196 const faMatrix<Type>&
A,
1197 const faMatrix<Type>&
B 1201 auto tC = tmp<faMatrix<Type>>
::New(
A);
1207 template<
class Type>
1210 const tmp<faMatrix<Type>>& tA,
1211 const faMatrix<Type>&
B 1215 tmp<faMatrix<Type>> tC(tA.
ptr());
1221 template<
class Type>
1224 const faMatrix<Type>&
A,
1225 const tmp<faMatrix<Type>>& tB
1229 tmp<faMatrix<Type>> tC(tB.ptr());
1235 template<
class Type>
1238 const tmp<faMatrix<Type>>& tA,
1239 const tmp<faMatrix<Type>>& tB
1243 tmp<faMatrix<Type>> tC(tA.
ptr());
1250 template<
class Type>
1253 const faMatrix<Type>&
A 1256 auto tC = tmp<faMatrix<Type>>
::New(
A);
1262 template<
class Type>
1265 const tmp<faMatrix<Type>>& tA
1268 tmp<faMatrix<Type>> tC(tA.
ptr());
1274 template<
class Type>
1277 const faMatrix<Type>&
A,
1278 const faMatrix<Type>&
B 1282 auto tC = tmp<faMatrix<Type>>
::New(
A);
1288 template<
class Type>
1291 const tmp<faMatrix<Type>>& tA,
1292 const faMatrix<Type>&
B 1296 tmp<faMatrix<Type>> tC(tA.
ptr());
1302 template<
class Type>
1305 const faMatrix<Type>&
A,
1306 const tmp<faMatrix<Type>>& tB
1310 tmp<faMatrix<Type>> tC(tB.ptr());
1317 template<
class Type>
1320 const tmp<faMatrix<Type>>& tA,
1321 const tmp<faMatrix<Type>>& tB
1325 tmp<faMatrix<Type>> tC(tA.
ptr());
1332 template<
class Type>
1335 const faMatrix<Type>&
A,
1336 const faMatrix<Type>&
B 1344 template<
class Type>
1347 const tmp<faMatrix<Type>>& tA,
1348 const faMatrix<Type>&
B 1356 template<
class Type>
1359 const faMatrix<Type>&
A,
1360 const tmp<faMatrix<Type>>& tB
1368 template<
class Type>
1371 const tmp<faMatrix<Type>>& tA,
1372 const tmp<faMatrix<Type>>& tB
1380 template<
class Type>
1383 const faMatrix<Type>&
A,
1384 const DimensionedField<Type, areaMesh>& su
1389 tC.ref().source() -= su.mesh().S()*su.field();
1394 template<
class Type>
1397 const faMatrix<Type>&
A,
1398 const tmp<DimensionedField<Type, areaMesh>>& tsu
1403 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1409 template<
class Type>
1412 const faMatrix<Type>&
A,
1413 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1418 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1424 template<
class Type>
1427 const tmp<faMatrix<Type>>& tA,
1428 const DimensionedField<Type, areaMesh>& su
1432 tmp<faMatrix<Type>> tC(tA.
ptr());
1433 tC.ref().source() -= su.mesh().S()*su.field();
1438 template<
class Type>
1441 const tmp<faMatrix<Type>>& tA,
1442 const tmp<DimensionedField<Type, areaMesh>>& tsu
1446 tmp<faMatrix<Type>> tC(tA.
ptr());
1447 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1453 template<
class Type>
1456 const tmp<faMatrix<Type>>& tA,
1457 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1461 tmp<faMatrix<Type>> tC(tA.
ptr());
1462 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1468 template<
class Type>
1471 const DimensionedField<Type, areaMesh>& su,
1472 const faMatrix<Type>&
A 1477 tC.ref().source() -= su.mesh().S()*su.field();
1482 template<
class Type>
1485 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1486 const faMatrix<Type>&
A 1491 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1497 template<
class Type>
1500 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1501 const faMatrix<Type>&
A 1506 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1512 template<
class Type>
1515 const DimensionedField<Type, areaMesh>& su,
1516 const tmp<faMatrix<Type>>& tA
1520 tmp<faMatrix<Type>> tC(tA.
ptr());
1521 tC.ref().source() -= su.mesh().S()*su.field();
1526 template<
class Type>
1529 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1530 const tmp<faMatrix<Type>>& tA
1534 tmp<faMatrix<Type>> tC(tA.
ptr());
1535 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1541 template<
class Type>
1544 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1545 const tmp<faMatrix<Type>>& tA
1549 tmp<faMatrix<Type>> tC(tA.
ptr());
1550 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1556 template<
class Type>
1559 const faMatrix<Type>&
A,
1560 const DimensionedField<Type, areaMesh>& su
1565 tC.ref().source() += su.mesh().S()*su.field();
1570 template<
class Type>
1573 const faMatrix<Type>&
A,
1574 const tmp<DimensionedField<Type, areaMesh>>& tsu
1579 tC.ref().source() += tsu().mesh().S()*tsu().field();
1585 template<
class Type>
1588 const faMatrix<Type>&
A,
1589 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1594 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1600 template<
class Type>
1603 const tmp<faMatrix<Type>>& tA,
1604 const DimensionedField<Type, areaMesh>& su
1608 tmp<faMatrix<Type>> tC(tA.
ptr());
1609 tC.ref().source() += su.mesh().S()*su.field();
1614 template<
class Type>
1617 const tmp<faMatrix<Type>>& tA,
1618 const tmp<DimensionedField<Type, areaMesh>>& tsu
1622 tmp<faMatrix<Type>> tC(tA.
ptr());
1623 tC.ref().source() += tsu().mesh().S()*tsu().field();
1629 template<
class Type>
1632 const tmp<faMatrix<Type>>& tA,
1633 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1637 tmp<faMatrix<Type>> tC(tA.
ptr());
1638 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1644 template<
class Type>
1647 const DimensionedField<Type, areaMesh>& su,
1648 const faMatrix<Type>&
A 1654 tC.ref().source() -= su.mesh().S()*su.field();
1659 template<
class Type>
1662 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1663 const faMatrix<Type>&
A 1669 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1675 template<
class Type>
1678 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1679 const faMatrix<Type>&
A 1685 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1691 template<
class Type>
1694 const DimensionedField<Type, areaMesh>& su,
1695 const tmp<faMatrix<Type>>& tA
1699 tmp<faMatrix<Type>> tC(tA.
ptr());
1701 tC.ref().source() -= su.mesh().S()*su.field();
1706 template<
class Type>
1709 const tmp<DimensionedField<Type, areaMesh>>& tsu,
1710 const tmp<faMatrix<Type>>& tA
1714 tmp<faMatrix<Type>> tC(tA.
ptr());
1716 tC.ref().source() -= tsu().mesh().S()*tsu().field();
1722 template<
class Type>
1725 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu,
1726 const tmp<faMatrix<Type>>& tA
1730 tmp<faMatrix<Type>> tC(tA.
ptr());
1732 tC.ref().source() -= tsu().mesh().S()*tsu().primitiveField();
1738 template<
class Type>
1741 const faMatrix<Type>&
A,
1742 const dimensioned<Type>& su
1747 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1752 template<
class Type>
1755 const tmp<faMatrix<Type>>& tA,
1756 const dimensioned<Type>& su
1760 tmp<faMatrix<Type>> tC(tA.
ptr());
1761 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1766 template<
class Type>
1769 const dimensioned<Type>& su,
1770 const faMatrix<Type>&
A 1775 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1780 template<
class Type>
1783 const dimensioned<Type>& su,
1784 const tmp<faMatrix<Type>>& tA
1788 tmp<faMatrix<Type>> tC(tA.
ptr());
1789 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1794 template<
class Type>
1797 const faMatrix<Type>&
A,
1798 const dimensioned<Type>& su
1803 tC.ref().source() += su.value()*tC().psi().mesh().S();
1808 template<
class Type>
1811 const tmp<faMatrix<Type>>& tA,
1812 const dimensioned<Type>& su
1816 tmp<faMatrix<Type>> tC(tA.
ptr());
1817 tC.ref().source() += su.value()*tC().psi().mesh().S();
1822 template<
class Type>
1825 const dimensioned<Type>& su,
1826 const faMatrix<Type>&
A 1832 tC.ref().source() -= su.value()*
A.psi().mesh().S();
1837 template<
class Type>
1840 const dimensioned<Type>& su,
1841 const tmp<faMatrix<Type>>& tA
1845 tmp<faMatrix<Type>> tC(tA.
ptr());
1847 tC.ref().source() -= su.value()*tC().psi().mesh().S();
1852 template<
class Type>
1855 const faMatrix<Type>&
A,
1856 const DimensionedField<Type, areaMesh>& su
1861 tC.ref().source() += su.mesh().S()*su.field();
1866 template<
class Type>
1869 const faMatrix<Type>&
A,
1870 const tmp<DimensionedField<Type, areaMesh>>& tsu
1875 tC.ref().source() += tsu().mesh().S()*tsu().field();
1881 template<
class Type>
1884 const faMatrix<Type>&
A,
1885 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1890 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1896 template<
class Type>
1899 const tmp<faMatrix<Type>>& tA,
1900 const DimensionedField<Type, areaMesh>& su
1904 tmp<faMatrix<Type>> tC(tA.ptr());
1905 tC.ref().source() += su.mesh().S()*su.field();
1910 template<
class Type>
1913 const tmp<faMatrix<Type>>& tA,
1914 const tmp<DimensionedField<Type, areaMesh>>& tsu
1918 tmp<faMatrix<Type>> tC(tA.ptr());
1919 tC.ref().source() += tsu().mesh().S()*tsu().field();
1925 template<
class Type>
1928 const tmp<faMatrix<Type>>& tA,
1929 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tsu
1933 tmp<faMatrix<Type>> tC(tA.ptr());
1934 tC.ref().source() += tsu().mesh().S()*tsu().primitiveField();
1940 template<
class Type>
1943 const faMatrix<Type>&
A,
1944 const dimensioned<Type>& su
1949 tC.ref().source() +=
A.psi().mesh().S()*su.value();
1954 template<
class Type>
1957 const tmp<faMatrix<Type>>& tA,
1958 const dimensioned<Type>& su
1962 tmp<faMatrix<Type>> tC(tA.ptr());
1963 tC.ref().source() += tC().psi().mesh().S()*su.value();
1968 template<
class Type>
1971 const faMatrix<Type>&
A,
1979 template<
class Type>
1982 const tmp<faMatrix<Type>>& tA,
1990 template<
class Type>
1994 const faMatrix<Type>&
A 2003 template<
class Type>
2006 const tmp<areaScalarField::Internal>& tdsf,
2007 const faMatrix<Type>&
A 2016 template<
class Type>
2019 const tmp<areaScalarField>& tvsf,
2020 const faMatrix<Type>&
A 2029 template<
class Type>
2033 const tmp<faMatrix<Type>>& tA
2036 tmp<faMatrix<Type>> tC(tA.ptr());
2042 template<
class Type>
2045 const tmp<areaScalarField::Internal>& tdsf,
2046 const tmp<faMatrix<Type>>& tA
2049 tmp<faMatrix<Type>> tC(tA.ptr());
2055 template<
class Type>
2058 const tmp<areaScalarField>& tvsf,
2059 const tmp<faMatrix<Type>>& tA
2062 tmp<faMatrix<Type>> tC(tA.ptr());
2068 template<
class Type>
2071 const dimensioned<scalar>& ds,
2072 const faMatrix<Type>&
A 2081 template<
class Type>
2084 const dimensioned<scalar>& ds,
2085 const tmp<faMatrix<Type>>& tA
2088 tmp<faMatrix<Type>> tC(tA.ptr());
2094 template<
class Type>
2098 const faMatrix<Type>&
M,
2099 const DimensionedField<Type, areaMesh>&
psi 2109 auto& Mphi = tMphi.ref();
2118 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2119 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2124 Mphi.primitiveFieldRef() =
Zero;
2127 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2128 M.addBoundarySource(Mphi.primitiveFieldRef());
2130 Mphi.primitiveFieldRef() /= -
psi.
mesh().S();
2131 Mphi.correctBoundaryConditions();
2137 template<
class Type>
2141 const faMatrix<Type>&
M,
2142 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2145 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2151 template<
class Type>
2155 const faMatrix<Type>&
M,
2156 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2159 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi =
M & tpsi();
2165 template<
class Type>
2169 const tmp<faMatrix<Type>>& tM,
2170 const DimensionedField<Type, areaMesh>&
psi 2173 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() &
psi;
2179 template<
class Type>
2183 const tmp<faMatrix<Type>>& tM,
2184 const tmp<DimensionedField<Type, areaMesh>>& tpsi
2187 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2194 template<
class Type>
2198 const tmp<faMatrix<Type>>& tM,
2199 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tpsi
2202 tmp<GeometricField<Type, faPatchField, areaMesh>> tMpsi = tM() & tpsi();
2211 template<
class Type>
2214 os << static_cast<const lduMatrix&>(
fam) <<
nl 2215 <<
fam.dimensions_ <<
nl 2216 <<
fam.source_ <<
nl 2217 <<
fam.internalCoeffs_ <<
nl 2218 <<
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.
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.
::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 &)
Copy assignment.
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.
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)
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.