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 if (
mesh.isInternalFace(facei))
265 if (celli == own[facei])
267 source_[nei[facei]] -=
upper()[facei]*value;
271 source_[own[facei]] -=
upper()[facei]*value;
274 upper()[facei] = 0.0;
278 if (celli == own[facei])
280 source_[nei[facei]] -=
lower()[facei]*value;
284 source_[own[facei]] -=
upper()[facei]*value;
287 upper()[facei] = 0.0;
288 lower()[facei] = 0.0;
293 const label patchi =
mesh.boundaryMesh().whichPatch(facei);
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();
373 faceFluxCorrectionPtr_(nullptr)
376 <<
"Constructing fvMatrix<Type> for field " << psi_.
name() <<
endl;
395 auto& psiRef = this->
psi(0);
396 const label currentStatePsi = psiRef.eventNo();
397 psiRef.boundaryFieldRef().updateCoeffs();
398 psiRef.eventNo() = currentStatePsi;
407 useImplicit_(fvm.useImplicit_),
408 lduAssemblyName_(fvm.lduAssemblyName_),
409 nMatrix_(fvm.nMatrix_),
410 dimensions_(fvm.dimensions_),
411 source_(fvm.source_),
412 internalCoeffs_(fvm.internalCoeffs_),
413 boundaryCoeffs_(fvm.boundaryCoeffs_),
414 faceFluxCorrectionPtr_(nullptr)
417 <<
"Copying fvMatrix<Type> for field " << psi_.
name() <<
endl;
419 if (fvm.faceFluxCorrectionPtr_)
421 faceFluxCorrectionPtr_ =
424 *(fvm.faceFluxCorrectionPtr_)
433 lduMatrix(tmat.constCast(), tmat.movable()),
435 useImplicit_(tmat().useImplicit_),
436 lduAssemblyName_(tmat().lduAssemblyName_),
437 nMatrix_(tmat().nMatrix_),
438 dimensions_(tmat().dimensions_),
439 source_(tmat.constCast().source_, tmat.movable()),
440 internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
441 boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable()),
442 faceFluxCorrectionPtr_(nullptr)
445 <<
"Copy/move fvMatrix<Type> for field " << psi_.
name() <<
endl;
447 if (tmat().faceFluxCorrectionPtr_)
451 faceFluxCorrectionPtr_ = tmat().faceFluxCorrectionPtr_;
452 tmat().faceFluxCorrectionPtr_ =
nullptr;
456 faceFluxCorrectionPtr_ =
457 new GeometricField<Type, fvsPatchField, surfaceMesh>
459 *(tmat().faceFluxCorrectionPtr_)
474 <<
"Destroying fvMatrix<Type> for field " << psi_.name() <<
endl;
477 subMatrices_.clear();
490 interfaces.
setSize(internalCoeffs_.size());
491 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
496 forAll (fieldInterfaces, patchi)
498 label globalPatchID = lduMeshPtr()->patchMap()[fieldi][patchi];
500 if (globalPatchID != -1)
502 if (fieldInterfaces.set(patchi))
504 if (isA<cyclicLduInterfaceField>(bpsi[patchi]))
510 refCast<const fvPatch>
512 lduMeshPtr()->interfaces()[globalPatchID]
514 bpsi[patchi].internalField()
517 interfaces.
set(globalPatchID, &newInterfaces.
last());
520 else if (isA<cyclicAMILduInterfaceField>(bpsi[patchi]))
526 refCast<const fvPatch>
528 lduMeshPtr()->interfaces()[globalPatchID]
530 bpsi[patchi].internalField()
533 interfaces.
set(globalPatchID, &newInterfaces.
last());
535 else if (isA<cyclicACMILduInterfaceField>(bpsi[patchi]))
541 refCast<const fvPatch>
543 lduMeshPtr()->interfaces()[globalPatchID]
545 bpsi[patchi].internalField()
548 interfaces.
set(globalPatchID, &newInterfaces.
last());
552 interfaces.
set(globalPatchID, &fieldInterfaces[patchi]);
565 const FieldField<Field, Type>& fluxContrib,
566 FieldField<Field, Type>& contrib,
570 const lduPrimitiveMeshAssembly* ptr = lduMeshPtr();
572 const labelList& patchMap = ptr->patchMap()[fieldi];
576 const label globalPtchId = patchMap[patchi];
578 if (globalPtchId != -1)
581 const Field<Type> saveContrib(fluxContrib[globalPtchId]);
582 contrib[patchi].setSize(psi_.boundaryField()[patchi].size()),
583 contrib[patchi] = pTraits<Type>::zero;
591 psi_.boundaryField()[patchi].patchInternalField()
602 psi_.boundaryField()[patchi].patchNeighbourField()
607 else if (globalPtchId == -1)
609 const polyPatch&
pp =
610 this->
psi(fieldi).
mesh().boundaryMesh()[patchi];
612 if (
pp.masterImplicit())
615 ptr->patchLocalToGlobalMap()[fieldi][patchi];
617 const label nbrPatchId =
pp.neighbPolyPatchID();
620 const Field<Type> saveContrib(fluxContrib[virtualPatch]);
622 Field<Type>& coeffs = contrib[patchi];
623 Field<Type>& nbrCoeffs = contrib[nbrPatchId];
625 coeffs.setSize(psi_.boundaryField()[patchi].size());
626 nbrCoeffs.setSize(psi_.boundaryField()[nbrPatchId].size());
628 coeffs = pTraits<Type>::zero;
629 nbrCoeffs = pTraits<Type>::zero;
633 ptr->cellBoundMap()[fieldi][patchi];
636 ptr->cellBoundMap()[fieldi][nbrPatchId];
638 const GeometricField<Type, fvPatchField, volMesh>&
psi =
641 forAll(saveContrib, subFaceI)
644 ptr->facePatchFaceMap()[fieldi][patchi][subFaceI];
645 const label nbrFaceId =
646 ptr->facePatchFaceMap()[fieldi][nbrPatchId][subFaceI];
648 const label nbrCellId = nbrCellIds[subFaceI];
649 const label
cellId = cellIds[subFaceI];
656 nbrCoeffs[nbrFaceId] +=
664 nbrCoeffs[nbrFaceId] +=
682 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
684 const auto&
psi = this->
psi(fieldi);
691 internalCoeffs_.setSize(interfaceI);
692 boundaryCoeffs_.setSize(interfaceI);
695 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
697 const auto&
psi = this->
psi(fieldi);
704 new Field<Type>(
psi.
mesh().boundary()[patchi].size(),
Zero)
710 new Field<Type>(
psi.
mesh().boundary()[patchi].size(),
Zero)
717 for (label i=0; i < nMatrices(); ++i)
722 FieldField<Field, Type>
boundary(bpsi.size());
723 FieldField<Field, Type>
internal(bpsi.size());
728 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
729 if (globalPatchId == -1)
734 matrix(i).boundaryCoeffs()[patchI].clone()
739 matrix(i).internalCoeffs()[patchI].clone()
748 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
749 if (globalPatchId != -1)
751 if (matrix(i).internalCoeffs().
set(patchI))
756 matrix(i).internalCoeffs()[patchI].clone()
760 if (matrix(i).boundaryCoeffs().
set(patchI))
765 matrix(i).boundaryCoeffs()[patchI].clone()
775 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
776 if (globalPatchId == -1)
778 const label implicitPatchId =
779 lduMeshPtr()->patchLocalToGlobalMap()[i][patchI];
783 implicitPatchId,
internal[implicit].clone()
787 implicitPatchId,
boundary[implicit].clone()
807 for (label i=0; i < nMatrices(); ++i)
811 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
813 if (globalPatchId == -1)
831 const labelList& cellMap = lduMeshPtr()->cellOffsets();
833 label newFaces = lduMeshPtr()->lduAddr().upperAddr().
size();
834 label newCells = lduMeshPtr()->lduAddr().size();
839 Field<Type> sourceAssemb(newCells,
Zero);
841 bool asymmetricAssemby =
false;
842 for (label i=0; i < nMatrices(); ++i)
844 if (matrix(i).asymmetric())
846 asymmetricAssemby =
true;
850 for (label i=0; i < nMatrices(); ++i)
852 if (asymmetricAssemby)
857 lowerAssemb[
faceMap[i][facei]] = lowerSub[facei];
863 const Field<Type> sourceSub(matrix(i).source());
867 upperAssemb[
faceMap[i][facei]] = upperSub[facei];
872 const label globalCelli = cellMap[i] + celli;
873 diagAssemb[globalCelli] = diagSub[celli];
874 sourceAssemb[globalCelli] = sourceSub[celli];
878 if (asymmetricAssemby)
881 lower() = lowerAssemb;
884 upper() = upperAssemb;
890 source() = sourceAssemb;
898 psi_.
mesh().
thisDb().objectRegistry::template findObject
901 > (lduAssemblyName_);
912 psi_.mesh().thisDb().objectRegistry::template cfindObject
928 psi_.mesh().time().timeName(),
929 psi_.mesh().thisDb(),
938 uFieldPtr(nMatrices());
940 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
946 &const_cast<fvMesh&>(meshi)
948 uFieldPtr.
set(fieldi, &this->
psi(fieldi));
953 lduPrimitiveMeshAssembly* lduAssemMeshPtr =
954 new lduPrimitiveMeshAssembly(
io, uMeshPtr);
956 lduAssemMeshPtr->store();
957 lduAssemMeshPtr->update(uFieldPtr);
960 <<
"Creating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
964 psi_.mesh().changing() && !psi_.mesh().upToDatePoints(*ptr)
970 psi_.mesh().setUpToDatePoints(*ptr);
973 <<
"Updating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
978 <<
"Using lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
1001 this->setValuesFromList(cellLabels,
values);
1005 template<
class Type>
1012 this->setValuesFromList(cellLabels,
values);
1016 template<
class Type>
1021 const bool forceReference
1024 if ((forceReference || psi_.needReference()) && celli >= 0)
1026 source()[celli] +=
diag()[celli]*value;
1032 template<
class Type>
1037 const bool forceReference
1040 if (forceReference || psi_.needReference())
1042 forAll(cellLabels, celli)
1044 const label
cellId = cellLabels[celli];
1055 template<
class Type>
1059 const UList<Type>&
values,
1060 const bool forceReference
1063 if (forceReference || psi_.needReference())
1065 forAll(cellLabels, celli)
1067 const label
cellId = cellLabels[celli];
1078 template<
class Type>
1081 subMatrices_.append(matrix.clone());
1084 if (dimensions_ != matrix.dimensions())
1087 <<
"incompatible dimensions for matrix addition " 1089 <<
"[" << dimensions_ <<
" ] " 1090 <<
" [" << matrix.dimensions() <<
" ]" 1094 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
1096 if (checkImplicit(fieldi))
1102 internalCoeffs_.clear();
1103 boundaryCoeffs_.clear();
1107 template<
class Type>
1116 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
1118 Field<Type>& S = source();
1126 sumMagOffDiag(sumOff);
1129 forAll(psi_.boundaryField(), patchi)
1131 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1135 const labelUList& pa = lduAddr().patchAddr(patchi);
1136 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1140 const Field<Type>& pCoeffs = boundaryCoeffs_[patchi];
1167 scalar maxNon = 0.0;
1168 scalar sumNon = 0.0;
1171 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
1176 maxNon =
max(maxNon, d);
1205 <<
"Matrix dominance test for " << psi_.name() <<
nl 1206 <<
" number of non-dominant cells : " << nNon <<
nl 1207 <<
" maximum relative non-dominance : " << maxNon <<
nl 1208 <<
" average relative non-dominance : " << sumNon <<
nl 1217 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
1224 forAll(psi_.boundaryField(), patchi)
1226 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1230 const labelUList& pa = lduAddr().patchAddr(patchi);
1231 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1244 D[pa[face]] -=
cmptMin(iCoeffs[face]);
1251 S += (
D - D0)*psi_.primitiveField();
1255 template<
class Type>
1260 psi_.mesh().data().isFinalIteration()
1263 scalar relaxCoeff = 0;
1265 if (psi_.mesh().relaxEquation(
name, relaxCoeff))
1272 template<
class Type>
1275 typename GeometricField<Type, fvPatchField, volMesh>::
1281 bFields[patchi].manipulateMatrix(*
this);
1286 template<
class Type>
1290 addCmptAvBoundaryDiag(tdiag.ref());
1295 template<
class Type>
1300 forAll(psi_.boundaryField(), patchi)
1308 lduAddr().patchAddr(patchi),
1309 internalCoeffs_[patchi],
1319 template<
class Type>
1324 "A(" + psi_.name() +
')',
1326 dimensions_/psi_.dimensions()/
dimVol,
1330 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().V();
1331 tAphi.ref().correctBoundaryConditions();
1337 template<
class Type>
1343 "H(" + psi_.name() +
')',
1348 auto& Hphi = tHphi.ref();
1353 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
1356 addBoundaryDiag(boundaryDiagCmpt, cmpt);
1357 boundaryDiagCmpt.negate();
1358 addCmptAvBoundaryDiag(boundaryDiagCmpt);
1369 typename Type::labelType validComponents
1371 psi_.mesh().template validComponents<Type>()
1376 if (validComponents[cmpt] == -1)
1390 template<
class Type>
1397 dimensions_/(
dimVol*psi_.dimensions()),
1400 auto& H1_ = tH1.ref();
1404 forAll(psi_.boundaryField(), patchi)
1406 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1408 if (ptf.coupled() && ptf.size())
1412 lduAddr().patchAddr(patchi),
1419 H1_.primitiveFieldRef() /= psi_.mesh().V();
1420 H1_.correctBoundaryConditions();
1426 template<
class Type>
1431 if (!psi_.mesh().fluxRequired(psi_.name()))
1434 <<
"flux requested but " << psi_.name()
1435 <<
" not specified in the fluxRequired sub-dictionary" 1440 if (nMatrices() > 1)
1443 <<
"Flux requested but " << psi_.name()
1444 <<
" can't handle multiple fvMatrix." 1450 "flux(" + psi_.name() +
')',
1454 auto& fieldFlux = tfieldFlux.ref();
1456 fieldFlux.setOriented();
1460 fieldFlux.primitiveFieldRef().replace
1467 FieldField<Field, Type> InternalContrib = internalCoeffs_;
1472 forAll(InternalContrib, patchi)
1474 InternalContrib[patchi] =
1477 InternalContrib[patchi],
1478 psi_.boundaryField()[patchi].patchInternalField()
1484 FieldField<Field, Type> fluxInternalContrib(internalCoeffs_);
1486 mapContributions(fieldi, fluxInternalContrib, InternalContrib,
true);
1489 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
1493 forAll(NeighbourContrib, patchi)
1495 if (psi_.boundaryField()[patchi].coupled())
1497 NeighbourContrib[patchi] =
1500 NeighbourContrib[patchi],
1501 psi_.boundaryField()[patchi].patchNeighbourField()
1508 FieldField<Field, Type> fluxBoundaryContrib(boundaryCoeffs_);
1510 mapContributions(fieldi, fluxBoundaryContrib, NeighbourContrib,
false);
1513 typename GeometricField<Type, fvsPatchField, surfaceMesh>::
1514 Boundary& ffbf = fieldFlux.boundaryFieldRef();
1518 ffbf[patchi] = InternalContrib[patchi] - NeighbourContrib[patchi];
1522 if (faceFluxCorrectionPtr_)
1524 fieldFlux += *faceFluxCorrectionPtr_;
1531 template<
class Type>
1537 return psi_.mesh().solverDict(
name);
1541 template<
class Type>
1544 return psi_.mesh().solverDict
1546 psi_.select(psi_.mesh().data().isFinalIteration())
1553 template<
class Type>
1561 if (&psi_ != &(fvmv.psi_))
1564 <<
"different fields" 1568 dimensions_ = fvmv.dimensions_;
1570 source_ = fvmv.source_;
1571 internalCoeffs_ = fvmv.internalCoeffs_;
1572 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1574 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1576 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1578 else if (fvmv.faceFluxCorrectionPtr_)
1580 faceFluxCorrectionPtr_ =
1581 new GeometricField<Type, fvsPatchField, surfaceMesh>
1582 (*fvmv.faceFluxCorrectionPtr_);
1585 useImplicit_ = fvmv.useImplicit_;
1586 lduAssemblyName_ = fvmv.lduAssemblyName_;
1590 template<
class Type>
1598 template<
class Type>
1603 internalCoeffs_.negate();
1604 boundaryCoeffs_.negate();
1606 if (faceFluxCorrectionPtr_)
1608 faceFluxCorrectionPtr_->negate();
1613 template<
class Type>
1618 dimensions_ += fvmv.dimensions_;
1620 source_ += fvmv.source_;
1621 internalCoeffs_ += fvmv.internalCoeffs_;
1622 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1624 useImplicit_ = fvmv.useImplicit_;
1625 lduAssemblyName_ = fvmv.lduAssemblyName_;
1626 nMatrix_ = fvmv.nMatrix_;
1628 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1630 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1632 else if (fvmv.faceFluxCorrectionPtr_)
1634 faceFluxCorrectionPtr_ =
new 1635 GeometricField<Type, fvsPatchField, surfaceMesh>
1637 *fvmv.faceFluxCorrectionPtr_
1643 template<
class Type>
1646 operator+=(tfvmv());
1651 template<
class Type>
1656 dimensions_ -= fvmv.dimensions_;
1658 source_ -= fvmv.source_;
1659 internalCoeffs_ -= fvmv.internalCoeffs_;
1660 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1662 useImplicit_ = fvmv.useImplicit_;
1663 lduAssemblyName_ = fvmv.lduAssemblyName_;
1664 nMatrix_ = fvmv.nMatrix_;
1666 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1668 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1670 else if (fvmv.faceFluxCorrectionPtr_)
1672 faceFluxCorrectionPtr_ =
1674 (-*fvmv.faceFluxCorrectionPtr_);
1679 template<
class Type>
1682 operator-=(tfvmv());
1687 template<
class Type>
1694 source() -= su.mesh().V()*su.field();
1698 template<
class Type>
1709 template<
class Type>
1720 template<
class Type>
1727 source() += su.mesh().V()*su.field();
1731 template<
class Type>
1742 template<
class Type>
1753 template<
class Type>
1759 source() -=
psi().
mesh().V()*su;
1763 template<
class Type>
1769 source() +=
psi().
mesh().V()*su;
1773 template<
class Type>
1779 dimensions_ *= dsf.dimensions();
1781 source_ *= dsf.field();
1783 forAll(boundaryCoeffs_, patchi)
1787 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1790 internalCoeffs_[patchi] *= pisf;
1791 boundaryCoeffs_[patchi] *= pisf;
1794 if (faceFluxCorrectionPtr_)
1797 <<
"cannot scale a matrix containing a faceFluxCorrection" 1803 template<
class Type>
1806 const tmp<volScalarField::Internal>& tfld
1814 template<
class Type>
1825 template<
class Type>
1831 dimensions_ *= ds.dimensions();
1833 source_ *= ds.value();
1834 internalCoeffs_ *= ds.value();
1835 boundaryCoeffs_ *= ds.value();
1837 if (faceFluxCorrectionPtr_)
1839 *faceFluxCorrectionPtr_ *= ds.value();
1846 template<
class Type>
1849 const fvMatrix<Type>& mat1,
1850 const fvMatrix<Type>& mat2,
1854 if (&mat1.psi() != &mat2.psi())
1857 <<
"Incompatible fields for operation\n " 1858 <<
"[" << mat1.psi().name() <<
"] " 1860 <<
" [" << mat2.psi().name() <<
"]" 1867 && mat1.dimensions() != mat2.dimensions()
1871 <<
"Incompatible dimensions for operation\n " 1872 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimVolume <<
" ] " 1874 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimVolume <<
" ]" 1880 template<
class Type>
1883 const fvMatrix<Type>& mat,
1884 const DimensionedField<Type, volMesh>&
fld,
1895 <<
"Incompatible dimensions for operation\n " 1896 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1898 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1904 template<
class Type>
1907 const fvMatrix<Type>& mat,
1908 const dimensioned<Type>& dt,
1915 && mat.dimensions()/
dimVolume != dt.dimensions()
1919 <<
"Incompatible dimensions for operation\n " 1920 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1922 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1928 template<
class Type>
1931 fvMatrix<Type>& mat,
1935 return mat.solve(solverControls);
1938 template<
class Type>
1941 const tmp<fvMatrix<Type>>& tmat,
1945 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1953 template<
class Type>
1956 fvMatrix<Type>& mat,
1960 return mat.solve(
name);
1963 template<
class Type>
1966 const tmp<fvMatrix<Type>>& tmat,
1970 SolverPerformance<Type> solverPerf(tmat.constCast().solve(
name));
1978 template<
class Type>
1984 template<
class Type>
1987 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1995 template<
class Type>
1998 const fvMatrix<Type>&
A 2001 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
2011 template<
class Type>
2014 const tmp<fvMatrix<Type>>& tA
2017 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
2029 template<
class Type>
2032 const fvMatrix<Type>&
A,
2033 const fvMatrix<Type>&
B 2040 template<
class Type>
2043 const tmp<fvMatrix<Type>>& tA,
2044 const fvMatrix<Type>&
B 2051 template<
class Type>
2054 const fvMatrix<Type>&
A,
2055 const tmp<fvMatrix<Type>>& tB
2062 template<
class Type>
2065 const tmp<fvMatrix<Type>>& tA,
2066 const tmp<fvMatrix<Type>>& tB
2073 template<
class Type>
2076 const fvMatrix<Type>&
A,
2077 const DimensionedField<Type, volMesh>& su
2081 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2082 tC.ref().source() += su.mesh().V()*su.field();
2086 template<
class Type>
2089 const fvMatrix<Type>&
A,
2090 const tmp<DimensionedField<Type, volMesh>>& tsu
2094 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2095 tC.ref().source() += tsu().mesh().V()*tsu().field();
2100 template<
class Type>
2103 const fvMatrix<Type>&
A,
2104 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2108 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2109 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2114 template<
class Type>
2117 const tmp<fvMatrix<Type>>& tA,
2118 const DimensionedField<Type, volMesh>& su
2122 tmp<fvMatrix<Type>> tC(tA.ptr());
2123 tC.ref().source() += su.mesh().V()*su.field();
2127 template<
class Type>
2130 const tmp<fvMatrix<Type>>& tA,
2131 const tmp<DimensionedField<Type, volMesh>>& tsu
2135 tmp<fvMatrix<Type>> tC(tA.ptr());
2136 tC.ref().source() += tsu().mesh().V()*tsu().field();
2141 template<
class Type>
2144 const tmp<fvMatrix<Type>>& tA,
2145 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2149 tmp<fvMatrix<Type>> tC(tA.ptr());
2150 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2155 template<
class Type>
2158 const fvMatrix<Type>&
A,
2159 const dimensioned<Type>& su
2163 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2164 tC.ref().source() +=
A.psi().mesh().V()*su.value();
2168 template<
class Type>
2171 const tmp<fvMatrix<Type>>& tA,
2172 const dimensioned<Type>& su
2176 tmp<fvMatrix<Type>> tC(tA.ptr());
2177 tC.ref().source() += tC().psi().mesh().V()*su.value();
2181 template<
class Type>
2184 const fvMatrix<Type>&
A,
2192 template<
class Type>
2195 const tmp<fvMatrix<Type>>& tA,
2203 template<
class Type>
2206 const fvMatrix<Type>&
A 2209 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2214 template<
class Type>
2217 const tmp<fvMatrix<Type>>& tA
2220 tmp<fvMatrix<Type>> tC(tA.ptr());
2226 template<
class Type>
2229 const fvMatrix<Type>&
A,
2230 const fvMatrix<Type>&
B 2234 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2239 template<
class Type>
2242 const tmp<fvMatrix<Type>>& tA,
2243 const fvMatrix<Type>&
B 2247 tmp<fvMatrix<Type>> tC(tA.
ptr());
2252 template<
class Type>
2255 const fvMatrix<Type>&
A,
2256 const tmp<fvMatrix<Type>>& tB
2260 tmp<fvMatrix<Type>> tC(tB.ptr());
2265 template<
class Type>
2268 const tmp<fvMatrix<Type>>& tA,
2269 const tmp<fvMatrix<Type>>& tB
2273 tmp<fvMatrix<Type>> tC(tA.
ptr());
2279 template<
class Type>
2282 const fvMatrix<Type>&
A,
2283 const DimensionedField<Type, volMesh>& su
2287 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2288 tC.ref().source() -= su.mesh().V()*su.field();
2292 template<
class Type>
2295 const fvMatrix<Type>&
A,
2296 const tmp<DimensionedField<Type, volMesh>>& tsu
2300 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2301 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2306 template<
class Type>
2309 const fvMatrix<Type>&
A,
2310 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2314 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2315 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2320 template<
class Type>
2323 const tmp<fvMatrix<Type>>& tA,
2324 const DimensionedField<Type, volMesh>& su
2328 tmp<fvMatrix<Type>> tC(tA.
ptr());
2329 tC.ref().source() -= su.mesh().V()*su.field();
2333 template<
class Type>
2336 const tmp<fvMatrix<Type>>& tA,
2337 const tmp<DimensionedField<Type, volMesh>>& tsu
2341 tmp<fvMatrix<Type>> tC(tA.
ptr());
2342 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2347 template<
class Type>
2350 const tmp<fvMatrix<Type>>& tA,
2351 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2355 tmp<fvMatrix<Type>> tC(tA.
ptr());
2356 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2361 template<
class Type>
2364 const DimensionedField<Type, volMesh>& su,
2365 const fvMatrix<Type>&
A 2369 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2370 tC.ref().source() -= su.mesh().V()*su.field();
2374 template<
class Type>
2377 const tmp<DimensionedField<Type, volMesh>>& tsu,
2378 const fvMatrix<Type>&
A 2382 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2383 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2388 template<
class Type>
2391 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2392 const fvMatrix<Type>&
A 2396 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2397 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2402 template<
class Type>
2405 const DimensionedField<Type, volMesh>& su,
2406 const tmp<fvMatrix<Type>>& tA
2410 tmp<fvMatrix<Type>> tC(tA.
ptr());
2411 tC.ref().source() -= su.mesh().V()*su.field();
2415 template<
class Type>
2418 const tmp<DimensionedField<Type, volMesh>>& tsu,
2419 const tmp<fvMatrix<Type>>& tA
2423 tmp<fvMatrix<Type>> tC(tA.
ptr());
2424 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2429 template<
class Type>
2432 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2433 const tmp<fvMatrix<Type>>& tA
2437 tmp<fvMatrix<Type>> tC(tA.
ptr());
2438 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2444 template<
class Type>
2447 const fvMatrix<Type>&
A,
2448 const fvMatrix<Type>&
B 2452 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2457 template<
class Type>
2460 const tmp<fvMatrix<Type>>& tA,
2461 const fvMatrix<Type>&
B 2465 tmp<fvMatrix<Type>> tC(tA.
ptr());
2470 template<
class Type>
2473 const fvMatrix<Type>&
A,
2474 const tmp<fvMatrix<Type>>& tB
2478 tmp<fvMatrix<Type>> tC(tB.ptr());
2484 template<
class Type>
2487 const tmp<fvMatrix<Type>>& tA,
2488 const tmp<fvMatrix<Type>>& tB
2492 tmp<fvMatrix<Type>> tC(tA.
ptr());
2498 template<
class Type>
2501 const fvMatrix<Type>&
A,
2502 const DimensionedField<Type, volMesh>& su
2506 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2507 tC.ref().source() += su.mesh().V()*su.field();
2511 template<
class Type>
2514 const fvMatrix<Type>&
A,
2515 const tmp<DimensionedField<Type, volMesh>>& tsu
2519 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2520 tC.ref().source() += tsu().mesh().V()*tsu().field();
2525 template<
class Type>
2528 const fvMatrix<Type>&
A,
2529 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2533 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2534 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2539 template<
class Type>
2542 const tmp<fvMatrix<Type>>& tA,
2543 const DimensionedField<Type, volMesh>& su
2547 tmp<fvMatrix<Type>> tC(tA.
ptr());
2548 tC.ref().source() += su.mesh().V()*su.field();
2552 template<
class Type>
2555 const tmp<fvMatrix<Type>>& tA,
2556 const tmp<DimensionedField<Type, volMesh>>& tsu
2560 tmp<fvMatrix<Type>> tC(tA.
ptr());
2561 tC.ref().source() += tsu().mesh().V()*tsu().field();
2566 template<
class Type>
2569 const tmp<fvMatrix<Type>>& tA,
2570 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2574 tmp<fvMatrix<Type>> tC(tA.
ptr());
2575 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2580 template<
class Type>
2583 const DimensionedField<Type, volMesh>& su,
2584 const fvMatrix<Type>&
A 2588 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2590 tC.ref().source() -= su.mesh().V()*su.field();
2594 template<
class Type>
2597 const tmp<DimensionedField<Type, volMesh>>& tsu,
2598 const fvMatrix<Type>&
A 2602 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2604 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2609 template<
class Type>
2612 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2613 const fvMatrix<Type>&
A 2617 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2619 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2624 template<
class Type>
2627 const DimensionedField<Type, volMesh>& su,
2628 const tmp<fvMatrix<Type>>& tA
2632 tmp<fvMatrix<Type>> tC(tA.
ptr());
2634 tC.ref().source() -= su.mesh().V()*su.field();
2638 template<
class Type>
2641 const tmp<DimensionedField<Type, volMesh>>& tsu,
2642 const tmp<fvMatrix<Type>>& tA
2646 tmp<fvMatrix<Type>> tC(tA.
ptr());
2648 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2653 template<
class Type>
2656 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2657 const tmp<fvMatrix<Type>>& tA
2661 tmp<fvMatrix<Type>> tC(tA.
ptr());
2663 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2668 template<
class Type>
2671 const fvMatrix<Type>&
A,
2672 const dimensioned<Type>& su
2676 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2677 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2681 template<
class Type>
2684 const tmp<fvMatrix<Type>>& tA,
2685 const dimensioned<Type>& su
2689 tmp<fvMatrix<Type>> tC(tA.
ptr());
2690 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2694 template<
class Type>
2697 const dimensioned<Type>& su,
2698 const fvMatrix<Type>&
A 2702 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2703 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2707 template<
class Type>
2710 const dimensioned<Type>& su,
2711 const tmp<fvMatrix<Type>>& tA
2715 tmp<fvMatrix<Type>> tC(tA.
ptr());
2716 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2720 template<
class Type>
2723 const fvMatrix<Type>&
A,
2724 const dimensioned<Type>& su
2728 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2729 tC.ref().source() += su.value()*tC().psi().mesh().V();
2733 template<
class Type>
2736 const tmp<fvMatrix<Type>>& tA,
2737 const dimensioned<Type>& su
2741 tmp<fvMatrix<Type>> tC(tA.
ptr());
2742 tC.ref().source() += su.value()*tC().psi().mesh().V();
2746 template<
class Type>
2749 const dimensioned<Type>& su,
2750 const fvMatrix<Type>&
A 2754 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2756 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2760 template<
class Type>
2763 const dimensioned<Type>& su,
2764 const tmp<fvMatrix<Type>>& tA
2768 tmp<fvMatrix<Type>> tC(tA.
ptr());
2770 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2775 template<
class Type>
2779 const fvMatrix<Type>&
A 2782 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2787 template<
class Type>
2790 const tmp<volScalarField::Internal>& tdsf,
2791 const fvMatrix<Type>&
A 2794 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2799 template<
class Type>
2802 const tmp<volScalarField>& tvsf,
2803 const fvMatrix<Type>&
A 2806 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2811 template<
class Type>
2815 const tmp<fvMatrix<Type>>& tA
2818 tmp<fvMatrix<Type>> tC(tA.
ptr());
2823 template<
class Type>
2826 const tmp<volScalarField::Internal>& tdsf,
2827 const tmp<fvMatrix<Type>>& tA
2830 tmp<fvMatrix<Type>> tC(tA.
ptr());
2835 template<
class Type>
2838 const tmp<volScalarField>& tvsf,
2839 const tmp<fvMatrix<Type>>& tA
2842 tmp<fvMatrix<Type>> tC(tA.
ptr());
2847 template<
class Type>
2850 const dimensioned<scalar>& ds,
2851 const fvMatrix<Type>&
A 2854 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2859 template<
class Type>
2862 const dimensioned<scalar>& ds,
2863 const tmp<fvMatrix<Type>>& tA
2866 tmp<fvMatrix<Type>> tC(tA.
ptr());
2872 template<
class Type>
2876 const fvMatrix<Type>&
M,
2877 const DimensionedField<Type, volMesh>&
psi 2887 auto& Mphi = tMphi.ref();
2896 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2897 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2902 Mphi.primitiveFieldRef() =
Zero;
2905 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2906 M.addBoundarySource(Mphi.primitiveFieldRef());
2908 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2909 Mphi.correctBoundaryConditions();
2914 template<
class Type>
2918 const fvMatrix<Type>&
M,
2919 const tmp<DimensionedField<Type, volMesh>>& tpsi
2922 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2927 template<
class Type>
2931 const fvMatrix<Type>&
M,
2932 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2935 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2940 template<
class Type>
2944 const tmp<fvMatrix<Type>>& tM,
2945 const DimensionedField<Type, volMesh>&
psi 2948 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() &
psi;
2953 template<
class Type>
2957 const tmp<fvMatrix<Type>>& tM,
2958 const tmp<DimensionedField<Type, volMesh>>& tpsi
2961 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2967 template<
class Type>
2971 const tmp<fvMatrix<Type>>& tM,
2972 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2975 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2984 template<
class Type>
2985 Foam::Ostream& Foam::operator<<(Ostream& os, const fvMatrix<Type>& fvm)
2987 os << static_cast<const lduMatrix&>(fvm) <<
nl 2988 << fvm.dimensions_ <<
nl 2989 << fvm.source_ <<
nl 2990 << fvm.internalCoeffs_ <<
nl 2991 << 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.
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.
static const lduMesh & mesh(const lduMesh &mesh0, const PtrList< lduPrimitiveMesh > &otherMeshes, const label meshI)
Select either mesh0 (meshI is 0) or otherMeshes[meshI-1].
errorManip< error > abort(error &err)
void operator=(const lduMatrix &)
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.
virtual const objectRegistry & thisDb() const
Return the object registry.
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 reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
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)
void deleteDemandDrivenData(DataPtr &dataPtr)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
void setBounAndInterCoeffs()
Manipulate boundary/internal coeffs for coupling.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const 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.