Merge pull request #921 from akva2/typetag_free_params_no_downstream

Start moving parameters to new parameter system
This commit is contained in:
Bård Skaflestad 2024-08-12 19:45:28 +02:00 committed by GitHub
commit 6b724aacc1
40 changed files with 361 additions and 524 deletions

View File

@ -48,15 +48,6 @@ struct ObstacleProblem
} // namespace Opm::Properties
namespace Opm::Parameters {
// Verbosity of the PVS model (0=silent, 1=medium, 2=chatty)
template<class TypeTag>
struct PvsVerbosity<TypeTag, Properties::TTag::ObstacleProblem>
{ static constexpr int value = 1; };
}
int main(int argc, char **argv)
{
using ProblemTypeTag = Opm::Properties::TTag::ObstacleProblem;

View File

@ -46,15 +46,6 @@ struct OutflowProblem
} // namespace Opm::Properties
namespace Opm::Parameters {
// Verbosity of the PVS model (0=silent, 1=medium, 2=chatty)
template<class TypeTag>
struct PvsVerbosity<TypeTag, Properties::TTag::OutflowProblem>
{ static constexpr int value = 1; };
}
int main(int argc, char **argv)
{
using ProblemTypeTag = Opm::Properties::TTag::OutflowProblem;

View File

@ -218,11 +218,6 @@ struct FluidSystemTemperatureLow<TypeTag, Properties::TTag::Co2InjectionBaseProb
static constexpr type value = 290;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr auto value = "data/co2injection.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
@ -415,6 +410,8 @@ public:
("The maximum depth [m] of the reservoir");
Parameters::registerParam<TypeTag, Parameters::SimulationName>
("The name of the simulation used for the output files");
Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf");
}
/*!

View File

@ -156,44 +156,6 @@ struct EpisodeLength { using type = Properties::UndefinedProperty;};
template <class TypeTag, class MyTypeTag>
struct Initialpressure { using type = Properties::UndefinedProperty;};
template<class TypeTag>
struct CellsX<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr unsigned value = 30; };
template<class TypeTag>
struct CellsY<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr unsigned value = 1; };
// CellsZ is not needed, while to keep structuredgridvanguard.hh compile
template<class TypeTag>
struct CellsZ<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr unsigned value = 1; };
//\Note: from the Julia code, the problem is a 1D problem with 3X1 cell.
//\Note: DomainSizeX is 3.0 meters
//\Note: DomainSizeY is 1.0 meters
template <class TypeTag>
struct DomainSizeX<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 300; // meter
};
template <class TypeTag>
struct DomainSizeY<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
// DomainSizeZ is not needed, while to keep structuredgridvanguard.hh compile
template <class TypeTag>
struct DomainSizeZ<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
// Enable gravity false
template <class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::CO2PTBaseProblem>
@ -424,6 +386,18 @@ public:
("The name of the simulation used for the output files");
Parameters::registerParam<TypeTag, Parameters::EpisodeLength>
("Time interval [s] for episode length");
Parameters::SetDefault<Parameters::CellsX>(30);
Parameters::SetDefault<Parameters::DomainSizeX<Scalar>>(300.0);
if constexpr (dim > 1) {
Parameters::SetDefault<Parameters::CellsY>(1);
Parameters::SetDefault<Parameters::DomainSizeY<Scalar>>(1.0);
}
if constexpr (dim == 3) {
Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
}
}
/*!
@ -517,7 +491,7 @@ public:
{
int spatialIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
int inj = 0;
int prod = Parameters::get<TypeTag, Parameters::CellsX>() - 1;
int prod = Parameters::Get<Parameters::CellsX>() - 1;
if (spatialIdx == inj || spatialIdx == prod) {
return 1.0;
} else {
@ -568,7 +542,7 @@ private:
// p0 = 75e5
// T0 = 423.25
int inj = 0;
int prod = Parameters::get<TypeTag, Parameters::CellsX>() - 1;
int prod = Parameters::Get<Parameters::CellsX>() - 1;
int spatialIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
ComponentVector comp;
comp[0] = Evaluation::createVariable(0.5, 1);

View File

@ -129,11 +129,6 @@ struct EndTime<TypeTag, Properties::TTag::CuvetteBaseProblem>
static constexpr type value = 180;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::CuvetteBaseProblem>
{ static constexpr auto value = "./data/cuvette_11x4.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::CuvetteBaseProblem>
@ -309,6 +304,16 @@ public:
initInjectFluidState_();
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/cuvette_11x4.dgf");
}
/*!
* \name Auxiliary methods
*/

View File

