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() +
')',
1448 auto& fieldFlux = tfieldFlux.ref();
1449 fieldFlux.setOriented();
1452 FieldField<Field, Type> InternalContrib = internalCoeffs_;
1457 forAll(InternalContrib, patchi)
1459 InternalContrib[patchi] =
1462 InternalContrib[patchi],
1463 psi_.boundaryField()[patchi].patchInternalField()
1469 FieldField<Field, Type> fluxInternalContrib(internalCoeffs_);
1471 mapContributions(fieldi, fluxInternalContrib, InternalContrib,
true);
1474 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
1478 forAll(NeighbourContrib, patchi)
1480 if (psi_.boundaryField()[patchi].coupled())
1482 NeighbourContrib[patchi] =
1485 NeighbourContrib[patchi],
1486 psi_.boundaryField()[patchi].patchNeighbourField()
1493 FieldField<Field, Type> fluxBoundaryContrib(boundaryCoeffs_);
1495 mapContributions(fieldi, fluxBoundaryContrib, NeighbourContrib,
false);
1500 auto& ffbf = fieldFlux.boundaryFieldRef();
1504 ffbf[patchi] = InternalContrib[patchi] - NeighbourContrib[patchi];
1509 if (faceFluxCorrectionPtr_)
1511 fieldFlux += *faceFluxCorrectionPtr_;
1518 template<
class Type>
1524 return psi_.mesh().solverDict(
name);
1528 template<
class Type>
1531 return psi_.mesh().solverDict
1533 psi_.select(psi_.mesh().data().isFinalIteration())
1540 template<
class Type>
1548 if (&psi_ != &(fvmv.psi_))
1551 <<
"different fields" 1555 dimensions_ = fvmv.dimensions_;
1557 source_ = fvmv.source_;
1558 internalCoeffs_ = fvmv.internalCoeffs_;
1559 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1561 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1563 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1565 else if (fvmv.faceFluxCorrectionPtr_)
1567 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1569 *fvmv.faceFluxCorrectionPtr_
1573 useImplicit_ = fvmv.useImplicit_;
1574 lduAssemblyName_ = fvmv.lduAssemblyName_;
1578 template<
class Type>
1586 template<
class Type>
1591 internalCoeffs_.negate();
1592 boundaryCoeffs_.negate();
1594 if (faceFluxCorrectionPtr_)
1596 faceFluxCorrectionPtr_->negate();
1601 template<
class Type>
1606 dimensions_ += fvmv.dimensions_;
1608 source_ += fvmv.source_;
1609 internalCoeffs_ += fvmv.internalCoeffs_;
1610 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1612 useImplicit_ = fvmv.useImplicit_;
1613 lduAssemblyName_ = fvmv.lduAssemblyName_;
1614 nMatrix_ = fvmv.nMatrix_;
1616 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1618 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1620 else if (fvmv.faceFluxCorrectionPtr_)
1622 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1624 *fvmv.faceFluxCorrectionPtr_
1630 template<
class Type>
1633 operator+=(tfvmv());
1638 template<
class Type>
1643 dimensions_ -= fvmv.dimensions_;
1645 source_ -= fvmv.source_;
1646 internalCoeffs_ -= fvmv.internalCoeffs_;
1647 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1649 useImplicit_ = fvmv.useImplicit_;
1650 lduAssemblyName_ = fvmv.lduAssemblyName_;
1651 nMatrix_ = fvmv.nMatrix_;
1653 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1655 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1657 else if (fvmv.faceFluxCorrectionPtr_)
1659 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1661 -*fvmv.faceFluxCorrectionPtr_
1667 template<
class Type>
1670 operator-=(tfvmv());
1675 template<
class Type>
1682 source() -= su.mesh().V()*su.field();
1686 template<
class Type>
1697 template<
class Type>
1708 template<
class Type>
1715 source() += su.mesh().V()*su.field();
1719 template<
class Type>
1730 template<
class Type>
1741 template<
class Type>
1747 source() -=
psi().
mesh().V()*su;
1751 template<
class Type>
1757 source() +=
psi().
mesh().V()*su;
1761 template<
class Type>
1767 dimensions_ *= dsf.dimensions();
1769 source_ *= dsf.field();
1771 forAll(boundaryCoeffs_, patchi)
1775 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1778 internalCoeffs_[patchi] *= pisf;
1779 boundaryCoeffs_[patchi] *= pisf;
1782 if (faceFluxCorrectionPtr_)
1785 <<
"cannot scale a matrix containing a faceFluxCorrection" 1791 template<
class Type>
1794 const tmp<volScalarField::Internal>& tfld
1802 template<
class Type>
1813 template<
class Type>
1819 dimensions_ *= ds.dimensions();
1821 source_ *= ds.value();
1822 internalCoeffs_ *= ds.value();
1823 boundaryCoeffs_ *= ds.value();
1825 if (faceFluxCorrectionPtr_)
1827 *faceFluxCorrectionPtr_ *= ds.value();
1834 template<
class Type>
1837 const fvMatrix<Type>& mat1,
1838 const fvMatrix<Type>& mat2,
1842 if (&mat1.psi() != &mat2.psi())
1845 <<
"Incompatible fields for operation\n " 1846 <<
"[" << mat1.psi().name() <<
"] " 1848 <<
" [" << mat2.psi().name() <<
"]" 1855 && mat1.dimensions() != mat2.dimensions()
1859 <<
"Incompatible dimensions for operation\n " 1860 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimVolume <<
" ] " 1862 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimVolume <<
" ]" 1868 template<
class Type>
1871 const fvMatrix<Type>& mat,
1872 const DimensionedField<Type, volMesh>&
fld,
1883 <<
"Incompatible dimensions for operation\n " 1884 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1886 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1892 template<
class Type>
1895 const fvMatrix<Type>& mat,
1896 const dimensioned<Type>& dt,
1903 && mat.dimensions()/
dimVolume != dt.dimensions()
1907 <<
"Incompatible dimensions for operation\n " 1908 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1910 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1916 template<
class Type>
1919 fvMatrix<Type>& mat,
1923 return mat.solve(solverControls);
1926 template<
class Type>
1929 const tmp<fvMatrix<Type>>& tmat,
1933 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1941 template<
class Type>
1944 fvMatrix<Type>& mat,
1948 return mat.solve(
name);
1951 template<
class Type>
1954 const tmp<fvMatrix<Type>>& tmat,
1958 SolverPerformance<Type> solverPerf(tmat.constCast().solve(
name));
1966 template<
class Type>
1972 template<
class Type>
1975 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1983 template<
class Type>
1986 const fvMatrix<Type>&
A 1989 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
1993 tAcorr.ref().faceFluxCorrectionPtr(
nullptr);
1999 template<
class Type>
2002 const tmp<fvMatrix<Type>>& tA
2005 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
2009 tAcorr.
ref().faceFluxCorrectionPtr(
nullptr);
2017 template<
class Type>
2020 const fvMatrix<Type>&
A,
2021 const fvMatrix<Type>&
B 2028 template<
class Type>
2031 const tmp<fvMatrix<Type>>& tA,
2032 const fvMatrix<Type>&
B 2039 template<
class Type>
2042 const fvMatrix<Type>&
A,
2043 const tmp<fvMatrix<Type>>& tB
2050 template<
class Type>
2053 const tmp<fvMatrix<Type>>& tA,
2054 const tmp<fvMatrix<Type>>& tB
2061 template<
class Type>
2064 const fvMatrix<Type>&
A,
2065 const DimensionedField<Type, volMesh>& su
2069 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2070 tC.ref().source() += su.mesh().V()*su.field();
2074 template<
class Type>
2077 const fvMatrix<Type>&
A,
2078 const tmp<DimensionedField<Type, volMesh>>& tsu
2082 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2083 tC.ref().source() += tsu().mesh().V()*tsu().field();
2088 template<
class Type>
2091 const fvMatrix<Type>&
A,
2092 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2096 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2097 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2102 template<
class Type>
2105 const tmp<fvMatrix<Type>>& tA,
2106 const DimensionedField<Type, volMesh>& su
2110 tmp<fvMatrix<Type>> tC(tA.ptr());
2111 tC.ref().source() += su.mesh().V()*su.field();
2115 template<
class Type>
2118 const tmp<fvMatrix<Type>>& tA,
2119 const tmp<DimensionedField<Type, volMesh>>& tsu
2123 tmp<fvMatrix<Type>> tC(tA.ptr());
2124 tC.ref().source() += tsu().mesh().V()*tsu().field();
2129 template<
class Type>
2132 const tmp<fvMatrix<Type>>& tA,
2133 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2137 tmp<fvMatrix<Type>> tC(tA.ptr());
2138 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2143 template<
class Type>
2146 const fvMatrix<Type>&
A,
2147 const dimensioned<Type>& su
2151 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2152 tC.ref().source() +=
A.psi().mesh().V()*su.value();
2156 template<
class Type>
2159 const tmp<fvMatrix<Type>>& tA,
2160 const dimensioned<Type>& su
2164 tmp<fvMatrix<Type>> tC(tA.ptr());
2165 tC.ref().source() += tC().psi().mesh().V()*su.value();
2169 template<
class Type>
2172 const fvMatrix<Type>&
A,
2180 template<
class Type>
2183 const tmp<fvMatrix<Type>>& tA,
2191 template<
class Type>
2194 const fvMatrix<Type>&
A 2197 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2202 template<
class Type>
2205 const tmp<fvMatrix<Type>>& tA
2208 tmp<fvMatrix<Type>> tC(tA.ptr());
2214 template<
class Type>
2217 const fvMatrix<Type>&
A,
2218 const fvMatrix<Type>&
B 2222 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2227 template<
class Type>
2230 const tmp<fvMatrix<Type>>& tA,
2231 const fvMatrix<Type>&
B 2235 tmp<fvMatrix<Type>> tC(tA.
ptr());
2240 template<
class Type>
2243 const fvMatrix<Type>&
A,
2244 const tmp<fvMatrix<Type>>& tB
2248 tmp<fvMatrix<Type>> tC(tB.ptr());
2253 template<
class Type>
2256 const tmp<fvMatrix<Type>>& tA,
2257 const tmp<fvMatrix<Type>>& tB
2261 tmp<fvMatrix<Type>> tC(tA.
ptr());
2267 template<
class Type>
2270 const fvMatrix<Type>&
A,
2271 const DimensionedField<Type, volMesh>& su
2275 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2276 tC.ref().source() -= su.mesh().V()*su.field();
2280 template<
class Type>
2283 const fvMatrix<Type>&
A,
2284 const tmp<DimensionedField<Type, volMesh>>& tsu
2288 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2289 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2294 template<
class Type>
2297 const fvMatrix<Type>&
A,
2298 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2302 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2303 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2308 template<
class Type>
2311 const tmp<fvMatrix<Type>>& tA,
2312 const DimensionedField<Type, volMesh>& su
2316 tmp<fvMatrix<Type>> tC(tA.
ptr());
2317 tC.ref().source() -= su.mesh().V()*su.field();
2321 template<
class Type>
2324 const tmp<fvMatrix<Type>>& tA,
2325 const tmp<DimensionedField<Type, volMesh>>& tsu
2329 tmp<fvMatrix<Type>> tC(tA.
ptr());
2330 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2335 template<
class Type>
2338 const tmp<fvMatrix<Type>>& tA,
2339 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2343 tmp<fvMatrix<Type>> tC(tA.
ptr());
2344 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2349 template<
class Type>
2352 const DimensionedField<Type, volMesh>& su,
2353 const fvMatrix<Type>&
A 2357 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2358 tC.ref().source() -= su.mesh().V()*su.field();
2362 template<
class Type>
2365 const tmp<DimensionedField<Type, volMesh>>& tsu,
2366 const fvMatrix<Type>&
A 2370 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2371 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2376 template<
class Type>
2379 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2380 const fvMatrix<Type>&
A 2384 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2385 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2390 template<
class Type>
2393 const DimensionedField<Type, volMesh>& su,
2394 const tmp<fvMatrix<Type>>& tA
2398 tmp<fvMatrix<Type>> tC(tA.
ptr());
2399 tC.ref().source() -= su.mesh().V()*su.field();
2403 template<
class Type>
2406 const tmp<DimensionedField<Type, volMesh>>& tsu,
2407 const tmp<fvMatrix<Type>>& tA
2411 tmp<fvMatrix<Type>> tC(tA.
ptr());
2412 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2417 template<
class Type>
2420 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2421 const tmp<fvMatrix<Type>>& tA
2425 tmp<fvMatrix<Type>> tC(tA.
ptr());
2426 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2432 template<
class Type>
2435 const fvMatrix<Type>&
A,
2436 const fvMatrix<Type>&
B 2440 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2445 template<
class Type>
2448 const tmp<fvMatrix<Type>>& tA,
2449 const fvMatrix<Type>&
B 2453 tmp<fvMatrix<Type>> tC(tA.
ptr());
2458 template<
class Type>
2461 const fvMatrix<Type>&
A,
2462 const tmp<fvMatrix<Type>>& tB
2466 tmp<fvMatrix<Type>> tC(tB.ptr());
2472 template<
class Type>
2475 const tmp<fvMatrix<Type>>& tA,
2476 const tmp<fvMatrix<Type>>& tB
2480 tmp<fvMatrix<Type>> tC(tA.
ptr());
2486 template<
class Type>
2489 const fvMatrix<Type>&
A,
2490 const DimensionedField<Type, volMesh>& su
2494 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2495 tC.ref().source() += su.mesh().V()*su.field();
2499 template<
class Type>
2502 const fvMatrix<Type>&
A,
2503 const tmp<DimensionedField<Type, volMesh>>& tsu
2507 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2508 tC.ref().source() += tsu().mesh().V()*tsu().field();
2513 template<
class Type>
2516 const fvMatrix<Type>&
A,
2517 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2521 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2522 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2527 template<
class Type>
2530 const tmp<fvMatrix<Type>>& tA,
2531 const DimensionedField<Type, volMesh>& su
2535 tmp<fvMatrix<Type>> tC(tA.
ptr());
2536 tC.ref().source() += su.mesh().V()*su.field();
2540 template<
class Type>
2543 const tmp<fvMatrix<Type>>& tA,
2544 const tmp<DimensionedField<Type, volMesh>>& tsu
2548 tmp<fvMatrix<Type>> tC(tA.
ptr());
2549 tC.ref().source() += tsu().mesh().V()*tsu().field();
2554 template<
class Type>
2557 const tmp<fvMatrix<Type>>& tA,
2558 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2562 tmp<fvMatrix<Type>> tC(tA.
ptr());
2563 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2568 template<
class Type>
2571 const DimensionedField<Type, volMesh>& su,
2572 const fvMatrix<Type>&
A 2576 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2578 tC.ref().source() -= su.mesh().V()*su.field();
2582 template<
class Type>
2585 const tmp<DimensionedField<Type, volMesh>>& tsu,
2586 const fvMatrix<Type>&
A 2590 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2592 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2597 template<
class Type>
2600 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2601 const fvMatrix<Type>&
A 2605 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2607 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2612 template<
class Type>
2615 const DimensionedField<Type, volMesh>& su,
2616 const tmp<fvMatrix<Type>>& tA
2620 tmp<fvMatrix<Type>> tC(tA.
ptr());
2622 tC.ref().source() -= su.mesh().V()*su.field();
2626 template<
class Type>
2629 const tmp<DimensionedField<Type, volMesh>>& tsu,
2630 const tmp<fvMatrix<Type>>& tA
2634 tmp<fvMatrix<Type>> tC(tA.
ptr());
2636 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2641 template<
class Type>
2644 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2645 const tmp<fvMatrix<Type>>& tA
2649 tmp<fvMatrix<Type>> tC(tA.
ptr());
2651 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2656 template<
class Type>
2659 const fvMatrix<Type>&
A,
2660 const dimensioned<Type>& su
2664 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2665 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2669 template<
class Type>
2672 const tmp<fvMatrix<Type>>& tA,
2673 const dimensioned<Type>& su
2677 tmp<fvMatrix<Type>> tC(tA.
ptr());
2678 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2682 template<
class Type>
2685 const dimensioned<Type>& su,
2686 const fvMatrix<Type>&
A 2690 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2691 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2695 template<
class Type>
2698 const dimensioned<Type>& su,
2699 const tmp<fvMatrix<Type>>& tA
2703 tmp<fvMatrix<Type>> tC(tA.
ptr());
2704 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2708 template<
class Type>
2711 const fvMatrix<Type>&
A,
2712 const dimensioned<Type>& su
2716 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2717 tC.ref().source() += su.value()*tC().psi().mesh().V();
2721 template<
class Type>
2724 const tmp<fvMatrix<Type>>& tA,
2725 const dimensioned<Type>& su
2729 tmp<fvMatrix<Type>> tC(tA.
ptr());
2730 tC.ref().source() += su.value()*tC().psi().mesh().V();
2734 template<
class Type>
2737 const dimensioned<Type>& su,
2738 const fvMatrix<Type>&
A 2742 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2744 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2748 template<
class Type>
2751 const dimensioned<Type>& su,
2752 const tmp<fvMatrix<Type>>& tA
2756 tmp<fvMatrix<Type>> tC(tA.
ptr());
2758 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2763 template<
class Type>
2767 const fvMatrix<Type>&
A 2770 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2775 template<
class Type>
2778 const tmp<volScalarField::Internal>& tdsf,
2779 const fvMatrix<Type>&
A 2782 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2787 template<
class Type>
2790 const tmp<volScalarField>& tvsf,
2791 const fvMatrix<Type>&
A 2794 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2799 template<
class Type>
2803 const tmp<fvMatrix<Type>>& tA
2806 tmp<fvMatrix<Type>> tC(tA.
ptr());
2811 template<
class Type>
2814 const tmp<volScalarField::Internal>& tdsf,
2815 const tmp<fvMatrix<Type>>& tA
2818 tmp<fvMatrix<Type>> tC(tA.
ptr());
2823 template<
class Type>
2826 const tmp<volScalarField>& tvsf,
2827 const tmp<fvMatrix<Type>>& tA
2830 tmp<fvMatrix<Type>> tC(tA.
ptr());
2835 template<
class Type>
2838 const dimensioned<scalar>& ds,
2839 const fvMatrix<Type>&
A 2842 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2847 template<
class Type>
2850 const dimensioned<scalar>& ds,
2851 const tmp<fvMatrix<Type>>& tA
2854 tmp<fvMatrix<Type>> tC(tA.
ptr());
2860 template<
class Type>
2864 const fvMatrix<Type>&
M,
2865 const DimensionedField<Type, volMesh>&
psi 2875 auto& Mphi = tMphi.ref();
2884 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2885 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2890 Mphi.primitiveFieldRef() =
Zero;
2893 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2894 M.addBoundarySource(Mphi.primitiveFieldRef());
2896 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2897 Mphi.correctBoundaryConditions();
2902 template<
class Type>
2906 const fvMatrix<Type>&
M,
2907 const tmp<DimensionedField<Type, volMesh>>& tpsi
2910 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2915 template<
class Type>
2919 const fvMatrix<Type>&
M,
2920 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2923 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2928 template<
class Type>
2932 const tmp<fvMatrix<Type>>& tM,
2933 const DimensionedField<Type, volMesh>&
psi 2936 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() &
psi;
2941 template<
class Type>
2945 const tmp<fvMatrix<Type>>& tM,
2946 const tmp<DimensionedField<Type, volMesh>>& tpsi
2949 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2955 template<
class Type>
2959 const tmp<fvMatrix<Type>>& tM,
2960 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2963 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2972 template<
class Type>
2973 Foam::Ostream& Foam::operator<<(Ostream& os, const fvMatrix<Type>& fvm)
2975 os << static_cast<const lduMatrix&>(fvm) <<
nl 2976 << fvm.dimensions_ <<
nl 2977 << fvm.source_ <<
nl 2978 << fvm.internalCoeffs_ <<
nl 2979 << fvm.boundaryCoeffs_ <<
endl;
2989 template<
class Type>
2990 template<
typename E>
2997 typename E::DiagExpr,
2998 typename E::UpperExpr,
2999 typename E::LowerExpr,
3000 typename E::FaceFluxExpr,
3001 typename E::SourceExpr
3007 useImplicit_(false),
3010 dimensions_(
expr.dimensions()),
3016 <<
"Constructing fvMatrix<Type> from expression for field " 3022 expr.evaluate(*
this);
3024 auto& psiRef = this->
psi(0);
3025 const label currentStatePsi = psiRef.eventNo();
3026 psiRef.boundaryFieldRef().updateCoeffs();
3027 psiRef.eventNo() = currentStatePsi;
3031 template<
class Type>
3039 template<
class Type>
3040 template<
typename E>
3046 typename E::DiagExpr,
3047 typename E::UpperExpr,
3048 typename E::LowerExpr,
3049 typename E::FaceFluxExpr,
3050 typename E::SourceExpr
3054 expr.evaluate(*
this);
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.
Expression wrap of const reference to fvMatrix.
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.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
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.
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 that is much like a Foam::List except that it is expected to hold numeri...
void setInterfaces(lduInterfaceFieldPtrsList &, PtrDynList< lduInterfaceField > &newInterfaces)
Set interfaces.
ListConstRefWrap< typename Expr::value_type > expr
Fully self-contained constant field wrapper. Not needed?
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 > &)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
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)
Expression::fvMatrixConstRefWrap< fvMatrix< Type > > expr() const
Wrap value as expression.
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.
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.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
static bool checking() noexcept
True if dimension checking is enabled (the usual default)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const DynamicField< Type > & field() const noexcept
Return const-reference to the primitive field values.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
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.
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.
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.
void setSize(label n)
Alias for resize()
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.