43 template<
class Type,
template<
class>
class GeoField>
44 void Foam::fvMeshStitcher::resizePatchFields()
46 UPtrList<GeoField<Type>>
fields(mesh_.
fields<GeoField<Type>>());
51 typename GeoField<Type>::Patch& pf =
54 if (isA<nonConformalFvPatch>(pf.patch()))
56 pf.map(pf, setSizeFvPatchFieldMapper(pf.patch().size()));
63 template<
template<
class>
class GeoField>
64 void Foam::fvMeshStitcher::resizePatchFields()
66 #define ResizePatchFields(Type, nullArg) \
67 resizePatchFields<Type, GeoField>();
69 #undef ResizePatchFields
74 void Foam::fvMeshStitcher::preConformSurfaceFields()
76 UPtrList<SurfaceField<Type>>
fields(mesh_.curFields<SurfaceField<Type>>());
80 SurfaceField<Type>& field =
fields[i];
82 autoPtr<SurfaceField<Type>> nccFieldPtr
84 new SurfaceField<Type>
88 nccFieldPrefix_ + field.name(),
96 for (
label ti=0; ti<=field.nOldTimes(); ti++)
98 SurfaceField<Type>& field0 = field.oldTime(ti);
100 nccFieldPtr->oldTime(ti).boundaryFieldRef() =
101 conformalNccBoundaryField<Type>(field0.boundaryField());
103 field0.boundaryFieldRef() =
104 conformalOrigBoundaryField<Type>(field0.boundaryField());
107 nccFieldPtr.ptr()->store();
112 inline void Foam::fvMeshStitcher::preConformSurfaceFields()
114 #define PreConformSurfaceFields(Type, nullArg) \
115 preConformSurfaceFields<Type>();
117 #undef PreConformSurfaceFields
122 void Foam::fvMeshStitcher::postNonConformSurfaceFields()
124 UPtrList<SurfaceField<Type>>
fields(mesh_.curFields<SurfaceField<Type>>());
126 if (!mesh_.topoChanged())
130 if (
fields[i].
name()(nccFieldPrefix_.size()) == nccFieldPrefix_)
133 SurfaceField<Type>& field =
fields[i];
135 const word nccFieldName = nccFieldPrefix_ + field.name();
137 const SurfaceField<Type>& nccField =
138 mesh_.lookupObject<SurfaceField<Type>>(nccFieldName);
140 for (
label ti=0; ti<=field.nOldTimes(); ti++)
142 SurfaceField<Type>& field0 = field.oldTime(ti);
144 field0.boundaryFieldRef() =
145 nonConformalBoundaryField<Type>
147 nccField.oldTime(ti).boundaryField(),
148 field0.boundaryField()
151 field0.boundaryFieldRef() =
152 synchronisedBoundaryField<Type>(field0.boundaryField());
162 DynamicList<SurfaceField<Type>*> nccFields;
165 if (
fields[i].
name()(nccFieldPrefix_.size()) == nccFieldPrefix_)
168 SurfaceField<Type>& field =
fields[i];
170 const word nccFieldName = nccFieldPrefix_ + field.name();
172 SurfaceField<Type>& nccField =
173 mesh_.lookupObjectRef<SurfaceField<Type>>(nccFieldName);
175 nccFields.append(&nccField);
182 nccFields[i]->checkOut();
186 fields = mesh_.curFields<SurfaceField<Type>>();
189 if (
fields[i].
name()(nccFieldPrefix_.size()) != nccFieldPrefix_)
193 <<
"Stitching mapping field \"" <<
fields[i].name()
194 <<
"\" found, but the field it corresponds to no longer exists"
200 inline void Foam::fvMeshStitcher::postNonConformSurfaceFields()
202 #define PostNonConformSurfaceFields(Type, nullArg) \
203 postNonConformSurfaceFields<Type>();
205 #undef PostNonConformSurfaceFields
210 void Foam::fvMeshStitcher::evaluateVolFields()
212 UPtrList<VolField<Type>>
fields(mesh_.fields<VolField<Type>>());
222 if (isA<nonConformalFvPatch>(pf.patch()))
242 if (isA<nonConformalFvPatch>(pf.patch()))
251 inline void Foam::fvMeshStitcher::evaluateVolFields()
253 #define EvaluateVolFields(Type, nullArg) \
254 evaluateVolFields<Type>();
256 #undef EvaluateVolFields
260 inline void Foam::fvMeshStitcher::postNonConformSurfaceVelocities()
262 if (mesh_.topoChanged())
276 if (isA<nonConformalFvPatch>(mesh_.boundary()[
patchi]))
278 Uf.boundaryFieldRef()[
patchi] ==
290 template<
class GeoBoundaryField>
294 GeoBoundaryField& fieldBf
297 forAll(polyFacesBf, nccPatchi)
299 if (isA<nonConformalFvPatch>(polyFacesBf[nccPatchi].patch()))
301 fieldBf[nccPatchi].map
311 template<
class GeoField>
318 for (
label ti=0; ti<=field.nOldTimes(); ti++)
320 resizeBoundaryFieldPatchFields
323 field.oldTime(ti).boundaryFieldRef()
340 tresult.
ref()[addr[i]] +=
f[i];
384 const fvPatch& fvp = fvbm[nccPatchi];
386 if (isA<nonConformalCoupledFvPatch>(fvp))
389 refCast<const nonConformalCoupledFvPatch>(fvp);
397 origNccMagSfb[origPatchi] +=
407 return tOrigNccMagSfb;
418 const bool isFluxField =
isFlux(fieldb[0].internalField());
447 const fvPatch& fvp = fvbm[nccPatchi];
449 if (isA<nonConformalCoupledFvPatch>(fvp))
452 refCast<const nonConformalCoupledFvPatch>(fvbm[nccPatchi]);
463 nccFieldb[origPatchi] +=
475 nccFieldb[origPatchi] +=
478 fieldb[nccPatchi]*magSfb[nccPatchi],
492 const label origPatchi = origPatchIDs[i];
499 magSfb[origPatchi] + origNccMagSfb[origPatchi]
502 nccFieldb[origPatchi] *=
504 /
max(origNccMagSfb[origPatchi], small*origSumMagSf);
510 nccFieldb[origPatchi] /=
511 max(origNccMagSfb[origPatchi], vSmall);
526 const bool isFluxField =
isFlux(fieldb[0].internalField());
558 const label origPatchi = origPatchIDs[i];
562 magSfb[origPatchi] + origNccMagSfb[origPatchi]
565 origFieldb[origPatchi] *=
567 /
max(magSfb[origPatchi], small*origSumMagSf);
583 const bool isFluxField =
isFlux(origFieldb[0].internalField());
585 const fvBoundaryMesh& fvbm = origFieldb[0].patch().boundaryMesh();
604 const fvPatch& fvp = fvbm[nccPatchi];
606 if (isA<nonConformalCoupledFvPatch>(fvp))
609 refCast<const nonConformalCoupledFvPatch>(fvp);
619 Field<Type>(nccFieldb[origPatchi], nccOrigPatchFace);
634 const fvPatch& fvp = fvbm[nccPatchi];
636 if (isA<nonConformalCoupledFvPatch>(fvp))
639 refCast<const nonConformalCoupledFvPatch>(fvp);
649 magSfb[origPatchi] + origNccMagSfb[origPatchi]
651 const scalarField nccSumMagSf(origSumMagSf, nccOrigPatchFace);
653 fieldb[nccPatchi] *= magSfb[nccPatchi]/nccSumMagSf;
655 if (!isA<processorFvPatch>(fvp))
657 fieldb[origPatchi] *= magSfb[origPatchi]/origSumMagSf;
668 if (isA<nonConformalErrorFvPatch>(fvp))
673 refCast<const nonConformalErrorFvPatch>(fvp);
683 fieldb[errorPatchi] =
Zero;
687 fieldb[errorPatchi] =
688 Field<Type>(origFieldb[origPatchi], errorOrigPatchFace);
703 const scalar ownerWeight,
704 const scalar neighbourWeight
734 const scalar w = cfvp.
owner() ? ownerWeight : neighbourWeight;
735 const scalar v = cfvp.
owner() ? neighbourWeight : ownerWeight;
738 w*syncFieldb[
patchi] + (flip ? -v : +v)*fieldbNbr[
patchi];
753 const bool isFluxField =
isFlux(fieldb[0].internalField());
755 return synchronisedBoundaryField<Type>
#define forAll(list, i)
Loop across all elements in list.
static nonConformalBoundary & New(const polyMesh &mesh)
static const DimensionedField< Type, GeoMesh > & null()
Return a null DimensionedField.
Pre-declare SubField and related Field type.
Generic GeometricBoundaryField class.
tmp< GeometricBoundaryField > boundaryNeighbourField() const
Return BoundaryField of the values on the other side of couples.
Generic GeometricField class.
PatchField< Type > Patch
Type of the patch field of which the Boundary is composed.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void clear()
Clear the list, i.e. set size to zero.
static label nRequests()
Get number of outstanding requests.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static bool & parRun()
Is this a parallel run?
static commsTypes defaultCommsType
Default commsType.
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
An abstract base class for patches that couple regions of the computational domain e....
virtual bool owner() const
Does this side own the patch ?
const fvMesh & mesh() const
Return the mesh reference.
tmp< SurfaceFieldBoundary< Type > > conformalNccBoundaryField(const SurfaceFieldBoundary< Type > &fieldb) const
Extract the non-conformal-coupled parts of the boundary field.
tmp< SurfaceFieldBoundary< Type > > nonConformalBoundaryField(const SurfaceFieldBoundary< Type > &nccFieldb, const SurfaceFieldBoundary< Type > &origFieldb) const
Combine non-conformal-coupled and original parts of the.
static tmp< Field< Type > > fieldRMapSum(const Field< Type > &f, const label size, const labelUList &addr)
Reverse-map sum the values of a field.
tmp< SurfaceFieldBoundary< Type > > conformalOrigBoundaryField(const SurfaceFieldBoundary< Type > &fieldb) const
Extract the original parts of the boundary field and store it.
void resizeBoundaryFieldPatchFields(const SurfaceFieldBoundary< label > &polyFacesBf, GeoBoundaryField &fieldBf)
Resize the patch field of a given field to match the mesh.
tmp< SurfaceFieldBoundary< Type > > synchronisedBoundaryField(const SurfaceFieldBoundary< Type > &fieldb, const bool flip, const scalar ownerWeight, const scalar neighbourWeight) const
Synchronise the boundary field by combining corresponding.
tmp< SurfaceFieldBoundary< scalar > > getOrigNccMagSfb() const
Return the total non-conformal area associated with each.
void resizeFieldPatchFields(const SurfaceFieldBoundary< label > &polyFacesBf, GeoField &field)
Resize the patch field of a given field to match the mesh.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
UPtrList< GeoField > fields(const bool strict=false) const
Return the list of fields of type GeoField.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual label size() const
Return size.
virtual bool coupled() const
Return true if this patch is coupled.
virtual label start() const
Return start label of this patch in the polyMesh face list.
Traits class for primitives.
Set size fvPatchFieldMapper.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define PostNonConformSurfaceFields(Type, nullArg)
#define PreConformSurfaceFields(Type, nullArg)
#define ResizePatchFields(Type, nullArg)
#define EvaluateVolFields(Type, nullArg)
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
errorManipArg< error, int > exit(error &err, const int errNo=1)
VolField< vector > volVectorField
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
word name(const bool)
Return a word representation of a bool.
bool isFlux(const DimensionedField< Type, surfaceMesh > &df)
Check if surfaceField is a flux.
FOR_ALL_FIELD_TYPES(DefineContiguousFvWallLocationDataType)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
SurfaceField< vector > surfaceVectorField
const volVectorField & surfaceToVolVelocity(const surfaceVectorField &Uf)
Get the cell velocity field corresponding to a given face velocity, or a.
Return the vol-field velocity corresponding to a given surface-field velocity.