Merge pull request #915 from akva2/problems_move_params

Move parameters in example problems to Opm::Parameters namespace
This commit is contained in:
Bård Skaflestad
2024-08-08 17:15:06 +02:00
committed by GitHub
6 changed files with 383 additions and 328 deletions
+103 -85
View File
@@ -57,11 +57,12 @@
#include <string>
namespace Opm {
//! \cond SKIP_THIS
template <class TypeTag>
class Co2InjectionProblem;
//! \endcond
}
namespace Opm::Properties {
@@ -70,27 +71,6 @@ namespace TTag {
struct Co2InjectionBaseProblem {};
}
// declare the CO2 injection problem specific property tags
template<class TypeTag, class MyTypeTag>
struct FluidSystemPressureLow { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemPressureHigh { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemNumPressure { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemTemperatureLow { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemTemperatureHigh { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemNumTemperature { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MaxDepth { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct Temperature { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct SimulationName { using type = UndefinedProperty; };
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::Co2InjectionBaseProblem> { using type = Dune::YaspGrid<2>; };
@@ -157,55 +137,38 @@ struct SolidEnergyLaw<TypeTag, TTag::Co2InjectionBaseProblem>
template<class TypeTag>
struct LinearSolverSplice<TypeTag, TTag::Co2InjectionBaseProblem> { using type = TTag::ParallelAmgLinearSolver; };
// set the defaults for the problem specific properties
template<class TypeTag>
struct FluidSystemPressureLow<TypeTag, TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 3e7;
};
template<class TypeTag>
struct FluidSystemPressureHigh<TypeTag, TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 4e7;
};
template<class TypeTag>
struct FluidSystemNumPressure<TypeTag, TTag::Co2InjectionBaseProblem> { static constexpr unsigned value = 100; };
template<class TypeTag>
struct FluidSystemTemperatureLow<TypeTag, TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 290;
};
template<class TypeTag>
struct FluidSystemTemperatureHigh<TypeTag, TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 500;
};
template<class TypeTag>
struct FluidSystemNumTemperature<TypeTag, TTag::Co2InjectionBaseProblem> { static constexpr unsigned value = 100; };
template<class TypeTag>
struct MaxDepth<TypeTag, TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 2500;
};
template<class TypeTag>
struct Temperature<TypeTag, TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 293.15;
};
template<class TypeTag>
struct SimulationName<TypeTag, TTag::Co2InjectionBaseProblem> { static constexpr auto value = "co2injection"; };
} // namespace Opm::Properties
namespace Opm::Parameters {
// declare the CO2 injection problem specific property tags
template<class TypeTag, class MyTypeTag>
struct FluidSystemPressureLow { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemPressureHigh { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemNumPressure { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemTemperatureLow { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemTemperatureHigh { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FluidSystemNumTemperature { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MaxDepth { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct Temperature { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct SimulationName { using type = Properties::UndefinedProperty; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
@@ -219,6 +182,42 @@ struct EndTime<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
static constexpr type value = 1e4;
};
template<class TypeTag>
struct FluidSystemNumPressure<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr unsigned value = 100; };
template<class TypeTag>
struct FluidSystemNumTemperature<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr unsigned value = 100; };
template<class TypeTag>
struct FluidSystemPressureHigh<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 4e7;
};
template<class TypeTag>
struct FluidSystemPressureLow<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 3e7;
};
template<class TypeTag>
struct FluidSystemTemperatureHigh<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 500;
};
template<class TypeTag>
struct FluidSystemTemperatureLow<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 290;
};
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
@@ -232,11 +231,29 @@ struct InitialTimeStepSize<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
static constexpr type value = 250;
};
template<class TypeTag>
struct MaxDepth<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 2500;
};
// Write the Newton convergence behavior to disk?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr bool value = false; };
template<class TypeTag>
struct SimulationName<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr auto value = "co2injection"; };
template<class TypeTag>
struct Temperature<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 293.15;
};
} // namespace Opm::Parameters
namespace Opm {
@@ -318,16 +335,16 @@ public:
eps_ = 1e-6;
temperatureLow_ = Parameters::get<TypeTag, Properties::FluidSystemTemperatureLow>();
temperatureHigh_ = Parameters::get<TypeTag, Properties::FluidSystemTemperatureHigh>();
nTemperature_ = Parameters::get<TypeTag, Properties::FluidSystemNumTemperature>();
temperatureLow_ = Parameters::get<TypeTag, Parameters::FluidSystemTemperatureLow>();
temperatureHigh_ = Parameters::get<TypeTag, Parameters::FluidSystemTemperatureHigh>();
nTemperature_ = Parameters::get<TypeTag, Parameters::FluidSystemNumTemperature>();
pressureLow_ = Parameters::get<TypeTag, Properties::FluidSystemPressureLow>();
pressureHigh_ = Parameters::get<TypeTag, Properties::FluidSystemPressureHigh>();
nPressure_ = Parameters::get<TypeTag, Properties::FluidSystemNumPressure>();
pressureLow_ = Parameters::get<TypeTag, Parameters::FluidSystemPressureLow>();
pressureHigh_ = Parameters::get<TypeTag, Parameters::FluidSystemPressureHigh>();
nPressure_ = Parameters::get<TypeTag, Parameters::FluidSystemNumPressure>();
maxDepth_ = Parameters::get<TypeTag, Properties::MaxDepth>();
temperature_ = Parameters::get<TypeTag, Properties::Temperature>();
maxDepth_ = Parameters::get<TypeTag, Parameters::MaxDepth>();
temperature_ = Parameters::get<TypeTag, Parameters::Temperature>();
// initialize the tables of the fluid system
// FluidSystem::init();
@@ -380,23 +397,23 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Properties::FluidSystemTemperatureLow>
Parameters::registerParam<TypeTag, Parameters::FluidSystemTemperatureLow>
("The lower temperature [K] for tabulation of the fluid system");
Parameters::registerParam<TypeTag, Properties::FluidSystemTemperatureHigh>
Parameters::registerParam<TypeTag, Parameters::FluidSystemTemperatureHigh>
("The upper temperature [K] for tabulation of the fluid system");
Parameters::registerParam<TypeTag, Properties::FluidSystemNumTemperature>
Parameters::registerParam<TypeTag, Parameters::FluidSystemNumTemperature>
("The number of intervals between the lower and upper temperature");
Parameters::registerParam<TypeTag, Properties::FluidSystemPressureLow>
Parameters::registerParam<TypeTag, Parameters::FluidSystemPressureLow>
("The lower pressure [Pa] for tabulation of the fluid system");
Parameters::registerParam<TypeTag, Properties::FluidSystemPressureHigh>
Parameters::registerParam<TypeTag, Parameters::FluidSystemPressureHigh>
("The upper pressure [Pa] for tabulation of the fluid system");
Parameters::registerParam<TypeTag, Properties::FluidSystemNumPressure>
Parameters::registerParam<TypeTag, Parameters::FluidSystemNumPressure>
("The number of intervals between the lower and upper pressure");
Parameters::registerParam<TypeTag, Properties::Temperature>
Parameters::registerParam<TypeTag, Parameters::Temperature>
("The temperature [K] in the reservoir");
Parameters::registerParam<TypeTag, Properties::MaxDepth>
Parameters::registerParam<TypeTag, Parameters::MaxDepth>
("The maximum depth [m] of the reservoir");
Parameters::registerParam<TypeTag, Properties::SimulationName>
Parameters::registerParam<TypeTag, Parameters::SimulationName>
("The name of the simulation used for the output files");
}
@@ -411,7 +428,7 @@ public:
std::string name() const
{
std::ostringstream oss;
oss << Parameters::get<TypeTag, Properties::SimulationName>()
oss << Parameters::get<TypeTag, Parameters::SimulationName>()
<< "_" << Model::name();
if (getPropValue<TypeTag, Properties::EnableEnergy>())
oss << "_ni";
@@ -706,6 +723,7 @@ private:
Scalar pressureLow_, pressureHigh_;
Scalar temperatureLow_, temperatureHigh_;
};
} // namespace Opm
#endif
+52 -45
View File
@@ -66,16 +66,6 @@ namespace TTag {
struct CO2PTBaseProblem {};
} // end namespace TTag
template <class TypeTag, class MyTypeTag>
struct Temperature { using type = UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct SimulationName { using type = UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct EpisodeLength { using type = UndefinedProperty;};
template <class TypeTag, class MyTypeTag>
struct Initialpressure { using type = UndefinedProperty;};
template <class TypeTag, class MyTypeTag>
struct NumComp { using type = UndefinedProperty; };
@@ -139,31 +129,6 @@ public:
using type = EffMaterialLaw;
};
// set the defaults for the problem specific properties
template <class TypeTag>
struct Temperature<TypeTag, TTag::CO2PTBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 423.25;//TODO
};
template <class TypeTag>
struct Initialpressure<TypeTag, TTag::CO2PTBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 75.e5;
};
template <class TypeTag>
struct SimulationName<TypeTag, TTag::CO2PTBaseProblem> {
static constexpr auto value = "co2_ptflash";
};
// this is kinds of telling the report step length
template <class TypeTag>
struct EpisodeLength<TypeTag, TTag::CO2PTBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.1 * 60. * 60.;
};
// mesh grid
template <class TypeTag>
struct Vanguard<TypeTag, TTag::CO2PTBaseProblem> {
@@ -179,6 +144,18 @@ struct EnableEnergy<TypeTag, TTag::CO2PTBaseProblem> {
namespace Opm::Parameters {
template <class TypeTag, class MyTypeTag>
struct Temperature { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct SimulationName { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
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; };
@@ -230,6 +207,21 @@ struct EndTime<TypeTag, Properties::TTag::CO2PTBaseProblem>
static constexpr type value = 60. * 60.;
};
// this is kinds of telling the report step length
template <class TypeTag>
struct EpisodeLength<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.1 * 60. * 60.;
};
template <class TypeTag>
struct Initialpressure<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 75.e5;
};
// convergence control
template <class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::CO2PTBaseProblem>
@@ -275,6 +267,18 @@ template <class TypeTag>
struct NewtonMaxIterations<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr int value = 30; };
template <class TypeTag>
struct SimulationName<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr auto value = "co2_ptflash"; };
// set the defaults for the problem specific properties
template <class TypeTag>
struct Temperature<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 423.25; // TODO
};
template <class TypeTag>
struct VtkWriteEquilibriumConstants<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = true; };
@@ -357,7 +361,7 @@ public:
explicit CO2PTProblem(Simulator& simulator)
: ParentType(simulator)
{
const Scalar epi_len = Parameters::get<TypeTag, Properties::EpisodeLength>();
const Scalar epi_len = Parameters::get<TypeTag, Parameters::EpisodeLength>();
simulator.setEpisodeLength(epi_len);
FluidSystem::init();
using CompParm = typename FluidSystem::ComponentParam;
@@ -375,7 +379,7 @@ public:
void initPetrophysics()
{
temperature_ = Parameters::get<TypeTag, Properties::Temperature>();
temperature_ = Parameters::get<TypeTag, Parameters::Temperature>();
K_ = this->toDimMatrix_(9.869232667160131e-14);
porosity_ = 0.1;
@@ -383,7 +387,9 @@ public:
template <class Context>
const DimVector&
gravity([[maybe_unused]]const Context& context, [[maybe_unused]] unsigned spaceIdx, [[maybe_unused]] unsigned timeIdx) const
gravity([[maybe_unused]]const Context& context,
[[maybe_unused]] unsigned spaceIdx,
[[maybe_unused]] unsigned timeIdx) const
{
return gravity();
}
@@ -410,13 +416,13 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Properties::Temperature>
Parameters::registerParam<TypeTag, Parameters::Temperature>
("The temperature [K] in the reservoir");
Parameters::registerParam<TypeTag, Properties::Initialpressure>
Parameters::registerParam<TypeTag, Parameters::Initialpressure>
("The initial pressure [Pa s] in the reservoir");
Parameters::registerParam<TypeTag, Properties::SimulationName>
Parameters::registerParam<TypeTag, Parameters::SimulationName>
("The name of the simulation used for the output files");
Parameters::registerParam<TypeTag, Properties::EpisodeLength>
Parameters::registerParam<TypeTag, Parameters::EpisodeLength>
("Time interval [s] for episode length");
}
@@ -426,7 +432,7 @@ public:
std::string name() const
{
std::ostringstream oss;
oss << Parameters::get<TypeTag, Properties::SimulationName>();
oss << Parameters::get<TypeTag, Parameters::SimulationName>();
return oss.str();
}
@@ -435,7 +441,7 @@ public:
// the old one.
void endEpisode()
{
Scalar epi_len = Parameters::get<TypeTag, Properties::EpisodeLength>();
Scalar epi_len = Parameters::get<TypeTag, Parameters::EpisodeLength>();
this->simulator().startNextEpisode(epi_len);
}
@@ -577,7 +583,7 @@ private:
sat[0] = 1.0;
sat[1] = 1.0 - sat[0];
Scalar p0 = Parameters::get<TypeTag, Properties::Initialpressure>();
Scalar p0 = Parameters::get<TypeTag, Parameters::Initialpressure>();
//\Note, for an AD variable, if we multiply it with 2, the derivative will also be scalced with 2,
//\Note, so we should not do it.
@@ -630,6 +636,7 @@ private:
MaterialLawParams mat_;
DimVector gravity_;
};
} // namespace Opm
#endif
+12 -13
View File
@@ -79,10 +79,6 @@ struct Grid<TypeTag, TTag::FingerBaseProblem>
Dune::nonconforming>; };
#endif
// declare the properties used by the finger problem
template<class TypeTag, class MyTypeTag>
struct InitialWaterSaturation { using type = UndefinedProperty; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::FingerBaseProblem> { using type = Opm::FingerProblem<TypeTag>; };
@@ -128,17 +124,13 @@ struct MaterialLaw<TypeTag, TTag::FingerBaseProblem>
template<class TypeTag>
struct EnableConstraints<TypeTag, TTag::FingerBaseProblem> { static constexpr int value = true; };
template<class TypeTag>
struct InitialWaterSaturation<TypeTag, TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.01;
};
} // namespace Opm::Properties
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; };
@@ -194,6 +186,13 @@ struct InitialTimeStepSize<TypeTag, Properties::TTag::FingerBaseProblem>
static constexpr type value = 10;
};
template<class TypeTag>
struct InitialWaterSaturation<TypeTag, Properties::TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.01;
};
// Write the solutions of individual newton iterations?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::FingerBaseProblem>
@@ -319,7 +318,7 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Properties::InitialWaterSaturation>
Parameters::registerParam<TypeTag, Parameters::InitialWaterSaturation>
("The initial saturation in the domain [] of the wetting phase");
}
@@ -572,7 +571,7 @@ private:
auto& fs = initialFluidState_;
fs.setPressure(wettingPhaseIdx, /*pressure=*/1e5);
Scalar Sw = Parameters::get<TypeTag, Properties::InitialWaterSaturation>();
Scalar Sw = Parameters::get<TypeTag, Parameters::InitialWaterSaturation>();
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1 - Sw);
+96 -82
View File
@@ -56,23 +56,6 @@ namespace TTag {
struct GroundWaterBaseProblem {};
}
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftX { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftY { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftZ { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightX { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightY { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightZ { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct Permeability { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct PermeabilityLens { using type = UndefinedProperty; };
template<class TypeTag>
struct Fluid<TypeTag, TTag::GroundWaterBaseProblem>
{
@@ -92,55 +75,6 @@ template<class TypeTag>
struct Problem<TypeTag, TTag::GroundWaterBaseProblem>
{ using type = Opm::GroundWaterProblem<TypeTag>; };
template<class TypeTag>
struct LensLowerLeftX<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.25;
};
template<class TypeTag>
struct LensLowerLeftY<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.25;
};
template<class TypeTag>
struct LensLowerLeftZ<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.25;
};
template<class TypeTag>
struct LensUpperRightX<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.75;
};
template<class TypeTag>
struct LensUpperRightY<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.75;
};
template<class TypeTag>
struct LensUpperRightZ<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.75;
};
template<class TypeTag>
struct Permeability<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-10;
};
template<class TypeTag>
struct PermeabilityLens<TypeTag, TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-12;
};
// Use the conjugated gradient linear solver with the default preconditioner (i.e.,
// ILU-0) from dune-istl
template<class TypeTag>
@@ -154,6 +88,30 @@ struct LinearSolverWrapper<TypeTag, TTag::GroundWaterBaseProblem>
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftX { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftY { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftZ { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightX { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightY { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightZ { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct Permeability { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct PermeabilityLens { using type = Properties::UndefinedProperty; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::GroundWaterBaseProblem>
@@ -180,6 +138,62 @@ struct InitialTimeStepSize<TypeTag, Properties::TTag::GroundWaterBaseProblem>
static constexpr type value = 1;
};
template<class TypeTag>
struct LensLowerLeftX<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.25;
};
template<class TypeTag>
struct LensLowerLeftY<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.25;
};
template<class TypeTag>
struct LensLowerLeftZ<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.25;
};
template<class TypeTag>
struct LensUpperRightX<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.75;
};
template<class TypeTag>
struct LensUpperRightY<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.75;
};
template<class TypeTag>
struct LensUpperRightZ<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.75;
};
template<class TypeTag>
struct Permeability<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-10;
};
template<class TypeTag>
struct PermeabilityLens<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-12;
};
} // namespace Opm::Parameters
namespace Opm {
@@ -246,20 +260,20 @@ public:
eps_ = 1.0e-3;
lensLowerLeft_[0] = Parameters::get<TypeTag, Properties::LensLowerLeftX>();
lensLowerLeft_[0] = Parameters::get<TypeTag, Parameters::LensLowerLeftX>();
if (dim > 1)
lensLowerLeft_[1] = Parameters::get<TypeTag, Properties::LensLowerLeftY>();
lensLowerLeft_[1] = Parameters::get<TypeTag, Parameters::LensLowerLeftY>();
if (dim > 2)
lensLowerLeft_[2] = Parameters::get<TypeTag, Properties::LensLowerLeftY>();
lensLowerLeft_[2] = Parameters::get<TypeTag, Parameters::LensLowerLeftY>();
lensUpperRight_[0] = Parameters::get<TypeTag, Properties::LensUpperRightX>();
lensUpperRight_[0] = Parameters::get<TypeTag, Parameters::LensUpperRightX>();
if (dim > 1)
lensUpperRight_[1] = Parameters::get<TypeTag, Properties::LensUpperRightY>();
lensUpperRight_[1] = Parameters::get<TypeTag, Parameters::LensUpperRightY>();
if (dim > 2)
lensUpperRight_[2] = Parameters::get<TypeTag, Properties::LensUpperRightY>();
lensUpperRight_[2] = Parameters::get<TypeTag, Parameters::LensUpperRightY>();
intrinsicPerm_ = this->toDimMatrix_(Parameters::get<TypeTag, Properties::Permeability>());
intrinsicPermLens_ = this->toDimMatrix_(Parameters::get<TypeTag, Properties::PermeabilityLens>());
intrinsicPerm_ = this->toDimMatrix_(Parameters::get<TypeTag, Parameters::Permeability>());
intrinsicPermLens_ = this->toDimMatrix_(Parameters::get<TypeTag, Parameters::PermeabilityLens>());
}
/*!
@@ -269,28 +283,28 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Properties::LensLowerLeftX>
Parameters::registerParam<TypeTag, Parameters::LensLowerLeftX>
("The x-coordinate of the lens' lower-left corner [m].");
Parameters::registerParam<TypeTag, Properties::LensUpperRightX>
Parameters::registerParam<TypeTag, Parameters::LensUpperRightX>
("The x-coordinate of the lens' upper-right corner [m].");
if (dimWorld > 1) {
Parameters::registerParam<TypeTag, Properties::LensLowerLeftY>
Parameters::registerParam<TypeTag, Parameters::LensLowerLeftY>
("The y-coordinate of the lens' lower-left corner [m].");
Parameters::registerParam<TypeTag, Properties::LensUpperRightY>
Parameters::registerParam<TypeTag, Parameters::LensUpperRightY>
("The y-coordinate of the lens' upper-right corner [m].");
}
if (dimWorld > 2) {
Parameters::registerParam<TypeTag, Properties::LensLowerLeftZ>
Parameters::registerParam<TypeTag, Parameters::LensLowerLeftZ>
("The z-coordinate of the lens' lower-left corner [m].");
Parameters::registerParam<TypeTag, Properties::LensUpperRightZ>
Parameters::registerParam<TypeTag, Parameters::LensUpperRightZ>
("The z-coordinate of the lens' upper-right corner [m].");
}
Parameters::registerParam<TypeTag, Properties::Permeability>
Parameters::registerParam<TypeTag, Parameters::Permeability>
("The intrinsic permeability [m^2] of the ambient material.");
Parameters::registerParam<TypeTag, Properties::PermeabilityLens>
Parameters::registerParam<TypeTag, Parameters::PermeabilityLens>
("The intrinsic permeability [m^2] of the lens.");
}
+74 -65
View File
@@ -62,20 +62,6 @@ namespace TTag {
struct LensBaseProblem { using InheritsFrom = std::tuple<StructuredGridVanguard>; };
} // end namespace TTag
// declare the properties specific for the lens problem
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftX { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftY { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftZ { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightX { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightY { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightZ { using type = UndefinedProperty; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::LensBaseProblem> { using type = Opm::LensProblem<TypeTag>; };
@@ -129,49 +115,29 @@ public:
using type = Opm::EffToAbsLaw<EffectiveLaw>;
};
// define the properties specific for the lens problem
template<class TypeTag>
struct LensLowerLeftX<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct LensLowerLeftY<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 2.0;
};
template<class TypeTag>
struct LensLowerLeftZ<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.0;
};
template<class TypeTag>
struct LensUpperRightX<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 4.0;
};
template<class TypeTag>
struct LensUpperRightY<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 3.0;
};
template<class TypeTag>
struct LensUpperRightZ<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
} // namespace Opm::Properties
namespace Opm::Parameters {
// declare the properties specific for the lens problem
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftX { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftY { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensLowerLeftZ { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightX { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
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; };
@@ -236,6 +202,49 @@ struct InitialTimeStepSize<TypeTag, Properties::TTag::LensBaseProblem>
static constexpr type value = 250;
};
// define the properties specific for the lens problem
template<class TypeTag>
struct LensLowerLeftX<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct LensLowerLeftY<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 2.0;
};
template<class TypeTag>
struct LensLowerLeftZ<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.0;
};
template<class TypeTag>
struct LensUpperRightX<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 4.0;
};
template<class TypeTag>
struct LensUpperRightY<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 3.0;
};
template<class TypeTag>
struct LensUpperRightZ<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
// Write the solutions of individual newton iterations?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::LensBaseProblem>
@@ -329,14 +338,14 @@ public:
FluidSystem::init();
temperature_ = 273.15 + 20; // -> 20°C
lensLowerLeft_[0] = Parameters::get<TypeTag, Properties::LensLowerLeftX>();
lensLowerLeft_[1] = Parameters::get<TypeTag, Properties::LensLowerLeftY>();
lensUpperRight_[0] = Parameters::get<TypeTag, Properties::LensUpperRightX>();
lensUpperRight_[1] = Parameters::get<TypeTag, Properties::LensUpperRightY>();
lensLowerLeft_[0] = Parameters::get<TypeTag, Parameters::LensLowerLeftX>();
lensLowerLeft_[1] = Parameters::get<TypeTag, Parameters::LensLowerLeftY>();
lensUpperRight_[0] = Parameters::get<TypeTag, Parameters::LensUpperRightX>();
lensUpperRight_[1] = Parameters::get<TypeTag, Parameters::LensUpperRightY>();
if (dimWorld == 3) {
lensLowerLeft_[2] = Parameters::get<TypeTag, Properties::LensLowerLeftZ>();
lensUpperRight_[2] = Parameters::get<TypeTag, Properties::LensUpperRightZ>();
lensLowerLeft_[2] = Parameters::get<TypeTag, Parameters::LensLowerLeftZ>();
lensUpperRight_[2] = Parameters::get<TypeTag, Parameters::LensUpperRightZ>();
}
// residual saturations
@@ -370,19 +379,19 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Properties::LensLowerLeftX>
Parameters::registerParam<TypeTag, Parameters::LensLowerLeftX>
("The x-coordinate of the lens' lower-left corner [m].");
Parameters::registerParam<TypeTag, Properties::LensLowerLeftY>
Parameters::registerParam<TypeTag, Parameters::LensLowerLeftY>
("The y-coordinate of the lens' lower-left corner [m].");
Parameters::registerParam<TypeTag, Properties::LensUpperRightX>
Parameters::registerParam<TypeTag, Parameters::LensUpperRightX>
("The x-coordinate of the lens' upper-right corner [m].");
Parameters::registerParam<TypeTag, Properties::LensUpperRightY>
Parameters::registerParam<TypeTag, Parameters::LensUpperRightY>
("The y-coordinate of the lens' upper-right corner [m].");
if (dimWorld == 3) {
Parameters::registerParam<TypeTag, Properties::LensLowerLeftZ>
Parameters::registerParam<TypeTag, Parameters::LensLowerLeftZ>
("The z-coordinate of the lens' lower-left corner [m].");
Parameters::registerParam<TypeTag, Properties::LensUpperRightZ>
Parameters::registerParam<TypeTag, Parameters::LensUpperRightZ>
("The z-coordinate of the lens' upper-right corner [m].");
}
}
+46 -38
View File
@@ -45,8 +45,13 @@
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.hpp>
#include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/nonlinear/newtonmethodparameters.hh>
#include <opm/models/utils/basicproperties.hh>
#include <string>
#include <vector>
@@ -65,16 +70,6 @@ struct ReservoirBaseProblem {};
} // namespace TTag
// Maximum depth of the reservoir
template<class TypeTag, class MyTypeTag>
struct MaxDepth { using type = UndefinedProperty; };
// The temperature inside the reservoir
template<class TypeTag, class MyTypeTag>
struct Temperature { using type = UndefinedProperty; };
// The width of producer/injector wells as a fraction of the width of the spatial domain
template<class TypeTag, class MyTypeTag>
struct WellWidth { using type = UndefinedProperty; };
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::ReservoirBaseProblem> { using type = Dune::YaspGrid<2>; };
@@ -105,28 +100,6 @@ public:
template<class TypeTag>
struct EnableConstraints<TypeTag, TTag::ReservoirBaseProblem> { static constexpr bool value = true; };
// set the defaults for some problem specific properties
template<class TypeTag>
struct MaxDepth<TypeTag, TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 2500;
};
template<class TypeTag>
struct Temperature<TypeTag, TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 293.15;
};
// The width of producer/injector wells as a fraction of the width of the spatial domain
template<class TypeTag>
struct WellWidth<TypeTag, TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.01;
};
/*!
* \brief Explicitly set the fluid system to the black-oil fluid system
*
@@ -149,6 +122,18 @@ public:
namespace Opm::Parameters {
// Maximum depth of the reservoir
template<class TypeTag, class MyTypeTag>
struct MaxDepth { using type = Properties::UndefinedProperty; };
// The temperature inside the reservoir
template<class TypeTag, class MyTypeTag>
struct Temperature { using type = Properties::UndefinedProperty; };
// The width of producer/injector wells as a fraction of the width of the spatial domain
template<class TypeTag, class MyTypeTag>
struct WellWidth { using type = Properties::UndefinedProperty; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::ReservoirBaseProblem>
@@ -178,6 +163,14 @@ struct InitialTimeStepSize<TypeTag, Properties::TTag::ReservoirBaseProblem>
static constexpr type value = 100e3;
};
// set the defaults for some problem specific properties
template<class TypeTag>
struct MaxDepth<TypeTag, Properties::TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 2500;
};
// Write the Newton convergence behavior to disk?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::ReservoirBaseProblem>
@@ -191,6 +184,21 @@ struct NewtonTolerance<TypeTag, Properties::TTag::ReservoirBaseProblem>
static constexpr type value = 1e-6;
};
template<class TypeTag>
struct Temperature<TypeTag, Properties::TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 293.15;
};
// The width of producer/injector wells as a fraction of the width of the spatial domain
template<class TypeTag>
struct WellWidth<TypeTag, Properties::TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.01;
};
} // namespace Opm::Parameters
namespace Opm {
@@ -270,9 +278,9 @@ public:
{
ParentType::finishInit();
temperature_ = Parameters::get<TypeTag, Properties::Temperature>();
maxDepth_ = Parameters::get<TypeTag, Properties::MaxDepth>();
wellWidth_ = Parameters::get<TypeTag, Properties::WellWidth>();
temperature_ = Parameters::get<TypeTag, Parameters::Temperature>();
maxDepth_ = Parameters::get<TypeTag, Parameters::MaxDepth>();
wellWidth_ = Parameters::get<TypeTag, Parameters::WellWidth>();
std::vector<std::pair<Scalar, Scalar> > Bo = {
{ 101353, 1.062 },
@@ -434,11 +442,11 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Properties::Temperature>
Parameters::registerParam<TypeTag, Parameters::Temperature>
("The temperature [K] in the reservoir");
Parameters::registerParam<TypeTag, Properties::MaxDepth>
Parameters::registerParam<TypeTag, Parameters::MaxDepth>
("The maximum depth [m] of the reservoir");
Parameters::registerParam<TypeTag, Properties::WellWidth>
Parameters::registerParam<TypeTag, Parameters::WellWidth>
("The width of producer/injector wells as a fraction of the width"
" of the spatial domain");
}