Commit aaa5b663 authored by Ned Coltman's avatar Ned Coltman Committed by Melanie Lipp

[rans][komega] Store variables privately, clean up runtime params

parent 8d11b921
......@@ -64,9 +64,7 @@ class RANSProblemImpl<TypeTag, TurbulenceModel::komega> : public RANSProblemBase
public:
RANSProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry, const std::string& paramGroup = "")
: ParentType(gridGeometry, paramGroup)
{
useStoredEddyViscosity_ = getParamFromGroup<bool>(this->paramGroup(), "RANS.UseStoredEddyViscosity", false);
}
{ }
/*!
* \brief Correct size of the static (solution independent) wall variables
......@@ -117,7 +115,7 @@ public:
// calculate cell-centered gradients
for (const auto& element : elements(this->gridGeometry().gridView()))
{
unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
const unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
for (unsigned int dimIdx = 0; dimIdx < DimVector::dimension; ++dimIdx)
{
......@@ -126,11 +124,11 @@ public:
// Cell centered TKE Gradient
storedTurbulentKineticEnergyGradient_[elementIdx][dimIdx]
= (storedTurbulentKineticEnergy_[neighborIdx1] - storedTurbulentKineticEnergy_[neighborIdx0])
= (storedTurbulentKineticEnergy(neighborIdx1) - storedTurbulentKineticEnergy(neighborIdx0))
/ (ParentType::cellCenter(neighborIdx1)[dimIdx] - ParentType::cellCenter(neighborIdx0)[dimIdx]);
// Cell centered Omega Gradient
storedDissipationGradient_[elementIdx][dimIdx]
= (storedDissipation_[neighborIdx1] - storedDissipation_[neighborIdx0])
= (storedDissipation(neighborIdx1) - storedDissipation(neighborIdx0))
/ (ParentType::cellCenter(neighborIdx1)[dimIdx] - ParentType::cellCenter(neighborIdx0)[dimIdx]);
}
}
......@@ -142,15 +140,34 @@ public:
return 0.0708;
}
public:
bool useStoredEddyViscosity() const
{
static const bool useStoredEddyViscosity = getParamFromGroup<bool>(this->paramGroup(), "RANS.UseStoredEddyViscosity", false);
return useStoredEddyViscosity;
}
Scalar storedDynamicEddyViscosity(const int elementIdx) const
{ return storedDynamicEddyViscosity_[elementIdx]; }
Scalar storedTurbulentKineticEnergy(const int elementIdx) const
{ return storedTurbulentKineticEnergy_[elementIdx]; }
Scalar storedDissipation(const int elementIdx) const
{ return storedDissipation_[elementIdx]; }
DimVector storedTurbulentKineticEnergyGradient(const int elementIdx) const
{ return storedTurbulentKineticEnergyGradient_[elementIdx]; }
DimVector storedDissipationGradient(const int elementIdx) const
{ return storedDissipationGradient_[elementIdx]; }
private:
std::vector<Scalar> storedDynamicEddyViscosity_;
std::vector<Scalar> storedTurbulentKineticEnergy_;
std::vector<Scalar> storedDissipation_;
std::vector<DimVector> storedDissipationGradient_;
std::vector<Scalar> storedTurbulentKineticEnergy_;
std::vector<DimVector> storedTurbulentKineticEnergyGradient_;
bool useStoredEddyViscosity_;
private:
//! Returns the implementation of the problem (i.e. static polymorphism)
Implementation &asImp_()
{ return *static_cast<Implementation *>(this); }
......
......@@ -86,13 +86,13 @@ public:
betaOmega_ = problem.betaOmega();
turbulentKineticEnergy_ = elemSol[0][Indices::turbulentKineticEnergyIdx];
dissipation_ = elemSol[0][Indices::dissipationIdx];
storedDissipation_ = problem.storedDissipation_[RANSParentType::elementIdx()];
storedTurbulentKineticEnergy_ = problem.storedTurbulentKineticEnergy_[RANSParentType::elementIdx()];
storedDissipationGradient_ = problem.storedDissipationGradient_[RANSParentType::elementIdx()];
storedTurbulentKineticEnergyGradient_ = problem.storedTurbulentKineticEnergyGradient_[RANSParentType::elementIdx()];
storedDissipation_ = problem.storedDissipation(RANSParentType::elementIdx());
storedTurbulentKineticEnergy_ = problem.storedTurbulentKineticEnergy(RANSParentType::elementIdx());
storedDissipationGradient_ = problem.storedDissipationGradient(RANSParentType::elementIdx());
storedTurbulentKineticEnergyGradient_ = problem.storedTurbulentKineticEnergyGradient(RANSParentType::elementIdx());
stressTensorScalarProduct_ = problem.stressTensorScalarProduct(RANSParentType::elementIdx());
if (problem.useStoredEddyViscosity_)
RANSParentType::setDynamicEddyViscosity_(problem.storedDynamicEddyViscosity_[RANSParentType::elementIdx()]);
if (problem.useStoredEddyViscosity())
RANSParentType::setDynamicEddyViscosity_(problem.storedDynamicEddyViscosity(RANSParentType::elementIdx()));
else
RANSParentType::setDynamicEddyViscosity_(calculateEddyViscosity(problem));
RANSParentType::calculateEddyDiffusivity(problem);
......
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