Commit 7ef3d789 authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[RANS] Improve the RANS property system

parent 7a7c7613
......@@ -260,8 +260,10 @@ private:
// parameters in the mpfa group
params["Mpfa.Q"] = "0.0";
// parameters in the freeflow group
params["FreeFlow.EddyViscosityModel"] = "1";
// parameters in the RANS group
params["RANS.KarmanConstant"] = "0.41";
params["RANS.FlowNormalAxis"] = "0";
params["RANS.WallNormalAxis"] = "1";
}
};
......
......@@ -101,11 +101,15 @@ public:
wallDistance_ = problem.wallDistances_[elementID_];
velocity_ = problem.velocity_[elementID_];
velocityGradients_ = problem.velocityGradients_[elementID_];
static const int flowNormalAxis = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup),
"RANS.FlowNormalAxis");
static const int wallNormalAxis = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup),
"RANS.WallNormalAxis");
Scalar uStar = sqrt(problem.kinematicViscosity_[wallElementID_]
* abs(problem.velocityGradients_[wallElementID_][0][1])); // TODO: flow and wallnormalaxis
* abs(problem.velocityGradients_[wallElementID_][flowNormalAxis][wallNormalAxis]));
yPlus_ = wallDistance_ * uStar / asImp_().kinematicViscosity();
yPlus_ = max(yPlus_, 1e-10); // zero values lead to numerical problems in some turbulence models
uPlus_ = velocity_[0] / max(uStar, 1e-10); // TODO: flow and wallnormalaxis
uPlus_ = velocity_[flowNormalAxis] / max(uStar, 1e-10);
// calculate the eddy viscosity based on the implemented RANS model
asImp_().calculateEddyViscosity(elemSol, problem, element, scv);
......
......@@ -65,12 +65,6 @@ class ZeroEqVolumeVariablesImplementation<TypeTag, false>
static const int defaultPhaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
public:
ZeroEqVolumeVariablesImplementation()
{
eddyViscosityModel_ = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup),
"FreeFlow.EddyViscosityModel");
}
/*!
* \brief Update all quantities for a given control volume
*
......@@ -109,18 +103,25 @@ public:
using std::exp;
using std::sqrt;
Scalar kinematicEddyViscosity = 0.0;
const Scalar karmanConstant = 0.41; // TODO make karman constant a property
Scalar velGrad = abs(asImp_().velocityGradients()[0][1]); // TODO: flow and wallnormalaxis
if (eddyViscosityModel_ == Indices::noEddyViscosityModel)
static const Scalar karmanConstant = getParamFromGroup<Scalar>(GET_PROP_VALUE(TypeTag, ModelParameterGroup),
"RANS.KarmanConstant");
static const int flowNormalAxis = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup),
"RANS.FlowNormalAxis");
static const int wallNormalAxis = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup),
"RANS.WallNormalAxis");
static const int eddyViscosityModel = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup),
"RANS.EddyViscosityModel", 1);
Scalar velGrad = abs(asImp_().velocityGradients()[flowNormalAxis][wallNormalAxis]);
if (eddyViscosityModel == Indices::noEddyViscosityModel)
{
// kinematicEddyViscosity = 0.0
}
else if (eddyViscosityModel_ == Indices::prandtl)
else if (eddyViscosityModel == Indices::prandtl)
{
Scalar mixingLength = karmanConstant * asImp_().wallDistance();
kinematicEddyViscosity = mixingLength * mixingLength * velGrad;
}
else if (eddyViscosityModel_ == Indices::modifiedVanDriest)
else if (eddyViscosityModel == Indices::modifiedVanDriest)
{
Scalar mixingLength = karmanConstant * asImp_().wallDistance()
* (1.0 - exp(-asImp_().yPlus() / 26.0))
......@@ -130,7 +131,7 @@ public:
else
{
DUNE_THROW(Dune::NotImplemented,
"This eddy viscosity model is not implemented: " << eddyViscosityModel_);
"This eddy viscosity model is not implemented: " << eddyViscosityModel);
}
asImp_().setDynamicEddyViscosity(kinematicEddyViscosity * asImp_().density());
}
......@@ -143,9 +144,6 @@ private:
//! \copydoc asImp_()
const Implementation &asImp_() const
{ return *static_cast<const Implementation *>(this); }
protected:
int eddyViscosityModel_;
};
/*!
......
......@@ -6,5 +6,5 @@ dune_add_test(NAME test_pipe_laufer
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/pipe_laufer_zeroeq.vtu
${CMAKE_CURRENT_BINARY_DIR}/pipe_laufer_zeroeq_reference-00019.vtu
${CMAKE_CURRENT_BINARY_DIR}/pipe_laufer_zeroeq_reference-00021.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_pipe_laufer test_pipe_laufer_reference.input")
......@@ -15,7 +15,7 @@ Name = pipe_laufer_zeroeq
InletVelocity = 2.5 # [m/s]
EnableGravity = false
[FreeFlow]
[RANS]
EddyViscosityModel = 2
[Newton]
......
......@@ -15,7 +15,7 @@ Name = pipe_laufer_zeroeq_reference
InletVelocity = 2.5 # [m/s]
EnableGravity = false
[FreeFlow]
[RANS]
EddyViscosityModel = 2
[Newton]
......
This diff is collapsed.
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