changed: FlowBaseVanguard parameters moved to Opm::Parameters namespace

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:17:13 +02:00
parent 7aeaf6f216
commit 4fc1487a9d
6 changed files with 178 additions and 219 deletions

View File

@ -489,7 +489,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, Properties::EnableOpmRstFile>();
bool opm_rst_file = Parameters::get<TypeTag, Parameters::EnableOpmRstFile>();
bool read_temp = enableEnergy || (opm_rst_file && enableTemperature);
std::vector<RestartKey> solutionKeys{
{"PRESSURE", UnitSystem::measure::pressure},

View File

@ -56,193 +56,153 @@ template<typename Grid, typename GridView> struct LookUpCellCentroid;
namespace Opm::Properties {
namespace TTag {
struct FlowBaseVanguard {};
}
// declare the properties required by the for the ecl simulator vanguard
template<class TypeTag, class MyTypeTag>
struct EquilGrid {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct EnableOpmRstFile {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct ParsingStrictness {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct InputSkipMode {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct SchedRestart {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct EclOutputInterval {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct IgnoreKeywords {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct EdgeWeightsMethod {
using type = UndefinedProperty;
};
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
template<class TypeTag, class MyTypeTag>
struct NumJacobiBlocks {
using type = UndefinedProperty;
};
#endif
template<class TypeTag, class MyTypeTag>
struct OwnerCellsFirst {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct PartitionMethod {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct SerialPartitioning {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct ImbalanceTol {
using type = UndefinedProperty;
};
// Remove this for release 2025.04
template<class TypeTag, class MyTypeTag>
struct ZoltanImbalanceTol {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct ZoltanParams {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct MetisParams {
using type = UndefinedProperty;
};
template <class TypeTag, class MyTypeTag>
struct ExternalPartition
{
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct AllowDistributedWells {
using type = UndefinedProperty;
};
struct EquilGrid { using type = UndefinedProperty; };
template<class TypeTag>
struct IgnoreKeywords<TypeTag, TTag::FlowBaseVanguard> {
static constexpr auto value = "";
};
template<class TypeTag>
struct EclDeckFileName<TypeTag, TTag::FlowBaseVanguard> {
static constexpr auto value = "";
};
template<class TypeTag>
struct EclOutputInterval<TypeTag, TTag::FlowBaseVanguard> {
static constexpr int value = -1;
};
template<class TypeTag>
struct EnableOpmRstFile<TypeTag, TTag::FlowBaseVanguard> {
static constexpr bool value = false;
};
template<class TypeTag>
struct ParsingStrictness<TypeTag, TTag::FlowBaseVanguard> {
static constexpr auto value = "normal";
};
template<class TypeTag>
struct InputSkipMode<TypeTag, TTag::FlowBaseVanguard> {
static constexpr auto value = "100";
};
template<class TypeTag>
struct SchedRestart<TypeTag, TTag::FlowBaseVanguard> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EdgeWeightsMethod<TypeTag, TTag::FlowBaseVanguard> {
static constexpr int value = 1;
};
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
template<class TypeTag>
struct NumJacobiBlocks<TypeTag, TTag::FlowBaseVanguard> {
static constexpr int value = 0;
};
#endif
template<class TypeTag>
struct OwnerCellsFirst<TypeTag, TTag::FlowBaseVanguard> {
static constexpr bool value = true;
};
template<class TypeTag>
struct PartitionMethod<TypeTag, TTag::FlowBaseVanguard> {
static constexpr int value = 1; // 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp
};
template<class TypeTag>
struct SerialPartitioning<TypeTag, TTag::FlowBaseVanguard> {
static constexpr bool value = false;
};
template<class TypeTag>
struct ZoltanImbalanceTol<TypeTag, TTag::FlowBaseVanguard> {
static constexpr double value = 1.1;
};
template<class TypeTag>
struct ZoltanParams<TypeTag,TTag::FlowBaseVanguard> {
static constexpr auto value = "graph";
};
template<class TypeTag>
struct ImbalanceTol<TypeTag, TTag::FlowBaseVanguard> {
static constexpr double value = 1.1;
};
template<class TypeTag>
struct MetisParams<TypeTag,TTag::FlowBaseVanguard> {
static constexpr auto value = "default";
};
template <class TypeTag>
struct ExternalPartition<TypeTag, TTag::FlowBaseVanguard>
{
static constexpr auto* value = "";
};
template<class TypeTag>
struct AllowDistributedWells<TypeTag, TTag::FlowBaseVanguard> {
static constexpr bool value = false;
};
template<class T1, class T2>
struct UseMultisegmentWell;
struct EclDeckFileName<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = ""; };
// Same as in BlackoilModelParameters.hpp but for here.
template<class TypeTag>
struct UseMultisegmentWell<TypeTag, TTag::FlowBaseVanguard> {
static constexpr bool value = true;
};
struct UseMultisegmentWell<TypeTag, TTag::FlowBaseVanguard>
{ static constexpr bool value = true; };
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableOpmRstFile { using type = Properties::UndefinedProperty; };
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; };
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
template<class TypeTag, class MyTypeTag>
struct NumJacobiBlocks { using type = Properties::UndefinedProperty; };
#endif
template<class TypeTag, class MyTypeTag>
struct OwnerCellsFirst { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ImbalanceTol { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct PartitionMethod { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct SerialPartitioning { using type = Properties::UndefinedProperty; };
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; };
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; };
} // namespace Opm::Parameters
namespace Opm {
/*!
@ -280,70 +240,69 @@ public:
{
Parameters::registerParam<TypeTag, Properties::EclDeckFileName>
("The name of the file which contains the ECL deck to be simulated");
Parameters::registerParam<TypeTag, Properties::EclOutputInterval>
Parameters::registerParam<TypeTag, Parameters::EclOutputInterval>
("The number of report steps that ought to be skipped between two writes of ECL results");
Parameters::registerParam<TypeTag, Properties::EnableOpmRstFile>
Parameters::registerParam<TypeTag, Parameters::EnableOpmRstFile>
("Include OPM-specific keywords in the ECL restart file to "
"enable restart of OPM simulators from these files");
Parameters::registerParam<TypeTag, Properties::IgnoreKeywords>
Parameters::registerParam<TypeTag, Parameters::IgnoreKeywords>
("List of Eclipse keywords which should be ignored. As a ':' separated string.");
Parameters::registerParam<TypeTag, Properties::ParsingStrictness>
Parameters::registerParam<TypeTag, 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, Properties::InputSkipMode>
Parameters::registerParam<TypeTag, 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, Properties::SchedRestart>
Parameters::registerParam<TypeTag, Parameters::SchedRestart>
("When restarting: should we try to initialize wells and "
"groups from historical SCHEDULE section.");
Parameters::registerParam<TypeTag, Properties::EdgeWeightsMethod>
Parameters::registerParam<TypeTag, Parameters::EdgeWeightsMethod>
("Choose edge-weighing strategy: 0=uniform, 1=trans, 2=log(trans).");
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
Parameters::registerParam<TypeTag, Properties::NumJacobiBlocks>
Parameters::registerParam<TypeTag, Parameters::NumJacobiBlocks>
("Number of blocks to be created for the Block-Jacobi preconditioner.");
#endif
Parameters::registerParam<TypeTag, Properties::OwnerCellsFirst>
Parameters::registerParam<TypeTag, Parameters::OwnerCellsFirst>
("Order cells owned by rank before ghost/overlap cells.");
#if HAVE_MPI
Parameters::registerParam<TypeTag, Properties::PartitionMethod>
Parameters::registerParam<TypeTag, Parameters::PartitionMethod>
("Choose partitioning strategy: 0=simple, 1=Zoltan, 2=METIS.");
Parameters::registerParam<TypeTag, Properties::SerialPartitioning>
Parameters::registerParam<TypeTag, Parameters::SerialPartitioning>
("Perform partitioning for parallel runs on a single process.");
Parameters::registerParam<TypeTag, Properties::ZoltanImbalanceTol>
Parameters::registerParam<TypeTag, Parameters::ZoltanImbalanceTol>
("Tolerable imbalance of the loadbalancing provided by Zoltan. DEPRECATED: Use --imbalance-tol instead");
Parameters::hideParam<TypeTag, Properties::ZoltanImbalanceTol>();
Parameters::registerParam<TypeTag, Properties::ZoltanParams>
Parameters::hideParam<TypeTag, Parameters::ZoltanImbalanceTol>();
Parameters::registerParam<TypeTag, 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, Properties::ZoltanParams>();
Parameters::registerParam<TypeTag, Properties::ImbalanceTol>
Parameters::hideParam<TypeTag, Parameters::ZoltanParams>();
Parameters::registerParam<TypeTag, Parameters::ImbalanceTol>
("Tolerable imbalance of the loadbalancing (default: 1.1).");
Parameters::registerParam<TypeTag, Properties::MetisParams>
Parameters::registerParam<TypeTag, 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, Properties::ExternalPartition>
Parameters::registerParam<TypeTag, 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, Properties::ExternalPartition>();
Parameters::hideParam<TypeTag, Parameters::ExternalPartition>();
#endif
Parameters::registerParam<TypeTag, Properties::AllowDistributedWells>
Parameters::registerParam<TypeTag, 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::registerParam<TypeTag, Properties::UseMultisegmentWell>
@ -360,29 +319,29 @@ public:
: ParentType(simulator)
{
fileName_ = Parameters::get<TypeTag, Properties::EclDeckFileName>();
edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::get<TypeTag, Properties::EdgeWeightsMethod>());
edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::get<TypeTag, Parameters::EdgeWeightsMethod>());
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
numJacobiBlocks_ = Parameters::get<TypeTag, Properties::NumJacobiBlocks>();
numJacobiBlocks_ = Parameters::get<TypeTag, Parameters::NumJacobiBlocks>();
#endif
ownersFirst_ = Parameters::get<TypeTag, Properties::OwnerCellsFirst>();
ownersFirst_ = Parameters::get<TypeTag, Parameters::OwnerCellsFirst>();
#if HAVE_MPI
partitionMethod_ = Dune::PartitionMethod(Parameters::get<TypeTag, Properties::PartitionMethod>());
serialPartitioning_ = Parameters::get<TypeTag, Properties::SerialPartitioning>();
imbalanceTol_ = Parameters::get<TypeTag, Properties::ImbalanceTol>();
partitionMethod_ = Dune::PartitionMethod(Parameters::get<TypeTag, Parameters::PartitionMethod>());
serialPartitioning_ = Parameters::get<TypeTag, Parameters::SerialPartitioning>();
imbalanceTol_ = Parameters::get<TypeTag, Parameters::ImbalanceTol>();
zoltanImbalanceTolSet_ = Parameters::isSet<TypeTag, Properties::ZoltanImbalanceTol>();
zoltanImbalanceTol_ = Parameters::get<TypeTag, Properties::ZoltanImbalanceTol>();
zoltanParams_ = Parameters::get<TypeTag, Properties::ZoltanParams>();
zoltanImbalanceTolSet_ = Parameters::isSet<TypeTag, Parameters::ZoltanImbalanceTol>();
zoltanImbalanceTol_ = Parameters::get<TypeTag, Parameters::ZoltanImbalanceTol>();
zoltanParams_ = Parameters::get<TypeTag, Parameters::ZoltanParams>();
metisParams_ = Parameters::get<TypeTag, Properties::MetisParams>();
metisParams_ = Parameters::get<TypeTag, Parameters::MetisParams>();
externalPartitionFile_ = Parameters::get<TypeTag, Properties::ExternalPartition>();
externalPartitionFile_ = Parameters::get<TypeTag, Parameters::ExternalPartition>();
#endif
enableDistributedWells_ = Parameters::get<TypeTag, Properties::AllowDistributedWells>();
ignoredKeywords_ = Parameters::get<TypeTag, Properties::IgnoreKeywords>();
int output_param = Parameters::get<TypeTag, Properties::EclOutputInterval>();
enableDistributedWells_ = Parameters::get<TypeTag, Parameters::AllowDistributedWells>();
ignoredKeywords_ = Parameters::get<TypeTag, Parameters::IgnoreKeywords>();
int output_param = Parameters::get<TypeTag, Parameters::EclOutputInterval>();
if (output_param >= 0)
outputInterval_ = output_param;
useMultisegmentWell_ = Parameters::get<TypeTag, Properties::UseMultisegmentWell>();
@ -582,7 +541,7 @@ protected:
asImp_().createGrids_();
asImp_().filterConnections_();
std::string outputDir = Parameters::get<TypeTag, Parameters::OutputDir>();
bool enableEclCompatFile = !Parameters::get<TypeTag, Properties::EnableOpmRstFile>();
bool enableEclCompatFile = !Parameters::get<TypeTag, Parameters::EnableOpmRstFile>();
asImp_().updateOutputDir_(outputDir, enableEclCompatFile);
asImp_().finalizeInit_();
}

View File

@ -416,12 +416,12 @@ private:
this->readDeck(deckFilename,
outputDir,
Parameters::get<PreTypeTag, Properties::OutputMode>(),
!Parameters::get<PreTypeTag, Properties::SchedRestart>(),
!Parameters::get<PreTypeTag, Parameters::SchedRestart>(),
Parameters::get<PreTypeTag, Properties::EnableLoggingFalloutWarning>(),
Parameters::get<PreTypeTag, Properties::ParsingStrictness>(),
Parameters::get<PreTypeTag, Properties::InputSkipMode>(),
Parameters::get<PreTypeTag, Parameters::ParsingStrictness>(),
Parameters::get<PreTypeTag, Parameters::InputSkipMode>(),
getNumThreads<PreTypeTag>(),
Parameters::get<PreTypeTag, Properties::EclOutputInterval>(),
Parameters::get<PreTypeTag, 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, Properties::OwnerCellsFirst>()) {
if (! Parameters::get<TypeTag, 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<TypeTag, Properties::MatrixAddWellContributions>();
const bool ownersFirst = Parameters::get<TypeTag, Properties::OwnerCellsFirst>();
const bool ownersFirst = Parameters::get<TypeTag, 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, Properties::NumJacobiBlocks>();
bdaBridge_->numJacobiBlocks_ = Parameters::get<TypeTag, Parameters::NumJacobiBlocks>();
bdaBridge_->prepare(this->simulator_.vanguard().grid(),
this->simulator_.vanguard().cartesianIndexMapper(),
this->simulator_.vanguard().schedule().getWellsatEnd(),