changed: move the DomainSize(X|Y|Z) parameters to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving
2024-07-01 10:20:05 +02:00
parent 6b11559bf4
commit fdf0179c5a
10 changed files with 154 additions and 142 deletions

View File

@@ -53,7 +53,6 @@
#include <dune/common/fmatrix.hh> #include <dune/common/fmatrix.hh>
#include <sstream> #include <sstream>
#include <iostream>
#include <string> #include <string>
namespace Opm { namespace Opm {
@@ -224,28 +223,6 @@ struct Vanguard<TypeTag, TTag::CO2PTBaseProblem> {
using type = Opm::StructuredGridVanguard<TypeTag>; using type = Opm::StructuredGridVanguard<TypeTag>;
}; };
//\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, TTag::CO2PTBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 300; // meter
};
template <class TypeTag>
struct DomainSizeY<TypeTag, TTag::CO2PTBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
// DomainSizeZ is not needed, while to keep structuredgridvanguard.hh compile
template <class TypeTag>
struct DomainSizeZ<TypeTag, TTag::CO2PTBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag> template<class TypeTag>
struct CellsX<TypeTag, TTag::CO2PTBaseProblem> { static constexpr unsigned value = 30; }; struct CellsX<TypeTag, TTag::CO2PTBaseProblem> { static constexpr unsigned value = 30; };
template<class TypeTag> template<class TypeTag>
@@ -263,6 +240,31 @@ struct EnableEnergy<TypeTag, TTag::CO2PTBaseProblem> {
namespace Opm::Parameters { namespace Opm::Parameters {
//\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;
};
// The default for the end time of the simulation // The default for the end time of the simulation
template <class TypeTag> template <class TypeTag>
struct EndTime<TypeTag, Properties::TTag::CO2PTBaseProblem> struct EndTime<TypeTag, Properties::TTag::CO2PTBaseProblem>

View File

@@ -110,26 +110,6 @@ struct EnableDiffusion<TypeTag, TTag::DiffusionBaseProblem> { static constexpr b
template<class TypeTag> template<class TypeTag>
struct EnableGravity<TypeTag, TTag::DiffusionBaseProblem> { static constexpr bool value = false; }; struct EnableGravity<TypeTag, TTag::DiffusionBaseProblem> { static constexpr bool value = false; };
// define the properties specific for the diffusion problem
template<class TypeTag>
struct DomainSizeX<TypeTag, TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag> template<class TypeTag>
struct CellsX<TypeTag, TTag::DiffusionBaseProblem> { static constexpr unsigned value = 250; }; struct CellsX<TypeTag, TTag::DiffusionBaseProblem> { static constexpr unsigned value = 250; };
template<class TypeTag> template<class TypeTag>
@@ -141,6 +121,28 @@ struct CellsZ<TypeTag, TTag::DiffusionBaseProblem> { static constexpr unsigned v
namespace Opm::Parameters { namespace Opm::Parameters {
// 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;
};
// The default for the end time of the simulation // The default for the end time of the simulation
template<class TypeTag> template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::DiffusionBaseProblem> struct EndTime<TypeTag, Properties::TTag::DiffusionBaseProblem>

View File

@@ -136,26 +136,6 @@ struct EnableConstraints<TypeTag, TTag::FingerBaseProblem> { static constexpr in
template<class TypeTag> template<class TypeTag>
struct EnableGravity<TypeTag, TTag::FingerBaseProblem> { static constexpr bool value = true; }; struct EnableGravity<TypeTag, TTag::FingerBaseProblem> { static constexpr bool value = true; };
// define the properties specific for the finger problem
template<class TypeTag>
struct DomainSizeX<TypeTag, TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.1;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.3;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.1;
};
template<class TypeTag> template<class TypeTag>
struct InitialWaterSaturation<TypeTag, TTag::FingerBaseProblem> struct InitialWaterSaturation<TypeTag, TTag::FingerBaseProblem>
{ {
@@ -174,6 +154,28 @@ struct CellsZ<TypeTag, TTag::FingerBaseProblem> { static constexpr unsigned valu
namespace Opm::Parameters { namespace Opm::Parameters {
// 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;
};
// The default for the end time of the simulation // The default for the end time of the simulation
template<class TypeTag> template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::FingerBaseProblem> struct EndTime<TypeTag, Properties::TTag::FingerBaseProblem>

View File

@@ -175,25 +175,6 @@ struct LensUpperRightZ<TypeTag, TTag::LensBaseProblem>
static constexpr type value = 1.0; static constexpr type value = 1.0;
}; };
template<class TypeTag>
struct DomainSizeX<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 6.0;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 4.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag> template<class TypeTag>
struct CellsX<TypeTag, TTag::LensBaseProblem> { static constexpr unsigned value = 48; }; struct CellsX<TypeTag, TTag::LensBaseProblem> { static constexpr unsigned value = 48; };
template<class TypeTag> template<class TypeTag>
@@ -209,6 +190,27 @@ struct VtkWriteIntrinsicPermeabilities<TypeTag, TTag::LensBaseProblem> { static
namespace Opm::Parameters { namespace Opm::Parameters {
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 the cache for intensive quantities by default for this problem // enable the cache for intensive quantities by default for this problem
template<class TypeTag> template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::LensBaseProblem> struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::LensBaseProblem>

View File

@@ -127,26 +127,6 @@ struct VtkWriteFilterVelocities<TypeTag, TTag::PowerInjectionBaseProblem> { stat
template<class TypeTag> template<class TypeTag>
struct EnableGravity<TypeTag, TTag::PowerInjectionBaseProblem> { static constexpr bool value = false; }; struct EnableGravity<TypeTag, TTag::PowerInjectionBaseProblem> { static constexpr bool value = false; };
// define the properties specific for the power injection problem
template<class TypeTag>
struct DomainSizeX<TypeTag, TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 100.0;
};
template<class TypeTag>
struct DomainSizeY<TypeTag, TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag> template<class TypeTag>
struct CellsX<TypeTag, TTag::PowerInjectionBaseProblem> { static constexpr unsigned value = 250; }; struct CellsX<TypeTag, TTag::PowerInjectionBaseProblem> { static constexpr unsigned value = 250; };
template<class TypeTag> template<class TypeTag>
@@ -158,6 +138,28 @@ struct CellsZ<TypeTag, TTag::PowerInjectionBaseProblem> { static constexpr unsig
namespace Opm::Parameters { namespace Opm::Parameters {
// 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;
};
// The default for the end time of the simulation // The default for the end time of the simulation
template<class TypeTag> template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::PowerInjectionBaseProblem> struct EndTime<TypeTag, Properties::TTag::PowerInjectionBaseProblem>

View File

@@ -124,26 +124,6 @@ public:
template<class TypeTag> template<class TypeTag>
struct EnableGravity<TypeTag, TTag::Tutorial1Problem> { static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/ struct EnableGravity<TypeTag, TTag::Tutorial1Problem> { static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/
// define the physical size of the problem's domain [m]
template<class TypeTag>
struct DomainSizeX<TypeTag, TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 300.0;
}; /*@\label{tutorial1:grid-default-params-begin}@*/
template<class TypeTag>
struct DomainSizeY<TypeTag, TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 60.0;
};
template<class TypeTag>
struct DomainSizeZ<TypeTag, TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.0;
};
// // define the number of cells used for discretizing the physical domain // // define the number of cells used for discretizing the physical domain
template<class TypeTag> template<class TypeTag>
struct CellsX<TypeTag, TTag::Tutorial1Problem> { static constexpr unsigned value = 100; }; struct CellsX<TypeTag, TTag::Tutorial1Problem> { static constexpr unsigned value = 100; };
@@ -156,6 +136,28 @@ struct CellsZ<TypeTag, TTag::Tutorial1Problem> { static constexpr unsigned value
namespace Opm::Parameters { namespace Opm::Parameters {
// 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;
};
// define how long the simulation should run [s] // define how long the simulation should run [s]
template<class TypeTag> template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::Tutorial1Problem> struct EndTime<TypeTag, Properties::TTag::Tutorial1Problem>

View File

@@ -70,18 +70,18 @@ public:
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements> Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
("The number of global refinements of the grid " ("The number of global refinements of the grid "
"executed after it was loaded"); "executed after it was loaded");
Parameters::registerParam<TypeTag, Properties::DomainSizeX> Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
("The size of the domain in x direction"); ("The size of the domain in x direction");
Parameters::registerParam<TypeTag, Properties::CellsX> Parameters::registerParam<TypeTag, Properties::CellsX>
("The number of intervalls in x direction"); ("The number of intervalls in x direction");
if (dimWorld > 1) { if (dimWorld > 1) {
Parameters::registerParam<TypeTag, Properties::DomainSizeY> Parameters::registerParam<TypeTag, Parameters::DomainSizeY>
("The size of the domain in y direction"); ("The size of the domain in y direction");
Parameters::registerParam<TypeTag, Properties::CellsY> Parameters::registerParam<TypeTag, Properties::CellsY>
("The number of intervalls in y direction"); ("The number of intervalls in y direction");
} }
if (dimWorld > 2) { if (dimWorld > 2) {
Parameters::registerParam<TypeTag, Properties::DomainSizeZ> Parameters::registerParam<TypeTag, Parameters::DomainSizeZ>
("The size of the domain in z direction"); ("The size of the domain in z direction");
Parameters::registerParam<TypeTag, Properties::CellsZ> Parameters::registerParam<TypeTag, Properties::CellsZ>
("The number of intervalls in z direction"); ("The number of intervalls in z direction");
@@ -101,14 +101,14 @@ public:
for (unsigned i = 0; i < dimWorld; ++i) for (unsigned i = 0; i < dimWorld; ++i)
cellRes[i] = 0; cellRes[i] = 0;
upperRight[0] = Parameters::get<TypeTag, Properties::DomainSizeX>(); upperRight[0] = Parameters::get<TypeTag, Parameters::DomainSizeX>();
cellRes[0] = Parameters::get<TypeTag, Properties::CellsX>(); cellRes[0] = Parameters::get<TypeTag, Properties::CellsX>();
if (dimWorld > 1) { if (dimWorld > 1) {
upperRight[1] = Parameters::get<TypeTag, Properties::DomainSizeY>(); upperRight[1] = Parameters::get<TypeTag, Parameters::DomainSizeY>();
cellRes[1] = Parameters::get<TypeTag, Properties::CellsY>(); cellRes[1] = Parameters::get<TypeTag, Properties::CellsY>();
} }
if (dimWorld > 2) { if (dimWorld > 2) {
upperRight[2] = Parameters::get<TypeTag, Properties::DomainSizeZ>(); upperRight[2] = Parameters::get<TypeTag, Parameters::DomainSizeZ>();
cellRes[2] = Parameters::get<TypeTag, Properties::CellsZ>(); cellRes[2] = Parameters::get<TypeTag, Properties::CellsZ>();
} }

View File

@@ -111,18 +111,18 @@ public:
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements> Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
("The number of global refinements of the grid " ("The number of global refinements of the grid "
"executed after it was loaded"); "executed after it was loaded");
Parameters::registerParam<TypeTag, Properties::DomainSizeX> Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
("The size of the domain in x direction"); ("The size of the domain in x direction");
Parameters::registerParam<TypeTag, Properties::CellsX> Parameters::registerParam<TypeTag, Properties::CellsX>
("The number of intervalls in x direction"); ("The number of intervalls in x direction");
if (dim > 1) { if (dim > 1) {
Parameters::registerParam<TypeTag, Properties::DomainSizeY> Parameters::registerParam<TypeTag, Parameters::DomainSizeY>
("The size of the domain in y direction"); ("The size of the domain in y direction");
Parameters::registerParam<TypeTag, Properties::CellsY> Parameters::registerParam<TypeTag, Properties::CellsY>
("The number of intervalls in y direction"); ("The number of intervalls in y direction");
} }
if (dim > 2) { if (dim > 2) {
Parameters::registerParam<TypeTag, Properties::DomainSizeZ> Parameters::registerParam<TypeTag, Parameters::DomainSizeZ>
("The size of the domain in z direction"); ("The size of the domain in z direction");
Parameters::registerParam<TypeTag, Properties::CellsZ> Parameters::registerParam<TypeTag, Properties::CellsZ>
("The number of intervalls in z direction"); ("The number of intervalls in z direction");
@@ -141,13 +141,13 @@ public:
Dune::FieldVector<GridScalar, dim> upperRight; Dune::FieldVector<GridScalar, dim> upperRight;
Dune::FieldVector<GridScalar, dim> lowerLeft( 0 ); Dune::FieldVector<GridScalar, dim> lowerLeft( 0 );
upperRight[0] = Parameters::get<TypeTag, Properties::DomainSizeX>(); upperRight[0] = Parameters::get<TypeTag, Parameters::DomainSizeX>();
upperRight[1] = Parameters::get<TypeTag, Properties::DomainSizeY>(); upperRight[1] = Parameters::get<TypeTag, Parameters::DomainSizeY>();
cellRes[0] = Parameters::get<TypeTag, Properties::CellsX>(); cellRes[0] = Parameters::get<TypeTag, Properties::CellsX>();
cellRes[1] = Parameters::get<TypeTag, Properties::CellsY>(); cellRes[1] = Parameters::get<TypeTag, Properties::CellsY>();
if (dim == 3) { if (dim == 3) {
upperRight[2] = Parameters::get<TypeTag, Properties::DomainSizeZ>(); upperRight[2] = Parameters::get<TypeTag, Parameters::DomainSizeZ>();
cellRes[2] = Parameters::get<TypeTag, Properties::CellsZ>(); cellRes[2] = Parameters::get<TypeTag, Properties::CellsZ>();
} }

View File

@@ -32,6 +32,14 @@
namespace Opm::Parameters { namespace Opm::Parameters {
//! domain size
template<class TypeTag, class MyTypeTag>
struct DomainSizeX { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DomainSizeY { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DomainSizeZ { using type = Properties::UndefinedProperty; };
//! The default value for the simulation's end time //! The default value for the simulation's end time
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct EndTime { using type = Properties::UndefinedProperty; }; struct EndTime { using type = Properties::UndefinedProperty; };

View File

@@ -105,14 +105,6 @@ template<class TypeTag, class MyTypeTag>
struct GridPart { using type = UndefinedProperty; }; struct GridPart { using type = UndefinedProperty; };
#endif #endif
//! domain size
template<class TypeTag, class MyTypeTag>
struct DomainSizeX { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DomainSizeY { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DomainSizeZ { using type = UndefinedProperty; };
//! grid resolution //! grid resolution
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct CellsX { using type = UndefinedProperty; }; struct CellsX { using type = UndefinedProperty; };