@ -110,40 +110,6 @@ struct EnableDiffusion<TypeTag, TTag::DiffusionBaseProblem> { static constexpr b
namespace Opm::Parameters {
template<class TypeTag>
struct CellsX<TypeTag, Properties::TTag::DiffusionBaseProblem>
{ static constexpr unsigned value = 250; };
template<class TypeTag>
struct CellsY<TypeTag, Properties::TTag::DiffusionBaseProblem>
{ static constexpr unsigned value = 1; };
template<class TypeTag>
struct CellsZ<TypeTag, Properties::TTag::DiffusionBaseProblem>
{ static constexpr unsigned value = 1; };
// define the properties specific for the diffusion problem
template<class TypeTag>
struct DomainSizeX<TypeTag, Properties::TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, Properties::TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, Properties::TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::DiffusionBaseProblem>
@ -245,6 +211,24 @@ public:
setupInitialFluidStates_();
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::CellsX>(250);
if constexpr (dim > 1) {
Parameters::SetDefault<Parameters::CellsY>(1);
}
if constexpr (dim == 3) {
Parameters::SetDefault<Parameters::CellsZ>(1);
}
}
/*!
* \name Auxiliary methods
*/

View File

@ -131,40 +131,6 @@ namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct InitialWaterSaturation { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct CellsX<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr unsigned value = 20; };
template<class TypeTag>
struct CellsY<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr unsigned value = 70; };
template<class TypeTag>
struct CellsZ<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr unsigned value = 1; };
// define the properties specific for the finger problem
template<class TypeTag>
struct DomainSizeX<TypeTag, Properties::TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.1;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, Properties::TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.3;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, Properties::TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.1;
};
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::FingerBaseProblem>
@ -198,11 +164,6 @@ template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr bool value = false; };
// Use forward differences instead of central differences
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr int value = +1; };
} // namespace Opm::Parameters
namespace Opm {
@ -320,6 +281,21 @@ public:
Parameters::registerParam<TypeTag, Parameters::InitialWaterSaturation>
("The initial saturation in the domain [] of the wetting phase");
Parameters::SetDefault<Parameters::CellsX>(20);
Parameters::SetDefault<Parameters::DomainSizeX<Scalar>>(0.1);
if constexpr (dim > 1) {
Parameters::SetDefault<Parameters::CellsY>(70);
Parameters::SetDefault<Parameters::DomainSizeY<Scalar>>(0.3);
}
if constexpr (dim == 3) {
Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(0.1);
}
// Use forward differences
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
}
/*!

View File

@ -173,11 +173,6 @@ struct EndTime<TypeTag, Properties::TTag::FractureProblem>
static constexpr type value = 3e3;
};
// Set the default value for the file name of the grid
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::FractureProblem>
{ static constexpr auto value = "data/fracture.art.dgf"; };
// Set the default value for the initial time step size
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::FractureProblem>
@ -310,6 +305,16 @@ public:
initEnergyParams_(thermalConductionParams_, matrixPorosity_);
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("data/fracture.art.dgf");
}
/*!
* \name Auxiliary methods
*/

View File

@ -125,11 +125,6 @@ struct EndTime<TypeTag, Properties::TTag::GroundWaterBaseProblem>
static constexpr type value = 1;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{ static constexpr auto value = "./data/groundwater_2d.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::GroundWaterBaseProblem>
@ -306,6 +301,8 @@ public:
("The intrinsic permeability [m^2] of the ambient material.");
Parameters::registerParam<TypeTag, Parameters::PermeabilityLens>
("The intrinsic permeability [m^2] of the lens.");
Parameters::SetDefault<Parameters::GridFile>("./data/groundwater_2d.dgf");
}
/*!

View File

@ -105,11 +105,6 @@ struct EndTime<TypeTag, Properties::TTag::InfiltrationBaseProblem>
static constexpr type value = 6e3;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{ static constexpr auto value = "./data/infiltration_50x3.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::InfiltrationBaseProblem>
@ -123,11 +118,6 @@ template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{ static constexpr bool value = false; };
// -1 backward differences, 0: central differences, +1: forward differences
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{ static constexpr int value = 1; };
} // namespace Opm::Parameters
namespace Opm {
@ -244,6 +234,17 @@ public:
materialParams_.checkDefined();
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/infiltration_50x3.dgf");
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(1);
}
/*!
* \name Problem parameters
*/

View File

@ -138,39 +138,6 @@ struct LensUpperRightY { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightZ { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct CellsX<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr unsigned value = 48; };
template<class TypeTag>
struct CellsY<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr unsigned value = 32; };
template<class TypeTag>
struct CellsZ<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr unsigned value = 16; };
template<class TypeTag>
struct DomainSizeX<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 6.0;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 4.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::LensBaseProblem>
@ -261,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
@ -343,7 +310,7 @@ public:
lensUpperRight_[0] = Parameters::get<TypeTag, Parameters::LensUpperRightX>();
lensUpperRight_[1] = Parameters::get<TypeTag, Parameters::LensUpperRightY>();
if (dimWorld == 3) {
if constexpr (dim == 3) {
lensLowerLeft_[2] = Parameters::get<TypeTag, Parameters::LensLowerLeftZ>();
lensUpperRight_[2] = Parameters::get<TypeTag, Parameters::LensUpperRightZ>();
}
@ -388,12 +355,29 @@ public:
Parameters::registerParam<TypeTag, Parameters::LensUpperRightY>
("The y-coordinate of the lens' upper-right corner [m].");
if (dimWorld == 3) {
if constexpr (dim == 3) {
Parameters::registerParam<TypeTag, Parameters::LensLowerLeftZ>
("The z-coordinate of the lens' lower-left corner [m].");
Parameters::registerParam<TypeTag, Parameters::LensUpperRightZ>
("The z-coordinate of the lens' upper-right corner [m].");
}
Parameters::SetDefault<Parameters::CellsX>(48);
Parameters::SetDefault<Parameters::CellsY>(32);
Parameters::SetDefault<Parameters::DomainSizeX<Scalar>>(6.0);
Parameters::SetDefault<Parameters::DomainSizeY<Scalar>>(4.0);
if constexpr (dim == 3) {
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);
}
}
/*!
@ -402,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("")+
@ -490,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()

View File

@ -128,11 +128,6 @@ struct EndTime<TypeTag, Properties::TTag::ObstacleBaseProblem>
static constexpr type value = 1e4;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::ObstacleBaseProblem>
{ static constexpr auto value = "./data/obstacle_24x16.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::ObstacleBaseProblem>
@ -279,6 +274,16 @@ public:
initFluidStates_();
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/obstacle_24x16.dgf");
}
/*!
* \copydoc FvBaseProblem::endTimeStep
*/

