Commit 9143c6fc authored by Ned Coltman's avatar Ned Coltman
Browse files

[rans][isonWall] Deprecate all of the isOnWall calls with a compiler warning

parent 2fb379c4
......@@ -54,6 +54,20 @@ template <class Mapper>
void update(Mapper& mapper)
{ mapper.update(); };
template <typename Problem, typename GlobalPosition>
using HasIsOnWallDetector = decltype(std::declval<Problem>().isOnWallAtPos(std::declval<GlobalPosition>()));
template<class Problem, typename GlobalPosition>
static constexpr bool hasIsOnWall()
{ return Dune::Std::is_detected<HasIsOnWallDetector, Problem, GlobalPosition>::value; }
template <typename BcTypes>
using HasWallBCDetector = decltype(std::declval<BcTypes>().hasWall());
template<class BcTypes>
static constexpr bool hasHasWallBC()
{ return Dune::Std::is_detected<HasWallBCDetector, BcTypes>::value; }
} // end namespace Deprecated
#endif
......
......@@ -28,6 +28,7 @@
#include <dune/common/fmatrix.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/common/staggeredfvproblem.hh>
#include <dumux/discretization/localview.hh>
#include <dumux/discretization/method.hh>
......@@ -105,7 +106,7 @@ public:
if ( !(hasParamInGroup(this->paramGroup(), "RANS.IsFlatWallBounded")))
{
std::cout << "The parameter \"Rans.IsFlatWallBounded\" is not specified. \n"
<< " -- Based on the grid and the isOnWallAtPos function specified by the user,"
<< " -- Based on the grid and the boundary conditions specified by the user,"
<< " this parameter is set to be "<< std::boolalpha << isFlatWallBounded() << "\n";
}
......@@ -193,31 +194,13 @@ public:
*
* \param scvf The sub control volume face.
*/
[[deprecated("Will be removed after release 3.4")]]
[[deprecated("The isOnWall and IsOnWallAtPos functions will be removed after release 3.5. "
"Please use the Rans specific boundarytypes, and mark wall boundaries with the setWall() function.")]]
bool isOnWall(const SubControlVolumeFace& scvf) const
{
return asImp_().isOnWallAtPos(scvf.center());
}
bool isOnWall(const Element& element, const SubControlVolumeFace& scvf) const
{
// Return true if this wall has been marked as a Wall
return asImp_().boundaryTypes(element, scvf).hasWall();
}
/*!
* \brief Returns whether a given point is on a wall
*
* \param globalPos The position in global coordinates.
*/
[[deprecated("Will be removed after release 3.4")]]
bool isOnWallAtPos(const GlobalPosition &globalPos) const
{
// Throw an exception if no walls are implemented
DUNE_THROW(Dune::InvalidStateException,
"The problem does not provide an isOnWall() method.");
}
bool isFlatWallBounded() const
{
static const bool hasAlignedWalls = hasAlignedWalls_();
......@@ -356,9 +339,19 @@ private:
fvGeometry.bindElement(element);
for (const auto& scvf : scvfs(fvGeometry))
{
// only search for walls at a global boundary
if (!scvf.boundary() && asImp_().isOnWall(element, scvf))
wallFaceAxis.push_back(scvf.directionIndex());
// Remove this check after release 3.5. IsOnWall Interface is deprecated
if constexpr (Deprecated::hasIsOnWall<Implementation, GlobalPosition>())
{
// Remove this part
if (!scvf.boundary() && asImp_().isOnWall(scvf)) // only search for walls at a global boundary
wallFaceAxis.push_back(scvf.directionIndex());
}
else
{
// Keep this part
if (!scvf.boundary() && asImp_().boundaryTypes(element, scvf).hasWall()) // only search for walls at a global boundary
wallFaceAxis.push_back(scvf.directionIndex());
}
}
}
......@@ -373,11 +366,23 @@ private:
*/
void findWallDistances_()
{
WallDistance wallInformation(this->gridGeometry(), WallDistance<GridGeometry>::atElementCenters,
[this] (const FVElementGeometry& fvGeometry, const auto& scvf)
{ return asImp_().isOnWall(scvf); });
wallDistance_ = wallInformation.wallDistance();
storeWallElementAndDirectionIndex_(wallDistance.wallData());
// Remove this check after release 3.5. IsOnWall Interface is deprecated
if constexpr (Deprecated::hasIsOnWall<Implementation, GlobalPosition>())
{
WallDistance wallInformation(this->gridGeometry(), WallDistance<GridGeometry>::atElementCenters,
[this] (const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf)
{ return asImp_().isOnWall(scvf); });
wallDistance_ = wallInformation.wallDistance();
storeWallElementAndDirectionIndex_(wallInformation.wallData());
}
else
{
WallDistance wallInformation(this->gridGeometry(), WallDistance<GridGeometry>::atElementCenters,
[this] (const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf)
{ return asImp_().boundaryTypes(fvGeometry.element(), scvf).hasWall(); });
wallDistance_ = wallInformation.wallDistance();
storeWallElementAndDirectionIndex_(wallInformation.wallData());
}
}
template <class WallData>
......@@ -701,6 +706,11 @@ private:
}
}
[[deprecated("The isOnWall and IsOnWallAtPos functions will be removed after release 3.5. "
"Please use the Rans specific boundarytypes. "
"Mark wall boundaries in the rans problems with the setWall() function.")]]
void noSetWallCompilerWarning_(){}
const int fixedFlowDirectionAxis_ = getParam<int>("RANS.FlowDirectionAxis", 0);
const int fixedWallNormalAxis_ = getParam<int>("RANS.WallNormalAxis", 1);
......@@ -708,7 +718,6 @@ private:
std::vector<unsigned int> flowDirectionAxis_;
std::vector<Scalar> wallDistance_;
std::vector<unsigned int> wallElementIdx_;
std::vector<unsigned int> wallDirectionIndex_;
std::vector<std::array<std::array<unsigned int, 2>, dim>> neighborIdx_;
std::vector<DimVector> velocity_;
......
......@@ -27,6 +27,7 @@
#include <numeric>
#include <dumux/common/properties.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/common/staggeredfvproblem.hh>
#include <dumux/discretization/localview.hh>
#include <dumux/discretization/staggered/elementsolution.hh>
......@@ -63,6 +64,7 @@ class RANSProblemImpl<TypeTag, TurbulenceModel::kepsilon> : public RANSProblemBa
using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>;
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
......@@ -309,9 +311,22 @@ public:
{
unsigned int elementIdx = asImp_().gridGeometry().elementMapper().index(element);
auto bcTypes = asImp_().boundaryTypes(element, localSubFace);
return asImp_().isOnWall(element, localSubFace)
&& bcTypes.isDirichlet(eqIdx)
&& isMatchingPoint(elementIdx);
// Remove this check after release 3.5. IsOnWall Interface is deprecated
if constexpr (Deprecated::hasIsOnWall<Implementation, GlobalPosition>())
{
// Remove this part
return asImp_().isOnWall(localSubFace)
&& bcTypes.isDirichlet(eqIdx)
&& isMatchingPoint(elementIdx);
}
else
{
// Keep this part
return bcTypes.hasWall()
&& bcTypes.isDirichlet(eqIdx)
&& isMatchingPoint(elementIdx);
}
}
//! \brief Returns an additional wall function momentum flux (only needed for RANS models)
......
......@@ -26,6 +26,7 @@
#include <numeric>
#include <dumux/common/properties.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/flux/fluxvariablesbase.hh>
#include <dumux/discretization/method.hh>
#include <dumux/discretization/extrusion.hh>
......@@ -67,6 +68,7 @@ class KEpsilonFluxVariablesImpl<TypeTag, BaseFluxVariables, DiscretizationMethod
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using FVElementGeometry = typename GridGeometry::LocalView;
using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
using Extrusion = Extrusion_t<GridGeometry>;
using GridView = typename GridGeometry::GridView;
using Problem = GetPropType<TypeTag, Properties::Problem>;
......@@ -146,20 +148,46 @@ public:
}
const auto bcTypes = problem.boundaryTypes(element, scvf);
if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::turbulentKineticEnergyEqIdx)
|| bcTypes.isSymmetry()
|| bcTypes.hasWall())))
// Remove this check after release 3.5. IsOnWall Interface is deprecated
if constexpr (Deprecated::hasIsOnWall<Problem, GlobalPosition>())
{
if (!(insideVolVars.isMatchingPoint() && outsideVolVars.isMatchingPoint())
|| !(insideVolVars.isMatchingPoint() && outsideVolVars.inNearWallRegion())
|| !(insideVolVars.inNearWallRegion() && outsideVolVars.isMatchingPoint()))
noSetWallCompilerWarning_();
// Remove this part
if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::turbulentKineticEnergyEqIdx)
|| bcTypes.isSymmetry()
|| problem.isOnWall(scvf))))
{
flux[turbulentKineticEnergyEqIdx]
+= coeff_k / distance
* (insideVolVars.turbulentKineticEnergy() - outsideVolVars.turbulentKineticEnergy())
* Extrusion::area(scvf);
if (!(insideVolVars.isMatchingPoint() && outsideVolVars.isMatchingPoint())
|| !(insideVolVars.isMatchingPoint() && outsideVolVars.inNearWallRegion())
|| !(insideVolVars.inNearWallRegion() && outsideVolVars.isMatchingPoint()))
{
flux[turbulentKineticEnergyEqIdx]
+= coeff_k / distance
* (insideVolVars.turbulentKineticEnergy() - outsideVolVars.turbulentKineticEnergy())
* Extrusion::area(scvf);
}
}
}
else
{
// Keep this part
if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::turbulentKineticEnergyEqIdx)
|| bcTypes.isSymmetry()
|| bcTypes.hasWall())))
{
if (!(insideVolVars.isMatchingPoint() && outsideVolVars.isMatchingPoint())
|| !(insideVolVars.isMatchingPoint() && outsideVolVars.inNearWallRegion())
|| !(insideVolVars.inNearWallRegion() && outsideVolVars.isMatchingPoint()))
{
flux[turbulentKineticEnergyEqIdx]
+= coeff_k / distance
* (insideVolVars.turbulentKineticEnergy() - outsideVolVars.turbulentKineticEnergy())
* Extrusion::area(scvf);
}
}
}
if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::dissipationEqIdx)
|| bcTypes.isSymmetry())))
{
......@@ -189,6 +217,13 @@ public:
+ 2.0 / ModelTraits::dim() * insideVolVars.density() * insideVolVars.turbulentKineticEnergy()
* Extrusion::area(scvf) * scvf.directionSign() * insideVolVars.extrusionFactor();
}
private:
[[deprecated("The isOnWall and IsOnWallAtPos functions will be removed after release 3.5. "
"Please use the Rans specific boundarytypes. "
"Mark wall boundaries in the rans problems with the setWall() function.")]]
void noSetWallCompilerWarning_(){}
};
} // end namespace
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment