57 <<
"addressing (" << addr.
size()
58 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 64 intf[addr[facei]] += pf[facei];
74 const tmp<Field<Type2>>& tpf,
78 addToInternalField(addr, tpf(), intf);
95 <<
"addressing (" << addr.
size()
96 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 102 intf[addr[facei]] -= pf[facei];
108 template<
class Type2>
112 const tmp<Field<Type2>>& tpf,
116 subtractFromInternalField(addr, tpf(), intf);
128 for (label fieldi = 0; fieldi < nMatrices(); ++fieldi)
130 const auto& bpsi = this->
psi(fieldi).boundaryField();
134 const label patchi = globalPatchID(fieldi, ptfi);
140 lduAddr().patchAddr(patchi),
141 internalCoeffs_[patchi].
component(solveCmpt),
153 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
155 const auto& bpsi = this->
psi(fieldi).boundaryField();
159 const label patchi = globalPatchID(fieldi, ptfi);
164 lduAddr().patchAddr(patchi),
165 cmptAv(internalCoeffs_[patchi]),
181 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
183 const auto& bpsi = this->
psi(fieldi).boundaryField();
187 const fvPatchField<Type>& ptf = bpsi[ptfi];
189 const label patchi = globalPatchID(fieldi, ptfi);
193 const Field<Type>& pbc = boundaryCoeffs_[patchi];
199 lduAddr().patchAddr(patchi),
206 const tmp<Field<Type>> tpnf = ptf.patchNeighbourField();
207 const Field<Type>& pnf = tpnf();
209 const labelUList& addr = lduAddr().patchAddr(patchi);
213 source[addr[facei]] +=
224 template<
template<
class>
class ListType>
228 const ListType<Type>&
values 231 const fvMesh&
mesh = psi_.mesh();
241 GeometricField<Type, fvPatchField, volMesh>&
251 if (symmetric() || asymmetric())
255 const label celli = cellLabels[i];
256 const Type& value =
values[i];
258 for (
const label facei :
cells[celli])
260 const label patchi =
mesh.boundaryMesh().patchID(facei);
266 if (celli == own[facei])
268 source_[nei[facei]] -=
upper()[facei]*value;
272 source_[own[facei]] -=
upper()[facei]*value;
275 upper()[facei] = 0.0;
279 if (celli == own[facei])
281 source_[nei[facei]] -=
lower()[facei]*value;
285 source_[own[facei]] -=
upper()[facei]*value;
288 upper()[facei] = 0.0;
289 lower()[facei] = 0.0;
294 if (internalCoeffs_[patchi].size())
296 const label patchFacei =
297 mesh.boundaryMesh()[patchi].whichFace(facei);
299 internalCoeffs_[patchi][patchFacei] =
Zero;
300 boundaryCoeffs_[patchi][patchFacei] =
Zero;
311 const label celli = cellLabels[i];
312 const Type& value =
values[i];
315 source_[celli] = value*Diag[celli];
323 const auto& bpsi = this->
psi(fieldi).boundaryField();
328 if (bpsi[patchi].useImplicit())
332 Pout<<
"fvMatrix<Type>::checkImplicit " 333 <<
" field:" << this->
psi(fieldi).name()
335 << this->
psi(fieldi).mesh().name()
336 <<
" patch:" << bpsi[patchi].patch().name()
347 lduAssemblyName_ = word(
"lduAssembly") + idName;
350 return !idName.empty();
374 <<
"Constructing fvMatrix<Type> for field " << psi_.
name() <<
endl;
393 auto& psiRef = this->
psi(0);
394 const label currentStatePsi = psiRef.eventNo();
395 psiRef.boundaryFieldRef().updateCoeffs();
396 psiRef.eventNo() = currentStatePsi;
405 useImplicit_(fvm.useImplicit_),
406 lduAssemblyName_(fvm.lduAssemblyName_),
407 nMatrix_(fvm.nMatrix_),
408 dimensions_(fvm.dimensions_),
409 source_(fvm.source_),
410 internalCoeffs_(fvm.internalCoeffs_),
411 boundaryCoeffs_(fvm.boundaryCoeffs_)
414 <<
"Copying fvMatrix<Type> for field " << psi_.
name() <<
endl;
416 if (fvm.faceFluxCorrectionPtr_)
418 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
420 *(fvm.faceFluxCorrectionPtr_)
429 lduMatrix(tmat.constCast(), tmat.movable()),
431 useImplicit_(tmat().useImplicit_),
432 lduAssemblyName_(tmat().lduAssemblyName_),
433 nMatrix_(tmat().nMatrix_),
434 dimensions_(tmat().dimensions_),
435 source_(tmat.constCast().source_, tmat.movable()),
436 internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
437 boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable())
440 <<
"Copy/move fvMatrix<Type> for field " << psi_.
name() <<
endl;
442 if (tmat().faceFluxCorrectionPtr_)
446 faceFluxCorrectionPtr_ =
447 std::move(tmat.constCast().faceFluxCorrectionPtr_);
449 else if (tmat().faceFluxCorrectionPtr_)
451 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
453 *(tmat().faceFluxCorrectionPtr_)
468 <<
"Destroying fvMatrix<Type> for field " << psi_.name() <<
endl;
470 subMatrices_.clear();
483 interfaces.
setSize(internalCoeffs_.size());
484 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
489 forAll (fieldInterfaces, patchi)
491 label globalPatchID = lduMeshPtr()->patchMap()[fieldi][patchi];
493 if (globalPatchID != -1)
495 if (fieldInterfaces.set(patchi))
497 if (isA<cyclicLduInterfaceField>(bpsi[patchi]))
503 refCast<const fvPatch>
505 lduMeshPtr()->interfaces()[globalPatchID]
507 bpsi[patchi].internalField()
510 interfaces.
set(globalPatchID, &newInterfaces.
last());
513 else if (isA<cyclicAMILduInterfaceField>(bpsi[patchi]))
519 refCast<const fvPatch>
521 lduMeshPtr()->interfaces()[globalPatchID]
523 bpsi[patchi].internalField()
526 interfaces.
set(globalPatchID, &newInterfaces.
last());
528 else if (isA<cyclicACMILduInterfaceField>(bpsi[patchi]))
534 refCast<const fvPatch>
536 lduMeshPtr()->interfaces()[globalPatchID]
538 bpsi[patchi].internalField()
541 interfaces.
set(globalPatchID, &newInterfaces.
last());
545 interfaces.
set(globalPatchID, &fieldInterfaces[patchi]);
558 const FieldField<Field, Type>& fluxContrib,
559 FieldField<Field, Type>& contrib,
563 const lduPrimitiveMeshAssembly* ptr = lduMeshPtr();
565 const labelList& patchMap = ptr->patchMap()[fieldi];
569 const label globalPtchId = patchMap[patchi];
571 if (globalPtchId != -1)
574 const Field<Type> saveContrib(fluxContrib[globalPtchId]);
575 contrib[patchi].setSize(psi_.boundaryField()[patchi].size()),
576 contrib[patchi] = pTraits<Type>::zero;
584 psi_.boundaryField()[patchi].patchInternalField()
595 psi_.boundaryField()[patchi].patchNeighbourField()
600 else if (globalPtchId == -1)
602 const polyPatch&
pp =
603 this->
psi(fieldi).
mesh().boundaryMesh()[patchi];
605 if (
pp.masterImplicit())
608 ptr->patchLocalToGlobalMap()[fieldi][patchi];
610 const label nbrPatchId =
pp.neighbPolyPatchID();
613 const Field<Type> saveContrib(fluxContrib[virtualPatch]);
615 Field<Type>& coeffs = contrib[patchi];
616 Field<Type>& nbrCoeffs = contrib[nbrPatchId];
618 coeffs.setSize(psi_.boundaryField()[patchi].size());
619 nbrCoeffs.setSize(psi_.boundaryField()[nbrPatchId].size());
621 coeffs = pTraits<Type>::zero;
622 nbrCoeffs = pTraits<Type>::zero;
626 ptr->cellBoundMap()[fieldi][patchi];
629 ptr->cellBoundMap()[fieldi][nbrPatchId];
631 const GeometricField<Type, fvPatchField, volMesh>&
psi =
634 forAll(saveContrib, subFaceI)
637 ptr->facePatchFaceMap()[fieldi][patchi][subFaceI];
638 const label nbrFaceId =
639 ptr->facePatchFaceMap()[fieldi][nbrPatchId][subFaceI];
641 const label nbrCellId = nbrCellIds[subFaceI];
642 const label
cellId = cellIds[subFaceI];
649 nbrCoeffs[nbrFaceId] +=
657 nbrCoeffs[nbrFaceId] +=
675 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
677 const auto&
psi = this->
psi(fieldi);
684 internalCoeffs_.setSize(interfaceI);
685 boundaryCoeffs_.setSize(interfaceI);
688 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
690 const auto&
psi = this->
psi(fieldi);
697 new Field<Type>(
psi.
mesh().boundary()[patchi].size(),
Zero)
703 new Field<Type>(
psi.
mesh().boundary()[patchi].size(),
Zero)
710 for (label i=0; i < nMatrices(); ++i)
715 FieldField<Field, Type>
boundary(bpsi.size());
716 FieldField<Field, Type>
internal(bpsi.size());
721 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
722 if (globalPatchId == -1)
727 matrix(i).boundaryCoeffs()[patchI].clone()
732 matrix(i).internalCoeffs()[patchI].clone()
741 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
742 if (globalPatchId != -1)
744 if (matrix(i).internalCoeffs().
set(patchI))
749 matrix(i).internalCoeffs()[patchI].clone()
753 if (matrix(i).boundaryCoeffs().
set(patchI))
758 matrix(i).boundaryCoeffs()[patchI].clone()
768 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
769 if (globalPatchId == -1)
771 const label implicitPatchId =
772 lduMeshPtr()->patchLocalToGlobalMap()[i][patchI];
776 implicitPatchId,
internal[implicit].clone()
780 implicitPatchId,
boundary[implicit].clone()
800 for (label i=0; i < nMatrices(); ++i)
804 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
806 if (globalPatchId == -1)
824 const labelList& cellMap = lduMeshPtr()->cellOffsets();
826 label newFaces = lduMeshPtr()->lduAddr().upperAddr().
size();
827 label newCells = lduMeshPtr()->lduAddr().size();
832 Field<Type> sourceAssemb(newCells,
Zero);
834 bool asymmetricAssemby =
false;
835 for (label i=0; i < nMatrices(); ++i)
837 if (matrix(i).asymmetric())
839 asymmetricAssemby =
true;
843 for (label i=0; i < nMatrices(); ++i)
845 if (asymmetricAssemby)
850 lowerAssemb[
faceMap[i][facei]] = lowerSub[facei];
856 const Field<Type> sourceSub(matrix(i).source());
860 upperAssemb[
faceMap[i][facei]] = upperSub[facei];
865 const label globalCelli = cellMap[i] + celli;
866 diagAssemb[globalCelli] = diagSub[celli];
867 sourceAssemb[globalCelli] = sourceSub[celli];
871 if (asymmetricAssemby)
874 lower() = lowerAssemb;
877 upper() = upperAssemb;
883 source() = sourceAssemb;
892 psi_.mesh().thisDb().objectRegistry::template getObjectPtr
905 psi_.mesh().thisDb().objectRegistry::template cfindObject
921 psi_.mesh().time().timeName(),
922 psi_.mesh().thisDb(),
931 uFieldPtr(nMatrices());
933 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
939 &const_cast<fvMesh&>(meshi)
941 uFieldPtr.
set(fieldi, &this->
psi(fieldi));
946 lduPrimitiveMeshAssembly* lduAssemMeshPtr =
947 new lduPrimitiveMeshAssembly(
io, uMeshPtr);
949 lduAssemMeshPtr->store();
950 lduAssemMeshPtr->update(uFieldPtr);
953 <<
"Creating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
957 psi_.mesh().changing() && !psi_.mesh().upToDatePoints(*ptr)
963 psi_.mesh().setUpToDatePoints(*ptr);
966 <<
"Updating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
971 <<
"Using lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
994 this->setValuesFromList(cellLabels,
values);
1005 this->setValuesFromList(cellLabels,
values);
1009 template<
class Type>
1014 const bool forceReference
1017 if ((forceReference || psi_.needReference()) && celli >= 0)
1019 source()[celli] +=
diag()[celli]*value;
1025 template<
class Type>
1030 const bool forceReference
1033 if (forceReference || psi_.needReference())
1035 forAll(cellLabels, celli)
1037 const label
cellId = cellLabels[celli];
1048 template<
class Type>
1052 const UList<Type>&
values,
1053 const bool forceReference
1056 if (forceReference || psi_.needReference())
1058 forAll(cellLabels, celli)
1060 const label
cellId = cellLabels[celli];
1071 template<
class Type>
1074 subMatrices_.append(matrix.clone());
1077 if (dimensions_ != matrix.dimensions())
1080 <<
"incompatible dimensions for matrix addition " 1082 <<
"[" << dimensions_ <<
" ] " 1083 <<
" [" << matrix.dimensions() <<
" ]" 1087 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
1089 if (checkImplicit(fieldi))
1095 internalCoeffs_.clear();
1096 boundaryCoeffs_.clear();
1100 template<
class Type>
1109 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
1111 Field<Type>& S = source();
1119 sumMagOffDiag(sumOff);
1122 forAll(psi_.boundaryField(), patchi)
1124 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1128 const labelUList& pa = lduAddr().patchAddr(patchi);
1129 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1133 const Field<Type>& pCoeffs = boundaryCoeffs_[patchi];
1160 scalar maxNon = 0.0;
1161 scalar sumNon = 0.0;
1164 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
1169 maxNon =
max(maxNon, d);
1198 <<
"Matrix dominance test for " << psi_.name() <<
nl 1199 <<
" number of non-dominant cells : " << nNon <<
nl 1200 <<
" maximum relative non-dominance : " << maxNon <<
nl 1201 <<
" average relative non-dominance : " << sumNon <<
nl 1210 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
1217 forAll(psi_.boundaryField(), patchi)
1219 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1223 const labelUList& pa = lduAddr().patchAddr(patchi);
1224 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1237 D[pa[face]] -=
cmptMin(iCoeffs[face]);
1244 S += (
D - D0)*psi_.primitiveField();
1248 template<
class Type>
1253 psi_.mesh().data().isFinalIteration()
1256 scalar relaxCoeff = 0;
1258 if (psi_.mesh().relaxEquation(
name, relaxCoeff))
1265 template<
class Type>
1268 typename GeometricField<Type, fvPatchField, volMesh>::
1274 bFields[patchi].manipulateMatrix(*
this);
1279 template<
class Type>
1283 addCmptAvBoundaryDiag(tdiag.ref());
1288 template<
class Type>
1293 forAll(psi_.boundaryField(), patchi)
1301 lduAddr().patchAddr(patchi),
1302 internalCoeffs_[patchi],
1312 template<
class Type>
1317 "A(" + psi_.name() +
')',
1319 dimensions_/psi_.dimensions()/
dimVol,
1323 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().V();
1324 tAphi.ref().correctBoundaryConditions();
1330 template<
class Type>
1336 "H(" + psi_.name() +
')',
1341 auto& Hphi = tHphi.ref();
1346 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
1349 addBoundaryDiag(boundaryDiagCmpt, cmpt);
1350 boundaryDiagCmpt.negate();
1351 addCmptAvBoundaryDiag(boundaryDiagCmpt);
1362 typename Type::labelType validComponents
1364 psi_.mesh().template validComponents<Type>()
1369 if (validComponents[cmpt] == -1)
1383 template<
class Type>
1390 dimensions_/(
dimVol*psi_.dimensions()),
1393 auto& H1_ = tH1.ref();
1397 forAll(psi_.boundaryField(), patchi)
1399 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1401 if (ptf.coupled() && ptf.size())
1405 lduAddr().patchAddr(patchi),
1412 H1_.primitiveFieldRef() /= psi_.mesh().V();
1413 H1_.correctBoundaryConditions();
1419 template<
class Type>
1424 if (!psi_.mesh().fluxRequired(psi_.name()))
1427 <<
"flux requested but " << psi_.name()
1428 <<
" not specified in the fluxRequired sub-dictionary" 1433 if (nMatrices() > 1)
1436 <<
"Flux requested but " << psi_.name()
1437 <<
" can't handle multiple fvMatrix." 1443 "flux(" + psi_.name() +
')',
1447 auto& fieldFlux = tfieldFlux.ref();
1449 fieldFlux.setOriented();
1453 fieldFlux.primitiveFieldRef().replace
1460 FieldField<Field, Type> InternalContrib = internalCoeffs_;
1465 forAll(InternalContrib, patchi)
1467 InternalContrib[patchi] =
1470 InternalContrib[patchi],
1471 psi_.boundaryField()[patchi].patchInternalField()
1477 FieldField<Field, Type> fluxInternalContrib(internalCoeffs_);
1479 mapContributions(fieldi, fluxInternalContrib, InternalContrib,
true);
1482 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
1486 forAll(NeighbourContrib, patchi)
1488 if (psi_.boundaryField()[patchi].coupled())
1490 NeighbourContrib[patchi] =
1493 NeighbourContrib[patchi],
1494 psi_.boundaryField()[patchi].patchNeighbourField()
1501 FieldField<Field, Type> fluxBoundaryContrib(boundaryCoeffs_);
1503 mapContributions(fieldi, fluxBoundaryContrib, NeighbourContrib,
false);
1506 typename GeometricField<Type, fvsPatchField, surfaceMesh>::
1507 Boundary& ffbf = fieldFlux.boundaryFieldRef();
1511 ffbf[patchi] = InternalContrib[patchi] - NeighbourContrib[patchi];
1515 if (faceFluxCorrectionPtr_)
1517 fieldFlux += *faceFluxCorrectionPtr_;
1524 template<
class Type>
1530 return psi_.mesh().solverDict(
name);
1534 template<
class Type>
1537 return psi_.mesh().solverDict
1539 psi_.select(psi_.mesh().data().isFinalIteration())
1546 template<
class Type>
1554 if (&psi_ != &(fvmv.psi_))
1557 <<
"different fields" 1561 dimensions_ = fvmv.dimensions_;
1563 source_ = fvmv.source_;
1564 internalCoeffs_ = fvmv.internalCoeffs_;
1565 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1567 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1569 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1571 else if (fvmv.faceFluxCorrectionPtr_)
1573 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1575 *fvmv.faceFluxCorrectionPtr_
1579 useImplicit_ = fvmv.useImplicit_;
1580 lduAssemblyName_ = fvmv.lduAssemblyName_;
1584 template<
class Type>
1592 template<
class Type>
1597 internalCoeffs_.negate();
1598 boundaryCoeffs_.negate();
1600 if (faceFluxCorrectionPtr_)
1602 faceFluxCorrectionPtr_->negate();
1607 template<
class Type>
1612 dimensions_ += fvmv.dimensions_;
1614 source_ += fvmv.source_;
1615 internalCoeffs_ += fvmv.internalCoeffs_;
1616 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1618 useImplicit_ = fvmv.useImplicit_;
1619 lduAssemblyName_ = fvmv.lduAssemblyName_;
1620 nMatrix_ = fvmv.nMatrix_;
1622 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1624 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1626 else if (fvmv.faceFluxCorrectionPtr_)
1628 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1630 *fvmv.faceFluxCorrectionPtr_
1636 template<
class Type>
1639 operator+=(tfvmv());
1644 template<
class Type>
1649 dimensions_ -= fvmv.dimensions_;
1651 source_ -= fvmv.source_;
1652 internalCoeffs_ -= fvmv.internalCoeffs_;
1653 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1655 useImplicit_ = fvmv.useImplicit_;
1656 lduAssemblyName_ = fvmv.lduAssemblyName_;
1657 nMatrix_ = fvmv.nMatrix_;
1659 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1661 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1663 else if (fvmv.faceFluxCorrectionPtr_)
1665 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1667 -*fvmv.faceFluxCorrectionPtr_
1673 template<
class Type>
1676 operator-=(tfvmv());
1681 template<
class Type>
1688 source() -= su.mesh().V()*su.field();
1692 template<
class Type>
1703 template<
class Type>
1714 template<
class Type>
1721 source() += su.mesh().V()*su.field();
1725 template<
class Type>
1736 template<
class Type>
1747 template<
class Type>
1753 source() -=
psi().
mesh().V()*su;
1757 template<
class Type>
1763 source() +=
psi().
mesh().V()*su;
1767 template<
class Type>
1773 dimensions_ *= dsf.dimensions();
1775 source_ *= dsf.field();
1777 forAll(boundaryCoeffs_, patchi)
1781 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1784 internalCoeffs_[patchi] *= pisf;
1785 boundaryCoeffs_[patchi] *= pisf;
1788 if (faceFluxCorrectionPtr_)
1791 <<
"cannot scale a matrix containing a faceFluxCorrection" 1797 template<
class Type>
1800 const tmp<volScalarField::Internal>& tfld
1808 template<
class Type>
1819 template<
class Type>
1825 dimensions_ *= ds.dimensions();
1827 source_ *= ds.value();
1828 internalCoeffs_ *= ds.value();
1829 boundaryCoeffs_ *= ds.value();
1831 if (faceFluxCorrectionPtr_)
1833 *faceFluxCorrectionPtr_ *= ds.value();
1840 template<
class Type>
1843 const fvMatrix<Type>& mat1,
1844 const fvMatrix<Type>& mat2,
1848 if (&mat1.psi() != &mat2.psi())
1851 <<
"Incompatible fields for operation\n " 1852 <<
"[" << mat1.psi().name() <<
"] " 1854 <<
" [" << mat2.psi().name() <<
"]" 1861 && mat1.dimensions() != mat2.dimensions()
1865 <<
"Incompatible dimensions for operation\n " 1866 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimVolume <<
" ] " 1868 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimVolume <<
" ]" 1874 template<
class Type>
1877 const fvMatrix<Type>& mat,
1878 const DimensionedField<Type, volMesh>&
fld,
1889 <<
"Incompatible dimensions for operation\n " 1890 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1892 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1898 template<
class Type>
1901 const fvMatrix<Type>& mat,
1902 const dimensioned<Type>& dt,
1909 && mat.dimensions()/
dimVolume != dt.dimensions()
1913 <<
"Incompatible dimensions for operation\n " 1914 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1916 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1922 template<
class Type>
1925 fvMatrix<Type>& mat,
1929 return mat.solve(solverControls);
1932 template<
class Type>
1935 const tmp<fvMatrix<Type>>& tmat,
1939 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1947 template<
class Type>
1950 fvMatrix<Type>& mat,
1954 return mat.solve(
name);
1957 template<
class Type>
1960 const tmp<fvMatrix<Type>>& tmat,
1964 SolverPerformance<Type> solverPerf(tmat.constCast().solve(
name));
1972 template<
class Type>
1978 template<
class Type>
1981 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1989 template<
class Type>
1992 const fvMatrix<Type>&
A 1995 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
1999 tAcorr.ref().faceFluxCorrectionPtr(
nullptr);
2005 template<
class Type>
2008 const tmp<fvMatrix<Type>>& tA
2011 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
2015 tAcorr.
ref().faceFluxCorrectionPtr(
nullptr);
2023 template<
class Type>
2026 const fvMatrix<Type>&
A,
2027 const fvMatrix<Type>&
B 2034 template<
class Type>
2037 const tmp<fvMatrix<Type>>& tA,
2038 const fvMatrix<Type>&
B 2045 template<
class Type>
2048 const fvMatrix<Type>&
A,
2049 const tmp<fvMatrix<Type>>& tB
2056 template<
class Type>
2059 const tmp<fvMatrix<Type>>& tA,
2060 const tmp<fvMatrix<Type>>& tB
2067 template<
class Type>
2070 const fvMatrix<Type>&
A,
2071 const DimensionedField<Type, volMesh>& su
2075 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2076 tC.ref().source() += su.mesh().V()*su.field();
2080 template<
class Type>
2083 const fvMatrix<Type>&
A,
2084 const tmp<DimensionedField<Type, volMesh>>& tsu
2088 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2089 tC.ref().source() += tsu().mesh().V()*tsu().field();
2094 template<
class Type>
2097 const fvMatrix<Type>&
A,
2098 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2102 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2103 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2108 template<
class Type>
2111 const tmp<fvMatrix<Type>>& tA,
2112 const DimensionedField<Type, volMesh>& su
2116 tmp<fvMatrix<Type>> tC(tA.ptr());
2117 tC.ref().source() += su.mesh().V()*su.field();
2121 template<
class Type>
2124 const tmp<fvMatrix<Type>>& tA,
2125 const tmp<DimensionedField<Type, volMesh>>& tsu
2129 tmp<fvMatrix<Type>> tC(tA.ptr());
2130 tC.ref().source() += tsu().mesh().V()*tsu().field();
2135 template<
class Type>
2138 const tmp<fvMatrix<Type>>& tA,
2139 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2143 tmp<fvMatrix<Type>> tC(tA.ptr());
2144 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2149 template<
class Type>
2152 const fvMatrix<Type>&
A,
2153 const dimensioned<Type>& su
2157 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2158 tC.ref().source() +=
A.psi().mesh().V()*su.value();
2162 template<
class Type>
2165 const tmp<fvMatrix<Type>>& tA,
2166 const dimensioned<Type>& su
2170 tmp<fvMatrix<Type>> tC(tA.ptr());
2171 tC.ref().source() += tC().psi().mesh().V()*su.value();
2175 template<
class Type>
2178 const fvMatrix<Type>&
A,
2186 template<
class Type>
2189 const tmp<fvMatrix<Type>>& tA,
2197 template<
class Type>
2200 const fvMatrix<Type>&
A 2203 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2208 template<
class Type>
2211 const tmp<fvMatrix<Type>>& tA
2214 tmp<fvMatrix<Type>> tC(tA.ptr());
2220 template<
class Type>
2223 const fvMatrix<Type>&
A,
2224 const fvMatrix<Type>&
B 2228 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2233 template<
class Type>
2236 const tmp<fvMatrix<Type>>& tA,
2237 const fvMatrix<Type>&
B 2241 tmp<fvMatrix<Type>> tC(tA.
ptr());
2246 template<
class Type>
2249 const fvMatrix<Type>&
A,
2250 const tmp<fvMatrix<Type>>& tB
2254 tmp<fvMatrix<Type>> tC(tB.ptr());
2259 template<
class Type>
2262 const tmp<fvMatrix<Type>>& tA,
2263 const tmp<fvMatrix<Type>>& tB
2267 tmp<fvMatrix<Type>> tC(tA.
ptr());
2273 template<
class Type>
2276 const fvMatrix<Type>&
A,
2277 const DimensionedField<Type, volMesh>& su
2281 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2282 tC.ref().source() -= su.mesh().V()*su.field();
2286 template<
class Type>
2289 const fvMatrix<Type>&
A,
2290 const tmp<DimensionedField<Type, volMesh>>& tsu
2294 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2295 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2300 template<
class Type>
2303 const fvMatrix<Type>&
A,
2304 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2308 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2309 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2314 template<
class Type>
2317 const tmp<fvMatrix<Type>>& tA,
2318 const DimensionedField<Type, volMesh>& su
2322 tmp<fvMatrix<Type>> tC(tA.
ptr());
2323 tC.ref().source() -= su.mesh().V()*su.field();
2327 template<
class Type>
2330 const tmp<fvMatrix<Type>>& tA,
2331 const tmp<DimensionedField<Type, volMesh>>& tsu
2335 tmp<fvMatrix<Type>> tC(tA.
ptr());
2336 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2341 template<
class Type>
2344 const tmp<fvMatrix<Type>>& tA,
2345 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2349 tmp<fvMatrix<Type>> tC(tA.
ptr());
2350 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2355 template<
class Type>
2358 const DimensionedField<Type, volMesh>& su,
2359 const fvMatrix<Type>&
A 2363 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2364 tC.ref().source() -= su.mesh().V()*su.field();
2368 template<
class Type>
2371 const tmp<DimensionedField<Type, volMesh>>& tsu,
2372 const fvMatrix<Type>&
A 2376 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2377 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2382 template<
class Type>
2385 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2386 const fvMatrix<Type>&
A 2390 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2391 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2396 template<
class Type>
2399 const DimensionedField<Type, volMesh>& su,
2400 const tmp<fvMatrix<Type>>& tA
2404 tmp<fvMatrix<Type>> tC(tA.
ptr());
2405 tC.ref().source() -= su.mesh().V()*su.field();
2409 template<
class Type>
2412 const tmp<DimensionedField<Type, volMesh>>& tsu,
2413 const tmp<fvMatrix<Type>>& tA
2417 tmp<fvMatrix<Type>> tC(tA.
ptr());
2418 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2423 template<
class Type>
2426 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2427 const tmp<fvMatrix<Type>>& tA
2431 tmp<fvMatrix<Type>> tC(tA.
ptr());
2432 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2438 template<
class Type>
2441 const fvMatrix<Type>&
A,
2442 const fvMatrix<Type>&
B 2446 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2451 template<
class Type>
2454 const tmp<fvMatrix<Type>>& tA,
2455 const fvMatrix<Type>&
B 2459 tmp<fvMatrix<Type>> tC(tA.
ptr());
2464 template<
class Type>
2467 const fvMatrix<Type>&
A,
2468 const tmp<fvMatrix<Type>>& tB
2472 tmp<fvMatrix<Type>> tC(tB.ptr());
2478 template<
class Type>
2481 const tmp<fvMatrix<Type>>& tA,
2482 const tmp<fvMatrix<Type>>& tB
2486 tmp<fvMatrix<Type>> tC(tA.
ptr());
2492 template<
class Type>
2495 const fvMatrix<Type>&
A,
2496 const DimensionedField<Type, volMesh>& su
2500 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2501 tC.ref().source() += su.mesh().V()*su.field();
2505 template<
class Type>
2508 const fvMatrix<Type>&
A,
2509 const tmp<DimensionedField<Type, volMesh>>& tsu
2513 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2514 tC.ref().source() += tsu().mesh().V()*tsu().field();
2519 template<
class Type>
2522 const fvMatrix<Type>&
A,
2523 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2527 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2528 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2533 template<
class Type>
2536 const tmp<fvMatrix<Type>>& tA,
2537 const DimensionedField<Type, volMesh>& su
2541 tmp<fvMatrix<Type>> tC(tA.
ptr());
2542 tC.ref().source() += su.mesh().V()*su.field();
2546 template<
class Type>
2549 const tmp<fvMatrix<Type>>& tA,
2550 const tmp<DimensionedField<Type, volMesh>>& tsu
2554 tmp<fvMatrix<Type>> tC(tA.
ptr());
2555 tC.ref().source() += tsu().mesh().V()*tsu().field();
2560 template<
class Type>
2563 const tmp<fvMatrix<Type>>& tA,
2564 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2568 tmp<fvMatrix<Type>> tC(tA.
ptr());
2569 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2574 template<
class Type>
2577 const DimensionedField<Type, volMesh>& su,
2578 const fvMatrix<Type>&
A 2582 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2584 tC.ref().source() -= su.mesh().V()*su.field();
2588 template<
class Type>
2591 const tmp<DimensionedField<Type, volMesh>>& tsu,
2592 const fvMatrix<Type>&
A 2596 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2598 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2603 template<
class Type>
2606 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2607 const fvMatrix<Type>&
A 2611 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2613 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2618 template<
class Type>
2621 const DimensionedField<Type, volMesh>& su,
2622 const tmp<fvMatrix<Type>>& tA
2626 tmp<fvMatrix<Type>> tC(tA.
ptr());
2628 tC.ref().source() -= su.mesh().V()*su.field();
2632 template<
class Type>
2635 const tmp<DimensionedField<Type, volMesh>>& tsu,
2636 const tmp<fvMatrix<Type>>& tA
2640 tmp<fvMatrix<Type>> tC(tA.
ptr());
2642 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2647 template<
class Type>
2650 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2651 const tmp<fvMatrix<Type>>& tA
2655 tmp<fvMatrix<Type>> tC(tA.
ptr());
2657 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2662 template<
class Type>
2665 const fvMatrix<Type>&
A,
2666 const dimensioned<Type>& su
2670 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2671 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2675 template<
class Type>
2678 const tmp<fvMatrix<Type>>& tA,
2679 const dimensioned<Type>& su
2683 tmp<fvMatrix<Type>> tC(tA.
ptr());
2684 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2688 template<
class Type>
2691 const dimensioned<Type>& su,
2692 const fvMatrix<Type>&
A 2696 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2697 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2701 template<
class Type>
2704 const dimensioned<Type>& su,
2705 const tmp<fvMatrix<Type>>& tA
2709 tmp<fvMatrix<Type>> tC(tA.
ptr());
2710 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2714 template<
class Type>
2717 const fvMatrix<Type>&
A,
2718 const dimensioned<Type>& su
2722 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2723 tC.ref().source() += su.value()*tC().psi().mesh().V();
2727 template<
class Type>
2730 const tmp<fvMatrix<Type>>& tA,
2731 const dimensioned<Type>& su
2735 tmp<fvMatrix<Type>> tC(tA.
ptr());
2736 tC.ref().source() += su.value()*tC().psi().mesh().V();
2740 template<
class Type>
2743 const dimensioned<Type>& su,
2744 const fvMatrix<Type>&
A 2748 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2750 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2754 template<
class Type>
2757 const dimensioned<Type>& su,
2758 const tmp<fvMatrix<Type>>& tA
2762 tmp<fvMatrix<Type>> tC(tA.
ptr());
2764 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2769 template<
class Type>
2773 const fvMatrix<Type>&
A 2776 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2781 template<
class Type>
2784 const tmp<volScalarField::Internal>& tdsf,
2785 const fvMatrix<Type>&
A 2788 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2793 template<
class Type>
2796 const tmp<volScalarField>& tvsf,
2797 const fvMatrix<Type>&
A 2800 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2805 template<
class Type>
2809 const tmp<fvMatrix<Type>>& tA
2812 tmp<fvMatrix<Type>> tC(tA.
ptr());
2817 template<
class Type>
2820 const tmp<volScalarField::Internal>& tdsf,
2821 const tmp<fvMatrix<Type>>& tA
2824 tmp<fvMatrix<Type>> tC(tA.
ptr());
2829 template<
class Type>
2832 const tmp<volScalarField>& tvsf,
2833 const tmp<fvMatrix<Type>>& tA
2836 tmp<fvMatrix<Type>> tC(tA.
ptr());
2841 template<
class Type>
2844 const dimensioned<scalar>& ds,
2845 const fvMatrix<Type>&
A 2848 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2853 template<
class Type>
2856 const dimensioned<scalar>& ds,
2857 const tmp<fvMatrix<Type>>& tA
2860 tmp<fvMatrix<Type>> tC(tA.
ptr());
2866 template<
class Type>
2870 const fvMatrix<Type>&
M,
2871 const DimensionedField<Type, volMesh>&
psi 2881 auto& Mphi = tMphi.ref();
2890 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2891 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2896 Mphi.primitiveFieldRef() =
Zero;
2899 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2900 M.addBoundarySource(Mphi.primitiveFieldRef());
2902 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2903 Mphi.correctBoundaryConditions();
2908 template<
class Type>
2912 const fvMatrix<Type>&
M,
2913 const tmp<DimensionedField<Type, volMesh>>& tpsi
2916 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2921 template<
class Type>
2925 const fvMatrix<Type>&
M,
2926 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2929 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2934 template<
class Type>
2938 const tmp<fvMatrix<Type>>& tM,
2939 const DimensionedField<Type, volMesh>&
psi 2942 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() &
psi;
2947 template<
class Type>
2951 const tmp<fvMatrix<Type>>& tM,
2952 const tmp<DimensionedField<Type, volMesh>>& tpsi
2955 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2961 template<
class Type>
2965 const tmp<fvMatrix<Type>>& tM,
2966 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2969 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2978 template<
class Type>
2979 Foam::Ostream& Foam::operator<<(Ostream& os, const fvMatrix<Type>& fvm)
2981 os << static_cast<const lduMatrix&>(fvm) <<
nl 2982 << fvm.dimensions_ <<
nl 2983 << fvm.source_ <<
nl 2984 << fvm.internalCoeffs_ <<
nl 2985 << fvm.boundaryCoeffs_ <<
endl;
void mapContributions(label fieldi, const FieldField< Field, Type > &fluxContrib, FieldField< Field, Type > &contrib, bool internal) const
Add internal and boundary contribution to local patches.
void addToInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Add patch contribution to internal field.
void update(UPtrList< GeometricField< Type, fvPatchField, volMesh >> &psis)
Update mappings.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
tmp< Field< Type > > faceH(const Field< Type > &) const
virtual bool coupled() const
True if the patch field is coupled.
void size(const label n)
Older name for setAddressableSize.
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
void setValuesFromList(const labelUList &cellLabels, const ListType< Type > &values)
Set solution in given cells to the specified values.
T & last()
Return reference to the last element of the list.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
void createOrUpdateLduPrimitiveAssembly()
Create or update ldu assembly.
List< cell > cellList
List of cell.
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void relax()
Relax matrix (for steady-state solution).
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...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
void negate()
Inplace negate.
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.
void addCmptAvBoundaryDiag(scalarField &diag) const
constexpr char nl
The newline '\n' character (0x0a)
void setReference(const label celli, const Type &value, const bool forceReference=false)
Set reference level for solution.
void manipulateMatrix(direction cmp)
Manipulate matrix.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
A traits class, which is primarily used for primitives and vector-space.
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.
void operator-=(const fvMatrix< Type > &)
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
bool checkImplicit(const label fieldi=0)
Name the implicit assembly addressing.
static int & msgType() noexcept
Message tag of standard messages.
Generic GeometricField class.
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Generic dimensioned Type class.
tmp< volScalarField > H1() const
Return H(1)
Ignore writing from objectRegistry::writeObject()
void subtractFromInternalField(const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const
Subtract patch contribution from internal field.
List< labelList > labelListList
List of labelList.
DimensionedField< scalar, volMesh > Internal
The internal field type from which this GeometricField is derived.
tmp< scalarField > H1() const
conserve primitiveFieldRef()+
UList< label > labelUList
A UList of labels.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
tmp< scalarField > D() const
Return the matrix scalar diagonal.
void operator=(const fvMatrix< Type > &)
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
#define forAll(list, i)
Loop across all elements in list.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
const dimensionSet dimVolume(pow3(dimLength))
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void addFvMatrix(fvMatrix< Type > &matrix)
Add fvMatrix.
Generic templated field type.
void setInterfaces(lduInterfaceFieldPtrsList &, PtrDynList< lduInterfaceField > &newInterfaces)
Set interfaces.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void setReferences(const labelUList &cellLabels, const Type &value, const bool forceReference=false)
Set reference level for solution.
#define DebugInFunction
Report an information message using Foam::Info.
void checkMethod(const faMatrix< Type > &, const faMatrix< Type > &, const char *)
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
virtual ~fvMatrix()
Destructor.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
void transferFvMatrixCoeffs()
Transfer lower, upper, diag and source to this fvMatrix.
errorManip< error > abort(error &err)
void operator=(const lduMatrix &)
Copy assignment.
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
This boundary condition enforces a cyclic condition between a pair of boundaries. ...
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< 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)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
fvMatrix(const GeometricField< Type, fvPatchField, volMesh > &psi, const dimensionSet &ds)
Construct given a field to solve for.
void operator*=(const scalarField &)
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
const dimensionSet & dimensions() const noexcept
Return dimensions.
A dynamically resizable PtrList with allocation management.
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))
lduPrimitiveMeshAssembly * lduMeshPtr()
Access to lduPrimitiveMeshAssembly.
void operator+=(const fvMatrix< Type > &)
tmp< Field< Type > > DD() const
Return the matrix Type diagonal.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
tmp< volScalarField > A() const
Return the central coefficient.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
static bool checking() noexcept
True if dimension checking is enabled (the usual default)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
const Field< Type > & field() const noexcept
Return const-reference to the primitive field values.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Mesh & mesh() const noexcept
Return const reference to mesh.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
messageStream Info
Information stream (stdout output on master, null elsewhere)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void addBoundarySource(Field< Type > &source, const bool couples=true) const
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
const volScalarField & psi
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
std::enable_if_t< std::is_same_v< bool, TypeT >, bool > set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
void boundaryManipulate(typename GeometricField< Type, fvPatchField, volMesh >::Boundary &values)
Manipulate based on a boundary field.
tmp< Field< Type > > H(const Field< Type > &) const
const dimensionedScalar & D
void operator-=(const lduMatrix &)
void operator+=(const lduMatrix &)
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
List< label > labelList
A List of labels.
void clearOut()
Clear additional addressing.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
void setSize(const label n)
Alias for resize()
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
void setBounAndInterCoeffs()
Manipulate boundary/internal coeffs for coupling.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const dictionary & solverDict() const
Return the solver dictionary for psi, taking into account finalIteration.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
#define InfoInFunction
Report an information message using Foam::Info.
static constexpr const zero Zero
Global zero (0)
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.