55 if (addr.
size() != pf.size())
58 <<
"addressing (" << addr.
size()
59 <<
") and field (" << pf.size() <<
") are different sizes" <<
endl
65 intf[addr[facei]] += pf[facei];
79 addToInternalField(addr, tpf(), intf);
93 if (addr.
size() != pf.size())
96 <<
"addressing (" << addr.
size()
97 <<
") and field (" << pf.size() <<
") are different sizes" <<
endl
103 intf[addr[facei]] -= pf[facei];
109 template<
class Type2>
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();
190 const label patchi = globalPatchID(fieldi, ptfi);
200 lduAddr().patchAddr(patchi),
210 const labelUList& addr = lduAddr().patchAddr(patchi);
214 source[addr[facei]] +=
225 template<
template<
class>
class ListType>
229 const ListType<Type>&
values
247 const label celli = cellLabels[i];
248 const Type& value =
values[i];
251 source_[celli] = value*Diag[celli];
253 if (symmetric() || asymmetric())
255 for (
const label facei :
cells[celli])
257 if (
mesh.isInternalFace(facei))
261 if (celli == own[facei])
263 source_[nei[facei]] -=
upper()[facei]*value;
267 source_[own[facei]] -=
upper()[facei]*value;
270 upper()[facei] = 0.0;
274 if (celli == own[facei])
276 source_[nei[facei]] -=
lower()[facei]*value;
280 source_[own[facei]] -=
upper()[facei]*value;
283 upper()[facei] = 0.0;
284 lower()[facei] = 0.0;
289 const label patchi =
mesh.boundaryMesh().whichPatch(facei);
291 if (internalCoeffs_[patchi].size())
293 const label patchFacei =
294 mesh.boundaryMesh()[patchi].whichFace(facei);
296 internalCoeffs_[patchi][patchFacei] =
Zero;
297 boundaryCoeffs_[patchi][patchFacei] =
Zero;
309 const auto& bpsi = this->
psi(fieldI).boundaryField();
314 if (bpsi[patchI].useImplicit())
318 Pout<<
"fvMatrix<Type>::checkImplicit "
319 <<
" fieldi:" << fieldI
320 <<
" field:" << this->
psi(fieldI).name()
322 << this->
psi(fieldI).mesh().name()
323 <<
" patch:" << bpsi[patchI].patch().name()
327 id += (label(2) << patchI);
332 lduAssemblyName_ =
word(
"lduAssembly") +
name(
id);
352 lduAssemblyName_(word::null),
356 internalCoeffs_(
psi.mesh().boundary().size()),
357 boundaryCoeffs_(
psi.mesh().boundary().size()),
358 faceFluxCorrectionPtr_(
nullptr)
361 <<
"Constructing fvMatrix<Type> for field " << psi_.name() <<
endl;
372 psi.mesh().boundary()[patchi].size(),
382 psi.mesh().boundary()[patchi].size(),
388 auto& psiRef = this->
psi(0);
389 label currentStatePsi = psiRef.eventNo();
390 psiRef.boundaryFieldRef().updateCoeffs();
391 psiRef.eventNo() = currentStatePsi;
401 useImplicit_(fvm.useImplicit_),
402 lduAssemblyName_(fvm.lduAssemblyName_),
403 nMatrix_(fvm.nMatrix_),
404 dimensions_(fvm.dimensions_),
405 source_(fvm.source_),
406 internalCoeffs_(fvm.internalCoeffs_),
407 boundaryCoeffs_(fvm.boundaryCoeffs_),
408 faceFluxCorrectionPtr_(nullptr)
411 <<
"Copying fvMatrix<Type> for field " << psi_.name() <<
endl;
413 if (fvm.faceFluxCorrectionPtr_)
415 faceFluxCorrectionPtr_ =
418 *(fvm.faceFluxCorrectionPtr_)
429 const_cast<
fvMatrix<Type>&>(tfvm()),
433 useImplicit_(tfvm().useImplicit_),
434 lduAssemblyName_(tfvm().lduAssemblyName_),
435 nMatrix_(tfvm().nMatrix_),
436 dimensions_(tfvm().dimensions_),
439 const_cast<
fvMatrix<Type>&>(tfvm()).source_,
444 const_cast<
fvMatrix<Type>&>(tfvm()).internalCoeffs_,
449 const_cast<
fvMatrix<Type>&>(tfvm()).boundaryCoeffs_,
452 faceFluxCorrectionPtr_(nullptr)
455 <<
"Copying fvMatrix<Type> for field " << psi_.name() <<
endl;
457 if (tfvm().faceFluxCorrectionPtr_)
461 faceFluxCorrectionPtr_ = tfvm().faceFluxCorrectionPtr_;
462 tfvm().faceFluxCorrectionPtr_ =
nullptr;
466 faceFluxCorrectionPtr_ =
469 *(tfvm().faceFluxCorrectionPtr_)
492 internalCoeffs_(
psi.mesh().boundary().size()),
493 boundaryCoeffs_(
psi.mesh().boundary().size()),
494 faceFluxCorrectionPtr_(
nullptr)
498 <<
"Constructing fvMatrix<Type> for field " << psi_.name() <<
endl;
510 psi.mesh().boundary()[patchi].size(),
520 psi.mesh().boundary()[patchi].size(),
541 <<
"Destroying fvMatrix<Type> for field " << psi_.name() <<
endl;
544 subMatrices_.clear();
557 interfaces.
setSize(internalCoeffs_.size());
558 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
563 forAll (fieldInterfaces, patchi)
565 label globalPatchID = lduMeshPtr()->patchMap()[fieldi][patchi];
567 if (globalPatchID != -1)
569 if (fieldInterfaces.set(patchi))
571 if (isA<cyclicLduInterfaceField>(bpsi[patchi]))
577 refCast<const fvPatch>
579 lduMeshPtr()->interfaces()[globalPatchID]
581 bpsi[patchi].internalField()
584 interfaces.
set(globalPatchID, &newInterfaces.last());
587 else if (isA<cyclicAMILduInterfaceField>(bpsi[patchi]))
593 refCast<const fvPatch>
595 lduMeshPtr()->interfaces()[globalPatchID]
597 bpsi[patchi].internalField()
600 interfaces.
set(globalPatchID, &newInterfaces.last());
602 else if (isA<cyclicACMILduInterfaceField>(bpsi[patchi]))
608 refCast<const fvPatch>
610 lduMeshPtr()->interfaces()[globalPatchID]
612 bpsi[patchi].internalField()
615 interfaces.
set(globalPatchID, &newInterfaces.last());
619 interfaces.
set(globalPatchID, &fieldInterfaces[patchi]);
643 const label globalPtchId = patchMap[patchi];
645 if (globalPtchId != -1)
648 const Field<Type> saveContrib(fluxContrib[globalPtchId]);
649 contrib[patchi].setSize(psi_.boundaryField()[patchi].size()),
658 psi_.boundaryField()[patchi].patchInternalField()
669 psi_.boundaryField()[patchi].patchNeighbourField()
674 else if (globalPtchId == -1)
677 this->
psi(fieldi).mesh().boundaryMesh()[patchi];
687 const Field<Type> saveContrib(fluxContrib[virtualPatch]);
692 coeffs.setSize(psi_.boundaryField()[patchi].size());
693 nbrCoeffs.setSize(psi_.boundaryField()[nbrPatchId].size());
708 forAll(saveContrib, subFaceI)
712 const label nbrFaceId =
715 const label nbrCellId = nbrCellIds[subFaceI];
716 const label
cellId = cellIds[subFaceI];
723 nbrCoeffs[nbrFaceId] +=
731 nbrCoeffs[nbrFaceId] +=
749 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
751 const auto&
psi = this->
psi(fieldi);
758 internalCoeffs_.setSize(interfaceI);
759 boundaryCoeffs_.setSize(interfaceI);
762 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
764 const auto&
psi = this->
psi(fieldi);
773 psi.mesh().boundary()[patchi].size(),
783 psi.mesh().boundary()[patchi].size(),
792 for (label i=0; i < nMatrices(); ++i)
803 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
804 if (globalPatchId == -1)
809 matrix(i).boundaryCoeffs()[patchI].clone()
814 matrix(i).internalCoeffs()[patchI].clone()
823 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
824 if (globalPatchId != -1)
826 if (matrix(i).internalCoeffs().
set(patchI))
831 matrix(i).internalCoeffs()[patchI].clone()
835 if (matrix(i).boundaryCoeffs().
set(patchI))
840 matrix(i).boundaryCoeffs()[patchI].clone()
850 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
851 if (globalPatchId == -1)
853 const label implicitPatchId =
854 lduMeshPtr()->patchLocalToGlobalMap()[i][patchI];
858 implicitPatchId,
internal[implicit].clone()
862 implicitPatchId,
boundary[implicit].clone()
882 for (label i=0; i < nMatrices(); ++i)
886 label globalPatchId = lduMeshPtr()->patchMap()[i][patchI];
888 if (globalPatchId == -1)
906 const labelList& cellMap = lduMeshPtr()->cellOffsets();
908 label newFaces = lduMeshPtr()->lduAddr().upperAddr().size();
909 label newCells = lduMeshPtr()->lduAddr().size();
916 bool asymmetricAssemby =
false;
917 for (label i=0; i < nMatrices(); ++i)
919 if (matrix(i).asymmetric())
921 asymmetricAssemby =
true;
925 for (label i=0; i < nMatrices(); ++i)
927 if (asymmetricAssemby)
932 lowerAssemb[
faceMap[i][facei]] = lowerSub[facei];
942 upperAssemb[
faceMap[i][facei]] = upperSub[facei];
947 const label globalCelli = cellMap[i] + celli;
948 diagAssemb[globalCelli] = diagSub[celli];
949 sourceAssemb[globalCelli] = sourceSub[celli];
953 if (asymmetricAssemby)
956 lower() = lowerAssemb;
959 upper() = upperAssemb;
964 source().setSize(newCells,
Zero);
965 source() = sourceAssemb;
973 psi_.
mesh().
thisDb().objectRegistry::template findObject
976 > (lduAssemblyName_);
987 psi_.mesh().thisDb().objectRegistry::template cfindObject
1003 psi_.mesh().time().timeName(),
1012 uFieldPtr(nMatrices());
1014 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
1016 const fvMesh& meshi = this->
psi(fieldi).mesh();
1020 &
const_cast<fvMesh&
>(meshi)
1022 uFieldPtr.
set(fieldi, &this->
psi(fieldi));
1030 lduAssemMeshPtr->
store();
1031 lduAssemMeshPtr->
update(uFieldPtr);
1034 <<
"Creating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
1038 psi_.mesh().changing() && !psi_.mesh().upToDatePoints(*ptr)
1044 psi_.mesh().setUpToDatePoints(*ptr);
1047 <<
"Updating lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
1052 <<
"Using lduPrimitiveAssembly: " << lduAssemblyName_ <<
endl;
1057 template<
class Type>
1068 template<
class Type>
1075 this->setValuesFromList(cellLabels,
values);
1079 template<
class Type>
1086 this->setValuesFromList(cellLabels,
values);
1090 template<
class Type>
1095 const bool forceReference
1098 if ((forceReference || psi_.needReference()) && celli >= 0)
1100 source()[celli] +=
diag()[celli]*value;
1106 template<
class Type>
1111 const bool forceReference
1114 if (forceReference || psi_.needReference())
1116 forAll(cellLabels, celli)
1118 const label
cellId = cellLabels[celli];
1129 template<
class Type>
1134 const bool forceReference
1137 if (forceReference || psi_.needReference())
1139 forAll(cellLabels, celli)
1141 const label
cellId = cellLabels[celli];
1152 template<
class Type>
1155 subMatrices_.append(matrix.
clone());
1161 <<
"incompatible dimensions for matrix addition "
1163 <<
"[" << dimensions_ <<
" ] "
1168 for (label fieldi = 0; fieldi < nMatrices(); fieldi++)
1170 label
id = checkImplicit(fieldi);
1177 internalCoeffs_.setSize(0);
1178 boundaryCoeffs_.setSize(0);
1182 template<
class Type>
1191 <<
"Relaxing " << psi_.name() <<
" by " <<
alpha <<
endl;
1201 sumMagOffDiag(sumOff);
1204 forAll(psi_.boundaryField(), patchi)
1210 const labelUList& pa = lduAddr().patchAddr(patchi);
1215 const Field<Type>& pCoeffs = boundaryCoeffs_[patchi];
1242 scalar maxNon = 0.0;
1243 scalar sumNon = 0.0;
1246 scalar d = (sumOff[celli] -
D[celli])/
mag(
D[celli]);
1251 maxNon =
max(maxNon, d);
1280 <<
"Matrix dominance test for " << psi_.name() <<
nl
1281 <<
" number of non-dominant cells : " << nNon <<
nl
1282 <<
" maximum relative non-dominance : " << maxNon <<
nl
1283 <<
" average relative non-dominance : " << sumNon <<
nl
1292 D[celli] =
max(
mag(
D[celli]), sumOff[celli]);
1299 forAll(psi_.boundaryField(), patchi)
1305 const labelUList& pa = lduAddr().patchAddr(patchi);
1326 S += (
D - D0)*psi_.primitiveField();
1330 template<
class Type>
1335 psi_.mesh().data::template getOrDefault<bool>
1336 (
"finalIteration",
false)
1339 if (psi_.mesh().relaxEquation(
name))
1341 relax(psi_.mesh().equationRelaxationFactor(
name));
1346 template<
class Type>
1355 bFields[patchi].manipulateMatrix(*
this);
1360 template<
class Type>
1364 addCmptAvBoundaryDiag(tdiag.
ref());
1369 template<
class Type>
1374 forAll(psi_.boundaryField(), patchi)
1378 if (!ptf.
coupled() && ptf.size())
1382 lduAddr().patchAddr(patchi),
1383 internalCoeffs_[patchi],
1393 template<
class Type>
1402 "A("+psi_.name()+
')',
1409 dimensions_/psi_.dimensions()/
dimVol,
1410 extrapolatedCalculatedFvPatchScalarField::typeName
1421 template<
class Type>
1431 "H("+psi_.name()+
')',
1439 extrapolatedCalculatedFvPatchScalarField::typeName
1445 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
1447 scalarField psiCmpt(psi_.primitiveField().component(cmpt));
1450 addBoundaryDiag(boundaryDiagCmpt, cmpt);
1451 boundaryDiagCmpt.negate();
1452 addCmptAvBoundaryDiag(boundaryDiagCmpt);
1463 typename Type::labelType validComponents
1465 psi_.mesh().template validComponents<Type>()
1468 for (
direction cmpt=0; cmpt<Type::nComponents; cmpt++)
1470 if (validComponents[cmpt] == -1)
1484 template<
class Type>
1500 dimensions_/(
dimVol*psi_.dimensions()),
1501 extrapolatedCalculatedFvPatchScalarField::typeName
1508 forAll(psi_.boundaryField(), patchi)
1512 if (ptf.
coupled() && ptf.size())
1516 lduAddr().patchAddr(patchi),
1523 H1_.primitiveFieldRef() /= psi_.mesh().V();
1524 H1_.correctBoundaryConditions();
1531 template<
class Type>
1536 if (!psi_.mesh().fluxRequired(psi_.name()))
1539 <<
"flux requested but " << psi_.name()
1540 <<
" not specified in the fluxRequired sub-dictionary"
1545 if (nMatrices() > 1)
1548 <<
"Flux requested but " << psi_.name()
1549 <<
" can't handle multiple fvMatrix."
1560 "flux("+psi_.name()+
')',
1573 fieldFlux.setOriented();
1575 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
1589 forAll(InternalContrib, patchi)
1591 InternalContrib[patchi] =
1594 InternalContrib[patchi],
1595 psi_.boundaryField()[patchi].patchInternalField()
1603 mapContributions(fieldi, fluxInternalContrib, InternalContrib,
true);
1610 forAll(NeighbourContrib, patchi)
1612 if (psi_.boundaryField()[patchi].coupled())
1614 NeighbourContrib[patchi] =
1617 NeighbourContrib[patchi],
1618 psi_.boundaryField()[patchi].patchNeighbourField()
1627 mapContributions(fieldi, fluxBoundaryContrib, NeighbourContrib,
false);
1635 ffbf[patchi] = InternalContrib[patchi] - NeighbourContrib[patchi];
1639 if (faceFluxCorrectionPtr_)
1641 fieldFlux += *faceFluxCorrectionPtr_;
1648 template<
class Type>
1651 return psi_.mesh().solverDict
1655 psi_.mesh().data::template getOrDefault<bool>
1656 (
"finalIteration",
false)
1664 template<
class Type>
1672 if (&psi_ != &(fvmv.psi_))
1675 <<
"different fields"
1679 dimensions_ = fvmv.dimensions_;
1681 source_ = fvmv.source_;
1682 internalCoeffs_ = fvmv.internalCoeffs_;
1683 boundaryCoeffs_ = fvmv.boundaryCoeffs_;
1685 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1687 *faceFluxCorrectionPtr_ = *fvmv.faceFluxCorrectionPtr_;
1689 else if (fvmv.faceFluxCorrectionPtr_)
1691 faceFluxCorrectionPtr_ =
1693 (*fvmv.faceFluxCorrectionPtr_);
1696 useImplicit_ = fvmv.useImplicit_;
1697 lduAssemblyName_ = fvmv.lduAssemblyName_;
1701 template<
class Type>
1709 template<
class Type>
1714 internalCoeffs_.negate();
1715 boundaryCoeffs_.negate();
1717 if (faceFluxCorrectionPtr_)
1719 faceFluxCorrectionPtr_->negate();
1724 template<
class Type>
1729 dimensions_ += fvmv.dimensions_;
1731 source_ += fvmv.source_;
1732 internalCoeffs_ += fvmv.internalCoeffs_;
1733 boundaryCoeffs_ += fvmv.boundaryCoeffs_;
1735 useImplicit_ = fvmv.useImplicit_;
1736 lduAssemblyName_ = fvmv.lduAssemblyName_;
1737 nMatrix_ = fvmv.nMatrix_;
1739 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1741 *faceFluxCorrectionPtr_ += *fvmv.faceFluxCorrectionPtr_;
1743 else if (fvmv.faceFluxCorrectionPtr_)
1745 faceFluxCorrectionPtr_ =
new
1748 *fvmv.faceFluxCorrectionPtr_
1754 template<
class Type>
1757 operator+=(tfvmv());
1762 template<
class Type>
1767 dimensions_ -= fvmv.dimensions_;
1769 source_ -= fvmv.source_;
1770 internalCoeffs_ -= fvmv.internalCoeffs_;
1771 boundaryCoeffs_ -= fvmv.boundaryCoeffs_;
1773 useImplicit_ = fvmv.useImplicit_;
1774 lduAssemblyName_ = fvmv.lduAssemblyName_;
1775 nMatrix_ = fvmv.nMatrix_;
1777 if (faceFluxCorrectionPtr_ && fvmv.faceFluxCorrectionPtr_)
1779 *faceFluxCorrectionPtr_ -= *fvmv.faceFluxCorrectionPtr_;
1781 else if (fvmv.faceFluxCorrectionPtr_)
1783 faceFluxCorrectionPtr_ =
1785 (-*fvmv.faceFluxCorrectionPtr_);
1790 template<
class Type>
1793 operator-=(tfvmv());
1798 template<
class Type>
1805 source() -= su.mesh().V()*su.field();
1809 template<
class Type>
1820 template<
class Type>
1831 template<
class Type>
1838 source() += su.mesh().V()*su.field();
1842 template<
class Type>
1853 template<
class Type>
1864 template<
class Type>
1870 source() -=
psi().mesh().V()*su;
1874 template<
class Type>
1880 source() +=
psi().mesh().V()*su;
1884 template<
class Type>
1892 template<
class Type>
1900 template<
class Type>
1906 dimensions_ *= dsf.dimensions();
1908 source_ *= dsf.field();
1910 forAll(boundaryCoeffs_, patchi)
1914 dsf.mesh().boundary()[patchi].patchInternalField(dsf.field())
1917 internalCoeffs_[patchi] *= pisf;
1918 boundaryCoeffs_[patchi] *= pisf;
1921 if (faceFluxCorrectionPtr_)
1924 <<
"cannot scale a matrix containing a faceFluxCorrection"
1930 template<
class Type>
1941 template<
class Type>
1952 template<
class Type>
1958 dimensions_ *= ds.dimensions();
1960 source_ *= ds.value();
1961 internalCoeffs_ *= ds.value();
1962 boundaryCoeffs_ *= ds.value();
1964 if (faceFluxCorrectionPtr_)
1966 *faceFluxCorrectionPtr_ *= ds.value();
1973 template<
class Type>
1981 if (&fvm1.
psi() != &fvm2.
psi())
1984 <<
"incompatible fields for operation "
1986 <<
"[" << fvm1.
psi().name() <<
"] "
1988 <<
" [" << fvm2.
psi().name() <<
"]"
1999 <<
"incompatible dimensions for operation "
2009 template<
class Type>
2027 <<
" [" << df.name() << df.
dimensions() <<
" ]"
2033 template<
class Type>
2048 <<
"incompatible dimensions for operation "
2058 template<
class Type>
2061 fvMatrix<Type>& fvm,
2062 const dictionary& solverControls
2065 return fvm.solve(solverControls);
2068 template<
class Type>
2071 const tmp<fvMatrix<Type>>& tfvm,
2072 const dictionary& solverControls
2075 SolverPerformance<Type> solverPerf =
2076 const_cast<fvMatrix<Type>&
>(tfvm()).
solve(solverControls);
2084 template<
class Type>
2090 template<
class Type>
2093 SolverPerformance<Type> solverPerf =
2094 const_cast<fvMatrix<Type>&
>(tfvm()).
solve();
2102 template<
class Type>
2105 const fvMatrix<Type>&
A
2108 tmp<Foam::fvMatrix<Type>> tAcorr =
A - (
A &
A.psi());
2118 template<
class Type>
2121 const tmp<fvMatrix<Type>>& tA
2124 tmp<Foam::fvMatrix<Type>> tAcorr = tA - (tA() & tA().psi());
2136 template<
class Type>
2139 const fvMatrix<Type>&
A,
2140 const fvMatrix<Type>&
B
2147 template<
class Type>
2150 const tmp<fvMatrix<Type>>& tA,
2151 const fvMatrix<Type>&
B
2158 template<
class Type>
2161 const fvMatrix<Type>&
A,
2162 const tmp<fvMatrix<Type>>& tB
2169 template<
class Type>
2172 const tmp<fvMatrix<Type>>& tA,
2173 const tmp<fvMatrix<Type>>& tB
2180 template<
class Type>
2183 const fvMatrix<Type>&
A,
2184 const DimensionedField<Type, volMesh>& su
2188 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2189 tC.ref().source() += su.mesh().V()*su.field();
2193 template<
class Type>
2196 const fvMatrix<Type>&
A,
2197 const tmp<DimensionedField<Type, volMesh>>& tsu
2201 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2202 tC.ref().source() += tsu().mesh().V()*tsu().field();
2207 template<
class Type>
2210 const fvMatrix<Type>&
A,
2211 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2215 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2216 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2221 template<
class Type>
2224 const tmp<fvMatrix<Type>>& tA,
2225 const DimensionedField<Type, volMesh>& su
2229 tmp<fvMatrix<Type>> tC(tA.ptr());
2230 tC.ref().source() += su.mesh().V()*su.field();
2234 template<
class Type>
2237 const tmp<fvMatrix<Type>>& tA,
2238 const tmp<DimensionedField<Type, volMesh>>& tsu
2242 tmp<fvMatrix<Type>> tC(tA.ptr());
2243 tC.ref().source() += tsu().mesh().V()*tsu().field();
2248 template<
class Type>
2251 const tmp<fvMatrix<Type>>& tA,
2252 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2256 tmp<fvMatrix<Type>> tC(tA.ptr());
2257 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2262 template<
class Type>
2265 const fvMatrix<Type>&
A,
2266 const dimensioned<Type>& su
2270 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2271 tC.ref().source() +=
A.psi().mesh().V()*su.value();
2275 template<
class Type>
2278 const tmp<fvMatrix<Type>>& tA,
2279 const dimensioned<Type>& su
2283 tmp<fvMatrix<Type>> tC(tA.ptr());
2284 tC.ref().source() += tC().psi().mesh().V()*su.value();
2288 template<
class Type>
2291 const fvMatrix<Type>&
A,
2299 template<
class Type>
2302 const tmp<fvMatrix<Type>>& tA,
2310 template<
class Type>
2313 const fvMatrix<Type>&
A
2316 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2321 template<
class Type>
2324 const tmp<fvMatrix<Type>>& tA
2327 tmp<fvMatrix<Type>> tC(tA.ptr());
2333 template<
class Type>
2336 const fvMatrix<Type>&
A,
2337 const fvMatrix<Type>&
B
2341 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2346 template<
class Type>
2349 const tmp<fvMatrix<Type>>& tA,
2350 const fvMatrix<Type>&
B
2354 tmp<fvMatrix<Type>> tC(tA.
ptr());
2359 template<
class Type>
2362 const fvMatrix<Type>&
A,
2363 const tmp<fvMatrix<Type>>& tB
2367 tmp<fvMatrix<Type>> tC(tB.ptr());
2372 template<
class Type>
2375 const tmp<fvMatrix<Type>>& tA,
2376 const tmp<fvMatrix<Type>>& tB
2380 tmp<fvMatrix<Type>> tC(tA.
ptr());
2386 template<
class Type>
2389 const fvMatrix<Type>&
A,
2390 const DimensionedField<Type, volMesh>& su
2394 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2395 tC.ref().source() -= su.mesh().V()*su.field();
2399 template<
class Type>
2402 const fvMatrix<Type>&
A,
2403 const tmp<DimensionedField<Type, volMesh>>& tsu
2407 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2408 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2413 template<
class Type>
2416 const fvMatrix<Type>&
A,
2417 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2421 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2422 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2427 template<
class Type>
2430 const tmp<fvMatrix<Type>>& tA,
2431 const DimensionedField<Type, volMesh>& su
2435 tmp<fvMatrix<Type>> tC(tA.
ptr());
2436 tC.ref().source() -= su.mesh().V()*su.field();
2440 template<
class Type>
2443 const tmp<fvMatrix<Type>>& tA,
2444 const tmp<DimensionedField<Type, volMesh>>& tsu
2448 tmp<fvMatrix<Type>> tC(tA.
ptr());
2449 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2454 template<
class Type>
2457 const tmp<fvMatrix<Type>>& tA,
2458 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2462 tmp<fvMatrix<Type>> tC(tA.
ptr());
2463 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2468 template<
class Type>
2471 const DimensionedField<Type, volMesh>& su,
2472 const fvMatrix<Type>&
A
2476 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2477 tC.ref().source() -= su.mesh().V()*su.field();
2481 template<
class Type>
2484 const tmp<DimensionedField<Type, volMesh>>& tsu,
2485 const fvMatrix<Type>&
A
2489 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2490 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2495 template<
class Type>
2498 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2499 const fvMatrix<Type>&
A
2503 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2504 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2509 template<
class Type>
2512 const DimensionedField<Type, volMesh>& su,
2513 const tmp<fvMatrix<Type>>& tA
2517 tmp<fvMatrix<Type>> tC(tA.
ptr());
2518 tC.ref().source() -= su.mesh().V()*su.field();
2522 template<
class Type>
2525 const tmp<DimensionedField<Type, volMesh>>& tsu,
2526 const tmp<fvMatrix<Type>>& tA
2530 tmp<fvMatrix<Type>> tC(tA.
ptr());
2531 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2536 template<
class Type>
2539 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2540 const tmp<fvMatrix<Type>>& tA
2544 tmp<fvMatrix<Type>> tC(tA.
ptr());
2545 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2551 template<
class Type>
2554 const fvMatrix<Type>&
A,
2555 const fvMatrix<Type>&
B
2559 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2564 template<
class Type>
2567 const tmp<fvMatrix<Type>>& tA,
2568 const fvMatrix<Type>&
B
2572 tmp<fvMatrix<Type>> tC(tA.
ptr());
2577 template<
class Type>
2580 const fvMatrix<Type>&
A,
2581 const tmp<fvMatrix<Type>>& tB
2585 tmp<fvMatrix<Type>> tC(tB.ptr());
2591 template<
class Type>
2594 const tmp<fvMatrix<Type>>& tA,
2595 const tmp<fvMatrix<Type>>& tB
2599 tmp<fvMatrix<Type>> tC(tA.
ptr());
2605 template<
class Type>
2608 const fvMatrix<Type>&
A,
2609 const DimensionedField<Type, volMesh>& su
2613 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2614 tC.ref().source() += su.mesh().V()*su.field();
2618 template<
class Type>
2621 const fvMatrix<Type>&
A,
2622 const tmp<DimensionedField<Type, volMesh>>& tsu
2626 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2627 tC.ref().source() += tsu().mesh().V()*tsu().field();
2632 template<
class Type>
2635 const fvMatrix<Type>&
A,
2636 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2640 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2641 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2646 template<
class Type>
2649 const tmp<fvMatrix<Type>>& tA,
2650 const DimensionedField<Type, volMesh>& su
2654 tmp<fvMatrix<Type>> tC(tA.
ptr());
2655 tC.ref().source() += su.mesh().V()*su.field();
2659 template<
class Type>
2662 const tmp<fvMatrix<Type>>& tA,
2663 const tmp<DimensionedField<Type, volMesh>>& tsu
2667 tmp<fvMatrix<Type>> tC(tA.
ptr());
2668 tC.ref().source() += tsu().mesh().V()*tsu().field();
2673 template<
class Type>
2676 const tmp<fvMatrix<Type>>& tA,
2677 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu
2681 tmp<fvMatrix<Type>> tC(tA.
ptr());
2682 tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
2687 template<
class Type>
2690 const DimensionedField<Type, volMesh>& su,
2691 const fvMatrix<Type>&
A
2695 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2697 tC.ref().source() -= su.mesh().V()*su.field();
2701 template<
class Type>
2704 const tmp<DimensionedField<Type, volMesh>>& tsu,
2705 const fvMatrix<Type>&
A
2709 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2711 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2716 template<
class Type>
2719 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2720 const fvMatrix<Type>&
A
2724 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2726 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2731 template<
class Type>
2734 const DimensionedField<Type, volMesh>& su,
2735 const tmp<fvMatrix<Type>>& tA
2739 tmp<fvMatrix<Type>> tC(tA.
ptr());
2741 tC.ref().source() -= su.mesh().V()*su.field();
2745 template<
class Type>
2748 const tmp<DimensionedField<Type, volMesh>>& tsu,
2749 const tmp<fvMatrix<Type>>& tA
2753 tmp<fvMatrix<Type>> tC(tA.
ptr());
2755 tC.ref().source() -= tsu().mesh().V()*tsu().field();
2760 template<
class Type>
2763 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu,
2764 const tmp<fvMatrix<Type>>& tA
2768 tmp<fvMatrix<Type>> tC(tA.
ptr());
2770 tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
2775 template<
class Type>
2778 const fvMatrix<Type>&
A,
2779 const dimensioned<Type>& su
2783 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2784 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2788 template<
class Type>
2791 const tmp<fvMatrix<Type>>& tA,
2792 const dimensioned<Type>& su
2796 tmp<fvMatrix<Type>> tC(tA.
ptr());
2797 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2801 template<
class Type>
2804 const dimensioned<Type>& su,
2805 const fvMatrix<Type>&
A
2809 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2810 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2814 template<
class Type>
2817 const dimensioned<Type>& su,
2818 const tmp<fvMatrix<Type>>& tA
2822 tmp<fvMatrix<Type>> tC(tA.
ptr());
2823 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2827 template<
class Type>
2830 const fvMatrix<Type>&
A,
2831 const dimensioned<Type>& su
2835 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2836 tC.ref().source() += su.value()*tC().psi().mesh().V();
2840 template<
class Type>
2843 const tmp<fvMatrix<Type>>& tA,
2844 const dimensioned<Type>& su
2848 tmp<fvMatrix<Type>> tC(tA.
ptr());
2849 tC.ref().source() += su.value()*tC().psi().mesh().V();
2853 template<
class Type>
2856 const dimensioned<Type>& su,
2857 const fvMatrix<Type>&
A
2861 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2863 tC.ref().source() -= su.value()*
A.psi().mesh().V();
2867 template<
class Type>
2870 const dimensioned<Type>& su,
2871 const tmp<fvMatrix<Type>>& tA
2875 tmp<fvMatrix<Type>> tC(tA.
ptr());
2877 tC.ref().source() -= su.value()*tC().psi().mesh().V();
2882 template<
class Type>
2886 const fvMatrix<Type>&
A
2889 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2894 template<
class Type>
2897 const tmp<volScalarField::Internal>& tdsf,
2898 const fvMatrix<Type>&
A
2901 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2906 template<
class Type>
2909 const tmp<volScalarField>& tvsf,
2910 const fvMatrix<Type>&
A
2913 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2918 template<
class Type>
2922 const tmp<fvMatrix<Type>>& tA
2925 tmp<fvMatrix<Type>> tC(tA.
ptr());
2930 template<
class Type>
2933 const tmp<volScalarField::Internal>& tdsf,
2934 const tmp<fvMatrix<Type>>& tA
2937 tmp<fvMatrix<Type>> tC(tA.
ptr());
2942 template<
class Type>
2945 const tmp<volScalarField>& tvsf,
2946 const tmp<fvMatrix<Type>>& tA
2949 tmp<fvMatrix<Type>> tC(tA.
ptr());
2954 template<
class Type>
2957 const dimensioned<scalar>& ds,
2958 const fvMatrix<Type>&
A
2961 tmp<fvMatrix<Type>> tC(
new fvMatrix<Type>(
A));
2966 template<
class Type>
2969 const dimensioned<scalar>& ds,
2970 const tmp<fvMatrix<Type>>& tA
2973 tmp<fvMatrix<Type>> tC(tA.
ptr());
2979 template<
class Type>
2983 const fvMatrix<Type>&
M,
2984 const DimensionedField<Type, volMesh>&
psi
2987 tmp<GeometricField<Type, fvPatchField, volMesh>> tMphi
2989 new GeometricField<Type, fvPatchField, volMesh>
3001 extrapolatedCalculatedFvPatchScalarField::typeName
3004 GeometricField<Type, fvPatchField, volMesh>& Mphi = tMphi.ref();
3009 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
3013 M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
3014 Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
3019 Mphi.primitiveFieldRef() =
Zero;
3022 Mphi.primitiveFieldRef() +=
M.lduMatrix::H(
psi.field()) +
M.source();
3023 M.addBoundarySource(Mphi.primitiveFieldRef());
3025 Mphi.primitiveFieldRef() /= -
psi.mesh().V();
3031 template<
class Type>
3035 const fvMatrix<Type>&
M,
3036 const tmp<DimensionedField<Type, volMesh>>& tpsi
3039 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
3044 template<
class Type>
3048 const fvMatrix<Type>&
M,
3049 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
3052 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi =
M & tpsi();
3057 template<
class Type>
3061 const tmp<fvMatrix<Type>>& tM,
3062 const DimensionedField<Type, volMesh>&
psi
3065 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() &
psi;
3070 template<
class Type>
3074 const tmp<fvMatrix<Type>>& tM,
3075 const tmp<DimensionedField<Type, volMesh>>& tpsi
3078 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
3084 template<
class Type>
3088 const tmp<fvMatrix<Type>>& tM,
3089 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tpsi
3092 tmp<GeometricField<Type, fvPatchField, volMesh>> tMpsi = tM() & tpsi();
3101 template<
class Type>
3104 os << static_cast<const lduMatrix&>(fvm) <<
nl
3105 << fvm.dimensions_ <<
nl
3106 << fvm.source_ <<
nl
3107 << fvm.internalCoeffs_ <<
nl
3108 << fvm.boundaryCoeffs_ <<
endl;