move NumericDifferenceMethod to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving
2024-07-05 17:49:51 +02:00
parent 7da433b6dd
commit 00121f10a4
6 changed files with 52 additions and 47 deletions

View File

@@ -228,7 +228,7 @@ namespace Opm {
* water saturated medium.
*
* The domain is sized 6m times 4m and features a rectangular lens
* with low permeablility which spans from (1 m , 2 m) to (4 m, 3 m)
* with low permeablility which spans from (1m, 2m) to (4m, 3m)
* and is surrounded by a medium with higher permability. Note that
* this problem is discretized using only two dimensions, so from the
* point of view of the model, the depth of the domain is implicitly
@@ -371,6 +371,13 @@ public:
Parameters::SetDefault<Parameters::CellsZ>(16);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
}
// Use forward differences
using LLS = GetPropType<TypeTag, Properties::LocalLinearizerSplice>;
constexpr bool useFD = std::is_same_v<LLS, Properties::TTag::FiniteDifferenceLocalLinearizer>;
if constexpr (useFD) {
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
}
}
/*!
@@ -379,20 +386,21 @@ public:
static std::string briefDescription()
{
std::string thermal = "isothermal";
bool enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>();
if (enableEnergy)
constexpr bool enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>();
if constexpr (enableEnergy)
thermal = "non-isothermal";
std::string deriv = "finite difference";
using LLS = GetPropType<TypeTag, Properties::LocalLinearizerSplice>;
bool useAutoDiff = std::is_same<LLS, Properties::TTag::AutoDiffLocalLinearizer>::value;
if (useAutoDiff)
constexpr bool useAutoDiff = std::is_same_v<LLS, Properties::TTag::AutoDiffLocalLinearizer>;
if constexpr (useAutoDiff) {
deriv = "automatic differentiation";
}
std::string disc = "vertex centered finite volume";
using D = GetPropType<TypeTag, Properties::Discretization>;
bool useEcfv = std::is_same<D, Opm::EcfvDiscretization<TypeTag>>::value;
if (useEcfv)
constexpr bool useEcfv = std::is_same<D, Opm::EcfvDiscretization<TypeTag>>::value;
if constexpr (useEcfv)
disc = "element centered finite volume";
return std::string("")+
@@ -467,10 +475,10 @@ public:
{
using LLS = GetPropType<TypeTag, Properties::LocalLinearizerSplice>;
bool useAutoDiff = std::is_same<LLS, Properties::TTag::AutoDiffLocalLinearizer>::value;
constexpr bool useAutoDiff = std::is_same_v<LLS, Properties::TTag::AutoDiffLocalLinearizer>;
using FM = GetPropType<TypeTag, Properties::FluxModule>;
bool useTrans = std::is_same<FM, Opm::TransFluxModule<TypeTag>>::value;
constexpr bool useTrans = std::is_same_v<FM, Opm::TransFluxModule<TypeTag>>;
std::ostringstream oss;
oss << "lens_" << Model::name()