move EnableGravity to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent 1a74100d00
commit f14c73857b
22 changed files with 89 additions and 190 deletions

View File

@ -169,11 +169,6 @@ 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>
{ static constexpr bool value = true; };
template<class TypeTag>
struct FluidSystemNumPressure<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr unsigned value = 100; };
@ -396,8 +391,8 @@ public:
Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250);
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(Scalar{Co2InjectionTolerance});
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -156,11 +156,6 @@ struct EpisodeLength { using type = Properties::UndefinedProperty;};
template <class TypeTag, class MyTypeTag>
struct Initialpressure { using type = Properties::UndefinedProperty;};
// Enable gravity false
template <class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = false; };
// this is kinds of telling the report step length
template <class TypeTag>
struct EpisodeLength<TypeTag, Properties::TTag::CO2PTBaseProblem>

View File

@ -114,15 +114,6 @@ public:
} // namespace Opm::Properties
namespace Opm::Parameters {
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::CuvetteBaseProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems
@ -291,6 +282,7 @@ public:
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1.0);
Parameters::SetDefault<Parameters::MaxTimeStepSize<Scalar>>(600.0);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -108,15 +108,6 @@ struct EnableDiffusion<TypeTag, TTag::DiffusionBaseProblem> { static constexpr b
} // namespace Opm::Properties
namespace Opm::Parameters {
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::DiffusionBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems

View File

@ -28,32 +28,38 @@
#ifndef EWOMS_FINGER_PROBLEM_HH
#define EWOMS_FINGER_PROBLEM_HH
#include <opm/models/io/structuredgridvanguard.hh>
#include <opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp>
#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/ParkerLenhard.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
#include <opm/material/components/SimpleH2O.hpp>
#include <opm/material/components/Air.hpp>
#include <opm/models/immiscible/immiscibleproperties.hh>
#include <opm/models/discretization/common/restrictprolong.hh>
#if HAVE_DUNE_ALUGRID
#include <dune/alugrid/grid.hh>
#endif
#include <dune/common/version.hh>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/common/version.hh>
#include <dune/grid/utility/persistentcontainer.hh>
#include <vector>
#include <opm/material/components/Air.hpp>
#include <opm/material/components/SimpleH2O.hpp>
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/fluidmatrixinteractions/ParkerLenhard.hpp>
#include <opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp>
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
#include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
#include <opm/models/common/multiphasebaseparameters.hh>
#include <opm/models/discretization/common/fvbasefdlocallinearizer.hh>
#include <opm/models/discretization/common/restrictprolong.hh>
#include <opm/models/immiscible/immiscibleproperties.hh>
#include <opm/models/io/structuredgridvanguard.hh>
#include <string>
namespace Opm {
@ -131,11 +137,6 @@ namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct InitialWaterSaturation { using type = Properties::UndefinedProperty; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr bool value = true; };
template<class TypeTag>
struct InitialWaterSaturation<TypeTag, Properties::TTag::FingerBaseProblem>
{
@ -278,6 +279,7 @@ public:
Parameters::SetDefault<Parameters::EndTime<Scalar>>(215);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(10);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -158,15 +158,6 @@ struct EnableConstraints<TypeTag, TTag::FractureProblem> { static constexpr bool
} // namespace Opm::Properties
namespace Opm::Parameters {
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::FractureProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems

View File

@ -28,19 +28,22 @@
#ifndef EWOMS_GROUND_WATER_PROBLEM_HH
#define EWOMS_GROUND_WATER_PROBLEM_HH
#include <opm/models/immiscible/immiscibleproperties.hh>
#include <opm/simulators/linalg/parallelistlbackend.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/common/version.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
#include <opm/material/components/SimpleH2O.hpp>
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
#include <opm/material/fluidsystems/LiquidPhase.hpp>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
#include <opm/models/common/multiphasebaseparameters.hh>
#include <dune/common/version.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <opm/models/immiscible/immiscibleproperties.hh>
#include <opm/simulators/linalg/parallelistlbackend.hh>
#include <sstream>
#include <string>
@ -112,11 +115,6 @@ 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>
{ static constexpr bool value = true; };
template<class TypeTag>
struct LensLowerLeftX<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
@ -289,6 +287,7 @@ public:
Parameters::SetDefault<Parameters::GridFile>("./data/groundwater_2d.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1.0);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -27,21 +27,25 @@
#ifndef EWOMS_INFILTRATION_PROBLEM_HH
#define EWOMS_INFILTRATION_PROBLEM_HH
#include <opm/models/pvs/pvsproperties.hh>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp>
#include <opm/material/fluidmatrixinteractions/ThreePhaseParkerVanGenuchten.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/common/version.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
#include <dune/common/version.hh>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <opm/material/common/Valgrind.hpp>
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
#include <opm/material/fluidmatrixinteractions/ThreePhaseParkerVanGenuchten.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp>
#include <opm/models/common/multiphasebaseparameters.hh>
#include <opm/models/discretization/common/fvbasefdlocallinearizer.hh>
#include <opm/models/pvs/pvsproperties.hh>
#include <sstream>
#include <string>
@ -90,15 +94,6 @@ public:
} // namespace Opm::Properties
namespace Opm::Parameters {
// Enable gravity?
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems
@ -224,6 +219,7 @@ public:
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(1);
Parameters::SetDefault<Parameters::EndTime<Scalar>>(6e3);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(60.0);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -143,11 +143,6 @@ struct LensUpperRightY { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LensUpperRightZ { using type = Properties::UndefinedProperty; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; };
// define the properties specific for the lens problem
template<class TypeTag>
struct LensLowerLeftX<TypeTag, Properties::TTag::LensBaseProblem>
@ -358,6 +353,7 @@ public:
Parameters::SetDefault<Parameters::EnableStorageCache>(true);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
Parameters::SetDefault<Parameters::VtkWriteIntrinsicPermeabilities>(true);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -28,28 +28,30 @@
#ifndef EWOMS_OBSTACLE_PROBLEM_HH
#define EWOMS_OBSTACLE_PROBLEM_HH
#include <opm/models/ncp/ncpproperties.hh>
#include <opm/material/fluidsystems/H2ON2FluidSystem.hpp>
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp>
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/thermal/ConstantSolidHeatCapLaw.hpp>
#include <opm/material/thermal/SomertonThermalConductionLaw.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/common/version.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
#include <dune/common/version.hh>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <opm/material/constraintsolvers/ComputeFromReferencePhase.hpp>
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/fluidsystems/H2ON2FluidSystem.hpp>
#include <opm/material/thermal/ConstantSolidHeatCapLaw.hpp>
#include <opm/material/thermal/SomertonThermalConductionLaw.hpp>
#include <opm/models/common/multiphasebaseparameters.hh>
#include <opm/models/ncp/ncpproperties.hh>
#include <iostream>
#include <sstream>
#include <string>
#include <iostream>
namespace Opm {
template <class TypeTag>
@ -113,15 +115,6 @@ struct SolidEnergyLaw<TypeTag, TTag::ObstacleBaseProblem>
} // namespace Opm::Properties
namespace Opm::Parameters {
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::ObstacleBaseProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems
@ -268,6 +261,7 @@ public:
Parameters::SetDefault<Parameters::GridFile>("./data/obstacle_24x16.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -74,15 +74,6 @@ public:
} // namespace Opm::Properties
namespace Opm::Parameters {
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::OutflowBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems

View File

@ -121,15 +121,6 @@ public:
} // namespace Opm::Properties
namespace Opm::Parameters {
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems

View File

@ -135,11 +135,6 @@ struct Temperature { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct WellWidth { using type = Properties::UndefinedProperty; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::ReservoirBaseProblem>
{ static constexpr bool value = true; };
// set the defaults for some problem specific properties
template<class TypeTag>
struct MaxDepth<TypeTag, Properties::TTag::ReservoirBaseProblem>
@ -425,6 +420,8 @@ public:
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100e3);
// increase the tolerance for this problem to get larger time steps
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-6);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -101,15 +101,6 @@ public:
} // namespace Opm::Properties
namespace Opm::Parameters {
// Enable gravitational acceleration
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm {
/*!
@ -246,6 +237,7 @@ public:
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100.0);
Parameters::SetDefault<Parameters::NewtonMaxIterations>(28);
Parameters::SetDefault<Parameters::NewtonTargetIterations>(18);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -135,11 +135,6 @@ struct PreconditionerWrapper<TypeTag, TTag::WaterAirBaseProblem>
namespace Opm::Parameters {
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr bool value = true; };
template<class TypeTag>
struct PreconditionerOrder<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr int value = 2; };
@ -302,6 +297,7 @@ public:
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0 * 365 * 24 * 60 * 60);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
Parameters::SetDefault<Parameters::EnableGravity>(true);
}
/*!

View File

@ -122,16 +122,8 @@ public:
} // namespace Opm::Properties
namespace Opm::Parameters {
// Disable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::Tutorial1Problem>
{ static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/
} // namespace Opm::Parameters
namespace Opm {
//! Tutorial problem using the "immiscible" model.
template <class TypeTag>
class Tutorial1Problem

View File

@ -189,7 +189,7 @@ public:
Simulator&)
{
if constexpr (enableFoam) {
if (Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) {
if (Parameters::Get<Parameters::EnableVtkOutput>()) {
OpmLog::warning("VTK output requested, currently unsupported by the foam module.");
}
}

View File

@ -1369,7 +1369,7 @@ public:
Valgrind::CheckDefined(solventPGrad);
// correct the pressure gradients by the gravitational acceleration
if (Parameters::get<TypeTag, Parameters::EnableGravity>()) {
if (Parameters::Get<Parameters::EnableGravity>()) {
// estimate the gravitational acceleration at a given SCV face
// using the arithmetic mean
const auto& gIn = elemCtx.problem().gravity(elemCtx, i, timeIdx);

View File

@ -212,7 +212,7 @@ protected:
}
// correct the pressure gradients by the gravitational acceleration
if (Parameters::get<TypeTag, Parameters::EnableGravity>()) {
if (Parameters::Get<Parameters::EnableGravity>()) {
// estimate the gravitational acceleration at a given SCV face
// using the arithmetic mean
const auto& gIn = elemCtx.problem().gravity(elemCtx, i, timeIdx);
@ -362,7 +362,7 @@ protected:
K_ = intQuantsIn.intrinsicPermeability();
// correct the pressure gradients by the gravitational acceleration
if (Parameters::get<TypeTag, Parameters::EnableGravity>()) {
if (Parameters::Get<Parameters::EnableGravity>()) {
// estimate the gravitational acceleration at a given SCV face
// using the arithmetic mean
const auto& gIn = elemCtx.problem().gravity(elemCtx, i, timeIdx);

View File

@ -141,15 +141,6 @@ struct ThermalConductionLawParams<TypeTag, TTag::MultiPhaseBaseModel>
} // namespace Opm::Properties
namespace Opm::Parameters {
//! disable gravity by default
template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::MultiPhaseBaseModel>
{ static constexpr bool value = false; };
}
namespace Opm {
/*!

View File

@ -24,19 +24,16 @@
* \file
* \ingroup MultiPhaseBaseModel
*
* \brief Defines the common paramamters for the porous medium
* \brief Defines the common parameters for the porous medium
* multi-phase models.
*/
#ifndef EWOMS_MULTI_PHASE_BASE_PARAMETERS_HH
#define EWOMS_MULTI_PHASE_BASE_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
//! Returns whether gravity is considered in the problem
template<class TypeTag, class MyTypeTag>
struct EnableGravity { using type = Properties::UndefinedProperty; };
//! Returns whether gravity is considered in the problem.
struct EnableGravity { static constexpr bool value = false; };
} // namespace Opm::Parameters

View File

@ -93,7 +93,7 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableGravity>
Parameters::Register<Parameters::EnableGravity>
("Use the gravity correction for the pressure gradients.");
}
@ -398,8 +398,9 @@ private:
void init_()
{
gravity_ = 0.0;
if (Parameters::get<TypeTag, Parameters::EnableGravity>())
if (Parameters::Get<Parameters::EnableGravity>()) {
gravity_[dimWorld-1] = -9.81;
}
}
};