45 template<
class Type,
class ResultType,
class CellToFaceOp>
50 const CellToFaceOp& cop,
56 const auto& Sf =
mesh.Sf();
57 const auto& P =
mesh.owner();
58 const auto&
N =
mesh.neighbour();
59 const auto&
pbm =
mesh.boundaryMesh();
69 const label oldSize = vf.
constCast().boundaryEvaluate
75 pfld.patchNeighbourField(slice);
76 isCoupled.set(pfld.patch().index());
92 const auto& Sfi = Sf.primitiveField();
99 const label nCells =
mesh.nCells();
100 const label nIntFaces =
mesh.nInternalFaces();
102 for (label celli = 0; celli < nCells; celli++)
104 const auto& cFaces =
cells[celli];
105 auto& res = sfi[celli];
107 for (
const label facei : cFaces)
109 if (facei < nIntFaces)
121 if (P[facei] != celli)
125 sfi[celli] += faceVal;
129 const label patchi =
patchID[facei-nIntFaces];
130 const label patchFacei = facei-
pbm[patchi].start();
131 const label offset = nCells+
pbm[patchi].offset();
132 const auto& pSf = Sf.boundaryField()[patchi];
135 if (isCoupled(patchi))
138 const ResultType faceVal
145 vfi[offset+patchFacei]
148 sfi[celli] += faceVal;
153 const ResultType faceVal
159 vfi[offset+patchFacei],
163 sfi[celli] += faceVal;
171 for (label facei=0; facei<P.size(); facei++)
173 const label ownCelli = P[facei];
174 const label neiCelli =
N[facei];
176 const ResultType faceVal
186 sfi[ownCelli] += faceVal;
187 sfi[neiCelli] -= faceVal;
193 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
194 const label offset =
mesh.nCells()+
pbm[patchi].offset();
195 const auto& pSf = Sf.boundaryField()[patchi];
198 if (isCoupled(patchi))
203 for (label facei=0; facei<pFaceCells.size(); facei++)
206 const ResultType faceVal
212 vfi[pFaceCells[facei]],
217 sfi[pFaceCells[facei]] += faceVal;
222 for (label facei=0; facei<pFaceCells.size(); facei++)
225 const ResultType faceVal
235 sfi[pFaceCells[facei]] += faceVal;
252 template<
class Type,
class FType,
class ResultType,
class CellToFaceOp>
258 const CellToFaceOp& cop,
264 const auto& Sf =
mesh.Sf();
265 const auto& P =
mesh.owner();
266 const auto&
N =
mesh.neighbour();
275 const auto& Sfi = Sf.primitiveField();
279 for (label facei=0; facei<P.size(); facei++)
281 const label ownCelli = P[facei];
282 const label neiCelli =
N[facei];
284 const ResultType faceVal
296 sfi[ownCelli] += faceVal;
297 sfi[neiCelli] -= faceVal;
305 const label oldSize = vf.
constCast().boundaryEvaluate
307 [](
const auto& pfld, UList<Type>& slice)
311 pfld.patchNeighbourField(slice);
318 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
319 const auto& pSf = Sf.boundaryField()[patchi];
329 const label offset =
mesh.nCells()+pvf.patch().offset();
331 for (label facei=0; facei<pFaceCells.size(); facei++)
334 const ResultType faceVal
340 vfi[pFaceCells[facei]],
346 sfi[pFaceCells[facei]] += faceVal;
351 for (label facei=0; facei<pFaceCells.size(); facei++)
354 const ResultType faceVal
366 sfi[pFaceCells[facei]] += faceVal;
398 const CellToFaceOp& cop,
404 const auto& Sf =
mesh.Sf();
405 const auto& P =
mesh.owner();
406 const auto&
N =
mesh.neighbour();
415 const auto& Sfi = Sf.primitiveField();
420 for (label facei=0; facei<P.size(); facei++)
422 const label ownCelli = P[facei];
423 const label neiCelli =
N[facei];
425 const ResultType faceVal
439 resulti[ownCelli] += faceVal;
440 resulti[neiCelli] -= faceVal;
448 const label oldSize = vf.
constCast().boundaryEvaluate
454 pfld.patchNeighbourField(slice);
461 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
462 const auto& pSf = Sf.boundaryField()[patchi];
473 const label offset =
mesh.nCells()+pvf.patch().offset();
475 for (label facei=0; facei<pFaceCells.size(); facei++)
478 const ResultType faceVal
485 vfi[pFaceCells[facei]],
494 resulti[pFaceCells[facei]] += faceVal;
499 for (label facei=0; facei<pFaceCells.size(); facei++)
502 const ResultType faceVal
516 resulti[pFaceCells[facei]] += faceVal;
532 template<
class Type,
class ResultType,
class CombineOp>
537 const CombineOp& cop,
553 template<
class Type,
class ResultType,
class CombineOp>
559 const CombineOp& cop,
564 const auto& Sf =
mesh.Sf();
565 const auto& P =
mesh.owner();
566 const auto&
N =
mesh.neighbour();
573 const auto& Sfi = Sf.primitiveField();
575 for (label facei=0; facei<P.size(); facei++)
577 const label ownCelli = P[facei];
578 const label neiCelli =
N[facei];
589 sfi[ownCelli] += ownLs[facei]*faceVal;
590 sfi[neiCelli] -= neiLs[facei]*faceVal;
598 const label oldSize = vf.
constCast().boundaryEvaluate
600 [](
const auto& pfld, UList<Type>& slice)
604 pfld.patchNeighbourField(slice);
611 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
612 const auto& pSf = Sf.boundaryField()[patchi];
621 const label offset =
mesh.nCells()+pvf.patch().offset();
623 for (label facei=0; facei<pFaceCells.size(); facei++)
630 vfi[pFaceCells[facei]],
635 sfi[pFaceCells[facei]] += pOwnLs[facei]*faceVal;
640 for (label facei=0; facei<pFaceCells.size(); facei++)
647 vfi[pFaceCells[facei]],
651 sfi[pFaceCells[facei]] += pOwnLs[facei]*faceVal;
664 template<
class Type,
class ResultType,
class CellToFaceOp>
670 const CellToFaceOp& cop,
677 const auto& Sf =
mesh.Sf();
678 const auto& P =
mesh.owner();
679 const auto&
N =
mesh.neighbour();
686 const auto& Sfi = Sf.primitiveField();
689 for (label facei=0; facei<P.size(); facei++)
691 const label ownCelli = P[facei];
692 const label neiCelli =
N[facei];
694 const ResultType faceVal
704 sfi[ownCelli] += faceVal;
705 sfi[neiCelli] -= faceVal;
712 const label oldSize = vf.
constCast().boundaryEvaluate
714 [](
const auto& pfld, UList<Type>& slice)
718 pfld.patchNeighbourField(slice);
733 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
734 const auto& pSf = Sf.boundaryField()[patchi];
738 const label offset =
mesh.nCells()+pvf.patch().offset();
745 for (label facei=0; facei<pFaceCells.size(); facei++)
747 const label ownCelli = pFaceCells[facei];
750 const ResultType faceVal
761 sfi[ownCelli] += faceVal;
769 for (label facei=0; facei<pFaceCells.size(); facei++)
771 const label ownCelli = pFaceCells[facei];
774 const ResultType faceVal
785 sfi[ownCelli] += faceVal;
801 template<
class Type,
class ResultType,
class CellToFaceOp>
808 const CellToFaceOp& cop,
815 const auto& Sf =
mesh.Sf();
816 const auto& P =
mesh.owner();
817 const auto&
N =
mesh.neighbour();
824 const auto& Sfi = Sf.primitiveField();
828 for (label facei=0; facei<P.size(); facei++)
830 const label ownCelli = P[facei];
831 const label neiCelli =
N[facei];
833 const ResultType faceVal
844 sfi[ownCelli] += faceVal;
845 sfi[neiCelli] -= faceVal;
853 const label oldSize = vf.
constCast().boundaryEvaluate
855 [](
const auto& pfld, UList<Type>& slice)
859 pfld.patchNeighbourField(slice);
874 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
875 const auto& pSf = Sf.boundaryField()[patchi];
880 const label offset =
mesh.nCells()+pvf.patch().offset();
887 for (label facei=0; facei<pFaceCells.size(); facei++)
889 const label ownCelli = pFaceCells[facei];
892 const ResultType faceVal
904 sfi[ownCelli] += faceVal;
912 for (label facei=0; facei<pFaceCells.size(); facei++)
914 const label ownCelli = pFaceCells[facei];
917 const ResultType faceVal
929 sfi[ownCelli] += faceVal;
945 template<
class Type,
class GType,
class ResultType,
class CellToFaceOp>
954 const CellToFaceOp& cop,
961 const auto& Sf =
mesh.Sf();
962 const auto& P =
mesh.owner();
963 const auto&
N =
mesh.neighbour();
965 const auto& gammai =
gamma.primitiveField();
971 const auto& Sfi = Sf.primitiveField();
975 for (label facei=0; facei<P.size(); facei++)
977 const label ownCelli = P[facei];
978 const label neiCelli =
N[facei];
980 const ResultType faceVal
995 sfi[ownCelli] += faceVal;
996 sfi[neiCelli] -= faceVal;
1004 const label oldSize = vf.
constCast().boundaryEvaluate
1006 [](
const auto& pfld, UList<Type>& slice)
1010 pfld.patchNeighbourField(slice);
1023 (void)
gamma.constCast().boundaryEvaluate
1025 [](
const auto& pfld, UList<GType>& slice)
1029 pfld.patchNeighbourField(slice);
1036 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1037 const auto& pSf = Sf.boundaryField()[patchi];
1040 const auto& pweights = gammaWeights.
boundaryField()[patchi];
1041 const auto& pgamma =
gamma.boundaryField()[patchi];
1043 const label offset =
mesh.nCells()+pvf.patch().offset();
1052 for (label facei=0; facei<pFaceCells.size(); facei++)
1054 const label ownCelli = pFaceCells[facei];
1057 const ResultType faceVal
1066 gammai[offset+facei],
1074 sfi[ownCelli] += faceVal;
1082 for (label facei=0; facei<pFaceCells.size(); facei++)
1084 const label ownCelli = pFaceCells[facei];
1087 const ResultType faceVal
1095 pTraits<GType>::zero,
1099 pTraits<Type>::zero,
1104 sfi[ownCelli] += faceVal;
1111 gamma.constCast().resize(oldSize);
1121 template<
class Type,
class GType,
class ResultType,
class CellToFaceOp>
1132 const CellToFaceOp& cop,
1139 const auto& Sf =
mesh.Sf();
1140 const auto& P =
mesh.owner();
1141 const auto&
N =
mesh.neighbour();
1143 const auto& gammai =
gamma.primitiveField();
1149 const auto& Sfi = Sf.primitiveField();
1154 for (label facei=0; facei<P.size(); facei++)
1156 const label ownCelli = P[facei];
1157 const label neiCelli =
N[facei];
1159 const ResultType faceVal
1176 sfi[ownCelli] += faceVal;
1177 sfi[neiCelli] -= faceVal;
1185 const label oldSize = vf.
constCast().boundaryEvaluate
1187 [](
const auto& pfld, UList<Type>& slice)
1191 pfld.patchNeighbourField(slice);
1204 (void)
gamma.constCast().boundaryEvaluate
1206 [](
const auto& pfld, UList<GType>& slice)
1210 pfld.patchNeighbourField(slice);
1217 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1218 const auto& pSf = Sf.boundaryField()[patchi];
1221 const auto& pweights = gammaWeights.
boundaryField()[patchi];
1222 const auto& pgamma =
gamma.boundaryField()[patchi];
1225 const label offset =
mesh.nCells()+pvf.patch().offset();
1229 for (label facei=0; facei<pFaceCells.size(); facei++)
1231 const label ownCelli = pFaceCells[facei];
1234 const ResultType faceVal
1243 gammai[offset+facei],
1253 sfi[ownCelli] += faceVal;
1261 for (label facei=0; facei<pFaceCells.size(); facei++)
1263 const label ownCelli = pFaceCells[facei];
1266 const ResultType faceVal
1274 pTraits<GType>::zero,
1278 pTraits<Type>::zero,
1285 sfi[ownCelli] += faceVal;
1292 gamma.constCast().resize(oldSize);
1319 const CellToFaceOp& cop,
1326 const auto& Sf =
mesh.Sf();
1327 const auto& P =
mesh.owner();
1328 const auto&
N =
mesh.neighbour();
1337 const auto& Sfi = Sf.primitiveField();
1341 for (label facei=0; facei<P.size(); facei++)
1343 const label ownCelli = P[facei];
1344 const label neiCelli =
N[facei];
1346 const ResultType faceVal
1365 sfi[ownCelli] += faceVal;
1366 sfi[neiCelli] -= faceVal;
1374 const label oldSize = vf.
constCast().boundaryEvaluate
1380 pfld.patchNeighbourField(slice);
1393 (void) gamma0.
constCast().boundaryEvaluate
1399 pfld.patchNeighbourField(slice);
1404 (void) gamma1.
constCast().boundaryEvaluate
1410 pfld.patchNeighbourField(slice);
1417 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1418 const auto& pSf = Sf.boundaryField()[patchi];
1421 const auto& pweights = gammaWeights.
boundaryField()[patchi];
1425 const label offset =
mesh.nCells()+pvf.patch().offset();
1436 for (label facei=0; facei<pFaceCells.size(); facei++)
1438 const label ownCelli = pFaceCells[facei];
1441 const ResultType faceVal
1450 gamma0i[offset+facei],
1453 gamma1i[offset+facei],
1460 sfi[ownCelli] += faceVal;
1467 for (label facei=0; facei<pFaceCells.size(); facei++)
1469 const label ownCelli = pFaceCells[facei];
1472 const ResultType faceVal
1491 sfi[ownCelli] += faceVal;
1509 template<
class Type,
class FType,
class ResultType,
class CellToFaceOp>
1515 const CellToFaceOp& cop,
1520 const auto& Sf =
mesh.Sf();
1521 const auto& P =
mesh.owner();
1522 const auto&
N =
mesh.neighbour();
1528 const auto& Sfi = Sf.primitiveField();
1534 for (label facei=0; facei<P.size(); facei++)
1536 const label ownCelli = P[facei];
1537 const label neiCelli =
N[facei];
1558 const label oldSize = vf.
constCast().boundaryEvaluate
1560 [](
const auto& pfld, UList<Type>& slice)
1564 pfld.patchNeighbourField(slice);
1571 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1572 const auto& pSf = Sf.boundaryField()[patchi];
1578 const label offset =
mesh.nCells()+pvf.patch().offset();
1585 for (label facei=0; facei<pFaceCells.size(); facei++)
1593 vfi[pFaceCells[facei]],
1604 for (label facei=0; facei<pFaceCells.size(); facei++)
1613 pTraits<Type>::zero,
1641 const CellToFaceOp& cop,
1646 const auto& Sf =
mesh.Sf();
1647 const auto& P =
mesh.owner();
1648 const auto&
N =
mesh.neighbour();
1655 const auto& Sfi = Sf.primitiveField();
1660 for (label facei=0; facei<P.size(); facei++)
1662 const label ownCelli = P[facei];
1663 const label neiCelli =
N[facei];
1686 const label oldSize = vf0.
constCast().boundaryEvaluate
1692 pfld.patchNeighbourField(slice);
1704 pfld.patchNeighbourField(slice);
1711 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1712 const auto& pSf = Sf.boundaryField()[patchi];
1718 const label offset =
mesh.nCells()+pvf0.patch().offset();
1720 if (pvf0.coupled() || pvf1.coupled())
1727 for (label facei=0; facei<pFaceCells.size(); facei++)
1736 vf0i[pFaceCells[facei]],
1739 vf1i[pFaceCells[facei]],
1748 for (label facei=0; facei<pFaceCells.size(); facei++)
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
A traits class, which is primarily used for primitives and vector-space.
static void doCorrectBoundaryConditions(bool correctBCs, VolumeField< Type > &field)
#define forAll(list, i)
Loop across all elements in list.
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
void surfaceSnSum(const surfaceScalarField &deltaCoeffs, const GeometricField< Type, fvPatchField, volMesh > &vf, const CellToFaceOp &cop, GeometricField< ResultType, fvPatchField, volMesh > &result, const bool doCorrectBoundaryConditions)
sum of snGrad
this_type & constCast() const noexcept
Return non-const reference to this field.
void surfaceOp(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceVectorField &ownLs, const surfaceVectorField &neiLs, const CombineOp &cop, GeometricField< ResultType, fvPatchField, volMesh > &result)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
const Vector< label > N(dict.get< Vector< label >>("N"))
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField...
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Mesh data needed to do the Finite Volume discretisation.
const Mesh & mesh() const noexcept
Return const reference to mesh.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
void GaussOp(const surfaceScalarField &lambdas, const GeometricField< Type, fvPatchField, volMesh > &vf, const CombineOp &cop, GeometricField< ResultType, fvPatchField, volMesh > &result)
static constexpr const zero Zero
Global zero (0)