View File

@ -89,11 +89,6 @@ struct EndTime<TypeTag, Properties::TTag::OutflowBaseProblem>
static constexpr type value = 100;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::OutflowBaseProblem>
{ static constexpr auto value = "./data/outflow.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::OutflowBaseProblem>
@ -187,6 +182,16 @@ public:
tortuosity_ = 0.28;
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/outflow.dgf");
}
/*!
* \name Problem parameters
*/

View File

@ -123,40 +123,6 @@ public:
namespace Opm::Parameters {
template<class TypeTag>
struct CellsX<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr unsigned value = 250; };
template<class TypeTag>
struct CellsY<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr unsigned value = 1; };
template<class TypeTag>
struct CellsZ<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr unsigned value = 1; };
// define the properties specific for the power injection problem
template<class TypeTag>
struct DomainSizeX<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100.0;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
@ -270,6 +236,26 @@ public:
setupInitialFluidState_();
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::CellsX>(250);
Parameters::SetDefault<Parameters::DomainSizeX<Scalar>>(100.0);
if constexpr (dim > 1) {
Parameters::SetDefault<Parameters::CellsY>(1);
Parameters::SetDefault<Parameters::DomainSizeY<Scalar>>(1.0);
}
if constexpr (dim == 3) {
Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
}
}
/*!
* \name Auxiliary methods
*/

View File

@ -150,11 +150,6 @@ struct EndTime<TypeTag, Properties::TTag::ReservoirBaseProblem>
static constexpr type value = 1000.0*24*60*60;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::ReservoirBaseProblem>
{ static constexpr auto value = "data/reservoir.dgf"; };
// The default for the initial time step size of the simulation [s]
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::ReservoirBaseProblem>
@ -449,6 +444,9 @@ public:
Parameters::registerParam<TypeTag, Parameters::WellWidth>
("The width of producer/injector wells as a fraction of the width"
" of the spatial domain");
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf");
}
/*!

View File

@ -116,11 +116,6 @@ struct EndTime<TypeTag, Properties::TTag::RichardsLensProblem>
static constexpr type value = 3000;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr auto value = "./data/richardslens_24x16.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::RichardsLensProblem>
@ -144,11 +139,6 @@ template<class TypeTag>
struct NewtonMaxIterations<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr int value = 28; };
// Use central differences to approximate the Jacobian matrix
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr int value = 0; };
} // namespace Opm::Parameters
namespace Opm {
@ -267,6 +257,23 @@ public:
}
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/richardslens_24x16.dgf");
// Use central differences to approximate the Jacobian matrix
using LLS = GetPropType<TypeTag, Properties::LocalLinearizerSplice>;
constexpr bool useFD = std::is_same_v<LLS, Properties::TTag::FiniteDifferenceLocalLinearizer>;
if constexpr (useFD) {
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(0);
}
}
/*!
* \name Problem parameters
*/

View File

@ -28,25 +28,28 @@
#ifndef EWOMS_WATER_AIR_PROBLEM_HH
#define EWOMS_WATER_AIR_PROBLEM_HH
#include <opm/models/pvs/pvsproperties.hh>
#include <opm/simulators/linalg/parallelistlbackend.hh>
#include <opm/material/fluidsystems/H2OAirFluidSystem.hpp>
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp>
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/thermal/ConstantSolidHeatCapLaw.hpp>
#include <opm/material/thermal/SomertonThermalConductionLaw.hpp>
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp>
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/fluidsystems/H2OAirFluidSystem.hpp>
#include <opm/material/thermal/ConstantSolidHeatCapLaw.hpp>
#include <opm/material/thermal/SomertonThermalConductionLaw.hpp>
#include <opm/models/discretization/common/fvbasefdlocallinearizer.hh>
#include <opm/models/pvs/pvsproperties.hh>
#include <opm/simulators/linalg/parallelistlbackend.hh>
#include <sstream>
#include <string>
@ -145,11 +148,6 @@ struct EndTime<TypeTag, Properties::TTag::WaterAirBaseProblem>
static constexpr type value = 1.0 * 365 * 24 * 60 * 60;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr auto value = "./data/waterair.dgf"; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::WaterAirBaseProblem>
@ -307,6 +305,18 @@ public:
* \name Problem parameters
*/
//! \{
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/waterair.dgf");
// Use forward differences
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
}
/*!
* \copydoc FvBaseProblem::name

View File

@ -124,41 +124,6 @@ public:
namespace Opm::Parameters {
// // define the number of cells used for discretizing the physical domain
template<class TypeTag>
struct CellsX<TypeTag, Properties::TTag::Tutorial1Problem>
{ static constexpr unsigned value = 100; };
template<class TypeTag>
struct CellsY<TypeTag, Properties::TTag::Tutorial1Problem>
{ static constexpr unsigned value = 1; };
template<class TypeTag>
struct CellsZ<TypeTag, Properties::TTag::Tutorial1Problem>
{ static constexpr unsigned value = 1; }; /*@\label{tutorial1:default-params-end}@*/
// define the physical size of the problem's domain [m]
template<class TypeTag>
struct DomainSizeX<TypeTag, Properties::TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 300.0;
}; /*@\label{tutorial1:grid-default-params-begin}@*/
template<class TypeTag>
struct DomainSizeY<TypeTag, Properties::TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 60.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, Properties::TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.0;
};
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::Tutorial1Problem>
@ -193,7 +158,10 @@ class Tutorial1Problem
using GridView = GetPropType<TypeTag, Properties::GridView>;
// Grid dimension
enum { dimWorld = GridView::dimensionworld };
enum {
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
};
// The type of the intrinsic permeability tensor
using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
@ -247,6 +215,24 @@ public:
materialParams_.finalize();
}
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::CellsX>(100);
Parameters::SetDefault<Parameters::CellsY>(1);
Parameters::SetDefault<Parameters::DomainSizeX<Scalar>>(300.0);
Parameters::SetDefault<Parameters::DomainSizeY<Scalar>>(60.0);
if constexpr (dim == 3) {
Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(0.0);
}
}
//! Specifies the problem name. This is used for files generated by the simulation.
std::string name() const
{ return "tutorial1"; }

