Skip to content
Snippets Groups Projects
Commit dac3d0ee authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

Merge branch 'feature/free-switchable-privars-from-typetag' into 'master'

[compositional] Free switchable privars from typetag

See merge request !821
parents 127e1226 8c083b62
No related branches found
No related tags found
1 merge request!821[compositional] Free switchable privars from typetag
......@@ -57,6 +57,8 @@
#ifndef DUMUX_2P1C_MODEL_HH
#define DUMUX_2P1C_MODEL_HH
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh>
......@@ -158,7 +160,14 @@ SET_TYPE_PROP(TwoPOneCNI, VolumeVariables, TwoPOneCVolumeVariables<TypeTag>);
SET_TYPE_PROP(TwoPOneCNI, PrimaryVariableSwitch, TwoPOneCPrimaryVariableSwitch<TypeTag>);
//! The primary variables vector for the 2p1cni model.
SET_TYPE_PROP(TwoPOneCNI, PrimaryVariables, SwitchablePrimaryVariables<TypeTag, int>);
SET_PROP(TwoPOneCNI, PrimaryVariables)
{
private:
using PrimaryVariablesVector = Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>;
public:
using type = SwitchablePrimaryVariables<PrimaryVariablesVector, int>;
};
//! Somerton is used as default model to compute the effective thermal heat conductivity.
SET_PROP(TwoPOneCNI, ThermalConductivityModel)
......
......@@ -77,6 +77,8 @@
#ifndef DUMUX_2P2C_MODEL_HH
#define DUMUX_2P2C_MODEL_HH
#include <dune/common/fvector.hh>
// property forward declarations
#include <dumux/common/properties.hh>
#include <dumux/porousmediumflow/properties.hh>
......@@ -94,11 +96,9 @@
#include "primaryvariableswitch.hh"
#include "vtkoutputfields.hh"
namespace Dumux
{
namespace Dumux {
namespace Properties {
namespace Properties
{
//////////////////////////////////////////////////////////////////
// Type tags
//////////////////////////////////////////////////////////////////
......@@ -178,7 +178,14 @@ SET_BOOL_PROP(TwoPTwoC, EnableEnergyBalance, false);
SET_TYPE_PROP(TwoPTwoC, PrimaryVariableSwitch, TwoPTwoCPrimaryVariableSwitch<TypeTag>);
//! The primary variables vector for the 2p2c model
SET_TYPE_PROP(TwoPTwoC, PrimaryVariables, SwitchablePrimaryVariables<TypeTag, int>);
SET_PROP(TwoPTwoC, PrimaryVariables)
{
private:
using PrimaryVariablesVector = Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>;
public:
using type = SwitchablePrimaryVariables<PrimaryVariablesVector, int>;
};
//! Use the 2p2c VolumeVariables
SET_TYPE_PROP(TwoPTwoC, VolumeVariables, TwoPTwoCVolumeVariables<TypeTag>);
......
......@@ -85,6 +85,8 @@
#ifndef DUMUX_2PNC_MODEL_HH
#define DUMUX_2PNC_MODEL_HH
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
#include <dumux/material/spatialparams/fv.hh>
......@@ -115,7 +117,16 @@ NEW_TYPE_TAG(TwoPNCNI, INHERITS_FROM(TwoPNC, NonIsothermal));
//////////////////////////////////////////////////////////////////
// Properties for the isothermal 2pnc model
//////////////////////////////////////////////////////////////////
SET_TYPE_PROP(TwoPNC, PrimaryVariables, SwitchablePrimaryVariables<TypeTag, int>); //!< The primary variables vector for the 2pnc model
//! The primary variables vector for the 2pnc model
SET_PROP(TwoPNC, PrimaryVariables)
{
private:
using PrimaryVariablesVector = Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>;
public:
using type = SwitchablePrimaryVariables<PrimaryVariablesVector, int>;
};
SET_TYPE_PROP(TwoPNC, PrimaryVariableSwitch, TwoPNCPrimaryVariableSwitch<TypeTag>); //!< The primary variable switch for the 2pnc model
SET_TYPE_PROP(TwoPNC, VolumeVariables, TwoPNCVolumeVariables<TypeTag>); //!< the VolumeVariables property
SET_TYPE_PROP(TwoPNC, Indices, TwoPNCIndices <TypeTag, /*PVOffset=*/0>); //!< The indices required by the isothermal 2pnc model
......
......@@ -78,6 +78,8 @@
#ifndef DUMUX_3P3C_MODEL_HH
#define DUMUX_3P3C_MODEL_HH
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
#include <dumux/porousmediumflow/properties.hh>
#include <dumux/porousmediumflow/nonisothermal/model.hh>
......@@ -165,7 +167,14 @@ SET_BOOL_PROP(ThreePThreeC, EnableEnergyBalance, false);
SET_TYPE_PROP(ThreePThreeC, PrimaryVariableSwitch, ThreePThreeCPrimaryVariableSwitch<TypeTag>);
//! The primary variables vector for the 3p3c model
SET_TYPE_PROP(ThreePThreeC, PrimaryVariables, SwitchablePrimaryVariables<TypeTag, int>);
SET_PROP(ThreePThreeC, PrimaryVariables)
{
private:
using PrimaryVariablesVector = Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>;
public:
using type = SwitchablePrimaryVariables<PrimaryVariablesVector, int>;
};
//! the VolumeVariables property
SET_TYPE_PROP(ThreePThreeC, VolumeVariables, ThreePThreeCVolumeVariables<TypeTag>);
......
......@@ -71,8 +71,9 @@
#ifndef DUMUX_3P2CNI_MODEL_HH
#define DUMUX_3P2CNI_MODEL_HH
#include <dumux/common/properties.hh>
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
#include <dumux/material/spatialparams/fv.hh>
#include <dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh>
#include <dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh>
......@@ -171,7 +172,14 @@ SET_BOOL_PROP(ThreePWaterOilNI, EnableEnergyBalance, true);
SET_TYPE_PROP(ThreePWaterOilNI, PrimaryVariableSwitch, ThreePWaterOilPrimaryVariableSwitch<TypeTag>);
//! The primary variables vector for the 3p3c model
SET_TYPE_PROP(ThreePWaterOilNI, PrimaryVariables, SwitchablePrimaryVariables<TypeTag, int>);
SET_PROP(ThreePWaterOilNI, PrimaryVariables)
{
private:
using PrimaryVariablesVector = Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>;
public:
using type = SwitchablePrimaryVariables<PrimaryVariablesVector, int>;
};
//! Determines whether a constraint solver should be used explicitly
SET_BOOL_PROP(ThreePWaterOilNI, OnlyGasPhaseCanDisappear, true);
......
......@@ -25,8 +25,6 @@
#define DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
#include <dune/common/exceptions.hh>
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
namespace Dumux {
......@@ -34,12 +32,10 @@ namespace Dumux {
* \ingroup PorousmediumCompositional
* \brief A primary variable vector with a state to allow variable switches
*/
template<class TypeTag, class StateType>
class SwitchablePrimaryVariables : public Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>
template<class PrimaryVariables, class StateType>
class SwitchablePrimaryVariables : public PrimaryVariables
{
using ParentType = Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>;
using ParentType = PrimaryVariables;
public:
//! inherit the constructors
using ParentType::ParentType;
......@@ -74,7 +70,6 @@ public:
private:
StateType state_;
bool stateIsSet_{false};
};
} // end namespace Dumux
......
......@@ -91,6 +91,8 @@
#ifndef DUMUX_RICHARDS_MODEL_HH
#define DUMUX_RICHARDS_MODEL_HH
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
#include <dumux/porousmediumflow/immiscible/localresidual.hh>
......@@ -170,8 +172,15 @@ SET_BOOL_PROP(Richards, EnableEnergyBalance, false);
//! The class with all index definitions for the model
SET_TYPE_PROP(Richards, Indices, RichardsIndices);
//! The class with all index definitions for the model
SET_TYPE_PROP(Richards, PrimaryVariables, SwitchablePrimaryVariables<TypeTag, int>);
//! The primary variables vector for the richards model
SET_PROP(Richards, PrimaryVariables)
{
private:
using PrimaryVariablesVector = Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEq)>;
public:
using type = SwitchablePrimaryVariables<PrimaryVariablesVector, int>;
};
//! The primary variable switch for the richards model
SET_TYPE_PROP(Richards, PrimaryVariableSwitch, ExtendedRichardsPrimaryVariableSwitch<TypeTag>);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment