Discussion: Reintroduce model class as a way to specify model properties / Remove TypeTag as template argument whereever feasible
I think it might make sense to reintroduce the model class as a place to specify things associated with a specific mathematical model, e.g. 2-phase 2-component porousmedium flow. In contrast to the old model class this class would know nothing about the linear algebra (solution, Jacobian), temporal or spatial discretization. Its member functions / data members would probably most all be static and constexpr. An idea would be something like
namespace Properties {
SET_PROP(TwoPTwoC, Model)
{
private:
// Some easy customization points through the property system
using FluidSystem = GET_PROP_TYPE(TypeTag, FluidSystem);
using ...
public:
// there are quite many template arguments but they can be conveniently set through the property system
using type = TwoPNCModel<FluidSystem, FluidState, ...>;
};
} // end namespace Properties
template<FSystem, BalanceTraits, ...>
class TwoPNCModel
{
// model specific constants
static constexpr std::size_t numEq() { return 2; }
static constexpr std::size_t numComponents() { return FSystem::numComponents; }
....
// model specific options, template parameters offer customization points through Traits/Policies
static constexpr bool useMoles() { return BalanceTraits::useMoles(); }
...
// model specific types
enum class Index // might be also a struct templated by formulation
{
pressureIdx = 0,
saturationIdx = 1
};
...
// model specific functions
template<typename Scalar>
static constexpr void checkPhysicalBounds(Scalar priVar, Index i)
{ ... }
static constexpr void defaultParams(Dune::ParameterTree& params, const std::string& paramGroup = "")
{ ... }
...
};
Other classes could get the model as a template parameter and extract a lot of types and other information from it.
Edited by Bernd Flemisch