View File

@ -45,11 +45,8 @@
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct PressureScale {
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class Scalar>
struct PressureScale { static constexpr Scalar value = 1.0; };
} // namespace Opm::Parameters
@ -203,12 +200,12 @@ public:
static void init()
{
// TODO: these parameters have undocumented non-trivial dependencies
pressureScale_ = Parameters::get<TypeTag, Parameters::PressureScale>();
pressureScale_ = Parameters::Get<Parameters::PressureScale<Scalar>>();
}
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::PressureScale>
Parameters::Register<Parameters::PressureScale<Scalar>>
("Scaling of pressure primary variable");
}

View File

@ -291,13 +291,6 @@ template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
//! By default, write the VTK output to asynchronously to disk
//!
//! This has only an effect if EnableVtkOutput is true
template<class TypeTag>
struct EnableAsyncVtkOutput<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = true; };
//! Disable grid adaptation by default
template<class TypeTag>
struct EnableGridAdaptation<TypeTag, Properties::TTag::FvBaseDiscretization>

View File

@ -82,9 +82,6 @@ struct BaseEpsilon<TypeTag, TTag::FiniteDifferenceLocalLinearizer>
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct NumericDifferenceMethod { using type = Properties::UndefinedProperty; };
/*!
* \brief Specify which kind of method should be used to numerically
* calculate the partial derivatives of the residual.
@ -92,9 +89,7 @@ struct NumericDifferenceMethod { using type = Properties::UndefinedProperty; };
* -1 means backward differences, 0 means central differences, 1 means
* forward differences. By default we use forward differences.
*/
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, Properties::TTag::FiniteDifferenceLocalLinearizer>
{ static constexpr int value = +1; };
struct NumericDifferenceMethod { static constexpr int value = +1; };
} // namespace Opm::Parameters
@ -188,7 +183,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::NumericDifferenceMethod>
Parameters::Register<Parameters::NumericDifferenceMethod>
("The method used for numeric differentiation (-1: backward "
"differences, 0: central differences, 1: forward differences)");
}
@ -342,7 +337,7 @@ protected:
*/
static int numericDifferenceMethod_()
{
static int diff = Parameters::get<TypeTag, Parameters::NumericDifferenceMethod>();
static int diff = Parameters::Get<Parameters::NumericDifferenceMethod>();
return diff;
}

View File

