Commit 90522834 authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

[laws] tell the public your discretization method

The laws now have a static const public variable stating which
discretization method they belong to. That makes it possible to use
the TPFA darcys law implementation in an mpfa context by changing the
MolecularDiffusionType property.
parent 0ea9c7ad
......@@ -67,6 +67,9 @@ class DarcysLawImplementation<TypeTag, DiscretizationMethods::CCMpfa>
static const bool useTpfaBoundary = GET_PROP_VALUE(TypeTag, UseTpfaBoundary);
public:
// state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCMpfa;
static Scalar flux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......
......@@ -60,6 +60,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCMpfa>
using Stencil = std::vector<IndexType>;
public:
// state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCMpfa;
static Scalar flux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......
......@@ -24,6 +24,7 @@
#define DUMUX_DISCRETIZATION_CCMPFA_GLOBAL_FLUXVARSCACHE_FILLER_BASE_HH
#include <dumux/implicit/properties.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux
{
......@@ -150,6 +151,7 @@ class CCMpfaDiffusionCacheFiller
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using InteractionVolume = typename GET_PROP_TYPE(TypeTag, InteractionVolume);
using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using MolecularDiffusionType = typename GET_PROP_TYPE(TypeTag, MolecularDiffusionType);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
......@@ -169,6 +171,11 @@ public:
const SubControlVolumeFace& scvf,
FluxVarsCacheContainer& fluxVarsCacheContainer)
{
//! If the problem does not use an mpfa method for diffusion, do nothing
//! This is known at compile time so it gets optimized away
if (MolecularDiffusionType::myDiscretizationMethod != DiscretizationMethods::CCMpfa)
return;
if (problem.model().globalFvGeometry().scvfTouchesBoundary(scvf))
{
const auto& seed = problem.model().globalFvGeometry().boundaryInteractionVolumeSeed(scvf);
......
......@@ -71,6 +71,8 @@ class DarcysLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
// state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCTpfa;
static Scalar flux(const Problem& problem,
const Element& element,
......
......@@ -72,6 +72,8 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa >
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
// state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCTpfa;
static Scalar flux(const Problem& problem,
const Element& element,
......
......@@ -72,6 +72,8 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
using ThermalConductivityModel = typename GET_PROP_TYPE(TypeTag, ThermalConductivityModel);
public:
// state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCTpfa;
static Scalar flux(const Problem& problem,
const Element& element,
......
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