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::template getOrDefault<bool>
1261 (
"finalIteration",
false)
1264 if (psi_.mesh().relaxEquation(
name))
1271 template<
class Type>
1274 typename GeometricField<Type, fvPatchField, volMesh>::
1280 bFields[patchi].manipulateMatrix(*
this);
1285 template<
class Type>
1289 addCmptAvBoundaryDiag(tdiag.ref());
1294 template<
class Type>
1299 forAll(psi_.boundaryField(), patchi)
1307 lduAddr().patchAddr(patchi),
1308 internalCoeffs_[patchi],
1318 template<
class Type>
1323 "A(" + psi_.name() +
')',
1325 dimensions_/psi_.dimensions()/
dimVol,
1329 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().V();
1330 tAphi.ref().correctBoundaryConditions();
1336 template<
class Type>
1342 "H(" + psi_.name() +
')',
1347 auto& Hphi = tHphi.ref();
1350 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
1352 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
1355 addBoundaryDiag(boundaryDiagCmpt, cmpt);
1356 boundaryDiagCmpt.negate();
1357 addCmptAvBoundaryDiag(boundaryDiagCmpt);
1368 typename Type::labelType validComponents
1370 psi_.mesh().template validComponents<Type>()
1373 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
1375 if (validComponents[cmpt] == -1)
1389 template<
class Type>
1396 dimensions_/(
dimVol*psi_.dimensions()),
1399 auto& H1_ = tH1.ref();
1403 forAll(psi_.boundaryField(), patchi)
1405 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1407 if (ptf.coupled() && ptf.size())
1411 lduAddr().patchAddr(patchi),
1418 H1_.primitiveFieldRef() /= psi_.mesh().V();
1419 H1_.correctBoundaryConditions();
1425 template<
class Type>
1430 if (!psi_.mesh().fluxRequired(psi_.name()))
1433 <<
"flux requested but " << psi_.name()
1434 <<
" not specified in the fluxRequired sub-dictionary" 1439 if (nMatrices() > 1)
1442 <<
"Flux requested but " << psi_.name()
1443 <<
" can't handle multiple fvMatrix." 1449 "flux(" + psi_.name() +
')',
1453 auto& fieldFlux = tfieldFlux.ref();
1455 fieldFlux.setOriented();
1457 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
1459 fieldFlux.primitiveFieldRef().replace
1466 FieldField<Field, Type> InternalContrib = internalCoeffs_;
1471 forAll(InternalContrib, patchi)
1473 InternalContrib[patchi] =
1476 InternalContrib[patchi],
1477 psi_.boundaryField()[patchi].patchInternalField()
1483 FieldField<Field, Type> fluxInternalContrib(internalCoeffs_);
1485 mapContributions(fieldi, fluxInternalContrib, InternalContrib,
true);
1488 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
1492 forAll(NeighbourContrib, patchi)
1494 if (psi_.boundaryField()[patchi].coupled())
1496 NeighbourContrib[patchi] =
1499 NeighbourContrib[patchi],
1500 psi_.boundaryField()[patchi].patchNeighbourField()
1507 FieldField<Field, Type> fluxBoundaryContrib(boundaryCoeffs_);
1509 mapContributions(fieldi, fluxBoundaryContrib, NeighbourContrib,
false);
1512 typename GeometricField<Type, fvsPatchField, surfaceMesh>::
1513 Boundary& ffbf = fieldFlux.boundaryFieldRef();
1517 ffbf[patchi] = InternalContrib[patchi] - NeighbourContrib[patchi];
1521 if (faceFluxCorrectionPtr_)
1523 fieldFlux += *faceFluxCorrectionPtr_;
1530 template<
class Type>
1533 return psi_.mesh().solverDict
1537 psi_.mesh().data::template getOrDefault<bool>
1538 (
"finalIteration",
false)
1546 template<
class Type>
1554 if (&psi_ != &(fvmv.psi_))
1557 <<
"different fields" 1561 dimensions_ = fvmv.dimensions_;
1563 source_ = fvmv.source_;
1564 internalCoeffs_ = fvmv.internalCoeffs_;
1565 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1567 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1569 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1571 else if (fvmv.faceFluxCorrectionPtr_)
1573 faceFluxCorrectionPtr_ =
1574 new GeometricField<Type, fvsPatchField, surfaceMesh>
1575 (*fvmv.faceFluxCorrectionPtr_);
1578 useImplicit_ = fvmv.useImplicit_;
1579 lduAssemblyName_ = fvmv.lduAssemblyName_;
1583 template<
class Type>
1591 template<
class Type>
1596 internalCoeffs_.negate();
1597 boundaryCoeffs_.negate();
1599 if (faceFluxCorrectionPtr_)
1601 faceFluxCorrectionPtr_->negate();
1606 template<
class Type>
1611 dimensions_ += fvmv.dimensions_;
1613 source_ += fvmv.source_;
1614 internalCoeffs_ += fvmv.internalCoeffs_;
1615 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1617 useImplicit_ = fvmv.useImplicit_;
1618 lduAssemblyName_ = fvmv.lduAssemblyName_;
1619 nMatrix_ = fvmv.nMatrix_;
1621 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1623 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1625 else if (fvmv.faceFluxCorrectionPtr_)
1627 faceFluxCorrectionPtr_ =
new 1628 GeometricField<Type, fvsPatchField, surfaceMesh>
1630 *fvmv.faceFluxCorrectionPtr_
1636 template<
class Type>
1639 operator+=(tfvmv());
1644 template<
class Type>
1649 dimensions_ -= fvmv.dimensions_;
1651 source_ -= fvmv.source_;
1652 internalCoeffs_ -= fvmv.internalCoeffs_;
1653 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1655 useImplicit_ = fvmv.useImplicit_;
1656 lduAssemblyName_ = fvmv.lduAssemblyName_;
1657 nMatrix_ = fvmv.nMatrix_;
1659 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1661 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1663 else if (fvmv.faceFluxCorrectionPtr_)
1665 faceFluxCorrectionPtr_ =
1667 (-*fvmv.faceFluxCorrectionPtr_);
1672 template<
class Type>
1675 operator-=(tfvmv());
1680 template<
class Type>
1687 source() -= su.mesh().V()*su.field();
1691 template<
class Type>
1702 template<
class Type>
1713 template<
class Type>
1720 source() += su.mesh().V()*su.field();
1724 template<
class Type>
1735 template<
class Type>
1746 template<
class Type>
1752 source() -=
psi().
mesh().V()*su;
1756 template<
class Type>
1762 source() +=
psi().
mesh().V()*su;
1766 template<
class Type>
1771 template<
class Type>
1776 template<
class Type>
1782 dimensions_ *= dsf.dimensions();
1784 source_ *= dsf.field();
1786 forAll(boundaryCoeffs_, patchi)
1790 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1793 internalCoeffs_[patchi] *= pisf;
1794 boundaryCoeffs_[patchi] *= pisf;
1797 if (faceFluxCorrectionPtr_)
1800 <<
"cannot scale a matrix containing a faceFluxCorrection" 1806 template<
class Type>
1809 const tmp<volScalarField::Internal>& tfld
1817 template<
class Type>
1828 template<
class Type>
1834 dimensions_ *= ds.dimensions();
1836 source_ *= ds.value();
1837 internalCoeffs_ *= ds.value();
1838 boundaryCoeffs_ *= ds.value();
1840 if (faceFluxCorrectionPtr_)
1842 *faceFluxCorrectionPtr_ *= ds.value();
1849 template<
class Type>
1852 const fvMatrix<Type>& mat1,
1853 const fvMatrix<Type>& mat2,
1857 if (&mat1.psi() != &mat2.psi())
1860 <<
"Incompatible fields for operation\n " 1861 <<
"[" << mat1.psi().name() <<
"] " 1863 <<
" [" << mat2.psi().name() <<
"]" 1870 && mat1.dimensions() != mat2.dimensions()
1874 <<
"Incompatible dimensions for operation\n " 1875 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimVolume <<
" ] " 1877 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimVolume <<
" ]" 1883 template<
class Type>
1886 const fvMatrix<Type>& mat,
1887 const DimensionedField<Type, volMesh>&
fld,
1898 <<
"Incompatible dimensions for operation\n " 1899 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1901 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1907 template<
class Type>
1910 const fvMatrix<Type>& mat,
1911 const dimensioned<Type>& dt,
1918 && mat.dimensions()/
dimVolume != dt.dimensions()
1922 <<
"Incompatible dimensions for operation\n " 1923 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1925 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1931 template<
class Type>
1934 fvMatrix<Type>& fvm,
1935 const dictionary& solverControls
1938 return fvm.solve(solverControls);
1941 template<
class Type>
1944 const tmp<fvMatrix<Type>>& tmat,
1945 const dictionary& solverControls
1948 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1956 template<
class Type>
1962 template<
class Type>
1965 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
1973 template<
class Type>
1976 const fvMatrix<Type>&
A 1979 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
1989 template<
class Type>
1992 const tmp<fvMatrix<Type>>& tA
1995 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
2007 template<
class Type>
2010 const fvMatrix<Type>&
A,
2011 const fvMatrix<Type>&
B 2018 template<
class Type>
2021 const tmp<fvMatrix<Type>>& tA,
2022 const fvMatrix<Type>&
B 2029 template<
class Type>
2032 const fvMatrix<Type>&
A,
2033 const tmp<fvMatrix<Type>>& tB
2040 template<
class Type>
2043 const tmp<fvMatrix<Type>>& tA,
2044 const tmp<fvMatrix<Type>>& tB
2051 template<
class Type>
2054 const fvMatrix<Type>&
A,
2055 const DimensionedField<Type, volMesh>& su
2059 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2060 tC.ref().source() += su.mesh().V()*su.field();
2064 template<
class Type>
2067 const fvMatrix<Type>&
A,
2068 const tmp<DimensionedField<Type, volMesh>>& tsu
2072 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2073 tC.ref().source() += tsu().mesh().V()*tsu().field();
2078 template<
class Type>
2081 const fvMatrix<Type>&
A,
2082 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2086 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2087 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2092 template<
class Type>
2095 const tmp<fvMatrix<Type>>& tA,
2096 const DimensionedField<Type, volMesh>& su
2100 tmp<fvMatrix<Type>> tC(tA.ptr());
2101 tC.ref().source() += su.mesh().V()*su.field();
2105 template<
class Type>
2108 const tmp<fvMatrix<Type>>& tA,
2109 const tmp<DimensionedField<Type, volMesh>>& tsu
2113 tmp<fvMatrix<Type>> tC(tA.ptr());
2114 tC.ref().source() += tsu().mesh().V()*tsu().field();
2119 template<
class Type>
2122 const tmp<fvMatrix<Type>>& tA,
2123 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2127 tmp<fvMatrix<Type>> tC(tA.ptr());
2128 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2133 template<
class Type>
2136 const fvMatrix<Type>&
A,
2137 const dimensioned<Type>& su
2141 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2142 tC.ref().source() +=
A.psi().mesh().V()*su.value();
2146 template<
class Type>
2149 const tmp<fvMatrix<Type>>& tA,
2150 const dimensioned<Type>& su
2154 tmp<fvMatrix<Type>> tC(tA.ptr());
2155 tC.ref().source() += tC().psi().mesh().V()*su.value();
2159 template<
class Type>
2162 const fvMatrix<Type>&
A,
2170 template<
class Type>
2173 const tmp<fvMatrix<Type>>& tA,
2181 template<
class Type>
2184 const fvMatrix<Type>&
A 2187 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2192 template<
class Type>
2195 const tmp<fvMatrix<Type>>& tA
2198 tmp<fvMatrix<Type>> tC(tA.ptr());
2204 template<
class Type>
2207 const fvMatrix<Type>&
A,
2208 const fvMatrix<Type>&
B 2212 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2217 template<
class Type>
2220 const tmp<fvMatrix<Type>>& tA,
2221 const fvMatrix<Type>&
B 2225 tmp<fvMatrix<Type>> tC(tA.
ptr());
2230 template<
class Type>
2233 const fvMatrix<Type>&
A,
2234 const tmp<fvMatrix<Type>>& tB
2238 tmp<fvMatrix<Type>> tC(tB.ptr());
2243 template<
class Type>
2246 const tmp<fvMatrix<Type>>& tA,
2247 const tmp<fvMatrix<Type>>& tB
2251 tmp<fvMatrix<Type>> tC(tA.
ptr());
2257 template<
class Type>
2260 const fvMatrix<Type>&
A,
2261 const DimensionedField<Type, volMesh>& su
2265 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2266 tC.ref().source() -= su.mesh().V()*su.field();
2270 template<
class Type>
2273 const fvMatrix<Type>&
A,
2274 const tmp<DimensionedField<Type, volMesh>>& tsu
2278 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2279 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2284 template<
class Type>
2287 const fvMatrix<Type>&
A,
2288 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2292 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2293 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2298 template<
class Type>
2301 const tmp<fvMatrix<Type>>& tA,
2302 const DimensionedField<Type, volMesh>& su
2306 tmp<fvMatrix<Type>> tC(tA.
ptr());
2307 tC.ref().source() -= su.mesh().V()*su.field();
2311 template<
class Type>
2314 const tmp<fvMatrix<Type>>& tA,
2315 const tmp<DimensionedField<Type, volMesh>>& tsu
2319 tmp<fvMatrix<Type>> tC(tA.
ptr());
2320 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2325 template<
class Type>
2328 const tmp<fvMatrix<Type>>& tA,
2329 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2333 tmp<fvMatrix<Type>> tC(tA.
ptr());
2334 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2339 template<
class Type>
2342 const DimensionedField<Type, volMesh>& su,
2343 const fvMatrix<Type>&
A 2347 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2348 tC.ref().source() -= su.mesh().V()*su.field();
2352 template<
class Type>
2355 const tmp<DimensionedField<Type, volMesh>>& tsu,
2356 const fvMatrix<Type>&
A 2360 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2361 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2366 template<
class Type>
2369 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2370 const fvMatrix<Type>&
A 2374 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2375 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2380 template<
class Type>
2383 const DimensionedField<Type, volMesh>& su,
2384 const tmp<fvMatrix<Type>>& tA
2388 tmp<fvMatrix<Type>> tC(tA.
ptr());
2389 tC.ref().source() -= su.mesh().V()*su.field();
2393 template<
class Type>
2396 const tmp<DimensionedField<Type, volMesh>>& tsu,
2397 const tmp<fvMatrix<Type>>& tA
2401 tmp<fvMatrix<Type>> tC(tA.
ptr());
2402 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2407 template<
class Type>
2410 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2411 const tmp<fvMatrix<Type>>& tA
2415 tmp<fvMatrix<Type>> tC(tA.
ptr());
2416 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2422 template<
class Type>
2425 const fvMatrix<Type>&
A,
2426 const fvMatrix<Type>&
B 2430 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2435 template<
class Type>
2438 const tmp<fvMatrix<Type>>& tA,
2439 const fvMatrix<Type>&
B 2443 tmp<fvMatrix<Type>> tC(tA.
ptr());
2448 template<
class Type>
2451 const fvMatrix<Type>&
A,
2452 const tmp<fvMatrix<Type>>& tB
2456 tmp<fvMatrix<Type>> tC(tB.ptr());
2462 template<
class Type>
2465 const tmp<fvMatrix<Type>>& tA,
2466 const tmp<fvMatrix<Type>>& tB
2470 tmp<fvMatrix<Type>> tC(tA.
ptr());
2476 template<
class Type>
2479 const fvMatrix<Type>&
A,
2480 const DimensionedField<Type, volMesh>& su
2484 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2485 tC.ref().source() += su.mesh().V()*su.field();
2489 template<
class Type>
2492 const fvMatrix<Type>&
A,
2493 const tmp<DimensionedField<Type, volMesh>>& tsu
2497 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2498 tC.ref().source() += tsu().mesh().V()*tsu().field();
2503 template<
class Type>
2506 const fvMatrix<Type>&
A,
2507 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2511 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2512 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2517 template<
class Type>
2520 const tmp<fvMatrix<Type>>& tA,
2521 const DimensionedField<Type, volMesh>& su
2525 tmp<fvMatrix<Type>> tC(tA.
ptr());
2526 tC.ref().source() += su.mesh().V()*su.field();
2530 template<
class Type>
2533 const tmp<fvMatrix<Type>>& tA,
2534 const tmp<DimensionedField<Type, volMesh>>& tsu
2538 tmp<fvMatrix<Type>> tC(tA.
ptr());
2539 tC.ref().source() += tsu().mesh().V()*tsu().field();
2544 template<
class Type>
2547 const tmp<fvMatrix<Type>>& tA,
2548 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2552 tmp<fvMatrix<Type>> tC(tA.
ptr());
2553 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2558 template<
class Type>
2561 const DimensionedField<Type, volMesh>& su,
2562 const fvMatrix<Type>&
A 2566 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2568 tC.ref().source() -= su.mesh().V()*su.field();
2572 template<
class Type>
2575 const tmp<DimensionedField<Type, volMesh>>& tsu,
2576 const fvMatrix<Type>&
A 2580 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2582 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2587 template<
class Type>
2590 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2591 const fvMatrix<Type>&
A 2595 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2597 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2602 template<
class Type>
2605 const DimensionedField<Type, volMesh>& su,
2606 const tmp<fvMatrix<Type>>& tA
2610 tmp<fvMatrix<Type>> tC(tA.
ptr());
2612 tC.ref().source() -= su.mesh().V()*su.field();
2616 template<
class Type>
2619 const tmp<DimensionedField<Type, volMesh>>& tsu,
2620 const tmp<fvMatrix<Type>>& tA
2624 tmp<fvMatrix<Type>> tC(tA.
ptr());
2626 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2631 template<
class Type>
2634 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2635 const tmp<fvMatrix<Type>>& tA
2639 tmp<fvMatrix<Type>> tC(tA.
ptr());
2641 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2646 template<
class Type>
2649 const fvMatrix<Type>&
A,
2650 const dimensioned<Type>& su
2654 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2655 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2659 template<
class Type>
2662 const tmp<fvMatrix<Type>>& tA,
2663 const dimensioned<Type>& su
2667 tmp<fvMatrix<Type>> tC(tA.
ptr());
2668 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2672 template<
class Type>
2675 const dimensioned<Type>& su,
2676 const fvMatrix<Type>&
A 2680 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2681 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2685 template<
class Type>
2688 const dimensioned<Type>& su,
2689 const tmp<fvMatrix<Type>>& tA
2693 tmp<fvMatrix<Type>> tC(tA.
ptr());
2694 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2698 template<
class Type>
2701 const fvMatrix<Type>&
A,
2702 const dimensioned<Type>& su
2706 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2707 tC.ref().source() += su.value()*tC().psi().mesh().V();
2711 template<
class Type>
2714 const tmp<fvMatrix<Type>>& tA,
2715 const dimensioned<Type>& su
2719 tmp<fvMatrix<Type>> tC(tA.
ptr());
2720 tC.ref().source() += su.value()*tC().psi().mesh().V();
2724 template<
class Type>
2727 const dimensioned<Type>& su,
2728 const fvMatrix<Type>&
A 2732 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2734 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2738 template<
class Type>
2741 const dimensioned<Type>& su,
2742 const tmp<fvMatrix<Type>>& tA
2746 tmp<fvMatrix<Type>> tC(tA.
ptr());
2748 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2753 template<
class Type>
2757 const fvMatrix<Type>&
A 2760 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2765 template<
class Type>
2768 const tmp<volScalarField::Internal>& tdsf,
2769 const fvMatrix<Type>&
A 2772 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2777 template<
class Type>
2780 const tmp<volScalarField>& tvsf,
2781 const fvMatrix<Type>&
A 2784 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2789 template<
class Type>
2793 const tmp<fvMatrix<Type>>& tA
2796 tmp<fvMatrix<Type>> tC(tA.
ptr());
2801 template<
class Type>
2804 const tmp<volScalarField::Internal>& tdsf,
2805 const tmp<fvMatrix<Type>>& tA
2808 tmp<fvMatrix<Type>> tC(tA.
ptr());
2813 template<
class Type>
2816 const tmp<volScalarField>& tvsf,
2817 const tmp<fvMatrix<Type>>& tA
2820 tmp<fvMatrix<Type>> tC(tA.
ptr());
2825 template<
class Type>
2828 const dimensioned<scalar>& ds,
2829 const fvMatrix<Type>&
A 2832 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2837 template<
class Type>
2840 const dimensioned<scalar>& ds,
2841 const tmp<fvMatrix<Type>>& tA
2844 tmp<fvMatrix<Type>> tC(tA.
ptr());
2850 template<
class Type>
2854 const fvMatrix<Type>&
M,
2855 const DimensionedField<Type, volMesh>&
psi 2865 auto& Mphi = tMphi.ref();
2870 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
2874 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2875 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2880 Mphi.primitiveFieldRef() =
Zero;
2883 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2884 M.addBoundarySource(Mphi.primitiveFieldRef());
2886 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2887 Mphi.correctBoundaryConditions();
2892 template<
class Type>
2896 const fvMatrix<Type>&
M,
2897 const tmp<DimensionedField<Type, volMesh>>& tpsi
2900 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2905 template<
class Type>
2909 const fvMatrix<Type>&
M,
2910 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2913 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2918 template<
class Type>
2922 const tmp<fvMatrix<Type>>& tM,
2923 const DimensionedField<Type, volMesh>&
psi 2926 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() &
psi;
2931 template<
class Type>
2935 const tmp<fvMatrix<Type>>& tM,
2936 const tmp<DimensionedField<Type, volMesh>>& tpsi
2939 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2945 template<
class Type>
2949 const tmp<fvMatrix<Type>>& tM,
2950 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2953 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2962 template<
class Type>
2963 Foam::Ostream& Foam::operator<<(Ostream& os, const fvMatrix<Type>& fvm)
2965 os << static_cast<const lduMatrix&>(fvm) <<
nl 2966 << fvm.dimensions_ <<
nl 2967 << fvm.source_ <<
nl 2968 << fvm.internalCoeffs_ <<
nl 2969 << 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.
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
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.
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...
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 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 &)
This boundary condition enforces a cyclic condition between a pair of boundaries. ...
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 tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return tmp field from name, mesh, dimensions and patch type.
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 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.