move FlowBaseVanguard parameters to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-06 10:22:47 +02:00
parent bfe6f47d58
commit dd1bc8d75b
6 changed files with 66 additions and 166 deletions

View File

@ -484,7 +484,7 @@ public:
bool gasActive = FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx);
bool waterActive = FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx);
bool enableSwatinit = simulator_.vanguard().eclState().fieldProps().has_double("SWATINIT");
bool opm_rst_file = Parameters::get<TypeTag, Parameters::EnableOpmRstFile>();
bool opm_rst_file = Parameters::Get<Parameters::EnableOpmRstFile>();
bool read_temp = enableEnergy || (opm_rst_file && enableTemperature);
std::vector<RestartKey> solutionKeys{
{"PRESSURE", UnitSystem::measure::pressure},

View File

@ -71,137 +71,37 @@ struct EquilGrid { using type = UndefinedProperty; };
namespace Opm::Parameters {
// TODO: enumeration parameters. we use strings for now.
template<class TypeTag, class MyTypeTag>
struct EnableDryRun { using type = Properties::UndefinedProperty; };
struct AllowDistributedWells { static constexpr bool value = false; };
struct EclOutputInterval { static constexpr int value = -1; };
struct EdgeWeightsMethod { static constexpr int value = 1; };
struct EnableDryRun { static constexpr auto value = "auto"; };
struct EnableOpmRstFile { static constexpr bool value = false; };
struct ExternalPartition { static constexpr auto* value = ""; };
template<class TypeTag, class MyTypeTag>
struct EnableOpmRstFile { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ImbalanceTol { static constexpr Scalar value = 1.1; };
template<class TypeTag, class MyTypeTag>
struct ParsingStrictness { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct InputSkipMode { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct SchedRestart { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EclOutputInterval { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct IgnoreKeywords { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EdgeWeightsMethod { using type = Properties::UndefinedProperty; };
struct IgnoreKeywords { static constexpr auto value = ""; };
struct InputSkipMode { static constexpr auto value = "100"; };
struct MetisParams { static constexpr auto value = "default"; };
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
template<class TypeTag, class MyTypeTag>
struct NumJacobiBlocks { using type = Properties::UndefinedProperty; };
struct NumJacobiBlocks { static constexpr int value = 0; };
#endif
template<class TypeTag, class MyTypeTag>
struct OwnerCellsFirst { using type = Properties::UndefinedProperty; };
struct OwnerCellsFirst { static constexpr bool value = true; };
struct ParsingStrictness { static constexpr auto value = "normal"; };
template<class TypeTag, class MyTypeTag>
struct ImbalanceTol { using type = Properties::UndefinedProperty; };
// 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp
struct PartitionMethod { static constexpr int value = 1; };
template<class TypeTag, class MyTypeTag>
struct PartitionMethod { using type = Properties::UndefinedProperty; };
struct SchedRestart{ static constexpr bool value = false; };
struct SerialPartitioning{ static constexpr bool value = false; };
template<class TypeTag, class MyTypeTag>
struct SerialPartitioning { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ZoltanImbalanceTol { static constexpr Scalar value = 1.1; };
template<class TypeTag, class MyTypeTag>
struct ZoltanImbalanceTol { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ZoltanParams { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MetisParams { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct ExternalPartition { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct AllowDistributedWells { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct IgnoreKeywords<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = ""; };
template<class TypeTag>
struct EclOutputInterval<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = -1; };
// TODO: enumeration parameters. we use strings for now.
template<class TypeTag>
struct EnableDryRun<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "auto"; };
template<class TypeTag>
struct EnableOpmRstFile<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
template<class TypeTag>
struct ParsingStrictness<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "normal"; };
template<class TypeTag>
struct InputSkipMode<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "100"; };
template<class TypeTag>
struct SchedRestart<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
template<class TypeTag>
struct EdgeWeightsMethod<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = 1; };
template<class TypeTag>
struct ImbalanceTol<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr double value = 1.1; };
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
template<class TypeTag>
struct NumJacobiBlocks<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = 0; };
#endif
template<class TypeTag>
struct OwnerCellsFirst<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = true; };
template<class TypeTag>
struct PartitionMethod<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = 1; }; // 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp
template<class TypeTag>
struct SerialPartitioning<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
template<class TypeTag>
struct ZoltanImbalanceTol<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr double value = 1.1; };
template<class TypeTag>
struct ZoltanParams<TypeTag,Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "graph"; };
template<class TypeTag>
struct MetisParams<TypeTag,Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "default"; };
template <class TypeTag>
struct ExternalPartition<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto* value = ""; };
template<class TypeTag>
struct AllowDistributedWells<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
struct ZoltanParams { static constexpr auto value = "graph"; };
} // namespace Opm::Parameters
@ -242,71 +142,71 @@ public:
{
Parameters::Register<Parameters::EclDeckFileName>
("The name of the file which contains the ECL deck to be simulated");
Parameters::registerParam<TypeTag, Parameters::EclOutputInterval>
Parameters::Register<Parameters::EclOutputInterval>
("The number of report steps that ought to be skipped between two writes of ECL results");
Parameters::registerParam<TypeTag, Parameters::EnableDryRun>
Parameters::Register<Parameters::EnableDryRun>
("Specify if the simulation ought to be actually run, or just pretended to be");
Parameters::registerParam<TypeTag, Parameters::EnableOpmRstFile>
Parameters::Register<Parameters::EnableOpmRstFile>
("Include OPM-specific keywords in the ECL restart file to "
"enable restart of OPM simulators from these files");
Parameters::registerParam<TypeTag, Parameters::IgnoreKeywords>
Parameters::Register<Parameters::IgnoreKeywords>
("List of Eclipse keywords which should be ignored. As a ':' separated string.");
Parameters::registerParam<TypeTag, Parameters::ParsingStrictness>
Parameters::Register<Parameters::ParsingStrictness>
("Set strictness of parsing process. Available options are "
"normal (stop for critical errors), "
"high (stop for all errors) and "
"low (as normal, except do not stop due to unsupported "
"keywords even if marked critical");
Parameters::registerParam<TypeTag, Parameters::InputSkipMode>
Parameters::Register<Parameters::InputSkipMode>
("Set compatibility mode for the SKIP100/SKIP300 keywords. Options are "
"100 (skip SKIP100..ENDSKIP, keep SKIP300..ENDSKIP) [default], "
"300 (skip SKIP300..ENDSKIP, keep SKIP100..ENDSKIP) and "
"all (skip both SKIP100..ENDSKIP and SKIP300..ENDSKIP) ");
Parameters::registerParam<TypeTag, Parameters::SchedRestart>
Parameters::Register<Parameters::SchedRestart>
("When restarting: should we try to initialize wells and "
"groups from historical SCHEDULE section.");
Parameters::registerParam<TypeTag, Parameters::EdgeWeightsMethod>
Parameters::Register<Parameters::EdgeWeightsMethod>
("Choose edge-weighing strategy: 0=uniform, 1=trans, 2=log(trans).");
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
Parameters::registerParam<TypeTag, Parameters::NumJacobiBlocks>
Parameters::Register<Parameters::NumJacobiBlocks>
("Number of blocks to be created for the Block-Jacobi preconditioner.");
#endif
Parameters::registerParam<TypeTag, Parameters::OwnerCellsFirst>
Parameters::Register<Parameters::OwnerCellsFirst>
("Order cells owned by rank before ghost/overlap cells.");
#if HAVE_MPI
Parameters::registerParam<TypeTag, Parameters::PartitionMethod>
Parameters::Register<Parameters::PartitionMethod>
("Choose partitioning strategy: 0=simple, 1=Zoltan, 2=METIS.");
Parameters::registerParam<TypeTag, Parameters::SerialPartitioning>
Parameters::Register<Parameters::SerialPartitioning>
("Perform partitioning for parallel runs on a single process.");
Parameters::registerParam<TypeTag, Parameters::ZoltanImbalanceTol>
Parameters::Register<Parameters::ZoltanImbalanceTol<Scalar>>
("Tolerable imbalance of the loadbalancing provided by Zoltan. DEPRECATED: Use --imbalance-tol instead");
Parameters::hideParam<TypeTag, Parameters::ZoltanImbalanceTol>();
Parameters::registerParam<TypeTag, Parameters::ZoltanParams>
Parameters::Hide<Parameters::ZoltanImbalanceTol<Scalar>>();
Parameters::Register<Parameters::ZoltanParams>
("Configuration of Zoltan partitioner. "
"Valid options are: graph, hypergraph or scotch. "
"Alternatively, you can request a configuration to be read "
"from a JSON file by giving the filename here, ending with '.json.' "
"See https://sandialabs.github.io/Zoltan/ug_html/ug.html "
"for available Zoltan options.");
Parameters::hideParam<TypeTag, Parameters::ZoltanParams>();
Parameters::registerParam<TypeTag, Parameters::ImbalanceTol>
Parameters::Hide<Parameters::ZoltanParams>();
Parameters::Register<Parameters::ImbalanceTol<Scalar>>
("Tolerable imbalance of the loadbalancing (default: 1.1).");
Parameters::registerParam<TypeTag, Parameters::MetisParams>
Parameters::Register<Parameters::MetisParams>
("Configuration of Metis partitioner. "
"You can request a configuration to be read "
"from a JSON file by giving the filename here, ending with '.json.' "
"See http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/manual.pdf"
"for available METIS options.");
Parameters::registerParam<TypeTag, Parameters::ExternalPartition>
Parameters::Register<Parameters::ExternalPartition>
("Name of file from which to load an externally generated "
"partitioning of the model's active cells for MPI "
"distribution purposes. If empty, the built-in partitioning "
"method will be employed.");
Parameters::hideParam<TypeTag, Parameters::ExternalPartition>();
Parameters::Hide<Parameters::ExternalPartition>();
#endif
Parameters::registerParam<TypeTag, Parameters::AllowDistributedWells>
Parameters::Register<Parameters::AllowDistributedWells>
("Allow the perforations of a well to be distributed to interior of multiple processes");
// register here for the use in the tests without BlackoilModelParameters
Parameters::Register<Parameters::UseMultisegmentWell>
@ -323,29 +223,29 @@ public:
: ParentType(simulator)
{
fileName_ = Parameters::Get<Parameters::EclDeckFileName>();
edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::get<TypeTag, Parameters::EdgeWeightsMethod>());
edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::Get<Parameters::EdgeWeightsMethod>());
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
numJacobiBlocks_ = Parameters::get<TypeTag, Parameters::NumJacobiBlocks>();
numJacobiBlocks_ = Parameters::Get<Parameters::NumJacobiBlocks>();
#endif
ownersFirst_ = Parameters::get<TypeTag, Parameters::OwnerCellsFirst>();
ownersFirst_ = Parameters::Get<Parameters::OwnerCellsFirst>();
#if HAVE_MPI
partitionMethod_ = Dune::PartitionMethod(Parameters::get<TypeTag, Parameters::PartitionMethod>());
serialPartitioning_ = Parameters::get<TypeTag, Parameters::SerialPartitioning>();
imbalanceTol_ = Parameters::get<TypeTag, Parameters::ImbalanceTol>();
partitionMethod_ = Dune::PartitionMethod(Parameters::Get<Parameters::PartitionMethod>());
serialPartitioning_ = Parameters::Get<Parameters::SerialPartitioning>();
imbalanceTol_ = Parameters::Get<Parameters::ImbalanceTol<Scalar>>();
zoltanImbalanceTolSet_ = Parameters::isSet<TypeTag, Parameters::ZoltanImbalanceTol>();
zoltanImbalanceTol_ = Parameters::get<TypeTag, Parameters::ZoltanImbalanceTol>();
zoltanParams_ = Parameters::get<TypeTag, Parameters::ZoltanParams>();
zoltanImbalanceTolSet_ = Parameters::IsSet<Parameters::ZoltanImbalanceTol<Scalar>>();
zoltanImbalanceTol_ = Parameters::Get<Parameters::ZoltanImbalanceTol<Scalar>>();
zoltanParams_ = Parameters::Get<Parameters::ZoltanParams>();
metisParams_ = Parameters::get<TypeTag, Parameters::MetisParams>();
metisParams_ = Parameters::Get<Parameters::MetisParams>();
externalPartitionFile_ = Parameters::get<TypeTag, Parameters::ExternalPartition>();
externalPartitionFile_ = Parameters::Get<Parameters::ExternalPartition>();
#endif
enableDistributedWells_ = Parameters::get<TypeTag, Parameters::AllowDistributedWells>();
ignoredKeywords_ = Parameters::get<TypeTag, Parameters::IgnoreKeywords>();
int output_param = Parameters::get<TypeTag, Parameters::EclOutputInterval>();
enableDistributedWells_ = Parameters::Get<Parameters::AllowDistributedWells>();
ignoredKeywords_ = Parameters::Get<Parameters::IgnoreKeywords>();
int output_param = Parameters::Get<Parameters::EclOutputInterval>();
if (output_param >= 0)
outputInterval_ = output_param;
useMultisegmentWell_ = Parameters::Get<Parameters::UseMultisegmentWell>();
@ -545,9 +445,9 @@ protected:
asImp_().createGrids_();
asImp_().filterConnections_();
std::string outputDir = Parameters::Get<Parameters::OutputDir>();
bool enableEclCompatFile = !Parameters::get<TypeTag, Parameters::EnableOpmRstFile>();
bool enableEclCompatFile = !Parameters::Get<Parameters::EnableOpmRstFile>();
asImp_().updateOutputDir_(outputDir, enableEclCompatFile);
const std::string& dryRunString = Parameters::get<TypeTag, Parameters::EnableDryRun>();
const std::string& dryRunString = Parameters::Get<Parameters::EnableDryRun>();
asImp_().updateNOSIM_(dryRunString);
asImp_().finalizeInit_();
}

