Commit 16314ea8 authored by Timo Koch's avatar Timo Koch
Browse files

[2p2c] Further simplify the 2p2c model properties

* inherit more from 2pnc
* move TwoPTwoCIndices -> TwoPNCIndices
* use TwoPNCVolumeVariable Traits
parent 97adbf55
add_subdirectory(sequential)
install(FILES
indices.hh
model.hh
volumevariables.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/porousmediumflow/2p2c)
......@@ -94,38 +94,11 @@
#include <dumux/porousmediumflow/compositional/localresidual.hh>
#include <dumux/porousmediumflow/compositional/switchableprimaryvariables.hh>
#include "indices.hh"
#include "volumevariables.hh"
#include <dumux/porousmediumflow/2pnc/primaryvariableswitch.hh>
#include <dumux/porousmediumflow/2pnc/vtkoutputfields.hh>
#include <dumux/porousmediumflow/2pnc/model.hh>
namespace Dumux {
/*!
* \ingroup TwoPTwoCModel
* \brief Traits class for the two-phase two-component model.
*
* \tparam PV The type used for primary variables
* \tparam FSY The fluid system type
* \tparam FST The fluid state type
* \tparam PT The type used for permeabilities
* \tparam MT The model traits
* \tparam useCS boolean to indicate if a constraint solver is to be used
*/
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, bool useCS>
struct TwoPTwoCVolumeVariablesTraits
{
using PrimaryVariables = PV;
using FluidSystem = FSY;
using FluidState = FST;
using SolidSystem = SSY;
using SolidState = SST;
using PermeabilityType = PT;
using ModelTraits = MT;
static constexpr bool useConstraintSolver = useCS;
};
#include "volumevariables.hh"
namespace Dumux {
namespace Properties {
//////////////////////////////////////////////////////////////////
......@@ -138,23 +111,6 @@ NEW_TYPE_TAG(TwoPTwoCNI, INHERITS_FROM(TwoPTwoC));
// Property values
//////////////////////////////////////////////////////////////////
/*!
* \brief Set the model traits property.
*/
SET_PROP(TwoPTwoC, ModelTraits)
{
private:
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static_assert(FluidSystem::numComponents == 2, "Only fluid systems with 2 components are supported by the 2p-2c model!");
static_assert(FluidSystem::numPhases == 2, "Only fluid systems with 2 phases are supported by the 2p-2c model!");
public:
using type = TwoPNCModelTraits<2, GET_PROP_VALUE(TypeTag, UseMoles), true, GET_PROP_VALUE(TypeTag, Formulation), GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx)>;
};
//! The primary variable switch for the 2p2c model
SET_TYPE_PROP(TwoPTwoC, PrimaryVariableSwitch, TwoPNCPrimaryVariableSwitch<TypeTag>);
//! Use the 2p2c VolumeVariables
SET_PROP(TwoPTwoC, VolumeVariables)
{
......@@ -167,44 +123,46 @@ private:
using MT = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using PT = typename GET_PROP_TYPE(TypeTag, SpatialParams)::PermeabilityType;
static constexpr bool useCS = GET_PROP_VALUE(TypeTag, UseConstraintSolver);
static_assert(FSY::numComponents == 2, "Only fluid systems with 2 components are supported by the 2p2c model!");
static_assert(FSY::numPhases == 2, "Only fluid systems with 2 phases are supported by the 2p2c model!");
using Traits = TwoPTwoCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, useCS>;
static constexpr bool useConstraintSolver = GET_PROP_VALUE(TypeTag, UseConstraintSolver);
using Traits = TwoPNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT>;
public:
using type = TwoPTwoCVolumeVariables<Traits>;
using type = TwoPTwoCVolumeVariables<Traits, useConstraintSolver>;
};
//! Determines whether the constraint solver is used
SET_BOOL_PROP(TwoPTwoC, UseConstraintSolver, true);
//! Somerton is used as default model to compute the effective thermal heat conductivity
SET_PROP(TwoPTwoCNI, ThermalConductivityModel)
{
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
public:
using type = ThermalConductivitySomerton<Scalar>;
};
//////////////////////////////////////////////////////////////////
// Property values for isothermal model required for the general non-isothermal model
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// Properties for the non-isothermal 2p2c model (inherited from 2pnc)
//////////////////////////////////////////////////////////////////////
//! Set the non-isothermal model traits
SET_PROP(TwoPTwoCNI, ModelTraits)
{
private:
//! we use the number of components specified by the fluid system here
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static_assert(FluidSystem::numComponents == 2, "Only fluid systems with 2 components are supported by the 2p-2c model!");
static_assert(FluidSystem::numPhases == 2, "Only fluid systems with 2 phases are supported by the 2p-2c model!");
using Traits = TwoPNCModelTraits< 2, GET_PROP_VALUE(TypeTag, UseMoles), true, GET_PROP_VALUE(TypeTag, Formulation), GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx)>;
static_assert(FluidSystem::numComponents == 2, "Only fluid systems with 2 components are supported by the 2p2c model!");
static_assert(FluidSystem::numPhases == 2, "Only fluid systems with 2 phases are supported by the 2p2c model!");
using IsothermalTraits = TwoPNCModelTraits<FluidSystem::numComponents,
GET_PROP_VALUE(TypeTag, UseMoles),
/*setMoleFractionsForFirstPhase=*/true,
GET_PROP_VALUE(TypeTag, Formulation),
GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx)>;
public:
using type = PorousMediumFlowNIModelTraits< Traits >;
using type = PorousMediumFlowNIModelTraits<IsothermalTraits>;
};
//! Set non-isothermal output fields
SET_TYPE_PROP(TwoPTwoCNI, VtkOutputFields, EnergyVtkOutputFields<TwoPNCVtkOutputFields>);
//! Somerton is used as default model to compute the effective thermal heat conductivity
SET_TYPE_PROP(TwoPTwoCNI, ThermalConductivityModel, ThermalConductivitySomerton<typename GET_PROP_TYPE(TypeTag, Scalar)>);
} // end namespace Properties
} // end namespace Dumux
......
......@@ -42,7 +42,7 @@ namespace Dumux {
* \brief Contains the quantities which are constant within a
* finite volume in the two-phase two-component model.
*/
template <class Traits>
template <class Traits, bool useConstraintSolver = true>
class TwoPTwoCVolumeVariables
: public PorousMediumFlowVolumeVariables<Traits>
, public EnergyVolumeVariables<Traits, TwoPTwoCVolumeVariables<Traits> >
......@@ -81,9 +81,6 @@ class TwoPTwoCVolumeVariables
// formulations
static constexpr auto formulation = ModelTraits::priVarFormulation();
// further specifications on the variables update
static constexpr bool useConstraintSolver = Traits::useConstraintSolver;
using PermeabilityType = typename Traits::PermeabilityType;
using ComputeFromReferencePhase = Dumux::ComputeFromReferencePhase<Scalar, typename Traits::FluidSystem>;
using MiscibleMultiPhaseComposition = Dumux::MiscibleMultiPhaseComposition< Scalar, typename Traits::FluidSystem >;
......
install(FILES
indices.hh
model.hh
primaryvariableswitch.hh
volumevariables.hh
......
......@@ -18,19 +18,19 @@
*****************************************************************************/
/*!
* \file
* \ingroup TwoPTwoCModel
* \brief Defines the indices required for the two-phase two-component model
* \ingroup TwoPNCModel
* \brief Defines the indices required for the two-phase n-component model
*/
#ifndef DUMUX_2P2C_INDICES_HH
#define DUMUX_2P2C_INDICES_HH
#ifndef DUMUX_2PNC_INDICES_HH
#define DUMUX_2PNC_INDICES_HH
namespace Dumux {
/*!
* \brief The indices for the isothermal two-phase two-component model.
* \ingroup TwoPTwoCModel
* \brief The indices for the isothermal two-phase n-component model
* \ingroup TwoPNCModel
*/
struct TwoPTwoCIndices
struct TwoPNCIndices
{
// present phases (-> 'pseudo' primary variable)
static constexpr int firstPhaseOnly = 1; //!< Only the first phase (in fluid system) is present
......
......@@ -100,11 +100,11 @@
#include <dumux/porousmediumflow/nonisothermal/indices.hh>
#include <dumux/porousmediumflow/nonisothermal/vtkoutputfields.hh>
#include <dumux/porousmediumflow/2p/formulation.hh>
#include <dumux/porousmediumflow/2p2c/indices.hh>
#include "volumevariables.hh"
#include "primaryvariableswitch.hh"
#include "vtkoutputfields.hh"
#include "indices.hh"
namespace Dumux {
......@@ -119,7 +119,7 @@ namespace Dumux {
template<int nComp, bool useMol, bool setMoleFractionForFP, TwoPFormulation formulation, int repCompEqIdx = nComp>
struct TwoPNCModelTraits
{
using Indices = TwoPTwoCIndices;
using Indices = TwoPNCIndices;
static constexpr int numEq() { return nComp; }
static constexpr int numPhases() { return 2; }
......
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