@ -37,6 +37,17 @@ namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct ThreadsPerProcess { using type = Properties::UndefinedProperty; };
/*!
* \brief Determines if the VTK output is written to disk asynchronously
*
* I.e. written to disk using a separate thread. This has only an effect if
* EnableVtkOutput is true and if the simulation is run sequentially. The reasons for
* this not being used for MPI-parallel simulations are that Dune's VTK output code does
* not support multi-threaded multi-process VTK output and even if it would, the result
* would be slower than when using synchronous output.
*/
struct EnableAsyncVtkOutput { static constexpr bool value = true; };
/*!
* \brief Switch to enable or disable grid adaptation
*
@ -61,18 +72,6 @@ struct OutputDir { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EnableVtkOutput { using type = Properties::UndefinedProperty; };
/*!
* \brief Determines if the VTK output is written to disk asynchronously
*
* I.e. written to disk using a separate thread. This has only an effect if
* EnableVtkOutput is true and if the simulation is run sequentially. The reasons for
* this not being used for MPI-parallel simulations are that Dune's VTK output code does
* not support multi-threaded multi-process VTK output and even if it would, the result
* would be slower than when using synchronous output.
*/
template<class TypeTag, class MyTypeTag>
struct EnableAsyncVtkOutput { using type = Properties::UndefinedProperty; };
/*!
* \brief Specify the maximum size of a time integration [s].
*

View File

@ -142,7 +142,7 @@ public:
if (enableVtkOutput_()) {
bool asyncVtkOutput =
simulator_.gridView().comm().size() == 1 &&
Parameters::get<TypeTag, Parameters::EnableAsyncVtkOutput>();
Parameters::Get<Parameters::EnableAsyncVtkOutput>();
// asynchonous VTK output currently does not work in conjunction with grid
// adaptivity because the async-IO code assumes that the grid stays
@ -176,7 +176,7 @@ public:
Parameters::registerParam<TypeTag, Parameters::MaxTimeStepDivisions>
("The maximum number of divisions by two of the timestep size "
"before the simulation bails out");
Parameters::registerParam<TypeTag, Parameters::EnableAsyncVtkOutput>
Parameters::Register<Parameters::EnableAsyncVtkOutput>
("Dispatch a separate thread to write the VTK output");
Parameters::registerParam<TypeTag, Parameters::ContinueOnConvergenceError>
("Continue with a non-converged solution instead of giving up "

View File

@ -53,10 +53,7 @@
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct SeparateSparseSourceTerms {
static constexpr bool value = false;
};
struct SeparateSparseSourceTerms { static constexpr bool value = false; };
} // namespace Opm::Parameters
@ -111,8 +108,9 @@ class TpfaLinearizer
static const bool linearizeNonLocalElements = getPropValue<TypeTag, Properties::LinearizeNonLocalElements>();
static const bool enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>();
static const bool enableDiffusion = getPropValue<TypeTag, Properties::EnableDiffusion>();
// copying the linearizer is not a good idea
TpfaLinearizer(const TpfaLinearizer&);
TpfaLinearizer(const TpfaLinearizer&) = delete;
//! \endcond
public:
@ -120,7 +118,7 @@ public:
: jacobian_()
{
simulatorPtr_ = 0;
separateSparseSourceTerms_ = Parameters::get<TypeTag, Parameters::SeparateSparseSourceTerms>();
separateSparseSourceTerms_ = Parameters::Get<Parameters::SeparateSparseSourceTerms>();
}
~TpfaLinearizer()
@ -132,7 +130,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::SeparateSparseSourceTerms>
Parameters::Register<Parameters::SeparateSparseSourceTerms>
("Treat well source terms all in one go, instead of on a cell by cell basis.");
}

View File

@ -107,7 +107,7 @@ public:
const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
const auto& problem = elemCtx.problem();
Scalar flashTolerance = Parameters::get<TypeTag, Parameters::FlashTolerance>();
Scalar flashTolerance = Parameters::Get<Parameters::FlashTolerance<Scalar>>();
// extract the total molar densities of the components
ComponentVector cTotal;

View File

@ -133,14 +133,6 @@ template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; };
//! Let the flash solver choose its tolerance by default
template<class TypeTag>
struct FlashTolerance<TypeTag, Properties::TTag::FlashModel>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = -1.0;
};
} // namespace Opm::Parameters
namespace Opm {
@ -244,7 +236,7 @@ public:
if (enableEnergy)
Opm::VtkEnergyModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::FlashTolerance>
Parameters::Register<Parameters::FlashTolerance<Scalar>>
("The maximum tolerance for the flash solver to "
"consider the solution converged");
}

View File

@ -30,13 +30,12 @@
#ifndef EWOMS_FLASH_PARAMETERS_HH
#define EWOMS_FLASH_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
//! The maximum accepted error of the flash solver
template<class TypeTag, class MyTypeTag>
struct FlashTolerance { using type = Properties::UndefinedProperty; };
//! Let the flash solver choose its tolerance by default
template<class Scalar>
struct FlashTolerance { static constexpr Scalar value = -1.0; };
} // namespace Opm::Parameters

View File

@ -58,7 +58,10 @@ class CubeGridVanguard : public BaseVanguard<TypeTag>
using GridPointer = std::unique_ptr<Grid>;
using CoordScalar = typename Grid::ctype;
enum { dimWorld = Grid::dimensionworld };
enum {
dim = Grid::dimension,
dimWorld = Grid::dimensionworld,
};
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
public:
@ -67,23 +70,24 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
Parameters::Register<Parameters::DomainSizeX<Scalar>>
("The size of the domain in x direction");
Parameters::registerParam<TypeTag, Parameters::CellsX>
Parameters::Register<Parameters::CellsX>
("The number of intervalls in x direction");
if (dimWorld > 1) {
Parameters::registerParam<TypeTag, Parameters::DomainSizeY>
if constexpr (dim > 1) {
Parameters::Register<Parameters::DomainSizeY<Scalar>>
("The size of the domain in y direction");
Parameters::registerParam<TypeTag, Parameters::CellsY>
Parameters::Register<Parameters::CellsY>
("The number of intervalls in y direction");
}
if (dimWorld > 2) {
Parameters::registerParam<TypeTag, Parameters::DomainSizeZ>
if constexpr (dim > 2) {
Parameters::Register<Parameters::DomainSizeZ<Scalar>>
("The size of the domain in z direction");
Parameters::registerParam<TypeTag, Parameters::CellsZ>
Parameters::Register<Parameters::CellsZ>
("The number of intervalls in z direction");
}
}
@ -94,25 +98,26 @@ public:
CubeGridVanguard(Simulator& simulator)
: ParentType(simulator)
{
std::array<unsigned int, dimWorld> cellRes;
std::array<unsigned int, dim> cellRes;
GlobalPosition upperRight(0.0);
GlobalPosition lowerLeft(0.0);
for (unsigned i = 0; i < dimWorld; ++i)
for (unsigned i = 0; i < dim; ++i)
cellRes[i] = 0;
upperRight[0] = Parameters::get<TypeTag, Parameters::DomainSizeX>();
cellRes[0] = Parameters::get<TypeTag, Parameters::CellsX>();
if (dimWorld > 1) {
upperRight[1] = Parameters::get<TypeTag, Parameters::DomainSizeY>();
cellRes[1] = Parameters::get<TypeTag, Parameters::CellsY>();
upperRight[0] = Parameters::Get<Parameters::DomainSizeX<Scalar>>();
cellRes[0] = Parameters::Get<Parameters::CellsX>();
if constexpr (dim > 1) {
upperRight[1] = Parameters::Get<Parameters::DomainSizeY<Scalar>>();
cellRes[1] = Parameters::Get<Parameters::CellsY>();
}
if (dimWorld > 2) {
upperRight[2] = Parameters::get<TypeTag, Parameters::DomainSizeZ>();
cellRes[2] = Parameters::get<TypeTag, Parameters::CellsZ>();
if constexpr (dim > 2) {
upperRight[2] = Parameters::Get<Parameters::DomainSizeZ<Scalar>>();
cellRes[2] = Parameters::Get<Parameters::CellsZ>();
}
unsigned numRefinements = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinements = Parameters::Get<Parameters::GridGlobalRefinements>();
cubeGrid_ = Dune::StructuredGridFactory<Grid>::createCubeGrid(lowerLeft, upperRight, cellRes);
cubeGrid_->globalRefine(static_cast<int>(numRefinements));

View File

@ -62,9 +62,9 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::GridFile>
Parameters::Register<Parameters::GridFile>
("The file name of the DGF file to load");
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
}
@ -75,8 +75,8 @@ public:
DgfVanguard(Simulator& simulator)
: ParentType(simulator)
{
const std::string dgfFileName = Parameters::get<TypeTag, Parameters::GridFile>();
unsigned numRefinments = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
const std::string dgfFileName = Parameters::Get<Parameters::GridFile>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
{
// create DGF GridPtr from a dgf file

View File

@ -53,7 +53,10 @@ class SimplexGridVanguard
using GridPointer = std::unique_ptr<Grid>;
using CoordScalar = typename Grid::ctype;
enum { dimWorld = Grid::dimensionworld };
enum {
dim = Grid::dimension,
dimWorld = Grid::dimensionworld,
};
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
public:
@ -62,23 +65,23 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
Parameters::Register<Parameters::DomainSizeX>
("The size of the domain in x direction");
Parameters::registerParam<TypeTag, Parameters::CellsX>
Parameters::Register<Parameters::CellsX>
("The number of intervalls in x direction");
if (dimWorld > 1) {
Parameters::registerParam<TypeTag, Parameters::DomainSizeY>
Parameters::Register<Parameters::DomainSizeY>
("The size of the domain in y direction");
Parameters::registerParam<TypeTag, Parameters::CellsY>
Parameters::Register<Parameters::CellsY>
("The number of intervalls in y direction");
}
if (dimWorld > 2) {
Parameters::registerParam<TypeTag, Parameters::DomainSizeZ>
if constexpr (dim > 2) {
Parameters::Register<Parameters::DomainSizeZ>
("The size of the domain in z direction");
Parameters::registerParam<TypeTag, Parameters::CellsZ>
Parameters::Register<Parameters::CellsZ>
("The number of intervalls in z direction");
}
}
@ -89,29 +92,29 @@ public:
SimplexGridVanguard(Simulator& simulator)
: ParentType(simulator)
{
Dune::array<unsigned, dimWorld> cellRes;
Dune::array<unsigned, dim> cellRes;
GlobalPosition upperRight;
GlobalPosition lowerLeft;
lowerLeft[0] = 0.0;
upperRight[0] = Parameters::get<TypeTag, Parameters::DomainSizeX>();
cellRes[0] = Parameters::get<TypeTag, Parameters::CellsX>();
if (dimWorld > 1) {
upperRight[0] = Parameters::Get<Parameters::DomainSizeX>();
cellRes[0] = Parameters::Get<Parameters::CellsX>();
if constexpr (dim > 1) {
lowerLeft[1] = 0.0;
upperRight[1] = Parameters::get<TypeTag, Parameters::DomainSizeY>();
cellRes[1] = Parameters::get<TypeTag, Parameters::CellsY>();
upperRight[1] = Parameters::Get<Parameters::DomainSizeY>();
cellRes[1] = Parameters::Get<Parameters::CellsY>();
}
if (dimWorld > 2) {
if constexpr (dim > 2) {
lowerLeft[2] = 0.0;
upperRight[2] = Parameters::get<TypeTag, Parameters::DomainSizeZ>();
cellRes[2] = Parameters::get<TypeTag, Parameters::CellsZ>();
upperRight[2] = Parameters::Get<Parameters::DomainSizeZ>();
cellRes[2] = Parameters::Get<Parameters::CellsZ>();
}
simplexGrid_ = Dune::StructuredGridFactory<Grid>::createSimplexGrid(lowerLeft,
upperRight,
cellRes);
unsigned numRefinments = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
simplexGrid_->globalRefine(numRefinments);
this->finalizeInit_();

View File

@ -100,7 +100,7 @@ class StructuredGridVanguard : public BaseVanguard<TypeTag>
using GridPointer = std::unique_ptr<Grid>;
static const int dim = Grid::dimension;
static constexpr int dim = Grid::dimension;
public:
/*!
@ -108,23 +108,23 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
Parameters::Register<Parameters::DomainSizeX<Scalar>>
("The size of the domain in x direction");
Parameters::registerParam<TypeTag, Parameters::CellsX>
Parameters::Register<Parameters::CellsX>
("The number of intervalls in x direction");
if (dim > 1) {
Parameters::registerParam<TypeTag, Parameters::DomainSizeY>
Parameters::Register<Parameters::DomainSizeY<Scalar>>
("The size of the domain in y direction");
Parameters::registerParam<TypeTag, Parameters::CellsY>
Parameters::Register<Parameters::CellsY>
("The number of intervalls in y direction");
}
if (dim > 2) {
Parameters::registerParam<TypeTag, Parameters::DomainSizeZ>
if constexpr (dim > 2) {
Parameters::Register<Parameters::DomainSizeZ<Scalar>>
("The size of the domain in z direction");
Parameters::registerParam<TypeTag, Parameters::CellsZ>
Parameters::Register<Parameters::CellsZ>
("The number of intervalls in z direction");
}
}
@ -141,14 +141,14 @@ public:
Dune::FieldVector<GridScalar, dim> upperRight;
Dune::FieldVector<GridScalar, dim> lowerLeft( 0 );
upperRight[0] = Parameters::get<TypeTag, Parameters::DomainSizeX>();
upperRight[1] = Parameters::get<TypeTag, Parameters::DomainSizeY>();
upperRight[0] = Parameters::Get<Parameters::DomainSizeX<Scalar>>();
upperRight[1] = Parameters::Get<Parameters::DomainSizeY<Scalar>>();
cellRes[0] = Parameters::get<TypeTag, Parameters::CellsX>();
cellRes[1] = Parameters::get<TypeTag, Parameters::CellsY>();
if (dim == 3) {
upperRight[2] = Parameters::get<TypeTag, Parameters::DomainSizeZ>();
cellRes[2] = Parameters::get<TypeTag, Parameters::CellsZ>();
cellRes[0] = Parameters::Get<Parameters::CellsX>();
cellRes[1] = Parameters::Get<Parameters::CellsY>();
if constexpr (dim == 3) {
upperRight[2] = Parameters::Get<Parameters::DomainSizeZ<Scalar>>();
cellRes[2] = Parameters::Get<Parameters::CellsZ>();
}
std::stringstream dgffile;
@ -167,7 +167,7 @@ public:
// use DGF parser to create a grid from interval block
gridPtr_.reset( Dune::GridPtr< Grid >( dgffile ).release() );
unsigned numRefinements = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinements = Parameters::Get<Parameters::GridGlobalRefinements>();
gridPtr_->globalRefine(static_cast<int>(numRefinements));
this->finalizeInit_();

View File

@ -52,10 +52,10 @@ class UnstructuredGridVanguard : public BaseVanguard<TypeTag> {
* unstructured grid simulator vanguard.
*/
static void registerParameters() {
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::GridFile>,
Parameters::Register<Parameters::GridFile>,
("The file name of the file to load");
}
@ -64,8 +64,8 @@ class UnstructuredGridVanguard : public BaseVanguard<TypeTag> {
*/
UnstructuredGridVanguard(Simulator& simulator) : ParentType(simulator){
#ifdef HAVE_OPM_GRID
const std::string gridFileName = Parameters::get<TypeTag, Parameters::GridFile>();
unsigned numRefinments = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
const std::string gridFileName = Parameters::Get<Parameters::GridFile>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
const char* c_str = gridFileName.c_str();

View File

@ -110,9 +110,9 @@ public:
const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
const auto& problem = elemCtx.problem();
const Scalar flashTolerance = Parameters::get<TypeTag, Parameters::FlashTolerance>();
const int flashVerbosity = Parameters::get<TypeTag, Parameters::FlashVerbosity>();
const std::string flashTwoPhaseMethod = Parameters::get<TypeTag, Parameters::FlashTwoPhaseMethod>();
const Scalar flashTolerance = Parameters::Get<Parameters::FlashTolerance<Scalar>>();
const int flashVerbosity = Parameters::Get<Parameters::FlashVerbosity>();
const std::string flashTwoPhaseMethod = Parameters::Get<Parameters::FlashTwoPhaseMethod>();
// extract the total molar densities of the components
ComponentVector z(0.);

View File

@ -156,24 +156,6 @@ template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; };
//! Let the flash solver choose its tolerance by default
template<class TypeTag>
struct FlashTolerance<TypeTag, Properties::TTag::FlashModel>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.e-12;
};
// Flash two-phase method
template<class TypeTag>
struct FlashTwoPhaseMethod<TypeTag, Properties::TTag::FlashModel>
{ static constexpr auto value = "ssi"; };
// Flash solver verbosity
template<class TypeTag>
struct FlashVerbosity<TypeTag, Properties::TTag::FlashModel>
{ static constexpr int value = 0; };
} // namespace Opm::Parameters
namespace Opm {
@ -261,14 +243,16 @@ public:
if (enableEnergy)
Opm::VtkEnergyModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::FlashTolerance>
Parameters::Register<Parameters::FlashTolerance<Scalar>>
("The maximum tolerance for the flash solver to "
"consider the solution converged");
Parameters::registerParam<TypeTag, Parameters::FlashVerbosity>
Parameters::Register<Parameters::FlashVerbosity>
("Flash solver verbosity level");
Parameters::registerParam<TypeTag, Parameters::FlashTwoPhaseMethod>
Parameters::Register<Parameters::FlashTwoPhaseMethod>
("Method for solving vapor-liquid composition. Available options include: "
"ssi, newton, ssi+newton");
Parameters::SetDefault<Parameters::FlashTolerance<Scalar>>(1e-12);
}
/*!

View File

@ -32,17 +32,13 @@
#include <opm/models/flash/flashparameters.hh>
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
//! Two-phase flash method
template<class TypeTag, class MyTypeTag>
struct FlashTwoPhaseMethod { using type = Properties::UndefinedProperty; };
struct FlashTwoPhaseMethod { static constexpr auto value = "ssi"; };
//! The verbosity level of the flash solver
template<class TypeTag, class MyTypeTag>
struct FlashVerbosity { using type = Properties::UndefinedProperty; };
struct FlashVerbosity { static constexpr int value = 0; };
} // namespace Opm::Parameters

View File

@ -160,13 +160,7 @@ struct PvsMoleFractionsBaseWeight<TypeTag, TTag::PvsModel>
namespace Opm::Parameters {
//! The verbosity of the model (0 -> do not print anything, 2 -> spam stdout a lot)
template<class TypeTag, class MyTypeTag>
struct PvsVerbosity { using type = Properties::UndefinedProperty; };
// set the model to a medium verbosity
template<class TypeTag>
struct PvsVerbosity<TypeTag, Properties::TTag::PvsModel>
{ static constexpr int value = 1; };
struct PvsVerbosity { static constexpr int value = 1; };
} // namespace Opm::Parameters
@ -298,7 +292,7 @@ public:
PvsModel(Simulator& simulator)
: ParentType(simulator)
{
verbosity_ = Parameters::get<TypeTag, Parameters::PvsVerbosity>();
verbosity_ = Parameters::Get<Parameters::PvsVerbosity>();
numSwitched_ = 0;
}
@ -319,7 +313,7 @@ public:
if (enableEnergy)
Opm::VtkEnergyModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::PvsVerbosity>
Parameters::Register<Parameters::PvsVerbosity>
("The verbosity level of the primary variable "
"switching model");
}

View File

@ -33,46 +33,37 @@
namespace Opm::Parameters {
//! grid resolution
template<class TypeTag, class MyTypeTag>
struct CellsX { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct CellsY { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct CellsZ { using type = Properties::UndefinedProperty; };
struct CellsX { static constexpr unsigned value = 1; };
struct CellsY { static constexpr unsigned value = 1; };
struct CellsZ { static constexpr unsigned value = 1; };
//! domain size
template<class TypeTag, class MyTypeTag>
struct DomainSizeX { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct DomainSizeX { static constexpr Scalar value = 1.0; };
template<class TypeTag, class MyTypeTag>
struct DomainSizeY { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct DomainSizeY { static constexpr Scalar value = 1.0; };
template<class TypeTag, class MyTypeTag>
struct DomainSizeZ { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct DomainSizeZ { static constexpr Scalar value = 1.0; };
//! The default value for the simulation's end time
template<class TypeTag, class MyTypeTag>
struct EndTime { using type = Properties::UndefinedProperty; };
//! name of the grid file
template<class TypeTag, class MyTypeTag>
struct GridFile { using type = Properties::UndefinedProperty; };
//! Name of the grid file
struct GridFile { static constexpr auto value = ""; };
//! Property which tells the Vanguard how often the grid should be refined
//! after creation.
template<class TypeTag, class MyTypeTag>
struct GridGlobalRefinements { using type = Properties::UndefinedProperty; };
struct GridGlobalRefinements { static constexpr unsigned value = 0; };
//! The default value for the simulation's initial time step size
template<class TypeTag, class MyTypeTag>
struct InitialTimeStepSize { using type = Properties::UndefinedProperty; };
//! Property provides the name of the file from which the additional runtime
//! parameters should to be loaded from
template<class TypeTag, class MyTypeTag>
struct ParameterFile { using type = Properties::UndefinedProperty; };
//! Set a value for the ParameterFile property
struct ParameterFile { static constexpr auto value = ""; };
//! The name of the file with a number of forced time step lengths
template<class TypeTag, class MyTypeTag>

View File

@ -187,17 +187,6 @@ struct EndTime<TypeTag, Properties::TTag::NumericModel>
static constexpr type value = -1e35;
};
//! Set a value for the GridFile property
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::NumericModel>
{ static constexpr auto value = ""; };
//! Set the number of refinement levels of the grid to 0. This does not belong
//! here, strictly speaking.
template<class TypeTag>
struct GridGlobalRefinements<TypeTag, Properties::TTag::NumericModel>
{ static constexpr unsigned value = 0; };
//! The default value for the simulation's initial time step size
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::NumericModel>
@ -206,11 +195,6 @@ struct InitialTimeStepSize<TypeTag, Properties::TTag::NumericModel>
static constexpr type value = -1e35;
};
//! Set a value for the ParameterFile property
template<class TypeTag>
struct ParameterFile<TypeTag, Properties::TTag::NumericModel>
{ static constexpr auto value = ""; };
//! By default, do not force any time steps
template<class TypeTag>
struct PredeterminedTimeStepsFile<TypeTag, Properties::TTag::NumericModel>

View File

@ -101,8 +101,7 @@ struct ParamInfo
return other.paramName == paramName
&& other.paramTypeName == paramTypeName
&& other.typeTagName == typeTagName
&& other.usageString == usageString
&& other.compileTimeValue == compileTimeValue;
&& other.usageString == usageString;
}
};
@ -924,6 +923,11 @@ auto Get(bool errorIfNotRegistered)
else if constexpr (std::is_same_v<ParamType, bool>) {
defaultValue = defVal == "1";
}
#if HAVE_QUAD
else if constexpr (std::is_same_v<ParamType, quad>) {
defaultValue = std::strtold(defVal.data(), nullptr);
}
#endif
else {
#ifdef _LIBCPP_VERSION // If this macro is defined, clang's libc++ is used
// For floating point types, libc++ (the llvm/clang library implementation)

View File

@ -78,7 +78,7 @@ static inline void registerAllParameters_(bool finalizeRegistration = true)
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
using ThreadManager = GetPropType<TypeTag, Properties::ThreadManager>;
Parameters::registerParam<TypeTag, Parameters::ParameterFile>
Parameters::Register<Parameters::ParameterFile>
("An .ini file which contains a set of run-time parameters");
Parameters::registerParam<TypeTag, Parameters::PrintParameters>
("Print the values of the run-time parameters at the "
@ -147,7 +147,7 @@ static inline int setupParameters_(int argc,
return status;
}
const std::string paramFileName = Parameters::get<TypeTag, Parameters::ParameterFile>(false);
const std::string paramFileName = Parameters::Get<Parameters::ParameterFile>(false);
if (!paramFileName.empty()) {
////////////////////////////////////////////////////////////
// add the parameters specified using an .ini file