Commit e2c53337 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[sequential] replace decoupled by sequential

Replace the word "Decoupled" in TypeTags and classes by "Sequential",
according to FS#252.

For both the TypeTags and the Decoupled...Indices classes, the compilers
don't emit a deprecation warning. For the TypeTags, a run-time check is
performed at the end of the start() routine.
parent 2472fa94
......@@ -41,11 +41,19 @@ Differences Between DuMuX 2.8 and DuMuX 2.9
compiler will not print any warning if a deprecated property or parameter name
is used. However, a run-time warning should appear in the summary lines after
the corresponding run.
- The word "Decoupled" in the TypeTags has been replaced by "Sequential":
DecoupledModel -> SequentialModel
DecoupledOneP -> SequentialOneP
DecoupledTwoP -> SequentialTwoP
DecoupledTwoPTwoC -> SequentialTwoPTwoC
DecoupledTwoPTwoCAdaptive -> SequentialTwoPTwoCAdaptive
* Deprecated CLASSES/FILES, to be removed after 2.9:
- CubeGridCreator, functionality available in default GridCreator (since 2.8)
- SimplexGridCreator, functionality available in default GridCreator (since 2.8)
- DgfGridCreator, functionality available in default GridCreator (since 2.8)
- Decoupled...Indices -> Sequential...Indices (BEWARE: no compiler warnings)
* Deprecated MEMBER FUNCTIONS, to be removed after 2.9:
......
......@@ -31,8 +31,11 @@
#include <list>
#include <sstream>
#include <unordered_map>
#include <tuple>
#include <dune/common/parametertree.hh>
#include <dune/common/classname.hh>
#include <dune/common/dynmatrix.hh>
#include <dumux/common/propertysystem.hh>
#include <dumux/common/exceptions.hh>
......
......@@ -46,6 +46,7 @@
#include <set>
#include <sstream>
#include <string>
#include <vector>
// For is_base_of
#include <type_traits>
......@@ -1080,6 +1081,169 @@ const std::string getDiagnostic(std::string propTagName)
#endif // !defined NO_PROPERTY_INTROSPECTION
template <class TypeTag, class Ancestor>
class AncestorAdder;
template <class TypeTag>
class TypeTagAncestors
{
public:
typedef std::vector<std::vector<std::string>> AncestorMatrix;
static void addAncestors()
{
AncestorAdder<TypeTag, TypeTag>::add();
}
static AncestorMatrix& ancestors()
{
static AncestorMatrix ancestors_;
return ancestors_;
};
static int& row()
{
static int row_ = 0;
return row_;
}
static void print(std::ostream& os)
{
const auto& a = ancestors();
std::vector<size_t> colSizes;
for (size_t i = 0; i < a.size(); ++i)
{
auto numCols = a[i].size();
colSizes.resize(numCols);
std::vector<bool> bifurcation(numCols, false);
for (size_t j = 0; j < numCols; ++j)
{
for (int below = i+1; below < a.size(); ++below)
{
if (j > 0 && a[below].size() > j && !a[below][j].empty())
{
if (a[below][j-1].empty())
{
bifurcation[j] = true;
break;
}
else
{
break;
}
}
}
if (a[i][j].empty())
{
if (bifurcation[j])
os << " | ";
else if (j > 0)
os << " ";
os << std::string(colSizes[j], ' ');
}
else
{
if (j > 0)
os << " - ";
os << a[i][j];
colSizes[j] = a[i][j].size();
}
}
os << std::endl;
for (size_t j = 0; j < numCols; ++j)
{
if (bifurcation[j])
os << " | ";
else if (j > 0)
os << " ";
os << std::string(colSizes[j], ' ');
}
os << std::endl;
}
}
static bool contains(const std::string& str)
{
const auto& a = ancestors();
for (size_t i = 0; i < a.size(); ++i)
{
for (size_t j = 0; j < a[i].size(); ++j)
{
auto found = a[i][j].find(str);
if (found != std::string::npos)
return true;
}
}
return false;
}
};
template <class TypeTag, class Ancestor>
class AncestorAdder
{
using TTAncestors = TypeTagAncestors<TypeTag>;
public:
static void add(unsigned col = 0)
{
auto& ancestors = TTAncestors::ancestors();
auto ancestorFull = Dune::className<Ancestor>();
// 25 is the size of "Dumux::Properties::TTag"
auto ancestorName = ancestorFull.substr(25, ancestorFull.size() - 25);
if (ancestors.size() < TTAncestors::row()+1)
{
ancestors.resize(TTAncestors::row()+1);
}
if (ancestors[TTAncestors::row()].size() < col+1)
{
ancestors[TTAncestors::row()].resize(col+1);
}
ancestors[TTAncestors::row()][col] = ancestorName;
AncestorAdder<TypeTag, typename Ancestor::Child1>::add(++col);
if (Dune::className<typename Ancestor::Child2>() != "void")
{
TTAncestors::row()++;
}
AncestorAdder<TypeTag, typename Ancestor::Child2>::add(col);
if (Dune::className<typename Ancestor::Child3>() != "void")
{
TTAncestors::row()++;
}
AncestorAdder<TypeTag, typename Ancestor::Child3>::add(col);
if (Dune::className<typename Ancestor::Child4>() != "void")
{
TTAncestors::row()++;
}
AncestorAdder<TypeTag, typename Ancestor::Child4>::add(col);
if (Dune::className<typename Ancestor::Child5>() != "void")
{
TTAncestors::row()++;
}
AncestorAdder<TypeTag, typename Ancestor::Child5>::add(col);
}
};
template <class TypeTag>
class AncestorAdder<TypeTag, void>
{
public:
static void add(unsigned col = 0){}
};
//! \endcond
} // namespace Properties
......
......@@ -472,6 +472,17 @@ int start_(int argc,
if (printParams && mpiHelper.rank() == 0) {
Dumux::Parameters::print<TypeTag>();
}
// check if a deprecated TypeTag has been used
Properties::TypeTagAncestors<TypeTag>::addAncestors();
if (Properties::TypeTagAncestors<TypeTag>::contains("Decoupled"))
{
std::cout << "\nAt least one of the used TypeTags contains the "
<< "deprecated name \"Decoupled\":" << std::endl;
Properties::TypeTagAncestors<TypeTag>::print(std::cout);
std::cout << "Please use \"Sequential\" instead." << std::endl;
}
return 0;
}
......
......@@ -140,8 +140,8 @@ public:
typedef typename SolverTraits::Smoother Smoother;
};
//! Decoupled model: use the overlapping AMG
SET_PROP(DecoupledModel, AmgTraits)
//! Sequential model: use the overlapping AMG
SET_PROP(SequentialModel, AmgTraits)
{
public:
typedef typename GET_PROP_TYPE(TypeTag, PressureCoefficientMatrix) JacobianMatrix;
......
......@@ -41,7 +41,7 @@ namespace Properties
//////////////////////////////////////////////////////////////////
//! The type tag for 1p pressure models
NEW_TYPE_TAG(PressureOneP, INHERITS_FROM(Pressure, DecoupledOneP));
NEW_TYPE_TAG(PressureOneP, INHERITS_FROM(Pressure, SequentialOneP));
//////////////////////////////////////////////////////////////////
// Property tags
......
......@@ -20,10 +20,10 @@
/*!
* \file
*
* \brief Defines the indices required for the decoupled one-phase model.
* \brief Defines the indices required for the sequential one-phase model.
*/
#ifndef DUMUX_DECOUPLED_1P_INDICES_HH
#define DUMUX_DECOUPLED_1P_INDICES_HH
#ifndef DUMUX_SEQUENTIAL_1P_INDICES_HH
#define DUMUX_SEQUENTIAL_1P_INDICES_HH
namespace Dumux
{
......@@ -35,12 +35,14 @@ namespace Dumux
/*!
* \brief The common indices for the 1-p models.
*/
struct DecoupledOnePCommonIndices
struct SequentialOnePCommonIndices
{
// Formulations
static const int pressureEqIdx = 0;//!< Index of the pressure equation
static const int pressureEqIdx = 0;//!< Index of the pressure equation
};
struct DecoupledOnePCommonIndices : public SequentialOnePCommonIndices
{} DUNE_DEPRECATED_MSG("Use SequentialOnePCommonIndices instead.");
// \}
} // namespace Dumux
......
......@@ -52,7 +52,10 @@ namespace Properties
//////////////////////////////////////////////////////////////////
//! The type tag for the single-phase problem
NEW_TYPE_TAG(DecoupledOneP, INHERITS_FROM(DecoupledModel));
NEW_TYPE_TAG(SequentialOneP, INHERITS_FROM(SequentialModel));
//! DEPRECATED Since compile-time detection is "impossible," a run-time check will be performed in start.hh
NEW_TYPE_TAG(DecoupledOneP, INHERITS_FROM(SequentialOneP));
//////////////////////////////////////////////////////////////////
// Property tags
......@@ -80,28 +83,28 @@ namespace Properties
//////////////////////////////////////////////////////////////////
//! Set number of equations to 1 for isothermal one-phase models
SET_INT_PROP(DecoupledOneP, NumEq, 1);
SET_INT_PROP(SequentialOneP, NumEq, 1);
//! Set number of phases to 1 for one-phase models
SET_INT_PROP(DecoupledOneP, NumPhases, 1);
SET_INT_PROP(SequentialOneP, NumPhases, 1);
//! Each phase consists of 1 pure component
SET_INT_PROP(DecoupledOneP, NumComponents, 1);
SET_INT_PROP(SequentialOneP, NumComponents, 1);
//! Chose the set of indices for the one-phase formulation
SET_TYPE_PROP(DecoupledOneP, Indices, DecoupledOnePCommonIndices);
SET_TYPE_PROP(SequentialOneP, Indices, SequentialOnePCommonIndices);
//! Set general decoupled VariableClass as default
SET_TYPE_PROP(DecoupledOneP, Variables, VariableClass<TypeTag>);
//! Set general sequential VariableClass as default
SET_TYPE_PROP(SequentialOneP, Variables, VariableClass<TypeTag>);
//! Set standart CellData of immiscible one-phase models as default
SET_TYPE_PROP(DecoupledOneP, CellData, CellData1P<TypeTag>);
SET_TYPE_PROP(SequentialOneP, CellData, CellData1P<TypeTag>);
//! The spatial parameters to be employed. Use BoxSpatialParams by default.
SET_TYPE_PROP(DecoupledOneP, SpatialParams, FVSpatialParamsOneP<TypeTag>);
SET_TYPE_PROP(SequentialOneP, SpatialParams, FVSpatialParamsOneP<TypeTag>);
//! Enable gravity by default
SET_BOOL_PROP(DecoupledOneP, ProblemEnableGravity, true);
SET_BOOL_PROP(SequentialOneP, ProblemEnableGravity, true);
}
}
#endif
......@@ -41,7 +41,7 @@ namespace Properties
//////////////////////////////////////////////////////////////////
//! The type tag for models based on the diffusion-scheme
NEW_TYPE_TAG(PressureTwoP, INHERITS_FROM(Pressure, DecoupledTwoP));
NEW_TYPE_TAG(PressureTwoP, INHERITS_FROM(Pressure, SequentialTwoP));
//////////////////////////////////////////////////////////////////
// Property tags
......
......@@ -46,7 +46,7 @@ namespace Properties
//////////////////////////////////////////////////////////////////
//! TypeTag for the two-phase IMPES scheme
NEW_TYPE_TAG(IMPESTwoP, INHERITS_FROM(IMPET, DecoupledTwoP));
NEW_TYPE_TAG(IMPESTwoP, INHERITS_FROM(IMPET, SequentialTwoP));
//////////////////////////////////////////////////////////////////
// Property tags
......
......@@ -45,7 +45,7 @@ namespace Properties
//////////////////////////////////////////////////////////////////
//! TypeTag for grid-adaptive two-phase IMPES scheme
NEW_TYPE_TAG(IMPESTwoPAdaptive, INHERITS_FROM(IMPET, DecoupledTwoP));
NEW_TYPE_TAG(IMPESTwoPAdaptive, INHERITS_FROM(IMPET, SequentialTwoP));
//////////////////////////////////////////////////////////////////
// Property tags
......
......@@ -20,10 +20,10 @@
/*!
* \file
*
* \brief Defines the indices required for the two-phase decoupled model.
* \brief Defines the indices required for the two-phase sequential model.
*/
#ifndef DUMUX_DECOUPLED_2P_INDICES_HH
#define DUMUX_DECOUPLED_2P_INDICES_HH
#ifndef DUMUX_SEQUENTIAL_2P_INDICES_HH
#define DUMUX_SEQUENTIAL_2P_INDICES_HH
namespace Dumux
{
......@@ -35,7 +35,7 @@ namespace Dumux
/*!
* \brief The common indices for the isothermal two-phase model.
*/
struct DecoupledTwoPCommonIndices
struct SequentialTwoPCommonIndices
{
// Formulations
static const int pwsn = 0; //!< pw and sn as primary variables
......@@ -69,6 +69,9 @@ struct DecoupledTwoPCommonIndices
static const int velocityTotal = 2; //!< Indicates total velocity
};
struct DecoupledTwoPCommonIndices : public SequentialTwoPCommonIndices
{} DUNE_DEPRECATED_MSG("Use SequentialTwoPCommonIndices instead.");
/*!
* \brief The indices for the \f$p_w-S_n\f$ formulation of the
* isothermal two-phase model.
......@@ -76,8 +79,8 @@ struct DecoupledTwoPCommonIndices
* \tparam formulation Index of the formulation
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int formulation = DecoupledTwoPCommonIndices::pwsn, int PVOffset = 0>
struct DecoupledTwoPIndices : public DecoupledTwoPCommonIndices
template <int formulation = SequentialTwoPCommonIndices::pwsn, int PVOffset = 0>
struct SequentialTwoPIndices : public SequentialTwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for the primary pressure variable in a solution vector
......@@ -110,8 +113,8 @@ struct DecoupledTwoPIndices : public DecoupledTwoPCommonIndices
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int PVOffset>
struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pnsw, PVOffset>
: public DecoupledTwoPCommonIndices
struct SequentialTwoPIndices<SequentialTwoPCommonIndices::pnsw, PVOffset>
: public SequentialTwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for the primary pressure variable in a solution vector
......@@ -145,8 +148,8 @@ struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pnsw, PVOffset>
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int PVOffset>
struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pwsw, PVOffset>
: public DecoupledTwoPCommonIndices
struct SequentialTwoPIndices<SequentialTwoPCommonIndices::pwsw, PVOffset>
: public SequentialTwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for the primary pressure variable in a solution vector
......@@ -179,8 +182,8 @@ struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pwsw, PVOffset>
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int PVOffset>
struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pnsn, PVOffset>
: public DecoupledTwoPCommonIndices
struct SequentialTwoPIndices<SequentialTwoPCommonIndices::pnsn, PVOffset>
: public SequentialTwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for the primary pressure vairable in a solution vector
......@@ -214,7 +217,7 @@ struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pnsn, PVOffset>
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int PVOffset>
struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pGlobalSw, PVOffset> : public DecoupledTwoPCommonIndices
struct SequentialTwoPIndices<SequentialTwoPCommonIndices::pGlobalSw, PVOffset> : public SequentialTwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for the primary pressure variable in a solution vector
......@@ -245,8 +248,8 @@ struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pGlobalSw, PVOffset> : p
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int PVOffset>
struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pGlobalSn, PVOffset>
: public DecoupledTwoPCommonIndices
struct SequentialTwoPIndices<SequentialTwoPCommonIndices::pGlobalSn, PVOffset>
: public SequentialTwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for the primary pressure variable in a solution vector
......@@ -270,6 +273,10 @@ struct DecoupledTwoPIndices<DecoupledTwoPCommonIndices::pGlobalSn, PVOffset>
static const int transportEqIdx = satEqIdx; //!< Index of the saturation transport equation
};
template <int formulation = SequentialTwoPCommonIndices::pwsn, int PVOffset = 0>
struct DecoupledTwoPIndices : public SequentialTwoPIndices<formulation, PVOffset>
{} DUNE_DEPRECATED_MSG("Use SequentialTwoPIndices instead.");
// \}
} // namespace Dumux
......
......@@ -27,8 +27,8 @@
* \brief Defines the properties required for (immiscible) two-phase sequential models.
*/
#ifndef DUMUX_2PPROPERTIES_DECOUPLED_HH
#define DUMUX_2PPROPERTIES_DECOUPLED_HH
#ifndef DUMUX_2PPROPERTIES_SEQUENTIAL_HH
#define DUMUX_2PPROPERTIES_SEQUENTIAL_HH
//Dumux-includes
#include <dumux/porousmediumflow/sequential/properties.hh>
......@@ -52,8 +52,11 @@ namespace Properties
// Type tags
//////////////////////////////////////////////////////////////////
//! The TypeTag for decoupled two-phase problems
NEW_TYPE_TAG(DecoupledTwoP, INHERITS_FROM(DecoupledModel));
//! The TypeTag for sequential two-phase problems
NEW_TYPE_TAG(SequentialTwoP, INHERITS_FROM(SequentialModel));
//! DEPRECATED Since compile-time detection is "impossible," a run-time check will be performed in start.hh
NEW_TYPE_TAG(DecoupledTwoP, INHERITS_FROM(SequentialTwoP));
//////////////////////////////////////////////////////////////////
// Property tags
......@@ -96,54 +99,52 @@ namespace Properties
// Properties
//////////////////////////////////////////////////////////////////
//! Set number of equations to 2 for isothermal two-phase models
SET_INT_PROP(DecoupledTwoP, NumEq, 2);
SET_INT_PROP(SequentialTwoP, NumEq, 2);
//! Set number of phases to 2 for two-phase models
SET_INT_PROP(DecoupledTwoP, NumPhases, 2);//!< The number of phases in the 2p model is 2
SET_INT_PROP(SequentialTwoP, NumPhases, 2);//!< The number of phases in the 2p model is 2
//! Set number of components to 1 for immiscible two-phase models
SET_INT_PROP(DecoupledTwoP, NumComponents, 1); //!< Each phase consists of 1 pure component
SET_INT_PROP(SequentialTwoP, NumComponents, 1); //!< Each phase consists of 1 pure component
//! Set \f$p_w\f$-\f$S_w\f$ formulation as default two-phase formulation
SET_INT_PROP(DecoupledTwoP,
Formulation,
DecoupledTwoPCommonIndices::pwsw);
SET_INT_PROP(SequentialTwoP, Formulation, DecoupledTwoPCommonIndices::pwsw);
//! Chose the set of indices depending on the chosen formulation
SET_PROP(DecoupledTwoP, Indices)
SET_PROP(SequentialTwoP, Indices)
{
typedef DecoupledTwoPIndices<GET_PROP_VALUE(TypeTag, Formulation), 0> type;
};
//! Set the default pressure formulation according to the chosen two-phase formulation
SET_INT_PROP(DecoupledTwoP,
SET_INT_PROP(SequentialTwoP,
PressureFormulation,
GET_PROP_TYPE(TypeTag, Indices)::pressureType);
//! Set the default saturation formulation according to the chosen two-phase formulation
SET_INT_PROP(DecoupledTwoP,
SET_INT_PROP(SequentialTwoP,
SaturationFormulation,
GET_PROP_TYPE(TypeTag, Indices)::saturationType);
//! Set the default velocity formulation according to the chosen two-phase formulation
SET_INT_PROP(DecoupledTwoP,
SET_INT_PROP(SequentialTwoP,
VelocityFormulation,
GET_PROP_TYPE(TypeTag, Indices)::velocityDefault);
//! Disable compressibility by default
SET_BOOL_PROP(DecoupledTwoP, EnableCompressibility, false);
SET_BOOL_PROP(SequentialTwoP, EnableCompressibility, false);
//! Set general decoupled VariableClass as default
SET_TYPE_PROP(DecoupledTwoP, Variables, VariableClass<TypeTag>);
//! Set general sequential VariableClass as default
SET_TYPE_PROP(SequentialTwoP, Variables, VariableClass<TypeTag>);
//! Set standart CellData of immiscible two-phase models as default
SET_TYPE_PROP(DecoupledTwoP, CellData, CellData2P<TypeTag, GET_PROP_VALUE(TypeTag, EnableCompressibility)>);
SET_TYPE_PROP(SequentialTwoP, CellData, CellData2P<TypeTag, GET_PROP_VALUE(TypeTag, EnableCompressibility)>);
//! Set default fluid system
SET_TYPE_PROP(DecoupledTwoP, FluidSystem, TwoPImmiscibleFluidSystem<TypeTag>);
SET_TYPE_PROP(SequentialTwoP, FluidSystem, TwoPImmiscibleFluidSystem<TypeTag>);
//! Set default fluid state
SET_PROP(DecoupledTwoP, FluidState)
SET_PROP(SequentialTwoP, FluidState)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
......@@ -153,13 +154,13 @@ public:
};
//! The spatial parameters to be employed. Use FVSpatialParams by default.
SET_TYPE_PROP(DecoupledTwoP, SpatialParams, FVSpatialParams<TypeTag>);
SET_TYPE_PROP(SequentialTwoP, SpatialParams, FVSpatialParams<TypeTag>);
/*!
* \brief Set the property for the material parameters by extracting
* it from the material law.
*/
SET_PROP(DecoupledTwoP, MaterialLawParams)
SET_PROP(SequentialTwoP, MaterialLawParams)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
......@@ -169,14 +170,14 @@ public:
};
//! Default error term factor
SET_SCALAR_PROP(DecoupledTwoP, ImpetErrorTermFactor, 0.5);
SET_SCALAR_PROP(SequentialTwoP, ImpetErrorTermFactor, 0.5);
//! Default lower threshold for evaluation of an error term
SET_SCALAR_PROP(DecoupledTwoP, ImpetErrorTermLowerBound, 0.1);
SET_SCALAR_PROP(SequentialTwoP, ImpetErrorTermLowerBound, 0.1);
//! Default upper threshold for evaluation of an error term
SET_SCALAR_PROP(DecoupledTwoP, ImpetErrorTermUpperBound, 0.9);
SET_SCALAR_PROP(SequentialTwoP, ImpetErrorTermUpperBound, 0.9);
// enable gravity by default
SET_BOOL_PROP(DecoupledTwoP, ProblemEnableGravity, true);
SET_BOOL_PROP(SequentialTwoP, ProblemEnableGravity, true);
// \}
}
......
......@@ -41,7 +41,7 @@ namespace Properties
//////////////////////////////////////////////////////////////////
//! The type tag for transport part of a decoupled two-phase model