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(),
937 uFieldPtr(nMatrices());
939 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
945 &const_cast<fvMesh&>(meshi)
947 uFieldPtr.
set(fieldi, &this->
psi(fieldi));
952 lduPrimitiveMeshAssembly* lduAssemMeshPtr =
953 new lduPrimitiveMeshAssembly(
io, uMeshPtr);
955 lduAssemMeshPtr->store();
956 lduAssemMeshPtr->update(uFieldPtr);
959 <<
"Creating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
963 psi_.mesh().changing() && !psi_.mesh().upToDatePoints(*ptr)
969 psi_.mesh().setUpToDatePoints(*ptr);
972 <<
"Updating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
977 <<
"Using lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
1000 this->setValuesFromList(cellLabels,
values);
1004 template<
class Type>
1011 this->setValuesFromList(cellLabels,
values);
1015 template<
class Type>
1020 const bool forceReference
1023 if ((forceReference || psi_.needReference()) && celli >= 0)
1025 source()[celli] +=
diag()[celli]*value;
1031 template<
class Type>
1036 const bool forceReference
1039 if (forceReference || psi_.needReference())
1041 forAll(cellLabels, celli)
1043 const label
cellId = cellLabels[celli];
1054 template<
class Type>
1058 const UList<Type>&
values,
1059 const bool forceReference
1062 if (forceReference || psi_.needReference())
1064 forAll(cellLabels, celli)
1066 const label
cellId = cellLabels[celli];
1077 template<
class Type>
1080 subMatrices_.append(matrix.clone());
1083 if (dimensions_ != matrix.dimensions())
1086 <<
"incompatible dimensions for matrix addition " 1088 <<
"[" << dimensions_ <<
" ] " 1089 <<
" [" << matrix.dimensions() <<
" ]" 1093 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
1095 if (checkImplicit(fieldi))
1101 internalCoeffs_.clear();
1102 boundaryCoeffs_.clear();
1106 template<
class Type>
1115 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
1117 Field<Type>& S = source();
1125 sumMagOffDiag(sumOff);
1128 forAll(psi_.boundaryField(), patchi)
1130 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1134 const labelUList& pa = lduAddr().patchAddr(patchi);
1135 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1139 const Field<Type>& pCoeffs = boundaryCoeffs_[patchi];
1166 scalar maxNon = 0.0;
1167 scalar sumNon = 0.0;
1170 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
1175 maxNon =
max(maxNon, d);
1204 <<
"Matrix dominance test for " << psi_.name() <<
nl 1205 <<
" number of non-dominant cells : " << nNon <<
nl 1206 <<
" maximum relative non-dominance : " << maxNon <<
nl 1207 <<
" average relative non-dominance : " << sumNon <<
nl 1216 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
1223 forAll(psi_.boundaryField(), patchi)
1225 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1229 const labelUList& pa = lduAddr().patchAddr(patchi);
1230 Field<Type>& iCoeffs = internalCoeffs_[patchi];
1243 D[pa[face]] -=
cmptMin(iCoeffs[face]);
1250 S += (
D - D0)*psi_.primitiveField();
1254 template<
class Type>
1259 psi_.mesh().data::template getOrDefault<bool>
1260 (
"finalIteration",
false)
1263 if (psi_.mesh().relaxEquation(
name))
1270 template<
class Type>
1273 typename GeometricField<Type, fvPatchField, volMesh>::
1279 bFields[patchi].manipulateMatrix(*
this);
1284 template<
class Type>
1288 addCmptAvBoundaryDiag(tdiag.ref());
1293 template<
class Type>
1298 forAll(psi_.boundaryField(), patchi)
1306 lduAddr().patchAddr(patchi),
1307 internalCoeffs_[patchi],
1317 template<
class Type>
1320 tmp<volScalarField> tAphi
1326 "A("+psi_.name()+
')',
1333 dimensions_/psi_.dimensions()/
dimVol,
1334 extrapolatedCalculatedFvPatchScalarField::typeName
1338 tAphi.ref().primitiveFieldRef() =
D()/psi_.mesh().V();
1339 tAphi.ref().correctBoundaryConditions();
1345 template<
class Type>
1355 "H("+psi_.name()+
')',
1363 extrapolatedCalculatedFvPatchScalarField::typeName
1369 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
1371 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
1374 addBoundaryDiag(boundaryDiagCmpt, cmpt);
1375 boundaryDiagCmpt.negate();
1376 addCmptAvBoundaryDiag(boundaryDiagCmpt);
1387 typename Type::labelType validComponents
1389 psi_.mesh().template validComponents<Type>()
1392 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
1394 if (validComponents[cmpt] == -1)
1408 template<
class Type>
1411 tmp<volScalarField> tH1
1424 dimensions_/(
dimVol*psi_.dimensions()),
1425 extrapolatedCalculatedFvPatchScalarField::typeName
1432 forAll(psi_.boundaryField(), patchi)
1434 const fvPatchField<Type>& ptf = psi_.boundaryField()[patchi];
1436 if (ptf.coupled() && ptf.size())
1440 lduAddr().patchAddr(patchi),
1447 H1_.primitiveFieldRef() /= psi_.mesh().V();
1448 H1_.correctBoundaryConditions();
1455 template<
class Type>
1460 if (!psi_.mesh().fluxRequired(psi_.name()))
1463 <<
"flux requested but " << psi_.name()
1464 <<
" not specified in the fluxRequired sub-dictionary" 1469 if (nMatrices() > 1)
1472 <<
"Flux requested but " << psi_.name()
1473 <<
" can't handle multiple fvMatrix." 1478 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfieldFlux
1480 new GeometricField<Type, fvsPatchField, surfaceMesh>
1484 "flux("+psi_.name()+
')',
1494 GeometricField<Type, fvsPatchField, surfaceMesh>& fieldFlux =
1497 fieldFlux.setOriented();
1499 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
1501 fieldFlux.primitiveFieldRef().replace
1508 FieldField<Field, Type> InternalContrib = internalCoeffs_;
1513 forAll(InternalContrib, patchi)
1515 InternalContrib[patchi] =
1518 InternalContrib[patchi],
1519 psi_.boundaryField()[patchi].patchInternalField()
1525 FieldField<Field, Type> fluxInternalContrib(internalCoeffs_);
1527 mapContributions(fieldi, fluxInternalContrib, InternalContrib,
true);
1530 FieldField<Field, Type> NeighbourContrib = boundaryCoeffs_;
1534 forAll(NeighbourContrib, patchi)
1536 if (psi_.boundaryField()[patchi].coupled())
1538 NeighbourContrib[patchi] =
1541 NeighbourContrib[patchi],
1542 psi_.boundaryField()[patchi].patchNeighbourField()
1549 FieldField<Field, Type> fluxBoundaryContrib(boundaryCoeffs_);
1551 mapContributions(fieldi, fluxBoundaryContrib, NeighbourContrib,
false);
1554 typename GeometricField<Type, fvsPatchField, surfaceMesh>::
1555 Boundary& ffbf = fieldFlux.boundaryFieldRef();
1559 ffbf[patchi] = InternalContrib[patchi] - NeighbourContrib[patchi];
1563 if (faceFluxCorrectionPtr_)
1565 fieldFlux += *faceFluxCorrectionPtr_;
1572 template<
class Type>
1575 return psi_.mesh().solverDict
1579 psi_.mesh().data::template getOrDefault<bool>
1580 (
"finalIteration",
false)
1588 template<
class Type>
1596 if (&psi_ != &(fvmv.psi_))
1599 <<
"different fields" 1603 dimensions_ = fvmv.dimensions_;
1605 source_ = fvmv.source_;
1606 internalCoeffs_ = fvmv.internalCoeffs_;
1607 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1609 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1611 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1613 else if (fvmv.faceFluxCorrectionPtr_)
1615 faceFluxCorrectionPtr_ =
1616 new GeometricField<Type, fvsPatchField, surfaceMesh>
1617 (*fvmv.faceFluxCorrectionPtr_);
1620 useImplicit_ = fvmv.useImplicit_;
1621 lduAssemblyName_ = fvmv.lduAssemblyName_;
1625 template<
class Type>
1633 template<
class Type>
1638 internalCoeffs_.negate();
1639 boundaryCoeffs_.negate();
1641 if (faceFluxCorrectionPtr_)
1643 faceFluxCorrectionPtr_->negate();
1648 template<
class Type>
1653 dimensions_ += fvmv.dimensions_;
1655 source_ += fvmv.source_;
1656 internalCoeffs_ += fvmv.internalCoeffs_;
1657 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1659 useImplicit_ = fvmv.useImplicit_;
1660 lduAssemblyName_ = fvmv.lduAssemblyName_;
1661 nMatrix_ = fvmv.nMatrix_;
1663 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1665 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1667 else if (fvmv.faceFluxCorrectionPtr_)
1669 faceFluxCorrectionPtr_ =
new 1670 GeometricField<Type, fvsPatchField, surfaceMesh>
1672 *fvmv.faceFluxCorrectionPtr_
1678 template<
class Type>
1681 operator+=(tfvmv());
1686 template<
class Type>
1691 dimensions_ -= fvmv.dimensions_;
1693 source_ -= fvmv.source_;
1694 internalCoeffs_ -= fvmv.internalCoeffs_;
1695 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1697 useImplicit_ = fvmv.useImplicit_;
1698 lduAssemblyName_ = fvmv.lduAssemblyName_;
1699 nMatrix_ = fvmv.nMatrix_;
1701 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1703 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1705 else if (fvmv.faceFluxCorrectionPtr_)
1707 faceFluxCorrectionPtr_ =
1709 (-*fvmv.faceFluxCorrectionPtr_);
1714 template<
class Type>
1717 operator-=(tfvmv());
1722 template<
class Type>
1729 source() -= su.mesh().V()*su.field();
1733 template<
class Type>
1744 template<
class Type>
1755 template<
class Type>
1762 source() += su.mesh().V()*su.field();
1766 template<
class Type>
1777 template<
class Type>
1788 template<
class Type>
1794 source() -=
psi().
mesh().V()*su;
1798 template<
class Type>
1804 source() +=
psi().
mesh().V()*su;
1808 template<
class Type>
1813 template<
class Type>
1818 template<
class Type>
1824 dimensions_ *= dsf.dimensions();
1826 source_ *= dsf.field();
1828 forAll(boundaryCoeffs_, patchi)
1832 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1835 internalCoeffs_[patchi] *= pisf;
1836 boundaryCoeffs_[patchi] *= pisf;
1839 if (faceFluxCorrectionPtr_)
1842 <<
"cannot scale a matrix containing a faceFluxCorrection" 1848 template<
class Type>
1851 const tmp<volScalarField::Internal>& tfld
1859 template<
class Type>
1870 template<
class Type>
1876 dimensions_ *= ds.dimensions();
1878 source_ *= ds.value();
1879 internalCoeffs_ *= ds.value();
1880 boundaryCoeffs_ *= ds.value();
1882 if (faceFluxCorrectionPtr_)
1884 *faceFluxCorrectionPtr_ *= ds.value();
1891 template<
class Type>
1894 const fvMatrix<Type>& mat1,
1895 const fvMatrix<Type>& mat2,
1899 if (&mat1.psi() != &mat2.psi())
1902 <<
"Incompatible fields for operation\n " 1903 <<
"[" << mat1.psi().name() <<
"] " 1905 <<
" [" << mat2.psi().name() <<
"]" 1912 && mat1.dimensions() != mat2.dimensions()
1916 <<
"Incompatible dimensions for operation\n " 1917 <<
"[" << mat1.psi().name() << mat1.dimensions()/
dimVolume <<
" ] " 1919 <<
" [" << mat2.psi().name() << mat2.dimensions()/
dimVolume <<
" ]" 1925 template<
class Type>
1928 const fvMatrix<Type>& mat,
1929 const DimensionedField<Type, volMesh>&
fld,
1940 <<
"Incompatible dimensions for operation\n " 1941 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1943 <<
" [" <<
fld.name() <<
fld.dimensions() <<
" ]" 1949 template<
class Type>
1952 const fvMatrix<Type>& mat,
1953 const dimensioned<Type>& dt,
1960 && mat.dimensions()/
dimVolume != dt.dimensions()
1964 <<
"Incompatible dimensions for operation\n " 1965 <<
"[" << mat.psi().name() << mat.dimensions()/
dimVolume <<
" ] " 1967 <<
" [" << dt.name() << dt.dimensions() <<
" ]" 1973 template<
class Type>
1976 fvMatrix<Type>& fvm,
1977 const dictionary& solverControls
1980 return fvm.solve(solverControls);
1983 template<
class Type>
1986 const tmp<fvMatrix<Type>>& tmat,
1987 const dictionary& solverControls
1990 SolverPerformance<Type> solverPerf(tmat.constCast().solve(solverControls));
1998 template<
class Type>
2004 template<
class Type>
2007 SolverPerformance<Type> solverPerf(tmat.constCast().solve());
2015 template<
class Type>
2018 const fvMatrix<Type>&
A 2021 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
2031 template<
class Type>
2034 const tmp<fvMatrix<Type>>& tA
2037 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
2049 template<
class Type>
2052 const fvMatrix<Type>&
A,
2053 const fvMatrix<Type>&
B 2060 template<
class Type>
2063 const tmp<fvMatrix<Type>>& tA,
2064 const fvMatrix<Type>&
B 2071 template<
class Type>
2074 const fvMatrix<Type>&
A,
2075 const tmp<fvMatrix<Type>>& tB
2082 template<
class Type>
2085 const tmp<fvMatrix<Type>>& tA,
2086 const tmp<fvMatrix<Type>>& tB
2093 template<
class Type>
2096 const fvMatrix<Type>&
A,
2097 const DimensionedField<Type, volMesh>& su
2101 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2102 tC.ref().source() += su.mesh().V()*su.field();
2106 template<
class Type>
2109 const fvMatrix<Type>&
A,
2110 const tmp<DimensionedField<Type, volMesh>>& tsu
2114 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2115 tC.ref().source() += tsu().mesh().V()*tsu().field();
2120 template<
class Type>
2123 const fvMatrix<Type>&
A,
2124 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2128 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2129 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2134 template<
class Type>
2137 const tmp<fvMatrix<Type>>& tA,
2138 const DimensionedField<Type, volMesh>& su
2142 tmp<fvMatrix<Type>> tC(tA.ptr());
2143 tC.ref().source() += su.mesh().V()*su.field();
2147 template<
class Type>
2150 const tmp<fvMatrix<Type>>& tA,
2151 const tmp<DimensionedField<Type, volMesh>>& tsu
2155 tmp<fvMatrix<Type>> tC(tA.ptr());
2156 tC.ref().source() += tsu().mesh().V()*tsu().field();
2161 template<
class Type>
2164 const tmp<fvMatrix<Type>>& tA,
2165 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2169 tmp<fvMatrix<Type>> tC(tA.ptr());
2170 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2175 template<
class Type>
2178 const fvMatrix<Type>&
A,
2179 const dimensioned<Type>& su
2183 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2184 tC.ref().source() +=
A.psi().mesh().V()*su.value();
2188 template<
class Type>
2191 const tmp<fvMatrix<Type>>& tA,
2192 const dimensioned<Type>& su
2196 tmp<fvMatrix<Type>> tC(tA.ptr());
2197 tC.ref().source() += tC().psi().mesh().V()*su.value();
2201 template<
class Type>
2204 const fvMatrix<Type>&
A,
2212 template<
class Type>
2215 const tmp<fvMatrix<Type>>& tA,
2223 template<
class Type>
2226 const fvMatrix<Type>&
A 2229 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2234 template<
class Type>
2237 const tmp<fvMatrix<Type>>& tA
2240 tmp<fvMatrix<Type>> tC(tA.ptr());
2246 template<
class Type>
2249 const fvMatrix<Type>&
A,
2250 const fvMatrix<Type>&
B 2254 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2259 template<
class Type>
2262 const tmp<fvMatrix<Type>>& tA,
2263 const fvMatrix<Type>&
B 2267 tmp<fvMatrix<Type>> tC(tA.
ptr());
2272 template<
class Type>
2275 const fvMatrix<Type>&
A,
2276 const tmp<fvMatrix<Type>>& tB
2280 tmp<fvMatrix<Type>> tC(tB.ptr());
2285 template<
class Type>
2288 const tmp<fvMatrix<Type>>& tA,
2289 const tmp<fvMatrix<Type>>& tB
2293 tmp<fvMatrix<Type>> tC(tA.
ptr());
2299 template<
class Type>
2302 const fvMatrix<Type>&
A,
2303 const DimensionedField<Type, volMesh>& su
2307 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2308 tC.ref().source() -= su.mesh().V()*su.field();
2312 template<
class Type>
2315 const fvMatrix<Type>&
A,
2316 const tmp<DimensionedField<Type, volMesh>>& tsu
2320 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2321 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2326 template<
class Type>
2329 const fvMatrix<Type>&
A,
2330 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2334 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2335 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2340 template<
class Type>
2343 const tmp<fvMatrix<Type>>& tA,
2344 const DimensionedField<Type, volMesh>& su
2348 tmp<fvMatrix<Type>> tC(tA.
ptr());
2349 tC.ref().source() -= su.mesh().V()*su.field();
2353 template<
class Type>
2356 const tmp<fvMatrix<Type>>& tA,
2357 const tmp<DimensionedField<Type, volMesh>>& tsu
2361 tmp<fvMatrix<Type>> tC(tA.
ptr());
2362 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2367 template<
class Type>
2370 const tmp<fvMatrix<Type>>& tA,
2371 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2375 tmp<fvMatrix<Type>> tC(tA.
ptr());
2376 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2381 template<
class Type>
2384 const DimensionedField<Type, volMesh>& su,
2385 const fvMatrix<Type>&
A 2389 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2390 tC.ref().source() -= su.mesh().V()*su.field();
2394 template<
class Type>
2397 const tmp<DimensionedField<Type, volMesh>>& tsu,
2398 const fvMatrix<Type>&
A 2402 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2403 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2408 template<
class Type>
2411 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2412 const fvMatrix<Type>&
A 2416 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2417 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2422 template<
class Type>
2425 const DimensionedField<Type, volMesh>& su,
2426 const tmp<fvMatrix<Type>>& tA
2430 tmp<fvMatrix<Type>> tC(tA.
ptr());
2431 tC.ref().source() -= su.mesh().V()*su.field();
2435 template<
class Type>
2438 const tmp<DimensionedField<Type, volMesh>>& tsu,
2439 const tmp<fvMatrix<Type>>& tA
2443 tmp<fvMatrix<Type>> tC(tA.
ptr());
2444 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2449 template<
class Type>
2452 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2453 const tmp<fvMatrix<Type>>& tA
2457 tmp<fvMatrix<Type>> tC(tA.
ptr());
2458 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2464 template<
class Type>
2467 const fvMatrix<Type>&
A,
2468 const fvMatrix<Type>&
B 2472 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2477 template<
class Type>
2480 const tmp<fvMatrix<Type>>& tA,
2481 const fvMatrix<Type>&
B 2485 tmp<fvMatrix<Type>> tC(tA.
ptr());
2490 template<
class Type>
2493 const fvMatrix<Type>&
A,
2494 const tmp<fvMatrix<Type>>& tB
2498 tmp<fvMatrix<Type>> tC(tB.ptr());
2504 template<
class Type>
2507 const tmp<fvMatrix<Type>>& tA,
2508 const tmp<fvMatrix<Type>>& tB
2512 tmp<fvMatrix<Type>> tC(tA.
ptr());
2518 template<
class Type>
2521 const fvMatrix<Type>&
A,
2522 const DimensionedField<Type, volMesh>& su
2526 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2527 tC.ref().source() += su.mesh().V()*su.field();
2531 template<
class Type>
2534 const fvMatrix<Type>&
A,
2535 const tmp<DimensionedField<Type, volMesh>>& tsu
2539 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2540 tC.ref().source() += tsu().mesh().V()*tsu().field();
2545 template<
class Type>
2548 const fvMatrix<Type>&
A,
2549 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2553 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2554 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2559 template<
class Type>
2562 const tmp<fvMatrix<Type>>& tA,
2563 const DimensionedField<Type, volMesh>& su
2567 tmp<fvMatrix<Type>> tC(tA.
ptr());
2568 tC.ref().source() += su.mesh().V()*su.field();
2572 template<
class Type>
2575 const tmp<fvMatrix<Type>>& tA,
2576 const tmp<DimensionedField<Type, volMesh>>& tsu
2580 tmp<fvMatrix<Type>> tC(tA.
ptr());
2581 tC.ref().source() += tsu().mesh().V()*tsu().field();
2586 template<
class Type>
2589 const tmp<fvMatrix<Type>>& tA,
2590 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2594 tmp<fvMatrix<Type>> tC(tA.
ptr());
2595 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2600 template<
class Type>
2603 const DimensionedField<Type, volMesh>& su,
2604 const fvMatrix<Type>&
A 2608 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2610 tC.ref().source() -= su.mesh().V()*su.field();
2614 template<
class Type>
2617 const tmp<DimensionedField<Type, volMesh>>& tsu,
2618 const fvMatrix<Type>&
A 2622 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2624 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2629 template<
class Type>
2632 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2633 const fvMatrix<Type>&
A 2637 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2639 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2644 template<
class Type>
2647 const DimensionedField<Type, volMesh>& su,
2648 const tmp<fvMatrix<Type>>& tA
2652 tmp<fvMatrix<Type>> tC(tA.
ptr());
2654 tC.ref().source() -= su.mesh().V()*su.field();
2658 template<
class Type>
2661 const tmp<DimensionedField<Type, volMesh>>& tsu,
2662 const tmp<fvMatrix<Type>>& tA
2666 tmp<fvMatrix<Type>> tC(tA.
ptr());
2668 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2673 template<
class Type>
2676 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2677 const tmp<fvMatrix<Type>>& tA
2681 tmp<fvMatrix<Type>> tC(tA.
ptr());
2683 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2688 template<
class Type>
2691 const fvMatrix<Type>&
A,
2692 const dimensioned<Type>& su
2696 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2697 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2701 template<
class Type>
2704 const tmp<fvMatrix<Type>>& tA,
2705 const dimensioned<Type>& su
2709 tmp<fvMatrix<Type>> tC(tA.
ptr());
2710 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2714 template<
class Type>
2717 const dimensioned<Type>& su,
2718 const fvMatrix<Type>&
A 2722 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2723 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2727 template<
class Type>
2730 const dimensioned<Type>& su,
2731 const tmp<fvMatrix<Type>>& tA
2735 tmp<fvMatrix<Type>> tC(tA.
ptr());
2736 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2740 template<
class Type>
2743 const fvMatrix<Type>&
A,
2744 const dimensioned<Type>& su
2748 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2749 tC.ref().source() += su.value()*tC().psi().mesh().V();
2753 template<
class Type>
2756 const tmp<fvMatrix<Type>>& tA,
2757 const dimensioned<Type>& su
2761 tmp<fvMatrix<Type>> tC(tA.
ptr());
2762 tC.ref().source() += su.value()*tC().psi().mesh().V();
2766 template<
class Type>
2769 const dimensioned<Type>& su,
2770 const fvMatrix<Type>&
A 2774 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2776 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2780 template<
class Type>
2783 const dimensioned<Type>& su,
2784 const tmp<fvMatrix<Type>>& tA
2788 tmp<fvMatrix<Type>> tC(tA.
ptr());
2790 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2795 template<
class Type>
2799 const fvMatrix<Type>&
A 2802 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2807 template<
class Type>
2810 const tmp<volScalarField::Internal>& tdsf,
2811 const fvMatrix<Type>&
A 2814 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2819 template<
class Type>
2822 const tmp<volScalarField>& tvsf,
2823 const fvMatrix<Type>&
A 2826 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2831 template<
class Type>
2835 const tmp<fvMatrix<Type>>& tA
2838 tmp<fvMatrix<Type>> tC(tA.
ptr());
2843 template<
class Type>
2846 const tmp<volScalarField::Internal>& tdsf,
2847 const tmp<fvMatrix<Type>>& tA
2850 tmp<fvMatrix<Type>> tC(tA.
ptr());
2855 template<
class Type>
2858 const tmp<volScalarField>& tvsf,
2859 const tmp<fvMatrix<Type>>& tA
2862 tmp<fvMatrix<Type>> tC(tA.
ptr());
2867 template<
class Type>
2870 const dimensioned<scalar>& ds,
2871 const fvMatrix<Type>&
A 2874 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2879 template<
class Type>
2882 const dimensioned<scalar>& ds,
2883 const tmp<fvMatrix<Type>>& tA
2886 tmp<fvMatrix<Type>> tC(tA.
ptr());
2892 template<
class Type>
2896 const fvMatrix<Type>&
M,
2897 const DimensionedField<Type, volMesh>&
psi 2900 tmp<GeometricField<Type, fvPatchField, volMesh>> tMphi
2902 new GeometricField<Type, fvPatchField, volMesh>
2914 extrapolatedCalculatedFvPatchScalarField::typeName
2917 GeometricField<Type, fvPatchField, volMesh>& Mphi = tMphi.ref();
2922 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
2926 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
2927 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
2932 Mphi.primitiveFieldRef() =
Zero;
2935 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.
field()) +
M.source();
2936 M.addBoundarySource(Mphi.primitiveFieldRef());
2938 Mphi.primitiveFieldRef() /= -
psi.
mesh().V();
2939 Mphi.correctBoundaryConditions();
2944 template<
class Type>
2948 const fvMatrix<Type>&
M,
2949 const tmp<DimensionedField<Type, volMesh>>& tpsi
2952 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2957 template<
class Type>
2961 const fvMatrix<Type>&
M,
2962 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
2965 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
2970 template<
class Type>
2974 const tmp<fvMatrix<Type>>& tM,
2975 const DimensionedField<Type, volMesh>&
psi 2978 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() &
psi;
2983 template<
class Type>
2987 const tmp<fvMatrix<Type>>& tM,
2988 const tmp<DimensionedField<Type, volMesh>>& tpsi
2991 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
2997 template<
class Type>
3001 const tmp<fvMatrix<Type>>& tM,
3002 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
3005 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
3014 template<
class Type>
3015 Foam::Ostream& Foam::operator<<(Ostream& os, const fvMatrix<Type>& fvm)
3017 os << static_cast<const lduMatrix&>(fvm) <<
nl 3018 << fvm.dimensions_ <<
nl 3019 << fvm.source_ <<
nl 3020 << fvm.internalCoeffs_ <<
nl 3021 << 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...
List< labelList > labelListList
A List of labelList.
tmp< Field< Type > > faceH(const Field< Type > &) const
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.
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.
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)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
tmp< scalarField > D() const
Return the matrix scalar diagonal.
void operator=(const fvMatrix< Type > &)
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
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.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
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.
virtual bool coupled() const
True if this patch field is coupled.
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.
const fileName & instance() const noexcept
Read access to instance path component.
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)
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void addBoundarySource(Field< Type > &source, const bool couples=true) const
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
const volScalarField & psi
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
void boundaryManipulate(typename GeometricField< Type, fvPatchField, volMesh >::Boundary &values)
Manipulate based on a boundary field.
tmp< Field< Type > > H(const Field< Type > &) const
const dimensionedScalar & D
void operator-=(const lduMatrix &)
void operator+=(const lduMatrix &)
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
List< label > labelList
A List of labels.
void clearOut()
Clear additional addressing.
A class for managing temporary objects.
void setSize(const label n)
Alias for resize()
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
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...
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.
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
List< cell > cellList
A List of cells.
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
const dimensionSet & dimensions() const noexcept
Return dimensions.
const dictionary & solverDict() const
Return the solver dictionary taking into account finalIteration.
#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.