43 template<
class Type,
class ResultType,
class CellToFaceOp>
48 const CellToFaceOp& cop,
54 const auto& Sf =
mesh.Sf();
55 const auto& P =
mesh.owner();
56 const auto&
N =
mesh.neighbour();
65 const auto& Sfi = Sf.primitiveField();
68 for (label facei=0; facei<P.size(); facei++)
70 const label ownCelli = P[facei];
71 const label neiCelli =
N[facei];
73 const ResultType faceVal
83 sfi[ownCelli] += faceVal;
84 sfi[neiCelli] -= faceVal;
93 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
94 const auto& pSf = Sf.boundaryField()[patchi];
100 auto tpnf(pvf.patchNeighbourField());
103 for (label facei=0; facei<pFaceCells.size(); facei++)
106 const ResultType faceVal
112 vfi[pFaceCells[facei]],
117 sfi[pFaceCells[facei]] += faceVal;
122 for (label facei=0; facei<pFaceCells.size(); facei++)
125 const ResultType faceVal
135 sfi[pFaceCells[facei]] += faceVal;
148 template<
class Type,
class FType,
class ResultType,
class CellToFaceOp>
152 const GeometricField<Type, fvPatchField, volMesh>& vf,
153 const GeometricField<FType, fvsPatchField, surfaceMesh>& sadd,
154 const CellToFaceOp& cop,
155 GeometricField<ResultType, fvPatchField, volMesh>& result,
159 const fvMesh&
mesh = vf.mesh();
160 const auto& Sf =
mesh.Sf();
161 const auto& P =
mesh.owner();
162 const auto&
N =
mesh.neighbour();
164 const auto& vfi = vf.primitiveField();
165 auto& sfi = result.primitiveFieldRef();
171 const auto& Sfi = Sf.primitiveField();
172 const auto&
lambda = lambdas.primitiveField();
173 const auto& saddi = sadd.primitiveField();
175 for (label facei=0; facei<P.size(); facei++)
177 const label ownCelli = P[facei];
178 const label neiCelli =
N[facei];
180 const ResultType faceVal
192 sfi[ownCelli] += faceVal;
193 sfi[neiCelli] -= faceVal;
202 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
203 const auto& pSf = Sf.boundaryField()[patchi];
204 const auto& pvf = vf.boundaryField()[patchi];
205 const auto& pLambda = lambdas.boundaryField()[patchi];
206 const auto& psadd = sadd.boundaryField()[patchi];
210 auto tpnf(pvf.patchNeighbourField());
213 for (label facei=0; facei<pFaceCells.size(); facei++)
216 const ResultType faceVal
222 vfi[pFaceCells[facei]],
228 sfi[pFaceCells[facei]] += faceVal;
233 for (label facei=0; facei<pFaceCells.size(); facei++)
236 const ResultType faceVal
248 sfi[pFaceCells[facei]] += faceVal;
256 result.correctBoundaryConditions();
277 const CellToFaceOp& cop,
283 const auto& Sf =
mesh.Sf();
284 const auto& P =
mesh.owner();
285 const auto&
N =
mesh.neighbour();
294 const auto& Sfi = Sf.primitiveField();
299 for (label facei=0; facei<P.size(); facei++)
301 const label ownCelli = P[facei];
302 const label neiCelli =
N[facei];
304 const ResultType faceVal
318 resulti[ownCelli] += faceVal;
319 resulti[neiCelli] -= faceVal;
328 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
329 const auto& pSf = Sf.boundaryField()[patchi];
337 auto tpnf(pvf.patchNeighbourField());
340 for (label facei=0; facei<pFaceCells.size(); facei++)
343 const ResultType faceVal
350 vfi[pFaceCells[facei]],
358 resulti[pFaceCells[facei]] += faceVal;
363 for (label facei=0; facei<pFaceCells.size(); facei++)
366 const ResultType faceVal
379 resulti[pFaceCells[facei]] += faceVal;
392 template<
class Type,
class ResultType,
class CombineOp>
396 const GeometricField<Type, fvPatchField, volMesh>& vf,
397 const CombineOp& cop,
398 GeometricField<ResultType, fvPatchField, volMesh>& result
401 const fvMesh&
mesh = vf.mesh();
406 auto& sfi = result.primitiveFieldRef();
409 result.correctBoundaryConditions();
413 template<
class Type,
class ResultType,
class CombineOp>
419 const CombineOp& cop,
424 const auto& Sf =
mesh.Sf();
425 const auto& P =
mesh.owner();
426 const auto&
N =
mesh.neighbour();
433 const auto& Sfi = Sf.primitiveField();
435 for (label facei=0; facei<P.size(); facei++)
437 const label ownCelli = P[facei];
438 const label neiCelli =
N[facei];
449 sfi[ownCelli] += ownLs[facei]*faceVal;
450 sfi[neiCelli] -= neiLs[facei]*faceVal;
459 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
460 const auto& pSf = Sf.boundaryField()[patchi];
466 auto tpnf(pvf.patchNeighbourField());
469 for (label facei=0; facei<pFaceCells.size(); facei++)
476 vfi[pFaceCells[facei]],
481 sfi[pFaceCells[facei]] += pOwnLs[facei]*faceVal;
486 for (label facei=0; facei<pFaceCells.size(); facei++)
493 vfi[pFaceCells[facei]],
497 sfi[pFaceCells[facei]] += pOwnLs[facei]*faceVal;
507 template<
class Type,
class ResultType,
class CellToFaceOp>
513 const CellToFaceOp& cop,
520 const auto& Sf =
mesh.Sf();
521 const auto& P =
mesh.owner();
522 const auto&
N =
mesh.neighbour();
529 const auto& Sfi = Sf.primitiveField();
532 for (label facei=0; facei<P.size(); facei++)
534 const label ownCelli = P[facei];
535 const label neiCelli =
N[facei];
537 const ResultType faceVal
547 sfi[ownCelli] += faceVal;
548 sfi[neiCelli] -= faceVal;
557 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
558 const auto& pSf = Sf.boundaryField()[patchi];
564 auto tpnf(pvf.patchNeighbourField());
567 for (label facei=0; facei<pFaceCells.size(); facei++)
569 const label ownCelli = pFaceCells[facei];
572 const ResultType faceVal
583 sfi[ownCelli] += faceVal;
588 auto tpnf(pvf.snGrad());
591 for (label facei=0; facei<pFaceCells.size(); facei++)
593 const label ownCelli = pFaceCells[facei];
596 const ResultType faceVal
606 sfi[ownCelli] += faceVal;
619 template<
class Type,
class ResultType,
class CellToFaceOp>
623 const GeometricField<Type, fvPatchField, volMesh>& vf,
624 const GeometricField<Type, fvsPatchField, surfaceMesh>& sadd,
626 const CellToFaceOp& cop,
628 GeometricField<ResultType, fvPatchField, volMesh>& result,
632 const fvMesh&
mesh = vf.mesh();
633 const auto& Sf =
mesh.Sf();
634 const auto& P =
mesh.owner();
635 const auto&
N =
mesh.neighbour();
637 const auto& vfi = vf.primitiveField();
638 auto& sfi = result.primitiveFieldRef();
642 const auto& Sfi = Sf.primitiveField();
643 const auto& dc = deltaCoeffs.primitiveField();
644 const auto& saddi = sadd.primitiveField();
646 for (label facei=0; facei<P.size(); facei++)
648 const label ownCelli = P[facei];
649 const label neiCelli =
N[facei];
651 const ResultType faceVal
662 sfi[ownCelli] += faceVal;
663 sfi[neiCelli] -= faceVal;
672 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
673 const auto& pSf = Sf.boundaryField()[patchi];
674 const auto& pvf = vf.boundaryField()[patchi];
675 const auto& pdc = deltaCoeffs.boundaryField()[patchi];
676 const auto& psadd = sadd.boundaryField()[patchi];
680 auto tpnf(pvf.patchNeighbourField());
683 for (label facei=0; facei<pFaceCells.size(); facei++)
685 const label ownCelli = pFaceCells[facei];
688 const ResultType faceVal
700 sfi[ownCelli] += faceVal;
705 auto tpnf(pvf.snGrad());
708 for (label facei=0; facei<pFaceCells.size(); facei++)
710 const label ownCelli = pFaceCells[facei];
713 const ResultType faceVal
724 sfi[ownCelli] += faceVal;
732 result.correctBoundaryConditions();
737 template<
class Type,
class GType,
class ResultType,
class CellToFaceOp>
741 const GeometricField<GType, fvPatchField, volMesh>&
gamma,
744 const GeometricField<Type, fvPatchField, volMesh>& vf,
746 const CellToFaceOp& cop,
748 GeometricField<ResultType, fvPatchField, volMesh>& result,
752 const fvMesh&
mesh = vf.mesh();
753 const auto& Sf =
mesh.Sf();
754 const auto& P =
mesh.owner();
755 const auto&
N =
mesh.neighbour();
757 const auto& gammai =
gamma.primitiveField();
758 const auto& vfi = vf.primitiveField();
759 auto& sfi = result.primitiveFieldRef();
763 const auto& Sfi = Sf.primitiveField();
764 const auto& weights = gammaWeights.primitiveField();
765 const auto& dc = deltaCoeffs.primitiveField();
767 for (label facei=0; facei<P.size(); facei++)
769 const label ownCelli = P[facei];
770 const label neiCelli =
N[facei];
772 const ResultType faceVal
787 sfi[ownCelli] += faceVal;
788 sfi[neiCelli] -= faceVal;
797 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
798 const auto& pSf = Sf.boundaryField()[patchi];
799 const auto& pvf = vf.boundaryField()[patchi];
800 const auto& pdc = deltaCoeffs.boundaryField()[patchi];
801 const auto& pweights = gammaWeights.boundaryField()[patchi];
802 const auto& pgamma =
gamma.boundaryField()[patchi];
806 auto tpnf(pvf.patchNeighbourField());
808 auto tgammanf(pgamma.patchNeighbourField());
809 auto& gammanf = tgammanf();
811 for (label facei=0; facei<pFaceCells.size(); facei++)
813 const label ownCelli = pFaceCells[facei];
816 const ResultType faceVal
832 sfi[ownCelli] += faceVal;
837 auto tpnf(pvf.snGrad());
840 for (label facei=0; facei<pFaceCells.size(); facei++)
842 const label ownCelli = pFaceCells[facei];
845 const ResultType faceVal
853 pTraits<GType>::zero,
861 sfi[ownCelli] += faceVal;
869 result.correctBoundaryConditions();
874 template<
class Type,
class GType,
class ResultType,
class CellToFaceOp>
878 const GeometricField<GType, fvPatchField, volMesh>&
gamma,
881 const GeometricField<Type, fvPatchField, volMesh>& vf,
883 const GeometricField<Type, fvsPatchField, surfaceMesh>& sadd,
885 const CellToFaceOp& cop,
887 GeometricField<ResultType, fvPatchField, volMesh>& result,
891 const fvMesh&
mesh = vf.mesh();
892 const auto& Sf =
mesh.Sf();
893 const auto& P =
mesh.owner();
894 const auto&
N =
mesh.neighbour();
896 const auto& gammai =
gamma.primitiveField();
897 const auto& vfi = vf.primitiveField();
898 auto& sfi = result.primitiveFieldRef();
902 const auto& Sfi = Sf.primitiveField();
903 const auto& weights = gammaWeights.primitiveField();
904 const auto& dc = deltaCoeffs.primitiveField();
905 const auto& saddi = sadd.primitiveField();
907 for (label facei=0; facei<P.size(); facei++)
909 const label ownCelli = P[facei];
910 const label neiCelli =
N[facei];
912 const ResultType faceVal
929 sfi[ownCelli] += faceVal;
930 sfi[neiCelli] -= faceVal;
939 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
940 const auto& pSf = Sf.boundaryField()[patchi];
941 const auto& pvf = vf.boundaryField()[patchi];
942 const auto& pdc = deltaCoeffs.boundaryField()[patchi];
943 const auto& pweights = gammaWeights.boundaryField()[patchi];
944 const auto& pgamma =
gamma.boundaryField()[patchi];
945 const auto& psadd = sadd.boundaryField()[patchi];
949 auto tpnf(pvf.patchNeighbourField());
951 auto tgammanf(pgamma.patchNeighbourField());
952 auto& gammanf = tgammanf();
954 for (label facei=0; facei<pFaceCells.size(); facei++)
956 const label ownCelli = pFaceCells[facei];
959 const ResultType faceVal
977 sfi[ownCelli] += faceVal;
982 auto tpnf(pvf.snGrad());
985 for (label facei=0; facei<pFaceCells.size(); facei++)
987 const label ownCelli = pFaceCells[facei];
990 const ResultType faceVal
998 pTraits<GType>::zero,
1002 pTraits<Type>::zero,
1008 sfi[ownCelli] += faceVal;
1016 result.correctBoundaryConditions();
1038 const CellToFaceOp& cop,
1045 const auto& Sf =
mesh.Sf();
1046 const auto& P =
mesh.owner();
1047 const auto&
N =
mesh.neighbour();
1056 const auto& Sfi = Sf.primitiveField();
1060 for (label facei=0; facei<P.size(); facei++)
1062 const label ownCelli = P[facei];
1063 const label neiCelli =
N[facei];
1065 const ResultType faceVal
1084 sfi[ownCelli] += faceVal;
1085 sfi[neiCelli] -= faceVal;
1094 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1095 const auto& pSf = Sf.boundaryField()[patchi];
1098 const auto& pweights = gammaWeights.
boundaryField()[patchi];
1104 auto tpnf(pvf.patchNeighbourField());
1106 auto tgamma0nf(pgamma0.patchNeighbourField());
1107 auto& gamma0nf = tgamma0nf();
1108 auto tgamma1nf(pgamma1.patchNeighbourField());
1109 auto& gamma1nf = tgamma1nf();
1111 for (label facei=0; facei<pFaceCells.size(); facei++)
1113 const label ownCelli = pFaceCells[facei];
1116 const ResultType faceVal
1136 sfi[ownCelli] += faceVal;
1141 auto tpnf(pvf.snGrad());
1144 for (label facei=0; facei<pFaceCells.size(); facei++)
1146 const label ownCelli = pFaceCells[facei];
1149 const ResultType faceVal
1168 sfi[ownCelli] += faceVal;
1181 template<
class Type,
class FType,
class ResultType,
class CellToFaceOp>
1185 const GeometricField<Type, fvPatchField, volMesh>& vf,
1186 const GeometricField<FType, fvsPatchField, surfaceMesh>& sf,
1187 const CellToFaceOp& cop,
1188 GeometricField<ResultType, fvsPatchField, surfaceMesh>& result
1191 const fvMesh&
mesh = vf.mesh();
1192 const auto& Sf =
mesh.Sf();
1193 const auto& P =
mesh.owner();
1194 const auto&
N =
mesh.neighbour();
1196 const auto& vfi = vf.primitiveField();
1200 const auto& Sfi = Sf.primitiveField();
1201 const auto& weight = weights.primitiveField();
1202 const auto& sfi = sf.primitiveField();
1204 auto& resulti = result.primitiveFieldRef();
1206 for (label facei=0; facei<P.size(); facei++)
1208 const label ownCelli = P[facei];
1209 const label neiCelli =
N[facei];
1231 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1232 const auto& pSf = Sf.boundaryField()[patchi];
1233 const auto& pvf = vf.boundaryField()[patchi];
1234 const auto& pweight = weights.boundaryField()[patchi];
1235 const auto& psf = sf.boundaryField()[patchi];
1236 auto& presult = result.boundaryFieldRef()[patchi];
1240 auto tpnf(pvf.patchNeighbourField());
1243 for (label facei=0; facei<pFaceCells.size(); facei++)
1251 vfi[pFaceCells[facei]],
1262 for (label facei=0; facei<pFaceCells.size(); facei++)
1271 pTraits<Type>::zero,
1294 const CellToFaceOp& cop,
1299 const auto& Sf =
mesh.Sf();
1300 const auto& P =
mesh.owner();
1301 const auto&
N =
mesh.neighbour();
1308 const auto& Sfi = Sf.primitiveField();
1313 for (label facei=0; facei<P.size(); facei++)
1315 const label ownCelli = P[facei];
1316 const label neiCelli =
N[facei];
1340 const auto& pFaceCells =
mesh.boundary()[patchi].faceCells();
1341 const auto& pSf = Sf.boundaryField()[patchi];
1347 if (pvf0.coupled() || pvf1.coupled())
1349 auto tpnf0(pvf0.patchNeighbourField());
1350 auto& pnf0 = tpnf0();
1352 auto tpnf1(pvf1.patchNeighbourField());
1353 auto& pnf1 = tpnf1();
1355 for (label facei=0; facei<pFaceCells.size(); facei++)
1364 vf0i[pFaceCells[facei]],
1367 vf1i[pFaceCells[facei]],
1376 for (label facei=0; facei<pFaceCells.size(); facei++)
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 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"))
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
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.
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)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
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)