View File

@ -418,12 +418,12 @@ private:
this->readDeck(deckFilename,
outputDir,
Parameters::get<PreTypeTag, Parameters::OutputMode>(),
!Parameters::get<PreTypeTag, Parameters::SchedRestart>(),
!Parameters::Get<Parameters::SchedRestart>(),
Parameters::Get<Parameters::EnableLoggingFalloutWarning>(),
Parameters::get<PreTypeTag, Parameters::ParsingStrictness>(),
Parameters::get<PreTypeTag, Parameters::InputSkipMode>(),
Parameters::Get<Parameters::ParsingStrictness>(),
Parameters::Get<Parameters::InputSkipMode>(),
getNumThreads<PreTypeTag>(),
Parameters::get<PreTypeTag, Parameters::EclOutputInterval>(),
Parameters::Get<Parameters::EclOutputInterval>(),
cmdline_params,
Opm::moduleVersion(),
Opm::compileTimestamp());

View File

@ -170,7 +170,7 @@ public:
this->forceDisableFipresvOutput_ =
Parameters::get<TypeTag, Parameters::ForceDisableResvFluidInPlaceOutput>();
if (! Parameters::get<TypeTag, Parameters::OwnerCellsFirst>()) {
if (! Parameters::Get<Parameters::OwnerCellsFirst>()) {
const std::string msg = "The output code does not support --owner-cells-first=false.";
if (collectToIORank.isIORank()) {
OpmLog::error(msg);

View File

@ -259,7 +259,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
ElementMapper elemMapper(simulator_.vanguard().gridView(), Dune::mcmgElementLayout());
detail::findOverlapAndInterior(simulator_.vanguard().grid(), elemMapper, overlapRows_, interiorRows_);
useWellConn_ = Parameters::Get<Parameters::MatrixAddWellContributions>();
const bool ownersFirst = Parameters::get<TypeTag, Parameters::OwnerCellsFirst>();
const bool ownersFirst = Parameters::Get<Parameters::OwnerCellsFirst>();
if (!ownersFirst) {
const std::string msg = "The linear solver no longer supports --owner-cells-first=false.";
if (on_io_rank) {

View File

@ -204,7 +204,7 @@ public:
// to the original one with a deleter that does nothing.
// Outch! We need to be able to scale the linear system! Hence const_cast
// setup sparsity pattern for jacobi matrix for preconditioner (only used for openclSolver)
bdaBridge_->numJacobiBlocks_ = Parameters::get<TypeTag, Parameters::NumJacobiBlocks>();
bdaBridge_->numJacobiBlocks_ = Parameters::Get<Parameters::NumJacobiBlocks>();
bdaBridge_->prepare(this->simulator_.vanguard().grid(),
this->simulator_.vanguard().cartesianIndexMapper(),
this->simulator_.vanguard().schedule().getWellsatEnd(),