24#ifndef DUMUX_KOMEGA_PROBLEM_HH
25#define DUMUX_KOMEGA_PROBLEM_HH
45template<
class TypeTag>
61 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
62 using DimVector =
typename Element::Geometry::GlobalCoordinate;
65 RANSProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
const std::string& paramGroup =
"")
66 : ParentType(gridGeometry, paramGroup)
68 useStoredEddyViscosity_ = getParamFromGroup<bool>(this->paramGroup(),
"RANS.UseStoredEddyViscosity",
false);
76 ParentType::updateStaticWallProperties();
79 storedDynamicEddyViscosity_.resize(this->gridGeometry().elementMapper().size(), 0.0);
80 storedDissipation_.resize(this->gridGeometry().elementMapper().size(), 0.0);
81 storedDissipationGradient_.resize(this->gridGeometry().elementMapper().size(), DimVector(0.0));
82 storedTurbulentKineticEnergy_.resize(this->gridGeometry().elementMapper().size(), 0.0);
83 storedTurbulentKineticEnergyGradient_.resize(this->gridGeometry().elementMapper().size(), DimVector(0.0));
93 ParentType::updateDynamicWallProperties(curSol);
95 for (
const auto& element : elements(this->gridGeometry().gridView()))
97 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
99 auto fvGeometry =
localView(this->gridGeometry());
100 fvGeometry.bindElement(element);
101 for (
auto&& scv : scvs(fvGeometry))
103 const int dofIdx = scv.dofIndex();
104 const auto& cellCenterPriVars = curSol[GridGeometry::cellCenterIdx()][dofIdx];
105 PrimaryVariables priVars = makePriVarsFromCellCenterPriVars<PrimaryVariables>(cellCenterPriVars);
106 auto elemSol = elementSolution<typename GridGeometry::LocalView>(std::move(priVars));
108 storedDissipation_[elementIdx] = elemSol[0][Indices::dissipationEqIdx];
109 storedTurbulentKineticEnergy_[elementIdx] = elemSol[0][Indices::turbulentKineticEnergyEqIdx];
111 VolumeVariables volVars;
112 volVars.update(elemSol, asImp_(), element, scv);
113 storedDynamicEddyViscosity_[elementIdx] = volVars.calculateEddyViscosity(*
this);
118 for (
const auto& element : elements(this->gridGeometry().gridView()))
120 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
122 for (
unsigned int dimIdx = 0; dimIdx < DimVector::dimension; ++dimIdx)
124 unsigned backwardNeighbor = ParentType::neighborIdx_[elementIdx][dimIdx][0];
125 unsigned forwardNeighbor = ParentType::neighborIdx_[elementIdx][dimIdx][1];
126 storedTurbulentKineticEnergyGradient_[elementIdx][dimIdx]
127 = (storedTurbulentKineticEnergy_[forwardNeighbor]
128 - storedTurbulentKineticEnergy_[backwardNeighbor])
129 / (ParentType::cellCenter_[forwardNeighbor][dimIdx]
130 - ParentType::cellCenter_[backwardNeighbor][dimIdx]);
131 storedDissipationGradient_[elementIdx][dimIdx]
132 = (storedDissipation_[forwardNeighbor]
133 - storedDissipation_[backwardNeighbor])
134 / (ParentType::cellCenter_[forwardNeighbor][dimIdx]
135 - ParentType::cellCenter_[backwardNeighbor][dimIdx]);
156 Implementation &asImp_()
157 {
return *
static_cast<Implementation *
>(
this); }
160 const Implementation &asImp_()
const
161 {
return *
static_cast<const Implementation *
>(
this); }
Base class for all staggered fv problems.
Free function to get the local view of a grid cache object.
The available discretization methods in Dumux.
The available free flow turbulence models in Dumux.
TurbulenceModel
The available free flow turbulence models in Dumux.
Definition: turbulencemodel.hh:37
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
forward declare
Definition: dumux/freeflow/rans/problem.hh:41
Reynolds-Averaged Navier-Stokes problem base class.
Definition: dumux/freeflow/rans/problem.hh:57
std::vector< Scalar > storedTurbulentKineticEnergy_
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:150
void updateDynamicWallProperties(const SolutionVector &curSol)
Update the dynamic (solution dependent) relations to the walls.
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:91
bool useStoredEddyViscosity_
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:152
std::vector< DimVector > storedTurbulentKineticEnergyGradient_
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:151
void updateStaticWallProperties()
Correct size of the static (solution independent) wall variables.
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:74
std::vector< DimVector > storedDissipationGradient_
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:149
RANSProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string ¶mGroup="")
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:65
std::vector< Scalar > storedDynamicEddyViscosity_
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:147
std::vector< Scalar > storedDissipation_
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:148
const Scalar betaOmega() const
Returns the constant.
Definition: dumux/freeflow/rans/twoeq/komega/problem.hh:141
Declares all properties used in Dumux.
Adaption of the fully implicit scheme to the tracer transport model.
The local element solution class for staggered methods.