25#ifndef DUMUX_CHANNEL_TEST_PROBLEM_HH
26#define DUMUX_CHANNEL_TEST_PROBLEM_HH
28#include <dune/grid/yaspgrid.hh>
39template <
class TypeTag>
40class ChannelTestProblem;
53template<
class TypeTag>
65template<
class TypeTag>
66struct Grid<TypeTag, TTag::ChannelTest> {
using type = Dune::YaspGrid<2>; };
69template<
class TypeTag>
72template<
class TypeTag>
75template<
class TypeTag>
77template<
class TypeTag>
92template <
class TypeTag>
99 using FVElementGeometry =
typename GridGeometry::LocalView;
100 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
106 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
107 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
109 using TimeLoopPtr = std::shared_ptr<CheckPointTimeLoop<Scalar>>;
112 enum class OutletCondition
114 outflow, doNothing, neumannXdirichletY, neumannXneumannY
119 : ParentType(gridGeometry), eps_(1e-6)
121 inletVelocity_ = getParam<Scalar>(
"Problem.InletVelocity");
122 const auto tmp = getParam<std::string>(
"Problem.OutletCondition",
"Outflow");
123 if (tmp ==
"Outflow")
124 outletCondition_ = OutletCondition::outflow;
125 else if (tmp ==
"DoNothing")
126 outletCondition_ = OutletCondition::doNothing;
127 else if (tmp ==
"NeumannX_DirichletY")
128 outletCondition_ = OutletCondition::neumannXdirichletY;
129 else if (tmp ==
"NeumannX_NeumannY")
130 outletCondition_ = OutletCondition::neumannXneumannY;
132 DUNE_THROW(Dune::InvalidStateException, tmp +
" is not a valid outlet boundary condition");
134 useVelocityProfile_ = getParam<bool>(
"Problem.UseVelocityProfile",
false);
135 outletPressure_ = getParam<Scalar>(
"Problem.OutletPressure", 1.1e5);
149 {
return 273.15 + 10; }
158 return NumEqVector(0.0);
174 BoundaryTypes values;
176 if(isInlet_(globalPos))
178 values.setDirichlet(Indices::velocityXIdx);
179 values.setDirichlet(Indices::velocityYIdx);
181 values.setDirichlet(Indices::temperatureIdx);
184 else if(isOutlet_(globalPos))
186 if (outletCondition_ == OutletCondition::outflow)
187 values.setDirichlet(Indices::pressureIdx);
188 else if (outletCondition_ == OutletCondition::doNothing ||
189 outletCondition_ == OutletCondition::neumannXneumannY)
191 values.setNeumann(Indices::momentumXBalanceIdx);
192 values.setNeumann(Indices::momentumYBalanceIdx);
196 values.setDirichlet(Indices::velocityYIdx);
197 values.setNeumann(Indices::momentumXBalanceIdx);
200 values.setOutflow(Indices::energyEqIdx);
205 values.setDirichlet(Indices::velocityXIdx);
206 values.setDirichlet(Indices::velocityYIdx);
208 values.setNeumann(Indices::energyEqIdx);
224 if(isInlet_(globalPos))
229 values[Indices::temperatureIdx] = 293.15;
233 values[Indices::velocityXIdx] = 0.0;
247 template<
class ElementVolumeVariables,
class ElementFaceVariables>
249 const FVElementGeometry& fvGeometry,
250 const ElementVolumeVariables& elemVolVars,
251 const ElementFaceVariables& elemFaceVars,
252 const SubControlVolumeFace& scvf)
const
254 NumEqVector values(0.0);
256 values[scvf.directionIndex()] =
initialAtPos(scvf.center())[Indices::pressureIdx];
259 if (getPropValue<TypeTag, Properties::NormalizePressure>())
260 values[scvf.directionIndex()] -=
initialAtPos(scvf.center())[Indices::pressureIdx];
262 if (outletCondition_ != OutletCondition::doNothing)
263 values[1] = -
dudy(scvf.center()[1], inletVelocity_) * elemVolVars[scvf.insideScvIdx()].viscosity();
276 const Scalar yMin = this->gridGeometry().bBoxMin()[1];
277 const Scalar yMax = this->gridGeometry().bBoxMax()[1];
278 return vMax * (y - yMin)*(yMax - y) / (0.25*(yMax - yMin)*(yMax - yMin));
288 Scalar
dudy(
const Scalar y,
const Scalar vMax)
const
290 const Scalar yMin = this->gridGeometry().bBoxMin()[1];
291 const Scalar yMax = this->gridGeometry().bBoxMax()[1];
292 return vMax * (4.0*yMin + 4*yMax - 8.0*y) / ((yMin-yMax)*(yMin-yMax));
309 PrimaryVariables values;
310 values[Indices::pressureIdx] = outletPressure_;
311 values[Indices::velocityYIdx] = 0.0;
314 values[Indices::temperatureIdx] = 283.15;
317 if (useVelocityProfile_)
318 values[Indices::velocityXIdx] =
parabolicProfile(globalPos[1], inletVelocity_);
320 values[Indices::velocityXIdx] = inletVelocity_;
328 timeLoop_ = timeLoop;
329 if(inletVelocity_ > eps_)
330 timeLoop_->setCheckPoint({200.0, 210.0});
335 return timeLoop_->time();
340 bool isInlet_(
const GlobalPosition& globalPos)
const
342 return globalPos[0] < eps_;
345 bool isOutlet_(
const GlobalPosition& globalPos)
const
347 return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_;
351 Scalar inletVelocity_;
352 Scalar outletPressure_;
353 OutletCondition outletCondition_;
354 bool useVelocityProfile_;
355 TimeLoopPtr timeLoop_;
A liquid phase consisting of a single component.
A much simpler (and thus potentially less buggy) version of pure water.
Setting constant fluid properties via the input file.
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
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Definition: common/properties.hh:169
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
specifies if data on flux vars should be saved (faster, but more memory consuming)
Definition: common/properties.hh:188
The type of the fluid system to use.
Definition: common/properties.hh:223
Navier-Stokes problem base class.
Definition: dumux/freeflow/navierstokes/problem.hh:63
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
Test problem for the one-phase (Navier-) Stokes problem in a channel.
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:94
Scalar dudy(const Scalar y, const Scalar vMax) const
The partial dervivative of the horizontal velocity (following a parabolic profile for Stokes flow) w....
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:288
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann control volume.
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:248
Scalar parabolicProfile(const Scalar y, const Scalar vMax) const
A parabolic velocity profile.
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:274
void setTimeLoop(TimeLoopPtr timeLoop)
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:326
ChannelTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:118
Scalar time() const
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:333
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:307
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
Returns the sources within the domain.
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:156
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary cont...
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:172
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:148
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:220
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:46
std::tuple< NavierStokes, StaggeredFreeFlowModel > InheritsFrom
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:46
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:56
Dune::YaspGrid< 2 > type
Definition: test/freeflow/navierstokes/channel/2d/problem.hh:66
A single-phase, isothermal Navier-Stokes model.
Defines a type tag and some properties for ree-flow models using the staggered scheme....