58 <<
"addressing (" << addr.
size()
59 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 65 intf[addr[facei]] += pf[facei];
75 const tmp<Field<Type2>>& tpf,
79 addToInternalField(addr, tpf(), intf);
96 <<
"addressing (" << addr.
size()
97 <<
") and field (" << pf.
size() <<
") are different sizes" <<
endl 103 intf[addr[facei]] -= pf[facei];
109 template<
class Type2>
113 const tmp<Field<Type2>>& tpf,
117 subtractFromInternalField(addr, tpf(), intf);
129 for (label fieldi = 0; fieldi < nMatrices(); ++fieldi)
131 const auto& bpsi = this->
psi(fieldi).boundaryField();
135 const label patchi = globalPatchID(fieldi, ptfi);
141 lduAddr().patchAddr(patchi),
142 internalCoeffs_[patchi].
component(solveCmpt),
154 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
156 const auto& bpsi = this->
psi(fieldi).boundaryField();
160 const label patchi = globalPatchID(fieldi, ptfi);
165 lduAddr().patchAddr(patchi),
166 cmptAv(internalCoeffs_[patchi]),
182 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
184 const auto& bpsi = this->
psi(fieldi).boundaryField();
188 const fvPatchField<Type>& ptf = bpsi[ptfi];
190 const label patchi = globalPatchID(fieldi, ptfi);
194 const Field<Type>& pbc = boundaryCoeffs_[patchi];
200 lduAddr().patchAddr(patchi),
207 const tmp<Field<Type>> tpnf = ptf.patchNeighbourField();
208 const Field<Type>& pnf = tpnf();
210 const labelUList& addr = lduAddr().patchAddr(patchi);
214 source[addr[facei]] +=
225 template<
template<
class>
class ListType>
229 const ListType<Type>&
values 232 const fvMesh&
mesh = psi_.mesh();
242 GeometricField<Type, fvPatchField, volMesh>&
252 if (symmetric() || asymmetric())
256 const label celli = cellLabels[i];
257 const Type& value =
values[i];
259 for (
const label facei :
cells[celli])
261 const label patchi =
mesh.boundaryMesh().patchID(facei);
267 if (celli == own[facei])
269 source_[nei[facei]] -=
upper()[facei]*value;
273 source_[own[facei]] -=
upper()[facei]*value;
276 upper()[facei] = 0.0;
280 if (celli == own[facei])
282 source_[nei[facei]] -=
lower()[facei]*value;
286 source_[own[facei]] -=
upper()[facei]*value;
289 upper()[facei] = 0.0;
290 lower()[facei] = 0.0;
295 if (internalCoeffs_[patchi].size())
297 const label patchFacei =
298 mesh.boundaryMesh()[patchi].whichFace(facei);
300 internalCoeffs_[patchi][patchFacei] =
Zero;
301 boundaryCoeffs_[patchi][patchFacei] =
Zero;
312 const label celli = cellLabels[i];
313 const Type& value =
values[i];
316 source_[celli] = value*Diag[celli];
324 const auto& bpsi = this->
psi(fieldi).boundaryField();
329 if (bpsi[patchi].useImplicit())
333 Pout<<
"fvMatrix<Type>::checkImplicit " 334 <<
" field:" << this->
psi(fieldi).name()
336 << this->
psi(fieldi).mesh().name()
337 <<
" patch:" << bpsi[patchi].patch().name()
348 lduAssemblyName_ = word(
"lduAssembly") + idName;
351 return !idName.empty();
375 <<
"Constructing fvMatrix<Type> for field " << psi_.
name() <<
endl;
394 auto& psiRef = this->
psi(0);
395 const label currentStatePsi = psiRef.eventNo();
396 psiRef.boundaryFieldRef().updateCoeffs();
397 psiRef.eventNo() = currentStatePsi;
406 useImplicit_(fvm.useImplicit_),
407 lduAssemblyName_(fvm.lduAssemblyName_),
408 nMatrix_(fvm.nMatrix_),
409 dimensions_(fvm.dimensions_),
410 source_(fvm.source_),
411 internalCoeffs_(fvm.internalCoeffs_),
412 boundaryCoeffs_(fvm.boundaryCoeffs_)
415 <<
"Copying fvMatrix<Type> for field " << psi_.
name() <<
endl;
417 if (fvm.faceFluxCorrectionPtr_)
419 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
421 *(fvm.faceFluxCorrectionPtr_)
430 lduMatrix(tmat.constCast(), tmat.movable()),
432 useImplicit_(tmat().useImplicit_),
433 lduAssemblyName_(tmat().lduAssemblyName_),
434 nMatrix_(tmat().nMatrix_),
435 dimensions_(tmat().dimensions_),
436 source_(tmat.constCast().source_, tmat.movable()),
437 internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
438 boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable())
441 <<
"Copy/move fvMatrix<Type> for field " << psi_.
name() <<
endl;
443 if (tmat().faceFluxCorrectionPtr_)
447 faceFluxCorrectionPtr_ =
448 std::move(tmat.constCast().faceFluxCorrectionPtr_);
450 else if (tmat().faceFluxCorrectionPtr_)
452 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
454 *(tmat().faceFluxCorrectionPtr_)
469 <<
"Destroying fvMatrix<Type> for field " << psi_.name() <<
endl;
471 subMatrices_.clear();
484 interfaces.
setSize(internalCoeffs_.size());
485 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
490 forAll (fieldInterfaces, patchi)
492 label globalPatchID = lduMeshPtr()->patchMap()[fieldi][patchi];
494 if (globalPatchID != -1)
496 if (fieldInterfaces.set(patchi))
498 if (isA<cyclicLduInterfaceField>(bpsi[patchi]))
504 refCast<const fvPatch>
506 lduMeshPtr()->interfaces()[globalPatchID]
508 bpsi[patchi].internalField()
511 interfaces.
set(globalPatchID, &newInterfaces.
last());
514 else if (isA<cyclicAMILduInterfaceField>(bpsi[patchi]))
520 refCast<const fvPatch>
522 lduMeshPtr()->interfaces()[globalPatchID]
524 bpsi[patchi].internalField()
527 interfaces.
set(globalPatchID, &newInterfaces.
last());
529 else if (isA<cyclicACMILduInterfaceField>(bpsi[patchi]))
535 refCast<const fvPatch>
537 lduMeshPtr()->interfaces()[globalPatchID]
539 bpsi[patchi].internalField()
542 interfaces.
set(globalPatchID, &newInterfaces.
last());
546 interfaces.
set(globalPatchID, &fieldInterfaces[patchi]);
559 const FieldField<Field, Type>& fluxContrib,
560 FieldField<Field, Type>& contrib,
564 const lduPrimitiveMeshAssembly* ptr = lduMeshPtr();
566 const labelList& patchMap = ptr->patchMap()[fieldi];
570 const label globalPtchId = patchMap[patchi];
572 if (globalPtchId != -1)
575 const Field<Type> saveContrib(fluxContrib[globalPtchId]);
576 contrib[patchi].setSize(psi_.boundaryField()[patchi].size()),
577 contrib[patchi] = pTraits<Type>::zero;
585 psi_.boundaryField()[patchi].patchInternalField()
596 psi_.boundaryField()[patchi].patchNeighbourField()
601 else if (globalPtchId == -1)
603 const polyPatch&
pp =
604 this->
psi(fieldi).
mesh().boundaryMesh()[patchi];
606 if (
pp.masterImplicit())
609 ptr->patchLocalToGlobalMap()[fieldi][patchi];
611 const label nbrPatchId =
pp.neighbPolyPatchID();
614 const Field<Type> saveContrib(fluxContrib[virtualPatch]);
616 Field<Type>& coeffs = contrib[patchi];
617 Field<Type>& nbrCoeffs = contrib[nbrPatchId];
619 coeffs.setSize(psi_.boundaryField()[patchi].size());
620 nbrCoeffs.setSize(psi_.boundaryField()[nbrPatchId].size());
622 coeffs = pTraits<Type>::zero;
623 nbrCoeffs = pTraits<Type>::zero;
627 ptr->cellBoundMap()[fieldi][patchi];
630 ptr->cellBoundMap()[fieldi][nbrPatchId];
632 const GeometricField<Type, fvPatchField, volMesh>&
psi =
635 forAll(saveContrib, subFaceI)
638 ptr->facePatchFaceMap()[fieldi][patchi][subFaceI];
639 const label nbrFaceId =
640 ptr->facePatchFaceMap()[fieldi][nbrPatchId][subFaceI];
642 const label nbrCellId = nbrCellIds[subFaceI];
643 const label
cellId = cellIds[subFaceI];
650 nbrCoeffs[nbrFaceId] +=
658 nbrCoeffs[nbrFaceId] +=
676 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
678 const auto&
psi = this->
psi(fieldi);
685 internalCoeffs_.setSize(interfaceI);
686 boundaryCoeffs_.setSize(interfaceI);
689 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
691 const auto&
psi = this->
psi(fieldi);
698 new Field<Type>(
psi.
mesh().boundary()[patchi].size(),
Zero)
704 new Field<Type>(
psi.
mesh().boundary()[patchi].size(),
Zero)
711 for (label i=0; i < nMatrices(); ++i)
716 FieldField<Field, Type>
boundary(bpsi.size());
717 FieldField<Field, Type>
internal(bpsi.size());
722 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
723 if (globalPatchId == -1)
728 matrix(i).boundaryCoeffs()[patchI].clone()
733 matrix(i).internalCoeffs()[patchI].clone()
742 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
743 if (globalPatchId != -1)
745 if (matrix(i).internalCoeffs().
set(patchI))
750 matrix(i).internalCoeffs()[patchI].clone()
754 if (matrix(i).boundaryCoeffs().
set(patchI))
759 matrix(i).boundaryCoeffs()[patchI].clone()
769 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
770 if (globalPatchId == -1)
772 const label implicitPatchId =
773 lduMeshPtr()->patchLocalToGlobalMap()[i][patchI];
777 implicitPatchId,
internal[implicit].clone()
781 implicitPatchId,
boundary[implicit].clone()
801 for (label i=0; i < nMatrices(); ++i)
805 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
807 if (globalPatchId == -1)
825 const labelList& cellMap = lduMeshPtr()->cellOffsets();
827 label newFaces = lduMeshPtr()->lduAddr().upperAddr().
size();
828 label newCells = lduMeshPtr()->lduAddr().size();
833 Field<Type> sourceAssemb(newCells,
Zero);
835 bool asymmetricAssemby =
false;
836 for (label i=0; i < nMatrices(); ++i)
838 if (matrix(i).asymmetric())
840 asymmetricAssemby =
true;
844 for (label i=0; i < nMatrices(); ++i)
846 if (asymmetricAssemby)
851 lowerAssemb[
faceMap[i][facei]] = lowerSub[facei];
857 const Field<Type> sourceSub(matrix(i).source());
861 upperAssemb[
faceMap[i][facei]] = upperSub[facei];
866 const label globalCelli = cellMap[i] + celli;
867 diagAssemb[globalCelli] = diagSub[celli];
868 sourceAssemb[globalCelli] = sourceSub[celli];
872 if (asymmetricAssemby)
875 lower() = lowerAssemb;
878 upper() = upperAssemb;
884 source() = sourceAssemb;
893 psi_.mesh().thisDb().objectRegistry::template getObjectPtr
906 psi_.mesh().thisDb().objectRegistry::template cfindObject
922 psi_.mesh().time().timeName(),
923 psi_.mesh().thisDb(),
932 uFieldPtr(nMatrices());
934 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
940 &const_cast<fvMesh&>(meshi)
942 uFieldPtr.
set(fieldi, &this->
psi(fieldi));
947 lduPrimitiveMeshAssembly* lduAssemMeshPtr =
948 new lduPrimitiveMeshAssembly(
io, uMeshPtr);
950 lduAssemMeshPtr->store();
951 lduAssemMeshPtr->update(uFieldPtr);
954 <<
"Creating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
958 psi_.mesh().changing() && !psi_.mesh().upToDatePoints(*ptr)
964 psi_.mesh().setUpToDatePoints(*ptr);
967 <<
"Updating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
972 <<
"Using lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
995 this->setValuesFromList(cellLabels,
values);
1006 this->setValuesFromList(cellLabels,
values);
1010 template<
class Type>
1015 const bool forceReference
1018 if ((forceReference || psi_.needReference()) && celli >= 0)
1020 source()[celli] +=
diag()[celli]*value;
1026 template<
class Type>
1031 const bool forceReference
1034 if (forceReference || psi_.needReference())
1036 forAll(cellLabels, celli)
1038 const label
cellId = cellLabels[celli];
1049 template<
class Type>
1053 const UList<Type>&
values,
1054 const bool forceReference
1057 if (forceReference || psi_.needReference())
1059 forAll(cellLabels, celli)
1061 const label
cellId = cellLabels[celli];
1072 template<
class Type>
1075 subMatrices_.append(matrix.clone());
1078 if (dimensions_ != matrix.dimensions())
1081 <<
"incompatible dimensions for matrix addition " 1083 <<
"[" << dimensions_ <<
" ] " 1084 <<
" [" << matrix.dimensions() <<
" ]" 1088 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
1090 if (checkImplicit(fieldi))
1096 internalCoeffs_.clear();
1097 boundaryCoeffs_.clear();
1101 template<
class Type>
1110 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
1112 Field<Type>& S = source();
1120 sumMagOffDiag(sumOff);
1123 forAll(psi_.boundaryField(), patchi)
1125 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1129 const labelUList& pa = lduAddr().patchAddr(patchi);
1130 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1134 const Field<Type>& pCoeffs = boundaryCoeffs_[patchi];
1161 scalar maxNon = 0.0;
1162 scalar sumNon = 0.0;
1165 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
1170 maxNon =
max(maxNon, d);
1199 <<
"Matrix dominance test for " << psi_.name() <<
nl 1200 <<
" number of non-dominant cells : " << nNon <<
nl 1201 <<
" maximum relative non-dominance : " << maxNon <<
nl 1202 <<
" average relative non-dominance : " << sumNon <<
nl 1211 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
1218 forAll(psi_.boundaryField(), patchi)
1220 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1224 const labelUList& pa = lduAddr().patchAddr(patchi);
1225 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1238 D[pa[face]] -=
cmptMin(iCoeffs[face]);
1245 S += (
D - D0)*psi_.primitiveField();
1249 template<
class Type>
1254 psi_.mesh().data().isFinalIteration()
1257 scalar relaxCoeff = 0;
1259 if (psi_.mesh().relaxEquation(
name, relaxCoeff))
1266 template<
class Type>
1269 typename GeometricField<Type, fvPatchField, volMesh>::
1275 bFields[patchi].manipulateMatrix(*
this);
1280 template<
class Type>
1284 addCmptAvBoundaryDiag(tdiag.ref());
1289 template<
class Type>
1294 forAll(psi_.boundaryField(), patchi)
1302 lduAddr().patchAddr(patchi),
1303 internalCoeffs_[patchi],
1313 template<
class Type>
1318 "A(" + psi_.name() +
')',
1320 dimensions_/psi_.dimensions()/
dimVol,
1324 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().V();
1325 tAphi.ref().correctBoundaryConditions();
1331 template<
class Type>
1337 "H(" + psi_.name() +
')',
1342 auto& Hphi = tHphi.ref();
1347 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
1350 addBoundaryDiag(boundaryDiagCmpt, cmpt);
1351 boundaryDiagCmpt.negate();
1352 addCmptAvBoundaryDiag(boundaryDiagCmpt);
1363 typename Type::labelType validComponents
1365 psi_.mesh().template validComponents<Type>()
1370 if (validComponents[cmpt] == -1)
1384 template<
class Type>
1391 dimensions_/(
dimVol*psi_.dimensions()),
1394 auto& H1_ = tH1.ref();
1398 forAll(psi_.boundaryField(), patchi)
1400 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1402 if (ptf.coupled() && ptf.size())
1406 lduAddr().patchAddr(patchi),
1413 H1_.primitiveFieldRef() /= psi_.mesh().V();
1414 H1_.correctBoundaryConditions();
1420 template<
class Type>
1425 if (!psi_.mesh().fluxRequired(psi_.name()))
1428 <<
"flux requested but " << psi_.name()
1429 <<
" not specified in the fluxRequired sub-dictionary" 1434 if (nMatrices() > 1)
1437 <<
"Flux requested but " << psi_.name()
1438 <<
" can't handle multiple fvMatrix." 1444 "flux(" + psi_.name() +
')',
1448 auto& fieldFlux = tfieldFlux.ref();
1450 fieldFlux.setOriented();
1454 fieldFlux.primitiveFieldRef().replace
1461 FieldField<Field, Type> InternalContrib = internalCoeffs_;
1466 forAll(InternalContrib, patchi)
1468 InternalContrib[patchi] =
1471 InternalContrib[patchi],
1472 psi_.boundaryField()[patchi].patchInternalField()
1478 FieldField<Field, Type> fluxInternalContrib(internalCoeffs_);
1480 mapContributions(fieldi, fluxInternalContrib, InternalContrib,
true);
1483 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
1487 forAll(NeighbourContrib, patchi)
1489 if (psi_.boundaryField()[patchi].coupled())
1491 NeighbourContrib[patchi] =
1494 NeighbourContrib[patchi],
1495 psi_.boundaryField()[patchi].patchNeighbourField()
1502 FieldField<Field, Type> fluxBoundaryContrib(boundaryCoeffs_);
1504 mapContributions(fieldi, fluxBoundaryContrib, NeighbourContrib,
false);
1507 typename GeometricField<Type, fvsPatchField, surfaceMesh>::
1508 Boundary& ffbf = fieldFlux.boundaryFieldRef();
1512 ffbf[patchi] = InternalContrib[patchi] - NeighbourContrib[patchi];
1516 if (faceFluxCorrectionPtr_)
1518 fieldFlux += *faceFluxCorrectionPtr_;
1525 template<
class Type>
1531 return psi_.mesh().solverDict(
name);
1535 template<
class Type>
1538 return psi_.mesh().solverDict
1540 psi_.select(psi_.mesh().data().isFinalIteration())
1547 template<
class Type>
1555 if (&psi_ != &(fvmv.psi_))
1558 <<
"different fields" 1562 dimensions_ = fvmv.dimensions_;
1564 source_ = fvmv.source_;
1565 internalCoeffs_ = fvmv.internalCoeffs_;
1566 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1568 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1570 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1572 else if (fvmv.faceFluxCorrectionPtr_)
1574 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1576 *fvmv.faceFluxCorrectionPtr_
1580 useImplicit_ = fvmv.useImplicit_;
1581 lduAssemblyName_ = fvmv.lduAssemblyName_;
1585 template<
class Type>
1593 template<
class Type>
1598 internalCoeffs_.negate();
1599 boundaryCoeffs_.negate();
1601 if (faceFluxCorrectionPtr_)
1603 faceFluxCorrectionPtr_->negate();
1608 template<
class Type>
1613 dimensions_ += fvmv.dimensions_;
1615 source_ += fvmv.source_;
1616 internalCoeffs_ += fvmv.internalCoeffs_;
1617 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1619 useImplicit_ = fvmv.useImplicit_;
1620 lduAssemblyName_ = fvmv.lduAssemblyName_;
1621 nMatrix_ = fvmv.nMatrix_;
1623 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1625 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1627 else if (fvmv.faceFluxCorrectionPtr_)
1629 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1631 *fvmv.faceFluxCorrectionPtr_
1637 template<
class Type>
1640 operator+=(tfvmv());
1645 template<
class Type>
1650 dimensions_ -= fvmv.dimensions_;
1652 source_ -= fvmv.source_;
1653 internalCoeffs_ -= fvmv.internalCoeffs_;
1654 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1656 useImplicit_ = fvmv.useImplicit_;
1657 lduAssemblyName_ = fvmv.lduAssemblyName_;
1658 nMatrix_ = fvmv.nMatrix_;
1660 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1662 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1664 else if (fvmv.faceFluxCorrectionPtr_)
1666 faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
1668 -*fvmv.faceFluxCorrectionPtr_
1674 template<
class Type>
1677 operator-=(tfvmv());
1682 template<
class Type>
1689 source() -= su.mesh().V()*su.field();
1693 template<
class Type>
1704 template<
class Type>
1715 template<
class Type>
1722 source() += su.mesh().V()*su.field();
1726 template<
class Type>
1737 template<
class Type>
1748 template<
class Type>
1754 source() -=
psi().
mesh().V()*su;
1758 template<
class Type>
1764 source() +=
psi().
mesh().V()*su;
1768 template<
class Type>
1774 dimensions_ *= dsf.dimensions();
1776 source_ *= dsf.field();
1778 forAll(boundaryCoeffs_, patchi)
1782 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1785 internalCoeffs_[patchi] *= pisf;
1786 boundaryCoeffs_[patchi] *= pisf;
1789 if (faceFluxCorrectionPtr_)
1792 <<
"cannot scale a matrix containing a faceFluxCorrection" 1798 template<
class Type>
1801 const tmp<volScalarField::Internal>& tfld
1809 template<
class Type>
1820 template<
class Type>
1826 dimensions_ *= ds.dimensions();
1828 source_ *= ds.value();
1829 internalCoeffs_ *= ds.value();
1830 boundaryCoeffs_ *= ds.value();
1832 if (faceFluxCorrectionPtr_)
1834 *faceFluxCorrectionPtr_ *= ds.value();
1841 template<
class Type>
1844 const fvMatrix<Type>& mat1,
1845 const fvMatrix<Type>& mat2,
1849 if (&mat1.psi() != &mat2.psi())
1852 <<
"Incompatible fields for operation\n " 1853 <<
"[" << mat1.psi().name() <<
"] " 1855 <<
" [" << mat2.psi().name() <<
"]" 1862 && mat1.dimensions() != mat2.dimensions()
1866 <<
"Incompatible dimensions for operation\n " 1867 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimVolume <<
" ] " 1869 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimVolume <<
" ]" 1875 template<
class Type>
1878 const fvMatrix<Type>& mat,
1879 const DimensionedField<Type, volMesh>&
fld,
1890 <<
"Incompatible dimensions for operation\n " 1891 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1893 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1899 template<
class Type>
1902 const fvMatrix<Type>& mat,
1903 const dimensioned<Type>& dt,
1910 && mat.dimensions()/
dimVolume != dt.dimensions()
1914 <<
"Incompatible dimensions for operation\n " 1915 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1917 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1923 template<
class Type>
1926 fvMatrix<Type>& mat,
1930 return mat.solve(solverControls);
1933 template<
class Type>
1936 const tmp<fvMatrix<Type>>& tmat,
1940 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1948 template<
class Type>
1951 fvMatrix<Type>& mat,
1955 return mat.solve(
name);
1958 template<
class Type>
1961 const tmp<fvMatrix<Type>>& tmat,
1965 SolverPerformance<Type> solverPerf(tmat.constCast().solve(
name));
1973 template<
class Type>
1979 template<
class Type>
1982 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1990 template<
class Type>
1993 const fvMatrix<Type>&
A 1996 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
2000 tAcorr.ref().faceFluxCorrectionPtr(
nullptr);
2006 template<
class Type>
2009 const tmp<fvMatrix<Type>>& tA
2012 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
2016 tAcorr.
ref().faceFluxCorrectionPtr(
nullptr);
2024 template<
class Type>
2027 const fvMatrix<Type>&
A,
2028 const fvMatrix<Type>&
B 2035 template<
class Type>
2038 const tmp<fvMatrix<Type>>& tA,
2039 const fvMatrix<Type>&
B 2046 template<
class Type>
2049 const fvMatrix<Type>&
A,
2050 const tmp<fvMatrix<Type>>& tB
2057 template<
class Type>
2060 const tmp<fvMatrix<Type>>& tA,
2061 const tmp<fvMatrix<Type>>& tB
2068 template<
class Type>
2071 const fvMatrix<Type>&
A,
2072 const DimensionedField<Type, volMesh>& su
2076 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2077 tC.ref().source() += su.mesh().V()*su.field();
2081 template<
class Type>
2084 const fvMatrix<Type>&
A,
2085 const tmp<DimensionedField<Type, volMesh>>& tsu
2089 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2090 tC.ref().source() += tsu().mesh().V()*tsu().field();
2095 template<
class Type>
2098 const fvMatrix<Type>&
A,
2099 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2103 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2104 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2109 template<
class Type>
2112 const tmp<fvMatrix<Type>>& tA,
2113 const DimensionedField<Type, volMesh>& su
2117 tmp<fvMatrix<Type>> tC(tA.ptr());
2118 tC.ref().source() += su.mesh().V()*su.field();
2122 template<
class Type>
2125 const tmp<fvMatrix<Type>>& tA,
2126 const tmp<DimensionedField<Type, volMesh>>& tsu
2130 tmp<fvMatrix<Type>> tC(tA.ptr());
2131 tC.ref().source() += tsu().mesh().V()*tsu().field();
2136 template<
class Type>
2139 const tmp<fvMatrix<Type>>& tA,
2140 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2144 tmp<fvMatrix<Type>> tC(tA.ptr());
2145 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2150 template<
class Type>
2153 const fvMatrix<Type>&
A,
2154 const dimensioned<Type>& su
2158 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2159 tC.ref().source() +=
A.psi().mesh().V()*su.value();
2163 template<
class Type>
2166 const tmp<fvMatrix<Type>>& tA,
2167 const dimensioned<Type>& su
2171 tmp<fvMatrix<Type>> tC(tA.ptr());
2172 tC.ref().source() += tC().psi().mesh().V()*su.value();
2176 template<
class Type>
2179 const fvMatrix<Type>&
A,
2187 template<
class Type>
2190 const tmp<fvMatrix<Type>>& tA,
2198 template<
class Type>
2201 const fvMatrix<Type>&
A 2204 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2209 template<
class Type>
2212 const tmp<fvMatrix<Type>>& tA
2215 tmp<fvMatrix<Type>> tC(tA.ptr());
2221 template<
class Type>
2224 const fvMatrix<Type>&
A,
2225 const fvMatrix<Type>&
B 2229 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2234 template<
class Type>
2237 const tmp<fvMatrix<Type>>& tA,
2238 const fvMatrix<Type>&
B 2242 tmp<fvMatrix<Type>> tC(tA.
ptr());
2247 template<
class Type>
2250 const fvMatrix<Type>&
A,
2251 const tmp<fvMatrix<Type>>& tB
2255 tmp<fvMatrix<Type>> tC(tB.ptr());
2260 template<
class Type>
2263 const tmp<fvMatrix<Type>>& tA,
2264 const tmp<fvMatrix<Type>>& tB
2268 tmp<fvMatrix<Type>> tC(tA.
ptr());
2274 template<
class Type>
2277 const fvMatrix<Type>&
A,
2278 const DimensionedField<Type, volMesh>& su
2282 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2283 tC.ref().source() -= su.mesh().V()*su.field();
2287 template<
class Type>
2290 const fvMatrix<Type>&
A,
2291 const tmp<DimensionedField<Type, volMesh>>& tsu
2295 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2296 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2301 template<
class Type>
2304 const fvMatrix<Type>&
A,
2305 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2309 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2310 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2315 template<
class Type>
2318 const tmp<fvMatrix<Type>>& tA,
2319 const DimensionedField<Type, volMesh>& su
2323 tmp<fvMatrix<Type>> tC(tA.
ptr());
2324 tC.ref().source() -= su.mesh().V()*su.field();
2328 template<
class Type>
2331 const tmp<fvMatrix<Type>>& tA,
2332 const tmp<DimensionedField<Type, volMesh>>& tsu
2336 tmp<fvMatrix<Type>> tC(tA.
ptr());
2337 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2342 template<
class Type>
2345 const tmp<fvMatrix<Type>>& tA,
2346 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2350 tmp<fvMatrix<Type>> tC(tA.
ptr());
2351 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2356 template<
class Type>
2359 const DimensionedField<Type, volMesh>& su,
2360 const fvMatrix<Type>&
A 2364 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2365 tC.ref().source() -= su.mesh().V()*su.field();
2369 template<
class Type>
2372 const tmp<DimensionedField<Type, volMesh>>& tsu,
2373 const fvMatrix<Type>&
A 2377 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2378 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2383 template<
class Type>
2386 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2387 const fvMatrix<Type>&
A 2391 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2392 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2397 template<
class Type>
2400 const DimensionedField<Type, volMesh>& su,
2401 const tmp<fvMatrix<Type>>& tA
2405 tmp<fvMatrix<Type>> tC(tA.
ptr());
2406 tC.ref().source() -= su.mesh().V()*su.field();
2410 template<
class Type>
2413 const tmp<DimensionedField<Type, volMesh>>& tsu,
2414 const tmp<fvMatrix<Type>>& tA
2418 tmp<fvMatrix<Type>> tC(tA.
ptr());
2419 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2424 template<
class Type>
2427 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2428 const tmp<fvMatrix<Type>>& tA
2432 tmp<fvMatrix<Type>> tC(tA.
ptr());
2433 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2439 template<
class Type>
2442 const fvMatrix<Type>&
A,
2443 const fvMatrix<Type>&
B 2447 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2452 template<
class Type>
2455 const tmp<fvMatrix<Type>>& tA,
2456 const fvMatrix<Type>&
B 2460 tmp<fvMatrix<Type>> tC(tA.
ptr());
2465 template<
class Type>
2468 const fvMatrix<Type>&
A,
2469 const tmp<fvMatrix<Type>>& tB
2473 tmp<fvMatrix<Type>> tC(tB.ptr());
2479 template<
class Type>
2482 const tmp<fvMatrix<Type>>& tA,
2483 const tmp<fvMatrix<Type>>& tB
2487 tmp<fvMatrix<Type>> tC(tA.
ptr());
2493 template<
class Type>
2496 const fvMatrix<Type>&
A,
2497 const DimensionedField<Type, volMesh>& su
2501 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2502 tC.ref().source() += su.mesh().V()*su.field();
2506 template<
class Type>
2509 const fvMatrix<Type>&
A,
2510 const tmp<DimensionedField<Type, volMesh>>& tsu
2514 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2515 tC.ref().source() += tsu().mesh().V()*tsu().field();
2520 template<
class Type>
2523 const fvMatrix<Type>&
A,
2524 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2528 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2529 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2534 template<
class Type>
2537 const tmp<fvMatrix<Type>>& tA,
2538 const DimensionedField<Type, volMesh>& su
2542 tmp<fvMatrix<Type>> tC(tA.
ptr());
2543 tC.ref().source() += su.mesh().V()*su.field();
2547 template<
class Type>
2550 const tmp<fvMatrix<Type>>& tA,
2551 const tmp<DimensionedField<Type, volMesh>>& tsu
2555 tmp<fvMatrix<Type>> tC(tA.
ptr());
2556 tC.ref().source() += tsu().mesh().V()*tsu().field();
2561 template<
class Type>
2564 const tmp<fvMatrix<Type>>& tA,
2565 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2569 tmp<fvMatrix<Type>> tC(tA.
ptr());
2570 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2575 template<
class Type>
2578 const DimensionedField<Type, volMesh>& su,
2579 const fvMatrix<Type>&
A 2583 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2585 tC.ref().source() -= su.mesh().V()*su.field();
2589 template<
class Type>
2592 const tmp<DimensionedField<Type, volMesh>>& tsu,
2593 const fvMatrix<Type>&
A 2597 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2599 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2604 template<
class Type>
2607 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2608 const fvMatrix<Type>&
A 2612 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2614 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2619 template<
class Type>
2622 const DimensionedField<Type, volMesh>& su,
2623 const tmp<fvMatrix<Type>>& tA
2627 tmp<fvMatrix<Type>> tC(tA.
ptr());
2629 tC.ref().source() -= su.mesh().V()*su.field();
2633 template<
class Type>
2636 const tmp<DimensionedField<Type, volMesh>>& tsu,
2637 const tmp<fvMatrix<Type>>& tA
2641 tmp<fvMatrix<Type>> tC(tA.
ptr());
2643 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2648 template<
class Type>
2651 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2652 const tmp<fvMatrix<Type>>& tA
2656 tmp<fvMatrix<Type>> tC(tA.
ptr());
2658 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2663 template<
class Type>
2666 const fvMatrix<Type>&
A,
2667 const dimensioned<Type>& su
2671 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2672 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2676 template<
class Type>
2679 const tmp<fvMatrix<Type>>& tA,
2680 const dimensioned<Type>& su
2684 tmp<fvMatrix<Type>> tC(tA.
ptr());
2685 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2689 template<
class Type>
2692 const dimensioned<Type>& su,
2693 const fvMatrix<Type>&
A 2697 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2698 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2702 template<
class Type>
2705 const dimensioned<Type>& su,
2706 const tmp<fvMatrix<Type>>& tA
2710 tmp<fvMatrix<Type>> tC(tA.
ptr());
2711 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2715 template<
class Type>
2718 const fvMatrix<Type>&
A,
2719 const dimensioned<Type>& su
2723 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2724 tC.ref().source() += su.value()*tC().psi().mesh().V();
2728 template<
class Type>
2731 const tmp<fvMatrix<Type>>& tA,
2732 const dimensioned<Type>& su
2736 tmp<fvMatrix<Type>> tC(tA.
ptr());
2737 tC.ref().source() += su.value()*tC().psi().mesh().V();
2741 template<
class Type>
2744 const dimensioned<Type>& su,
2745 const fvMatrix<Type>&
A 2749 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2751 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2755 template<
class Type>
2758 const dimensioned<Type>& su,
2759 const tmp<fvMatrix<Type>>& tA
2763 tmp<fvMatrix<Type>> tC(tA.
ptr());
2765 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2770 template<
class Type>
2774 const fvMatrix<Type>&
A 2777 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2782 template<
class Type>
2785 const tmp<volScalarField::Internal>& tdsf,
2786 const fvMatrix<Type>&
A 2789 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2794 template<
class Type>
2797 const tmp<volScalarField>& tvsf,
2798 const fvMatrix<Type>&
A 2801 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2806 template<
class Type>
2810 const tmp<fvMatrix<Type>>& tA
2813 tmp<fvMatrix<Type>> tC(tA.
ptr());
2818 template<
class Type>
2821 const tmp<volScalarField::Internal>& tdsf,
2822 const tmp<fvMatrix<Type>>& tA
2825 tmp<fvMatrix<Type>> tC(tA.
ptr());
2830 template<
class Type>
2833 const tmp<volScalarField>& tvsf,
2834 const tmp<fvMatrix<Type>>& tA
2837 tmp<fvMatrix<Type>> tC(tA.
ptr());
2842 template<
class Type>
2845 const dimensioned<scalar>& ds,
2846 const fvMatrix<Type>&
A 2849 auto tC = tmp<fvMatrix<Type>>
::New(
A);
2854 template<
class Type>
2857 const dimensioned<scalar>& ds,
2858 const tmp<fvMatrix<Type>>& tA
2861 tmp<fvMatrix<Type>> tC(tA.
ptr());
2867 template<
class Type>
2871 const fvMatrix<Type>&
M,
2872 const DimensionedField<Type, volMesh>&
psi 2882 auto& Mphi = tMphi.ref();
2891 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2892 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2897 Mphi.primitiveFieldRef() =
Zero;
2900 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2901 M.addBoundarySource(Mphi.primitiveFieldRef());
2903 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2904 Mphi.correctBoundaryConditions();
2909 template<
class Type>
2913 const fvMatrix<Type>&
M,
2914 const tmp<DimensionedField<Type, volMesh>>& tpsi
2917 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2922 template<
class Type>
2926 const fvMatrix<Type>&
M,
2927 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2930 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2935 template<
class Type>
2939 const tmp<fvMatrix<Type>>& tM,
2940 const DimensionedField<Type, volMesh>&
psi 2943 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() &
psi;
2948 template<
class Type>
2952 const tmp<fvMatrix<Type>>& tM,
2953 const tmp<DimensionedField<Type, volMesh>>& tpsi
2956 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2962 template<
class Type>
2966 const tmp<fvMatrix<Type>>& tM,
2967 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2970 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2979 template<
class Type>
2980 Foam::Ostream& Foam::operator<<(Ostream& os, const fvMatrix<Type>& fvm)
2982 os << static_cast<const lduMatrix&>(fvm) <<
nl 2983 << fvm.dimensions_ <<
nl 2984 << fvm.source_ <<
nl 2985 << fvm.internalCoeffs_ <<
nl 2986 << 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.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
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.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
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.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
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 > &)
#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.
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)
const Mesh & mesh() const noexcept
Return mesh.
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)
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
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))
const Field< Type > & field() const noexcept
Return const-reference to the field values.
lduPrimitiveMeshAssembly * lduMeshPtr()
Access to lduPrimitiveMeshAssembly.
void operator+=(const fvMatrix< Type > &)
tmp< Field< Type > > DD() const
Return the matrix Type diagonal.
Template functions to aid in the implementation of demand driven data.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
tmp< volScalarField > A() const
Return the central coefficient.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
static bool checking() noexcept
True if dimension checking is enabled (the usual default)
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. ...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
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.
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)
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const dimensionSet & dimensions() const noexcept
Return dimensions.
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.