From 4fc1487a9db15f06bebdd8c11f1d68cfed674644 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 28 Jun 2024 12:17:13 +0200 Subject: [PATCH] changed: FlowBaseVanguard parameters moved to Opm::Parameters namespace --- opm/simulators/flow/EclWriter.hpp | 2 +- opm/simulators/flow/FlowBaseVanguard.hpp | 381 +++++++++---------- opm/simulators/flow/Main.hpp | 8 +- opm/simulators/flow/OutputBlackoilModule.hpp | 2 +- opm/simulators/linalg/ISTLSolver.hpp | 2 +- opm/simulators/linalg/ISTLSolverBda.hpp | 2 +- 6 files changed, 178 insertions(+), 219 deletions(-) diff --git a/opm/simulators/flow/EclWriter.hpp b/opm/simulators/flow/EclWriter.hpp index d6675754b..a5e33614c 100644 --- a/opm/simulators/flow/EclWriter.hpp +++ b/opm/simulators/flow/EclWriter.hpp @@ -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(); + bool opm_rst_file = Parameters::get(); bool read_temp = enableEnergy || (opm_rst_file && enableTemperature); std::vector solutionKeys{ {"PRESSURE", UnitSystem::measure::pressure}, diff --git a/opm/simulators/flow/FlowBaseVanguard.hpp b/opm/simulators/flow/FlowBaseVanguard.hpp index ebd6df4f8..9cea9110f 100644 --- a/opm/simulators/flow/FlowBaseVanguard.hpp +++ b/opm/simulators/flow/FlowBaseVanguard.hpp @@ -56,193 +56,153 @@ template struct LookUpCellCentroid; namespace Opm::Properties { namespace TTag { + struct FlowBaseVanguard {}; + } // declare the properties required by the for the ecl simulator vanguard template -struct EquilGrid { - using type = UndefinedProperty; -}; -template -struct EnableOpmRstFile { - using type = UndefinedProperty; -}; -template -struct ParsingStrictness { - using type = UndefinedProperty; -}; -template -struct InputSkipMode { - using type = UndefinedProperty; -}; -template -struct SchedRestart { - using type = UndefinedProperty; -}; -template -struct EclOutputInterval { - using type = UndefinedProperty; -}; -template -struct IgnoreKeywords { - using type = UndefinedProperty; -}; -template -struct EdgeWeightsMethod { - using type = UndefinedProperty; -}; - -#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA -template -struct NumJacobiBlocks { - using type = UndefinedProperty; -}; -#endif - -template -struct OwnerCellsFirst { - using type = UndefinedProperty; -}; - -template -struct PartitionMethod { - using type = UndefinedProperty; -}; - -template -struct SerialPartitioning { - using type = UndefinedProperty; -}; - -template -struct ImbalanceTol { - using type = UndefinedProperty; -}; - -// Remove this for release 2025.04 -template -struct ZoltanImbalanceTol { - using type = UndefinedProperty; -}; - -template -struct ZoltanParams { - using type = UndefinedProperty; -}; - -template -struct MetisParams { - using type = UndefinedProperty; -}; - -template -struct ExternalPartition -{ - using type = UndefinedProperty; -}; - -template -struct AllowDistributedWells { - using type = UndefinedProperty; -}; +struct EquilGrid { using type = UndefinedProperty; }; template -struct IgnoreKeywords { - static constexpr auto value = ""; -}; -template -struct EclDeckFileName { - static constexpr auto value = ""; -}; -template -struct EclOutputInterval { - static constexpr int value = -1; -}; -template -struct EnableOpmRstFile { - static constexpr bool value = false; -}; -template -struct ParsingStrictness { - static constexpr auto value = "normal"; -}; -template -struct InputSkipMode { - static constexpr auto value = "100"; -}; -template -struct SchedRestart { - static constexpr bool value = false; -}; -template -struct EdgeWeightsMethod { - static constexpr int value = 1; -}; - -#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA -template -struct NumJacobiBlocks { - static constexpr int value = 0; -}; -#endif - -template -struct OwnerCellsFirst { - static constexpr bool value = true; -}; - -template -struct PartitionMethod { - static constexpr int value = 1; // 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp -}; - -template -struct SerialPartitioning { - static constexpr bool value = false; -}; - -template -struct ZoltanImbalanceTol { - static constexpr double value = 1.1; -}; - -template -struct ZoltanParams { - static constexpr auto value = "graph"; -}; - -template -struct ImbalanceTol { - static constexpr double value = 1.1; -}; - -template -struct MetisParams { - static constexpr auto value = "default"; -}; - -template -struct ExternalPartition -{ - static constexpr auto* value = ""; -}; - -template -struct AllowDistributedWells { - static constexpr bool value = false; -}; - -template -struct UseMultisegmentWell; +struct EclDeckFileName +{ static constexpr auto value = ""; }; // Same as in BlackoilModelParameters.hpp but for here. template -struct UseMultisegmentWell { - static constexpr bool value = true; -}; +struct UseMultisegmentWell +{ static constexpr bool value = true; }; + } // namespace Opm::Properties +namespace Opm::Parameters { + +template +struct EnableOpmRstFile { using type = Properties::UndefinedProperty; }; + +template +struct ParsingStrictness { using type = Properties::UndefinedProperty; }; + +template +struct InputSkipMode { using type = Properties::UndefinedProperty; }; + +template +struct SchedRestart { using type = Properties::UndefinedProperty; }; + +template +struct EclOutputInterval { using type = Properties::UndefinedProperty; }; + +template +struct IgnoreKeywords { using type = Properties::UndefinedProperty; }; + +template +struct EdgeWeightsMethod { using type = Properties::UndefinedProperty; }; + +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA +template +struct NumJacobiBlocks { using type = Properties::UndefinedProperty; }; +#endif + +template +struct OwnerCellsFirst { using type = Properties::UndefinedProperty; }; + +template +struct ImbalanceTol { using type = Properties::UndefinedProperty; }; + +template +struct PartitionMethod { using type = Properties::UndefinedProperty; }; + +template +struct SerialPartitioning { using type = Properties::UndefinedProperty; }; + +template +struct ZoltanImbalanceTol { using type = Properties::UndefinedProperty; }; + +template +struct ZoltanParams { using type = Properties::UndefinedProperty; }; + +template +struct MetisParams { using type = Properties::UndefinedProperty; }; + +template +struct ExternalPartition { using type = Properties::UndefinedProperty; }; + +template +struct AllowDistributedWells { using type = Properties::UndefinedProperty; }; + +template +struct IgnoreKeywords +{ static constexpr auto value = ""; }; + +template +struct EclOutputInterval +{ static constexpr int value = -1; }; + +template +struct EnableOpmRstFile +{ static constexpr bool value = false; }; + +template +struct ParsingStrictness +{ static constexpr auto value = "normal"; }; + +template +struct InputSkipMode +{ static constexpr auto value = "100"; }; + +template +struct SchedRestart +{ static constexpr bool value = false; }; + +template +struct EdgeWeightsMethod +{ static constexpr int value = 1; }; + +template +struct ImbalanceTol +{ static constexpr double value = 1.1; }; + +#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA +template +struct NumJacobiBlocks +{ static constexpr int value = 0; }; +#endif + +template +struct OwnerCellsFirst +{ static constexpr bool value = true; }; + +template +struct PartitionMethod +{ static constexpr int value = 1; }; // 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp + +template +struct SerialPartitioning +{ static constexpr bool value = false; }; + +template +struct ZoltanImbalanceTol +{ static constexpr double value = 1.1; }; + +template +struct ZoltanParams +{ static constexpr auto value = "graph"; }; + +template +struct MetisParams +{ static constexpr auto value = "default"; }; + +template +struct ExternalPartition +{ static constexpr auto* value = ""; }; + +template +struct AllowDistributedWells +{ static constexpr bool value = false; }; + +} // namespace Opm::Parameters + namespace Opm { /*! @@ -280,70 +240,69 @@ public: { Parameters::registerParam ("The name of the file which contains the ECL deck to be simulated"); - Parameters::registerParam + Parameters::registerParam ("The number of report steps that ought to be skipped between two writes of ECL results"); - Parameters::registerParam + Parameters::registerParam ("Include OPM-specific keywords in the ECL restart file to " "enable restart of OPM simulators from these files"); - Parameters::registerParam + Parameters::registerParam ("List of Eclipse keywords which should be ignored. As a ':' separated string."); - Parameters::registerParam + Parameters::registerParam ("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 + Parameters::registerParam ("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 + Parameters::registerParam ("When restarting: should we try to initialize wells and " "groups from historical SCHEDULE section."); - Parameters::registerParam + Parameters::registerParam ("Choose edge-weighing strategy: 0=uniform, 1=trans, 2=log(trans)."); #if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA - Parameters::registerParam + Parameters::registerParam ("Number of blocks to be created for the Block-Jacobi preconditioner."); #endif - Parameters::registerParam + Parameters::registerParam ("Order cells owned by rank before ghost/overlap cells."); #if HAVE_MPI - Parameters::registerParam + Parameters::registerParam ("Choose partitioning strategy: 0=simple, 1=Zoltan, 2=METIS."); - Parameters::registerParam + Parameters::registerParam ("Perform partitioning for parallel runs on a single process."); - Parameters::registerParam + Parameters::registerParam ("Tolerable imbalance of the loadbalancing provided by Zoltan. DEPRECATED: Use --imbalance-tol instead"); - Parameters::hideParam(); - Parameters::registerParam + Parameters::hideParam(); + Parameters::registerParam ("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(); - Parameters::registerParam + Parameters::hideParam(); + Parameters::registerParam ("Tolerable imbalance of the loadbalancing (default: 1.1)."); - - Parameters::registerParam + Parameters::registerParam ("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 + Parameters::registerParam ("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(); + Parameters::hideParam(); #endif - Parameters::registerParam + Parameters::registerParam ("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 @@ -360,29 +319,29 @@ public: : ParentType(simulator) { fileName_ = Parameters::get(); - edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::get()); + edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::get()); #if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA - numJacobiBlocks_ = Parameters::get(); + numJacobiBlocks_ = Parameters::get(); #endif - ownersFirst_ = Parameters::get(); + ownersFirst_ = Parameters::get(); #if HAVE_MPI - partitionMethod_ = Dune::PartitionMethod(Parameters::get()); - serialPartitioning_ = Parameters::get(); - imbalanceTol_ = Parameters::get(); + partitionMethod_ = Dune::PartitionMethod(Parameters::get()); + serialPartitioning_ = Parameters::get(); + imbalanceTol_ = Parameters::get(); - zoltanImbalanceTolSet_ = Parameters::isSet(); - zoltanImbalanceTol_ = Parameters::get(); - zoltanParams_ = Parameters::get(); + zoltanImbalanceTolSet_ = Parameters::isSet(); + zoltanImbalanceTol_ = Parameters::get(); + zoltanParams_ = Parameters::get(); - metisParams_ = Parameters::get(); + metisParams_ = Parameters::get(); - externalPartitionFile_ = Parameters::get(); + externalPartitionFile_ = Parameters::get(); #endif - enableDistributedWells_ = Parameters::get(); - ignoredKeywords_ = Parameters::get(); - int output_param = Parameters::get(); + enableDistributedWells_ = Parameters::get(); + ignoredKeywords_ = Parameters::get(); + int output_param = Parameters::get(); if (output_param >= 0) outputInterval_ = output_param; useMultisegmentWell_ = Parameters::get(); @@ -582,7 +541,7 @@ protected: asImp_().createGrids_(); asImp_().filterConnections_(); std::string outputDir = Parameters::get(); - bool enableEclCompatFile = !Parameters::get(); + bool enableEclCompatFile = !Parameters::get(); asImp_().updateOutputDir_(outputDir, enableEclCompatFile); asImp_().finalizeInit_(); } diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index 45ba34c31..372b61c0c 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -416,12 +416,12 @@ private: this->readDeck(deckFilename, outputDir, Parameters::get(), - !Parameters::get(), + !Parameters::get(), Parameters::get(), - Parameters::get(), - Parameters::get(), + Parameters::get(), + Parameters::get(), getNumThreads(), - Parameters::get(), + Parameters::get(), cmdline_params, Opm::moduleVersion(), Opm::compileTimestamp()); diff --git a/opm/simulators/flow/OutputBlackoilModule.hpp b/opm/simulators/flow/OutputBlackoilModule.hpp index b84dc5040..84209ec9b 100644 --- a/opm/simulators/flow/OutputBlackoilModule.hpp +++ b/opm/simulators/flow/OutputBlackoilModule.hpp @@ -170,7 +170,7 @@ public: this->forceDisableFipresvOutput_ = Parameters::get(); - if (! Parameters::get()) { + if (! Parameters::get()) { const std::string msg = "The output code does not support --owner-cells-first=false."; if (collectToIORank.isIORank()) { OpmLog::error(msg); diff --git a/opm/simulators/linalg/ISTLSolver.hpp b/opm/simulators/linalg/ISTLSolver.hpp index 7eddf6339..4145cdc95 100644 --- a/opm/simulators/linalg/ISTLSolver.hpp +++ b/opm/simulators/linalg/ISTLSolver.hpp @@ -259,7 +259,7 @@ std::unique_ptr blockJacobiAdjacency(const Grid& grid, ElementMapper elemMapper(simulator_.vanguard().gridView(), Dune::mcmgElementLayout()); detail::findOverlapAndInterior(simulator_.vanguard().grid(), elemMapper, overlapRows_, interiorRows_); useWellConn_ = Parameters::get(); - const bool ownersFirst = Parameters::get(); + const bool ownersFirst = Parameters::get(); if (!ownersFirst) { const std::string msg = "The linear solver no longer supports --owner-cells-first=false."; if (on_io_rank) { diff --git a/opm/simulators/linalg/ISTLSolverBda.hpp b/opm/simulators/linalg/ISTLSolverBda.hpp index d977b4f8e..ca692dbb9 100644 --- a/opm/simulators/linalg/ISTLSolverBda.hpp +++ b/opm/simulators/linalg/ISTLSolverBda.hpp @@ -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(); + bdaBridge_->numJacobiBlocks_ = Parameters::get(); bdaBridge_->prepare(this->simulator_.vanguard().grid(), this->simulator_.vanguard().cartesianIndexMapper(), this->simulator_.vanguard().schedule().getWellsatEnd(),