fvMeshStitcher: Update the event index of modified fields
This prevents inconsistent field data being cached. Note that the stitcher still does not cause old-time fields to be stored. Stitching is not considered an update (in time) to a field's value. It is a pure mapping, and it applies similarly to both current and old-time fields. Resolves bug report https://bugs.openfoam.org/view.php?id=4155
This commit is contained in:
@ -991,6 +991,17 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryFieldRef()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
typename
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary&
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::
|
||||||
|
boundaryFieldRefNoStoreOldTimes()
|
||||||
|
{
|
||||||
|
this->setUpToDate();
|
||||||
|
return boundaryField_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::storePrevIter() const
|
void Foam::GeometricField<Type, PatchField, GeoMesh>::storePrevIter() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -404,6 +404,10 @@ public:
|
|||||||
// old-time fields; avoid in loops.
|
// old-time fields; avoid in loops.
|
||||||
Boundary& boundaryFieldRef();
|
Boundary& boundaryFieldRef();
|
||||||
|
|
||||||
|
//- Return a reference to the boundary field without storing old times
|
||||||
|
// Note: this increments the event counter; avoid in loops.
|
||||||
|
Boundary& boundaryFieldRefNoStoreOldTimes();
|
||||||
|
|
||||||
//- Return const-reference to the boundary field
|
//- Return const-reference to the boundary field
|
||||||
inline const Boundary& boundaryField() const;
|
inline const Boundary& boundaryField() const;
|
||||||
|
|
||||||
|
|||||||
@ -1977,7 +1977,7 @@ void Foam::fvMeshStitcher::postUnconformVolFields()
|
|||||||
const label origPatchi = origPatchIndices[i];
|
const label origPatchi = origPatchIndices[i];
|
||||||
|
|
||||||
typename volVectorField::Patch& origUp =
|
typename volVectorField::Patch& origUp =
|
||||||
boundaryFieldRefNoUpdate(U)[origPatchi];
|
U.boundaryFieldRefNoStoreOldTimes()[origPatchi];
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -1985,7 +1985,7 @@ void Foam::fvMeshStitcher::postUnconformVolFields()
|
|||||||
|| isA<movingWallSlipVelocityFvPatchVectorField>(origUp)
|
|| isA<movingWallSlipVelocityFvPatchVectorField>(origUp)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
boundaryFieldRefNoUpdate(U).set
|
U.boundaryFieldRefNoStoreOldTimes().set
|
||||||
(
|
(
|
||||||
errorPatchi,
|
errorPatchi,
|
||||||
new movingWallSlipVelocityFvPatchVectorField
|
new movingWallSlipVelocityFvPatchVectorField
|
||||||
@ -2020,7 +2020,7 @@ void Foam::fvMeshStitcher::postUnconformVolFields()
|
|||||||
{
|
{
|
||||||
if (isA<nonConformalFvPatch>(mesh_.boundary()[patchi]))
|
if (isA<nonConformalFvPatch>(mesh_.boundary()[patchi]))
|
||||||
{
|
{
|
||||||
boundaryFieldRefNoUpdate(Uf)[patchi] ==
|
Uf.boundaryFieldRefNoStoreOldTimes()[patchi] ==
|
||||||
UfInterpolated.boundaryField()[patchi];
|
UfInterpolated.boundaryField()[patchi];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -369,15 +369,6 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Access the boundary field reference of a field, without updating
|
|
||||||
// the time index, storing old time fields, etc...
|
|
||||||
template<class GeoField>
|
|
||||||
static typename GeoField::Boundary& boundaryFieldRefNoUpdate
|
|
||||||
(
|
|
||||||
GeoField& fld
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Checking
|
// Checking
|
||||||
|
|
||||||
//- Determine which patches are coupled; i.e., for which
|
//- Determine which patches are coupled; i.e., for which
|
||||||
|
|||||||
@ -46,7 +46,7 @@ void Foam::fvMeshStitcher::resizePatchFields()
|
|||||||
forAll(mesh_.boundary(), patchi)
|
forAll(mesh_.boundary(), patchi)
|
||||||
{
|
{
|
||||||
typename GeoField<Type>::Patch& pf =
|
typename GeoField<Type>::Patch& pf =
|
||||||
boundaryFieldRefNoUpdate(fields[i])[patchi];
|
fields[i].boundaryFieldRefNoStoreOldTimes()[patchi];
|
||||||
|
|
||||||
if (isA<nonConformalFvPatch>(pf.patch()))
|
if (isA<nonConformalFvPatch>(pf.patch()))
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ void Foam::fvMeshStitcher::preConformSurfaceFields()
|
|||||||
{
|
{
|
||||||
conformedFvsPatchField<Type>::conform
|
conformedFvsPatchField<Type>::conform
|
||||||
(
|
(
|
||||||
boundaryFieldRefNoUpdate(field.oldTime(ti))
|
field.oldTimeRef(ti).boundaryFieldRefNoStoreOldTimes()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ void Foam::fvMeshStitcher::preConformVolFields()
|
|||||||
{
|
{
|
||||||
conformedFvPatchField<Type>::conform
|
conformedFvPatchField<Type>::conform
|
||||||
(
|
(
|
||||||
boundaryFieldRefNoUpdate(field.oldTime(ti))
|
field.oldTimeRef(ti).boundaryFieldRefNoStoreOldTimes()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ void Foam::fvMeshStitcher::postUnconformSurfaceFields()
|
|||||||
{
|
{
|
||||||
conformedFvsPatchField<Type>::unconform
|
conformedFvsPatchField<Type>::unconform
|
||||||
(
|
(
|
||||||
boundaryFieldRefNoUpdate(field.oldTime(ti))
|
field.oldTimeRef(ti).boundaryFieldRefNoStoreOldTimes()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ void Foam::fvMeshStitcher::postUnconformVolFields()
|
|||||||
{
|
{
|
||||||
conformedFvPatchField<Type>::unconform
|
conformedFvPatchField<Type>::unconform
|
||||||
(
|
(
|
||||||
boundaryFieldRefNoUpdate(field.oldTime(ti))
|
field.oldTimeRef(ti).boundaryFieldRefNoStoreOldTimes()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ void Foam::fvMeshStitcher::postUnconformEvaluateVolFields()
|
|||||||
forAll(mesh_.boundary(), patchi)
|
forAll(mesh_.boundary(), patchi)
|
||||||
{
|
{
|
||||||
typename VolField<Type>::Patch& pf =
|
typename VolField<Type>::Patch& pf =
|
||||||
boundaryFieldRefNoUpdate(fields[i])[patchi];
|
fields[i].boundaryFieldRefNoStoreOldTimes()[patchi];
|
||||||
|
|
||||||
if (evaluate(pf))
|
if (evaluate(pf))
|
||||||
{
|
{
|
||||||
@ -190,7 +190,7 @@ void Foam::fvMeshStitcher::postUnconformEvaluateVolFields()
|
|||||||
forAll(mesh_.boundary(), patchi)
|
forAll(mesh_.boundary(), patchi)
|
||||||
{
|
{
|
||||||
typename VolField<Type>::Patch& pf =
|
typename VolField<Type>::Patch& pf =
|
||||||
boundaryFieldRefNoUpdate(fields[i])[patchi];
|
fields[i].boundaryFieldRefNoStoreOldTimes()[patchi];
|
||||||
|
|
||||||
if (evaluate(pf))
|
if (evaluate(pf))
|
||||||
{
|
{
|
||||||
@ -201,16 +201,4 @@ void Foam::fvMeshStitcher::postUnconformEvaluateVolFields()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
typename GeoField::Boundary& Foam::fvMeshStitcher::boundaryFieldRefNoUpdate
|
|
||||||
(
|
|
||||||
GeoField& fld
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return const_cast<typename GeoField::Boundary&>(fld.boundaryField());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1030,7 +1030,7 @@ void Foam::fvMeshStitchers::moving::unconformCorrectMeshPhi
|
|||||||
for (label i = 0; i <= phi.nOldTimes(false); ++ i)
|
for (label i = 0; i <= phi.nOldTimes(false); ++ i)
|
||||||
{
|
{
|
||||||
surfaceScalarField::Boundary& phi0Bf =
|
surfaceScalarField::Boundary& phi0Bf =
|
||||||
boundaryFieldRefNoUpdate(phi.oldTime(i));
|
phi.oldTimeRef(i).boundaryFieldRefNoStoreOldTimes();
|
||||||
|
|
||||||
forAll(polyFacesBf, ncPatchi)
|
forAll(polyFacesBf, ncPatchi)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user