diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index e71473b51..e1a7a817c 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -494,6 +494,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/simulators/flow/FlowGenericVanguard.hpp opm/simulators/flow/FlowMain.hpp opm/simulators/flow/FlowProblem.hpp + opm/simulators/flow/FlowProblemParameters.hpp opm/simulators/flow/FlowProblemProperties.hpp opm/simulators/flow/FlowUtils.hpp opm/simulators/flow/FlowsData.hpp diff --git a/opm/simulators/flow/BlackoilModel.hpp b/opm/simulators/flow/BlackoilModel.hpp index a61f107dd..7bdaee297 100644 --- a/opm/simulators/flow/BlackoilModel.hpp +++ b/opm/simulators/flow/BlackoilModel.hpp @@ -79,77 +79,73 @@ struct FlowProblem { FlowNonLinearSolver, FlowBaseProblem, BlackOilModel>; }; } -template -struct EnableDebuggingChecks { - static constexpr bool value = false; -}; // default in flow is to formulate the equations in surface volumes template -struct BlackoilConserveSurfaceVolume { - static constexpr bool value = true; -}; -template -struct UseVolumetricResidual { - static constexpr bool value = false; -}; +struct BlackoilConserveSurfaceVolume +{ static constexpr bool value = true; }; template -struct AquiferModel { - using type = BlackoilAquiferModel; -}; +struct UseVolumetricResidual +{ static constexpr bool value = false; }; + +template +struct AquiferModel +{ using type = BlackoilAquiferModel; }; // disable all extensions supported by black oil model. this should not really be // necessary but it makes things a bit more explicit template -struct EnablePolymer { - static constexpr bool value = false; -}; -template -struct EnableSolvent { - static constexpr bool value = false; -}; -template -struct EnableTemperature { - static constexpr bool value = true; -}; -template -struct EnableEnergy { - static constexpr bool value = false; -}; -template -struct EnableFoam { - static constexpr bool value = false; -}; -template -struct EnableBrine { - static constexpr bool value = false; -}; -template -struct EnableSaltPrecipitation { - static constexpr bool value = false; -}; -template -struct EnableMICP { - static constexpr bool value = false; -}; -template -struct EnableDispersion { - static constexpr bool value = false; -}; +struct EnablePolymer +{ static constexpr bool value = false; }; template -struct WellModel { - using type = BlackoilWellModel; -}; +struct EnableSolvent +{ static constexpr bool value = false; }; + template -struct LinearSolverSplice { - using type = TTag::FlowIstlSolver; -}; +struct EnableTemperature +{ static constexpr bool value = true; }; + +template +struct EnableEnergy +{ static constexpr bool value = false; }; + +template +struct EnableFoam +{ static constexpr bool value = false; }; + +template +struct EnableBrine +{ static constexpr bool value = false; }; + +template +struct EnableSaltPrecipitation +{ static constexpr bool value = false; }; + +template +struct EnableMICP +{ static constexpr bool value = false; }; + +template +struct EnableDispersion +{ static constexpr bool value = false; }; + +template +struct WellModel +{ using type = BlackoilWellModel; }; + +template +struct LinearSolverSplice +{ using type = TTag::FlowIstlSolver; }; } // namespace Opm::Properties namespace Opm::Parameters { +template +struct EnableDebuggingChecks +{ static constexpr bool value = false; }; + template struct OutputDir { static constexpr auto value = ""; }; diff --git a/opm/simulators/flow/FlowMain.hpp b/opm/simulators/flow/FlowMain.hpp index bdfc10823..83dfeeefb 100644 --- a/opm/simulators/flow/FlowMain.hpp +++ b/opm/simulators/flow/FlowMain.hpp @@ -154,7 +154,7 @@ namespace Opm { // the default eWoms checkpoint/restart mechanism does not work with flow Parameters::hideParam(); - Parameters::hideParam(); + Parameters::hideParam(); // hide all vtk related it is not currently possible to do this dependet on if the vtk writing is used //if(not(Parameters::get())){ Parameters::hideParam(); diff --git a/opm/simulators/flow/FlowProblem.hpp b/opm/simulators/flow/FlowProblem.hpp index dcade9404..86c1f399f 100644 --- a/opm/simulators/flow/FlowProblem.hpp +++ b/opm/simulators/flow/FlowProblem.hpp @@ -228,20 +228,20 @@ public: #endif Parameters::registerParam ("Tell the output writer to use double precision. Useful for 'perfect' restarts"); - Parameters::registerParam + Parameters::registerParam ("The frequencies of which time steps are serialized to disk"); - Parameters::registerParam + Parameters::registerParam ("Enable partial compensation of systematic mass losses via " "the source term of the next time step"); - Parameters::registerParam + Parameters::registerParam ("Specify which messages are going to be printed. " "Valid values are: none, log, all (default)"); - Parameters::registerParam + Parameters::registerParam ("Number of pressure points (in each direction) in tables used for equilibration"); - Parameters::hideParam(); // Users will typically not need to modify this parameter.. - Parameters::registerParam + Parameters::hideParam(); // Users will typically not need to modify this parameter.. + Parameters::registerParam ("Use pressure from end of the last time step when evaluating rock compaction"); - Parameters::hideParam(); // Users will typically not need to modify this parameter.. + Parameters::hideParam(); // Users will typically not need to modify this parameter.. } @@ -311,7 +311,7 @@ public: damarisWriter_ = std::make_unique(simulator); enableDamarisOutput_ = Parameters::get(); #endif - enableDriftCompensation_ = Parameters::get(); + enableDriftCompensation_ = Parameters::get(); enableEclOutput_ = Parameters::get(); @@ -323,14 +323,14 @@ public: // 1. Command line value (--num-pressure-points-equil=N) // 2. EQLDIMS item 2 // Default value is defined in opm-common/src/opm/input/eclipse/share/keywords/000_Eclipse100/E/EQLDIMS - if (Parameters::isSet()) + if (Parameters::isSet()) { - this->numPressurePointsEquil_ = Parameters::get(); + this->numPressurePointsEquil_ = Parameters::get(); } else { this->numPressurePointsEquil_ = simulator.vanguard().eclState().getTableManager().getEqldims().getNumDepthNodesP(); } - explicitRockCompaction_ = Parameters::get(); + explicitRockCompaction_ = Parameters::get(); RelpermDiagnostics relpermDiagnostics; @@ -649,7 +649,7 @@ public: OPM_TIMEBLOCK(endTimeStep); #ifndef NDEBUG - if constexpr (getPropValue()) { + if constexpr (getPropValue()) { // in debug mode, we don't care about performance, so we check // if the model does the right thing (i.e., the mass change // inside the whole reservoir must be equivalent to the fluxes diff --git a/opm/simulators/flow/FlowProblemParameters.hpp b/opm/simulators/flow/FlowProblemParameters.hpp new file mode 100644 index 000000000..ab3f80099 --- /dev/null +++ b/opm/simulators/flow/FlowProblemParameters.hpp @@ -0,0 +1,63 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . + + Consult the COPYING file in the top-level source directory of this + module for the precise wording of the license and the list of + copyright holders. +*/ +/*! + * \file + * + * \copydoc Opm::FlowProblem + */ +#ifndef OPM_FLOW_PROBLEM_PARAMETERS_HPP +#define OPM_FLOW_PROBLEM_PARAMETERS_HPP + +#include + +namespace Opm::Parameters { + +// Enable the additional checks even if compiled in debug mode (i.e., with the NDEBUG +// macro undefined). Next to a slightly better performance, this also eliminates some +// print statements in debug mode. +template +struct EnableDebuggingChecks { using type = Properties::UndefinedProperty; }; + +// Enable partial compensation of systematic mass losses via the source term of the next time +// step +template +struct EnableDriftCompensation { using type = Properties::UndefinedProperty; }; + +// implicit or explicit pressure in rock compaction +template +struct ExplicitRockCompaction { using type = Properties::UndefinedProperty; }; + +// Parameterize equilibration accuracy +template +struct NumPressurePointsEquil { using type = Properties::UndefinedProperty; }; + +template +struct OutputMode { using type = Properties::UndefinedProperty; }; + +// The number of time steps skipped between writing two consequtive restart files +template +struct RestartWritingInterval { using type = Properties::UndefinedProperty; }; + +} // namespace Opm::Parameters + +#endif // OPM_FLOW_PROBLEM_PARAMETERS_HPP diff --git a/opm/simulators/flow/FlowProblemProperties.hpp b/opm/simulators/flow/FlowProblemProperties.hpp index de2bacc6c..392263244 100644 --- a/opm/simulators/flow/FlowProblemProperties.hpp +++ b/opm/simulators/flow/FlowProblemProperties.hpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -61,113 +62,62 @@ namespace Opm::Properties { namespace TTag { struct FlowBaseProblem { - using InheritsFrom = std::tuple; + using InheritsFrom = std::tuple; }; + } -// The class which deals with wells +// The class which deals with ECL aquifers template -struct WellModel { - using type = UndefinedProperty; -}; - -// The number of time steps skipped between writing two consequtive restart files -template -struct RestartWritingInterval { - using type = UndefinedProperty; -}; - -// Enable partial compensation of systematic mass losses via the source term of the next time -// step -template -struct EnableDriftCompensation { - using type = UndefinedProperty; -}; - -// Enable the additional checks even if compiled in debug mode (i.e., with the NDEBUG -// macro undefined). Next to a slightly better performance, this also eliminates some -// print statements in debug mode. -template -struct EnableDebuggingChecks { - using type = UndefinedProperty; -}; - -// if thermal flux boundaries are enabled an effort is made to preserve the initial -// thermal gradient specified via the TEMPVD keyword -template -struct EnableThermalFluxBoundaries { - using type = UndefinedProperty; -}; +struct AquiferModel { using type = UndefinedProperty; }; // Specify whether API tracking should be enabled (replaces PVT regions). // TODO: This is not yet implemented template -struct EnableApiTracking { - using type = UndefinedProperty; -}; +struct EnableApiTracking { using type = UndefinedProperty; }; -// The class which deals with ECL aquifers +// if thermal flux boundaries are enabled an effort is made to preserve the initial +// thermal gradient specified via the TEMPVD keyword template -struct AquiferModel { - using type = UndefinedProperty; -}; +struct EnableThermalFluxBoundaries { using type = UndefinedProperty; }; +// The class which deals with wells template -struct OutputMode { - using type = UndefinedProperty; -}; -// Parameterize equilibration accuracy -template -struct NumPressurePointsEquil { - using type = UndefinedProperty; -}; -// implicit or explicit pressure in rock compaction -template -struct ExplicitRockCompaction { - using type = UndefinedProperty; -}; - - +struct WellModel { using type = UndefinedProperty; }; // Set the problem property template -struct Problem { - using type = FlowProblem; -}; +struct Problem +{ using type = FlowProblem; }; template -struct Model { - using type = FIBlackOilModel; -}; +struct Model +{ using type = FIBlackOilModel; }; // Select the element centered finite volume method as spatial discretization template -struct SpatialDiscretizationSplice { - using type = TTag::EcfvDiscretization; -}; +struct SpatialDiscretizationSplice +{ using type = TTag::EcfvDiscretization; }; // use automatic differentiation to linearize the system of PDEs template -struct LocalLinearizerSplice { - using type = TTag::AutoDiffLocalLinearizer; -}; +struct LocalLinearizerSplice +{ using type = TTag::AutoDiffLocalLinearizer; }; template -struct BaseDiscretizationType { - using type = FvBaseDiscretizationNoAdapt; -}; +struct BaseDiscretizationType +{ using type = FvBaseDiscretizationNoAdapt; }; template -struct DiscreteFunction { +struct DiscreteFunction +{ using BaseDiscretization = FvBaseDiscretization; using type = typename BaseDiscretization::BlockVectorWrapper; }; template struct GridView -{ - using type = typename GetPropType::LeafGridView; -}; +{ using type = typename GetPropType::LeafGridView; }; // Set the material law for fluid fluxes template @@ -240,149 +190,99 @@ struct AquiferModel { // Enable diffusion template -struct EnableDiffusion { - static constexpr bool value = true; -}; +struct EnableDiffusion +{ static constexpr bool value = true; }; // Enable dispersion template -struct EnableDispersion { - static constexpr bool value = false; -}; +struct EnableDispersion +{ static constexpr bool value = false; }; // only write the solutions for the report steps to disk template -struct EnableWriteAllSolutions { - static constexpr bool value = false; -}; +struct EnableWriteAllSolutions +{ static constexpr bool value = false; }; // disable API tracking template -struct EnableApiTracking { - static constexpr bool value = false; -}; +struct EnableApiTracking +{ static constexpr bool value = false; }; // ... but enable the ECL output by default template -struct EnableEclOutput { - static constexpr bool value = true; -}; +struct EnableEclOutput +{ static constexpr bool value = true; }; // If available, write the ECL output in a non-blocking manner template -struct EnableAsyncEclOutput { - static constexpr bool value = true; -}; +struct EnableAsyncEclOutput +{ static constexpr bool value = true; }; // Write ESMRY file for fast loading of summary data template -struct EnableEsmry { - static constexpr bool value = false; -}; +struct EnableEsmry +{ static constexpr bool value = false; }; // By default, use single precision for the ECL formated results template -struct EclOutputDoublePrecision { - static constexpr bool value = false; -}; +struct EclOutputDoublePrecision +{ static constexpr bool value = false; }; // Use the "velocity module" which uses the Eclipse "NEWTRAN" transmissibilities template -struct FluxModule { - using type = NewTranFluxModule; -}; +struct FluxModule +{ using type = NewTranFluxModule; }; // Use the dummy gradient calculator in order not to do unnecessary work. template -struct GradientCalculator { - using type = DummyGradientCalculator; -}; - -// The frequency of writing restart (*.ers) files. This is the number of time steps -// between writing restart files -template -struct RestartWritingInterval { - static constexpr int value = 0xffffff; // disable -}; - -// Drift compensation is an experimental feature, i.e., systematic errors in the -// conservation quantities are only compensated for -// as default if experimental mode is enabled. -template -struct EnableDriftCompensation { - static constexpr bool value = true; -}; - -// By default, we enable the debugging checks if we're compiled in debug mode -template -struct EnableDebuggingChecks { - static constexpr bool value = true; -}; +struct GradientCalculator +{ using type = DummyGradientCalculator; }; // store temperature (but do not conserve energy, as long as EnableEnergy is false) template -struct EnableTemperature { - static constexpr bool value = true; -}; +struct EnableTemperature +{ static constexpr bool value = true; }; template -struct EnableMech { - static constexpr bool value = false; -}; +struct EnableMech +{ static constexpr bool value = false; }; + // disable all extensions supported by black oil model. this should not really be // necessary but it makes things a bit more explicit template -struct EnablePolymer { - static constexpr bool value = false; -}; +struct EnablePolymer +{ static constexpr bool value = false; }; + template -struct EnableSolvent { - static constexpr bool value = false; -}; +struct EnableSolvent +{ static constexpr bool value = false; }; + template -struct EnableEnergy { - static constexpr bool value = false; -}; +struct EnableEnergy +{ static constexpr bool value = false; }; + template -struct EnableFoam { - static constexpr bool value = false; -}; +struct EnableFoam +{ static constexpr bool value = false; }; + template -struct EnableExtbo { - static constexpr bool value = false; -}; +struct EnableExtbo +{ static constexpr bool value = false; }; + template -struct EnableMICP { - static constexpr bool value = false; -}; +struct EnableMICP +{ static constexpr bool value = false; }; // disable thermal flux boundaries by default template -struct EnableThermalFluxBoundaries { - static constexpr bool value = false; -}; +struct EnableThermalFluxBoundaries +{ static constexpr bool value = false; }; // By default, simulators derived from the FlowBaseProblem are production simulators, // i.e., experimental features must be explicitly enabled at compile time template -struct EnableExperiments { - static constexpr bool value = false; -}; - -template -struct OutputMode { - static constexpr auto value = "all"; -}; -// Parameterize equilibration accuracy -template -struct NumPressurePointsEquil { - static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue; -}; -// By default, use implicit pressure in rock compaction -template -struct ExplicitRockCompaction { - static constexpr bool value = false; -}; +struct EnableExperiments +{ static constexpr bool value = false; }; } // namespace Opm::Properties @@ -471,6 +371,18 @@ struct DamarisLimitVariables { static constexpr auto value = ""; }; #endif +// By default, we enable the debugging checks if we're compiled in debug mode +template +struct EnableDebuggingChecks +{ static constexpr bool value = true; }; + +// Drift compensation is an experimental feature, i.e., systematic errors in the +// conservation quantities are only compensated for +// as default if experimental mode is enabled. +template +struct EnableDriftCompensation +{ static constexpr bool value = true; }; + // Enable gravity template struct EnableGravity @@ -504,6 +416,11 @@ struct EndTime static constexpr type value = 1e100; }; +// By default, use implicit pressure in rock compaction +template +struct ExplicitRockCompaction +{ static constexpr bool value = false; }; + // The default for the initial time step size of the simulation [s]. // // The chosen value means that the size of the first time step is the @@ -524,11 +441,26 @@ struct NewtonTolerance static constexpr type value = 1e-2; }; +// Parameterize equilibration accuracy +template +struct NumPressurePointsEquil +{ static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue; }; + // The default location for the ECL output files template struct OutputDir { static constexpr auto value = "."; }; +template +struct OutputMode +{ static constexpr auto value = "all"; }; + +// The frequency of writing restart (*.ers) files. This is the number of time steps +// between writing restart files +template +struct RestartWritingInterval +{ static constexpr int value = 0xffffff; }; // disable + } // namespace Opm::Parameters #endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index bcee463f2..c9c37a000 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -415,7 +415,7 @@ private: try { this->readDeck(deckFilename, outputDir, - Parameters::get(), + Parameters::get(), !Parameters::get(), Parameters::get(), Parameters::get(),