Commit 20525641 authored by Ned Coltman's avatar Ned Coltman Committed by Timo Koch

[rans][problem] add geometric check for isFlatWallBounded

parent 333e3714
......@@ -333,8 +333,6 @@ private:
// parameters in the mpfa group
defaultParams["MPFA.Q"] = "0.0";
// parameters in the RANS group
defaultParams["RANS.IsFlatWallBounded"] = "false";
// merge the global default tree but do not overwrite if the parameter already exists
mergeTree_(params, defaultParams, false);
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_RANS_PROBLEM_HH
#define DUMUX_RANS_PROBLEM_HH
#include <algorithm>
#include <dune/common/fmatrix.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/staggeredfvproblem.hh>
......@@ -126,6 +128,13 @@ public:
wallNormalAxis_.resize(this->gridGeometry().elementMapper().size(), fixedWallNormalAxis_);
kinematicViscosity_.resize(this->gridGeometry().elementMapper().size(), 0.0);
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,"
<< " this parameter is set to be "<< std::boolalpha << isFlatWallBounded() << "\n";
}
std::vector<WallElementInformation> wallElements;
const auto gridView = this->gridGeometry().gridView();
......@@ -307,8 +316,8 @@ public:
bool isFlatWallBounded() const
{
static const bool isFlatWallBounded = getParamFromGroup<bool>(this->paramGroup(), "RANS.IsFlatWallBounded");
return isFlatWallBounded;
static const bool hasAlignedWalls = hasAlignedWalls_();
return hasAlignedWalls;
}
/*!
......@@ -409,6 +418,35 @@ public:
bool calledUpdateStaticWallProperties = false;
private:
bool hasAlignedWalls_() const
{
if ( hasParamInGroup(this->paramGroup(), "RANS.IsFlatWallBounded"))
{
static const bool isFlatWallBounded = getParamFromGroup<bool>(this->paramGroup(), "RANS.IsFlatWallBounded");
return isFlatWallBounded;
}
std::vector<int> wallFaceAxis;
wallFaceAxis.reserve(this->gridGeometry().numBoundaryScvf());
const auto gridView = this->gridGeometry().gridView();
auto fvGeometry = localView(this->gridGeometry());
for (const auto& element : elements(gridView))
{
fvGeometry.bindElement(element);
for (const auto& scvf : scvfs(fvGeometry))
{
// only search for walls at a global boundary
if (!scvf.boundary() && asImp_().isOnWall(scvf))
wallFaceAxis.push_back(scvf.directionIndex());
}
}
// Returns if all wall directions are the same
return std::all_of(wallFaceAxis.begin(), wallFaceAxis.end(), [firstDir=wallFaceAxis[0]](auto dir){ return (dir == firstDir);} ) ;
}
void calculateCCVelocities_(const SolutionVector& curSol)
{
// calculate cell-center-averaged velocities
......
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