25#ifndef DUMUX_SINCOS_TEST_PROBLEM_HH
26#define DUMUX_SINCOS_TEST_PROBLEM_HH
28#include <dune/grid/yaspgrid.hh>
36#include "../l2error.hh"
39template <
class TypeTag>
40class SincosTestProblem;
49template<
class TypeTag>
59template<
class TypeTag>
60struct Grid<TypeTag, TTag::SincosTest> {
using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; };
63template<
class TypeTag>
66template<
class TypeTag>
68template<
class TypeTag>
70template<
class TypeTag>
83template <
class TypeTag>
94 using TimeLoopPtr = std::shared_ptr<TimeLoop<Scalar>>;
95 using SubControlVolume =
typename GridGeometry::SubControlVolume;
96 using FVElementGeometry =
typename GridGeometry::LocalView;
99 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
100 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
101 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
108 : ParentType(gridGeometry), time_(0.0), timeStepSize_(0.0)
110 isStationary_ = getParam<bool>(
"Problem.IsStationary");
111 enableInertiaTerms_ = getParam<bool>(
"Problem.EnableInertiaTerms");
112 kinematicViscosity_ = getParam<Scalar>(
"Component.LiquidKinematicViscosity", 1.0);
130 NumEqVector source(0.0);
131 const Scalar x = globalPos[0];
132 const Scalar y = globalPos[1];
133 const Scalar t = time_ + timeStepSize_;
140 source[Indices::momentumXBalanceIdx] = -2.0 * kinematicViscosity_ * cos(x) * sin(y);
141 source[Indices::momentumYBalanceIdx] = 2.0 * kinematicViscosity_ * cos(y) * sin(x);
143 if (!enableInertiaTerms_)
145 source[Indices::momentumXBalanceIdx] += 0.5 * sin(2.0 * x);
146 source[Indices::momentumYBalanceIdx] += 0.5 * sin(2.0 * y);
151 source[Indices::momentumXBalanceIdx] = -2.0 * cos(x) * sin(y) * (cos(2.0 * t) + sin(2.0 * t) * kinematicViscosity_);
152 source[Indices::momentumYBalanceIdx] = 2.0 * sin(x) * cos(y) * (cos(2.0 * t) + sin(2.0 * t) * kinematicViscosity_);
172 BoundaryTypes values;
175 values.setDirichlet(Indices::velocityXIdx);
176 values.setDirichlet(Indices::velocityYIdx);
190 const FVElementGeometry& fvGeometry,
191 const SubControlVolume& scv,
195 return (scv.dofIndex() == 0) && pvIdx == Indices::pressureIdx;
217 const Scalar x = globalPos[0];
218 const Scalar y = globalPos[1];
220 const Scalar t = time;
222 PrimaryVariables values;
227 values[Indices::pressureIdx] = -0.25 * (cos(2.0 * x) + cos(2.0 * y));
228 values[Indices::velocityXIdx] = -1.0 * cos(x) * sin(y);
229 values[Indices::velocityYIdx] = sin(x) * cos(y);
233 values[Indices::pressureIdx] *= sin(2.0 * t) * sin(2.0 * t);
234 values[Indices::velocityXIdx] *= sin(2.0 * t);
235 values[Indices::velocityYIdx] *= sin(2.0 * t);
257 PrimaryVariables values;
258 values[Indices::pressureIdx] = 0.0;
259 values[Indices::velocityXIdx] = 0.0;
260 values[Indices::velocityYIdx] = 0.0;
283 timeStepSize_ = timeStepSize;
287 static constexpr Scalar eps_ = 1e-6;
289 Scalar kinematicViscosity_;
290 bool enableInertiaTerms_;
292 Scalar timeStepSize_;
A liquid phase consisting of a single component.
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 staggered grid.
Definition: test/freeflow/navierstokes/sincos/problem.hh:85
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
Return the sources within the domain.
Definition: test/freeflow/navierstokes/sincos/problem.hh:128
PrimaryVariables analyticalSolution(const GlobalPosition &globalPos, const Scalar time) const
Returns the analytical solution of the problem at a given position.
Definition: test/freeflow/navierstokes/sincos/problem.hh:215
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/sincos/problem.hh:170
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Returns Dirichlet boundary values at a given position.
Definition: test/freeflow/navierstokes/sincos/problem.hh:203
SincosTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/freeflow/navierstokes/sincos/problem.hh:107
bool isDirichletCell(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv, int pvIdx) const
Returns whether a fixed Dirichlet value shall be used at a given cell.
Definition: test/freeflow/navierstokes/sincos/problem.hh:189
void updateTimeStepSize(const Scalar timeStepSize)
Updates the time step size.
Definition: test/freeflow/navierstokes/sincos/problem.hh:281
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: test/freeflow/navierstokes/sincos/problem.hh:120
void updateTime(const Scalar time)
Updates the time.
Definition: test/freeflow/navierstokes/sincos/problem.hh:273
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/freeflow/navierstokes/sincos/problem.hh:253
GetPropType< TypeTag, Properties::ModelTraits > ModelTraits
Definition: test/freeflow/navierstokes/sincos/problem.hh:104
Definition: test/freeflow/navierstokes/sincos/problem.hh:45
std::tuple< NavierStokes, StaggeredFreeFlowModel > InheritsFrom
Definition: test/freeflow/navierstokes/sincos/problem.hh:45
Dune::YaspGrid< 2, Dune::EquidistantOffsetCoordinates< GetPropType< TypeTag, Properties::Scalar >, 2 > > type
Definition: test/freeflow/navierstokes/sincos/problem.hh:60
A single-phase, isothermal Navier-Stokes model.
Defines a type tag and some properties for ree-flow models using the staggered scheme....