Commit e1431d05 authored by Ned Coltman's avatar Ned Coltman
Browse files

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

parent c4771f93
Pipeline #6290 waiting for manual action with stages
......@@ -27,6 +27,7 @@
#include <algorithm>
#include <dune/common/fmatrix.hh>
#include <dumux/common/typetraits/isvalid.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/staggeredfvproblem.hh>
#include <dumux/discretization/localview.hh>
......@@ -47,6 +48,14 @@ class RANSProblemImpl;
template<class TypeTag>
using RANSProblem = RANSProblemImpl<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::turbulenceModel()>;
// Remove this check after release 3.5. IsOnWall Interface is deprecated!
namespace Detail {
template<class GlobalPosition>
constexpr auto hasIsOnWall = isValid([](auto&& c) -> decltype(c.isOnWallAtPos(GlobalPosition(0.0)))
{ std::cout << "As of release 3.5, the IsOnWallAtPos function will no longer be used. Please set all wall locations"
" using the setWall function"; });
}
/*!
* \ingroup RANSModel
* \brief Reynolds-Averaged Navier-Stokes problem base class.
......@@ -95,6 +104,7 @@ class RANSProblemBase : public NavierStokesProblem<TypeTag>
};
public:
/*!
* \brief The constructor
* \param gridGeometry The finite volume grid geometry
......@@ -106,7 +116,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";
}
......@@ -196,24 +206,20 @@ 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")]]
[[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 isOnWallAtPos(const GlobalPosition &globalPos) const
{
// Throw an exception if no walls are implemented
......@@ -353,9 +359,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 (decltype(Detail::hasIsOnWall<GlobalPosition>(asImp_()))::value)
{
// 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());
}
}
}
......@@ -371,7 +387,21 @@ private:
void findWallDistances_()
{
BoundarySearchWallDistance<GridGeometry> boundarySearchWallDistance(this->gridGeometry());
boundarySearchWallDistance.updateWallDistance( [this] (const auto& element, const auto& scvf) { return asImp_().isOnWall(element, scvf); });
// Remove this check after release 3.5. IsOnWall Interface is deprecated
if constexpr (decltype(Detail::hasIsOnWall<GlobalPosition>(asImp_()))::value)
{
// Remove this part
boundarySearchWallDistance.updateWallDistance([this] ([[maybe_unused]] const auto& element, const auto& scvf)
{ return asImp_().isOnWall(scvf); });
}
else
{
// Keep this part
boundarySearchWallDistance.updateWallDistance([this] (const auto& element, const auto& scvf)
{ return asImp_().boundaryTypes(element, scvf).hasWall(); });
}
wallDistance_ = boundarySearchWallDistance.wallDistance();
// If isFlatWallBounded, the corresonding wall element is stored for each element
......
......@@ -63,6 +63,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>;
......@@ -310,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 (decltype(Detail::hasIsOnWall<GlobalPosition>(asImp_()))::value)
{
// 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)
......
......@@ -67,6 +67,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 +147,45 @@ 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 (decltype(Detail::hasIsOnWall<GlobalPosition>(problem))::value)
{
if (!(insideVolVars.isMatchingPoint() && outsideVolVars.isMatchingPoint())
|| !(insideVolVars.isMatchingPoint() && outsideVolVars.inNearWallRegion())
|| !(insideVolVars.inNearWallRegion() && outsideVolVars.isMatchingPoint()))
// 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())))
{
......
Markdown is supported
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