Commit 1cd534e3 authored by Leopold Stadler's avatar Leopold Stadler Committed by Timo Koch
Browse files

[shallowwater] use fluxvariables

parent 04d8f17f
......@@ -19,7 +19,7 @@
/*!
* \file
* \ingroup ShallowWater
* \brief Compute the boundary fluxes based on the Riemann invariants
* \brief Compute boundary conditions (cell state) via Riemann invariants
*
*/
#ifndef DUMUX_SHALLOWWATER_BOUNDARYFLUXES_HH
......@@ -32,6 +32,9 @@
namespace Dumux {
namespace ShallowWater {
/*!
* \brief compute the cell state for fixed water depth boundary.
*/
template<class Scalar, class GlobalPosition>
std::array<Scalar,3> fixedWaterDepthBoundary(Scalar waterDepthBoundary,
Scalar waterDepthLeft,
......@@ -45,8 +48,8 @@ std::array<Scalar,3> fixedWaterDepthBoundary(Scalar waterDepthBoundary,
{
std::array<Scalar,3> cellStateRight;
cellStateRight[0] = waterDepthBoundary;
using std::sqrt;
auto uboundIn = nxy[0] * velocityXLeft + nxy[1] * velocityYLeft ;
auto uboundQut = uboundIn + 2.0 * sqrt(9.81 * waterDepthLeft) - 2.0 * sqrt(9.81 * cellStateRight[0]);
......@@ -56,6 +59,9 @@ std::array<Scalar,3> fixedWaterDepthBoundary(Scalar waterDepthBoundary,
return cellStateRight;
}
/*!
* \brief compute the cell state for a fixed discharge boundary.
*/
template<class Scalar, class GlobalPosition>
std::array<Scalar,3> fixedDischargeBoundary(Scalar dischargeBoundary,
Scalar waterDepthLeft,
......
......@@ -49,6 +49,16 @@ class ShallowWaterFluxVariables
using AdvectionType = GetPropType<TypeTag, Properties::AdvectionType>;
//using DiffusionType = GetPropType<TypeTag, Properties::DiffusionType>;
using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using FVElementGeometry = typename FVGridGeometry::LocalView;
using GridView = typename FVGridGeometry::GridView;
using Element = typename GridView::template Codim<0>::Entity;
using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
static constexpr bool enableAdvection = ModelTraits::enableAdvection();
static constexpr bool enableDiffusion = ModelTraits::enableDiffusion();
......@@ -59,19 +69,16 @@ public:
* \brief Returns the advective flux computed by the Riemann solver
*
*/
NumEqVector advectiveFlux() const
NumEqVector advectiveFlux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
const SubControlVolumeFace& scvf) const
{
NumEqVector fluxVector(0.0);
if (enableAdvection)
{
return AdvectionType::flux(this->problem(),
this->element(),
this->fvGeometry(),
this->elemVolVars(),
this->scvFace(),
this->elemFluxVarsCache());
return AdvectionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
}
else
{
......@@ -83,18 +90,16 @@ public:
* \brief Returns the diffusive flux (e.g. diffusion of tracer)
*
*/
NumEqVector diffusiveFlux() const
NumEqVector diffusiveFlux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
const SubControlVolumeFace& scvf) const
{
NumEqVector fluxVector(0.0);
if (enableDiffusion)
{
/*return DiffusionType::flux(this->problem(),
this->element(),
this->fvGeometry(),
this->elemVolVars(),
this->scvFace(),
this->elemFluxVarsCache());
*/
// TODO: add diffusive flux (e.g. tracer and viscosity)
return fluxVector;
}
......
......@@ -51,6 +51,7 @@ class ShallowWaterResidual : public GetPropType<TypeTag, Properties::BaseLocalRe
using Element = typename GridView::template Codim<0>::Entity;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using AdvectionType = GetPropType<TypeTag, Properties::AdvectionType>;
using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>;
public:
......@@ -96,11 +97,11 @@ public:
const SubControlVolumeFace& scvf,
const ElementFluxVariablesCache& elemFluxVarsCache) const
{
NumEqVector flux(0.0);
auto numFlux = AdvectionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
//auto turbFlux = DiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
flux = numFlux; //+ turbFlux;
FluxVariables fluxVars;
auto advectiveFlux = fluxVars.advectiveFlux(problem, element, fvGeometry, elemVolVars, scvf);
auto diffusiveFlux = fluxVars.diffusiveFlux(problem, element, fvGeometry, elemVolVars, scvf);
flux = advectiveFlux + diffusiveFlux;
return flux;
}
......
......@@ -81,13 +81,19 @@ namespace Dumux {
* \ingroup ShallowWaterModel
* \brief Specifies a number properties of shallow water models.
*/
template <class TypeTag>
struct ShallowWaterModelTraits
{
using Indices = ShallowWaterIndices;
static constexpr int numEq() { return 3; }
static constexpr int numPhases() { return 1; }
//! Enable advection
static constexpr bool enableAdvection() { return true; }
//! Enable diffusion
static constexpr bool enableDiffusion() { return false; }
};
/*!
......@@ -147,7 +153,7 @@ struct EnableThermalNonEquilibrium<TypeTag, TTag::ShallowWater> { static constex
//////////////////////////////////////////////////////////////////
template<class TypeTag>
struct ModelTraits<TypeTag, TTag::ShallowWater> {using type = ShallowWaterModelTraits<TypeTag>;};
struct ModelTraits<TypeTag, TTag::ShallowWater> {using type = ShallowWaterModelTraits;};
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::ShallowWater> {using type = ShallowWaterResidual<TypeTag>;};
......
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