BUG: fan: bc value not updated. See #3211

This commit is contained in:
Mattijs Janssens 2025-03-17 14:11:12 +00:00 committed by Andrew Heather
parent 09e04003c4
commit d4a959a93f
12 changed files with 161 additions and 14 deletions

View File

@ -1355,6 +1355,15 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
internalFieldRef() = gf.internalField();
boundaryFieldRef() = gf.boundaryField();
// Make sure any e.g. jump-cyclic are updated.
boundaryFieldRef().evaluate_if
(
[](const auto& pfld) -> bool
{
return pfld.constraintOverride();
}
);
}
@ -1391,6 +1400,15 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
boundaryFieldRef() = gf.boundaryField();
tgf.clear();
// Make sure any e.g. jump-cyclic are updated.
boundaryFieldRef().evaluate_if
(
[](const auto& pfld) -> bool
{
return pfld.constraintOverride();
}
);
}
@ -1402,6 +1420,15 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
{
internalFieldRef() = dt;
boundaryFieldRef() = dt.value();
// Make sure any e.g. jump-cyclic are updated.
boundaryFieldRef().evaluate_if
(
[](const auto& pfld) -> bool
{
return pfld.constraintOverride();
}
);
}
@ -1421,6 +1448,15 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator==
boundaryFieldRef() == gf.boundaryField();
tgf.clear();
// Make sure any e.g. jump-cyclic are updated.
boundaryFieldRef().evaluate_if
(
[](const auto& pfld) -> bool
{
return pfld.constraintOverride();
}
);
}
@ -1432,6 +1468,15 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator==
{
internalFieldRef() = dt;
boundaryFieldRef() == dt.value();
// Make sure any e.g. jump-cyclic are updated.
boundaryFieldRef().evaluate_if
(
[](const auto& pfld) -> bool
{
return pfld.constraintOverride();
}
);
}
@ -1447,6 +1492,14 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op \
\
internalFieldRef() op gf.internalField(); \
boundaryFieldRef() op gf.boundaryField(); \
\
boundaryFieldRef().evaluate_if \
( \
[](const auto& pfld) -> bool \
{ \
return pfld.constraintOverride(); \
} \
); \
} \
\
template<class Type, template<class> class PatchField, class GeoMesh> \
@ -1457,6 +1510,14 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op \
{ \
operator op(tgf()); \
tgf.clear(); \
\
boundaryFieldRef().evaluate_if \
( \
[](const auto& pfld) -> bool \
{ \
return pfld.constraintOverride(); \
} \
); \
} \
\
template<class Type, template<class> class PatchField, class GeoMesh> \
@ -1467,6 +1528,14 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op \
{ \
internalFieldRef() op dt; \
boundaryFieldRef() op dt.value(); \
\
boundaryFieldRef().evaluate_if \
( \
[](const auto& pfld) -> bool \
{ \
return pfld.constraintOverride(); \
} \
); \
}
COMPUTED_ASSIGNMENT(Type, +=)

View File

@ -213,6 +213,12 @@ public:
return patchType_;
}
//- True if the type does not correspond to the constraint type
virtual bool constraintOverride() const
{
return !patchType_.empty() && patchType_ != type();
}
// Solution

View File

@ -175,7 +175,7 @@ public:
virtual bool ready() const;
//- Return neighbour field given internal field
tmp<Field<Type>> patchNeighbourField() const;
virtual tmp<Field<Type>> patchNeighbourField() const;
// Evaluation

View File

@ -205,6 +205,12 @@ public:
return patchType_;
}
//- True if the type does not correspond to the constraint type
virtual bool constraintOverride() const
{
return !patchType_.empty() && patchType_ != type();
}
// Solution

View File

@ -83,6 +83,13 @@ class faePatchFieldBase
//- Reference to patch
const faPatch& patch_;
//- Optional patch type
// Used to allow specified boundary conditions to be applied
// to constraint patches by providing the constraint
// patch type as 'patchType'
word patchType_;
protected:
// Protected Member Functions
@ -176,6 +183,24 @@ public:
return patch_;
}
//- The optional patch type
const word& patchType() const noexcept
{
return patchType_;
}
//- The optional patch type
word& patchType() noexcept
{
return patchType_;
}
//- True if the type does not correspond to the constraint type
virtual bool constraintOverride() const
{
return !patchType_.empty() && patchType_ != type();
}
// Solution

