43 tmp<Field<Type>> tresult(
new Field<Type>(addr.size()));
46 tresult.ref()[i] =
f[addr[i] - addr0];
55 const tmp<Field<Type>>&
f,
61 tmp<Field<Type>> tresult =
fieldMap(
f(), addr, addr0);
76 tmp<Field<Type>> tresult(
new Field<Type>(size,
Zero));
79 tresult.ref()[addr[i] - addr0] +=
f[i];
88 const tmp<Field<Type>>&
f,
94 tmp<Field<Type>> tresult =
fieldRMapSum(
f(), size, addr, addr0);
104 const SurfaceFieldBoundary<Type>& fieldb
107 const bool isFluxField =
isFlux(fieldb[0].internalField());
109 const fvBoundaryMesh& fvbm = fieldb[0].patch().boundaryMesh();
111 tmp<SurfaceFieldBoundary<Type>> tncFieldb
113 new SurfaceFieldBoundary<Type>
115 SurfaceField<Type>::Internal::null(),
119 SurfaceFieldBoundary<Type>& ncFieldb = tncFieldb.ref();
121 ncFieldb == pTraits<Type>::zero;
125 surfaceScalarField::Internal::null(),
135 const fvPatch& fvp = fvbm[ncPatchi];
137 if (!isA<nonConformalFvPatch>(fvp))
continue;
139 const nonConformalFvPatch& ncFvp =
140 refCast<const nonConformalFvPatch>(fvbm[ncPatchi]);
142 const label origPatchi = ncFvp.origPatchIndex();
143 const fvPatch& origFvp = ncFvp.origPatch();
145 const scalarField& ncNcMagSf = ncFvp.patch().magSf();
149 ncFieldb[origPatchi] +=
152 isFluxField ? fieldb[ncPatchi] : ncNcMagSf*fieldb[ncPatchi],
160 forAll(origPatchIndices, i)
162 const label origPatchi = origPatchIndices[i];
163 const fvPatch& origFvp = fvbm[origPatchi];
173 ncFieldb[origPatchi] *=
181 ncFieldb[origPatchi] /=
194 const SurfaceFieldBoundary<Type>& fieldb
197 const bool isFluxField =
isFlux(fieldb[0].internalField());
199 const fvBoundaryMesh& fvbm = fieldb[0].patch().boundaryMesh();
201 tmp<SurfaceFieldBoundary<Type>> torigFieldb
203 new SurfaceFieldBoundary<Type>
205 SurfaceField<Type>::Internal::null(),
209 SurfaceFieldBoundary<Type>& origFieldb = torigFieldb.ref();
213 surfaceScalarField::Internal::null(),
221 forAll(origPatchIndices, i)
223 const label origPatchi = origPatchIndices[i];
224 const fvPatch& origFvp = fvbm[origPatchi];
234 origFieldb[origPatchi] *=
236 /
max(origFvp.magSf(), small*origTotalMagSf);
248 const SurfaceFieldBoundary<Type>& ncFieldb,
249 const SurfaceFieldBoundary<Type>& origFieldb
252 const bool isFluxField =
isFlux(origFieldb[0].internalField());
254 const fvBoundaryMesh& fvbm = origFieldb[0].patch().boundaryMesh();
256 const surfaceScalarField::Boundary& magSfb =
257 fvbm.mesh().magSf().boundaryField();
260 tmp<SurfaceFieldBoundary<Type>> tfieldb
262 new SurfaceFieldBoundary<Type>
264 SurfaceField<Type>::Internal::null(),
268 SurfaceFieldBoundary<Type>& fieldb = tfieldb.ref();
274 const fvPatch& fvp = fvbm[ncPatchi];
276 if (!isA<nonConformalFvPatch>(fvp))
continue;
278 const nonConformalFvPatch& ncFvp =
279 refCast<const nonConformalFvPatch>(fvp);
281 const label origPatchi = ncFvp.origPatchIndex();
282 const fvPatch& origFvp = ncFvp.origPatch();
287 ncFieldb[origPatchi],
301 surfaceScalarField::Internal::null(),
306 forAll(origPatchIndices, i)
308 const label origPatchi = origPatchIndices[i];
315 fieldb[origPatchi] *= magSfb[origPatchi]/origTotalMagSf;
321 const fvPatch& fvp = fvbm[ncPatchi];
323 if (!isA<nonConformalFvPatch>(fvp))
continue;
325 const nonConformalFvPatch& ncFvp =
326 refCast<const nonConformalFvPatch>(fvp);
328 const label origPatchi = ncFvp.origPatchIndex();
329 const fvPatch& origFvp = ncFvp.origPatch();
341 fieldb[ncPatchi] *= magSfb[ncPatchi]/ncTotalMagSf;
348 const fvPatch& fvp = fvbm[errorPatchi];
350 if (!isA<nonConformalErrorFvPatch>(fvp))
continue;
352 const nonConformalErrorFvPatch& errorFvp =
353 refCast<const nonConformalErrorFvPatch>(fvp);
355 const label origPatchi = errorFvp.origPatchIndex();
356 const fvPatch& origFvp = errorFvp.origPatch();
360 fieldb[errorPatchi] =
Zero;
364 fieldb[errorPatchi] =
367 origFieldb[origPatchi],
368 errorFvp.polyFaces(),
382 const SurfaceFieldBoundary<Type>& fieldb,
384 const scalar ownerWeight,
385 const scalar neighbourWeight
388 const fvBoundaryMesh& fvbm = fieldb[0].patch().boundaryMesh();
390 tmp<SurfaceFieldBoundary<Type>> tsyncFieldb
392 new SurfaceFieldBoundary<Type>
394 SurfaceField<Type>::Internal::null(),
398 SurfaceFieldBoundary<Type>& syncFieldb = tsyncFieldb.ref();
400 SurfaceFieldBoundary<Type> fieldbNbr
402 SurfaceField<Type>::Internal::null(),
403 fieldb.boundaryNeighbourField()
408 const fvPatch& fvp = fvbm[
patchi];
410 if (!fvp.coupled())
continue;
412 const coupledFvPatch& cFvp = refCast<const coupledFvPatch>(fvp);
414 const scalar w = cFvp.owner() ? ownerWeight : neighbourWeight;
415 const scalar v = cFvp.owner() ? neighbourWeight : ownerWeight;
418 w*syncFieldb[
patchi] + (flip ? -v : +v)*fieldbNbr[
patchi];
429 const SurfaceFieldBoundary<Type>& fieldb
432 const bool isFluxField =
isFlux(fieldb[0].internalField());
434 return synchronisedBoundaryField<Type>
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
volScalarField scalarField(fieldObject, mesh)
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool isFlux(const DimensionedField< Type, surfaceMesh > &df)
Check if surfaceField is a flux.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
UList< label > labelUList