View File

@ -47,7 +47,8 @@ int Foam::faePatchFieldBase::disallowGenericPatchField
Foam::faePatchFieldBase::faePatchFieldBase(const faPatch& p)
:
patch_(p)
patch_(p),
patchType_()
{}
@ -57,7 +58,8 @@ Foam::faePatchFieldBase::faePatchFieldBase
const word& patchType
)
:
faePatchFieldBase(p)
patch_(p),
patchType_(patchType)
{}
@ -79,20 +81,24 @@ Foam::faePatchFieldBase::faePatchFieldBase
const faPatch& p
)
:
patch_(p)
patch_(p),
patchType_(rhs.patchType_)
{}
Foam::faePatchFieldBase::faePatchFieldBase(const faePatchFieldBase& rhs)
:
patch_(rhs.patch_)
patch_(rhs.patch_),
patchType_(rhs.patchType_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faePatchFieldBase::readDict(const dictionary& dict)
{}
{
// TBD. read patchType_
}
const Foam::objectRegistry& Foam::faePatchFieldBase::db() const

View File

@ -170,7 +170,7 @@ public:
// Evaluation functions
//- Return neighbour coupled internal cell data
tmp<Field<Type>> patchNeighbourField() const;
virtual tmp<Field<Type>> patchNeighbourField() const;
//- Return reference to neighbour patchField
const cyclicFvPatchField<Type>& neighbourPatchField() const;

View File

@ -128,7 +128,7 @@ public:
// Evaluation functions
//- Return neighbour coupled given internal cell data
tmp<Field<Type>> patchNeighbourField() const;
virtual tmp<Field<Type>> patchNeighbourField() const;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix

View File

@ -137,7 +137,7 @@ public:
virtual void evaluate(const Pstream::commsTypes commsType);
//- Initialise interface functionality
void initInterfaceMatrixUpdate
virtual void initInterfaceMatrixUpdate
(
solveScalarField& result,
const bool add,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2024 OpenCFD Ltd.
Copyright (C) 2019-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -233,6 +233,12 @@ public:
return patchType_;
}
//- True if the type does not correspond to the constraint type
virtual bool constraintOverride() const
{
return !patchType_.empty() && patchType_ != type();
}
// Solution

View File

@ -81,6 +81,13 @@ class fvsPatchFieldBase
//- Reference to patch
const fvPatch& patch_;
//- Optional patch type
// Used to allow specified boundary conditions to be applied
// to constraint patches by providing the constraint
// patch type as 'patchType'
word patchType_;
protected:
// Protected Member Functions
@ -177,6 +184,24 @@ public:
return patch_;
}
//- The optional patch type
const word& patchType() const noexcept
{
return patchType_;
}
//- The optional patch type
word& patchType() noexcept
{
return patchType_;
}
//- True if the type does not correspond to the constraint type
virtual bool constraintOverride() const
{
return !patchType_.empty() && patchType_ != type();
}
// Solution

View File

@ -45,7 +45,8 @@ int Foam::fvsPatchFieldBase::disallowGenericPatchField
Foam::fvsPatchFieldBase::fvsPatchFieldBase(const fvPatch& p)
:
patch_(p)
patch_(p),
patchType_()
{}
@ -55,7 +56,8 @@ Foam::fvsPatchFieldBase::fvsPatchFieldBase
const dictionary& dict
)
:
patch_(p)
patch_(p),
patchType_()
{}
@ -65,13 +67,15 @@ Foam::fvsPatchFieldBase::fvsPatchFieldBase
const fvPatch& p
)
:
patch_(p)
patch_(p),
patchType_(rhs.patchType_)
{}
Foam::fvsPatchFieldBase::fvsPatchFieldBase(const fvsPatchFieldBase& rhs)
:
patch_(rhs.patch_)
patch_(rhs.patch_),
patchType_(rhs.patchType_)
{}