changed: SimulatorFullyImplicitBlackoil parameters moved to Opm::Parameters namespace

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:17:13 +02:00
parent 466e26d330
commit d75b91aaba
10 changed files with 73 additions and 103 deletions

View File

@ -96,11 +96,6 @@ struct MatrixAddWellContributions<TypeTag, TTag::FlowExpTypeTag> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, TTag::FlowExpTypeTag> {
static constexpr bool value = false;
};
// flow's well model only works with surface volumes
template<class TypeTag>
struct BlackoilConserveSurfaceVolume<TypeTag, TTag::FlowExpTypeTag> {
@ -153,6 +148,10 @@ template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = true; };
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = false; };
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, Properties::TTag::FlowExpTypeTag>
@ -167,13 +166,10 @@ template<class TypeTag>
struct NewtonMaxIterations<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr int value = 8; };
} // namespace Opm::Parameters
namespace Opm::Parameters {
// the maximum volumetric error of a cell in the relaxed region
template<class TypeTag>
struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpTypeTag> {
struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpTypeTag>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr auto baseValue =
Parameters::NewtonTolerance<TypeTag,
@ -181,7 +177,7 @@ struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpTypeTag> {
static constexpr type value = 1e6 * baseValue;
};
}
} // namespace Opm::Parameters
namespace Opm {
template <class TypeTag>
@ -207,7 +203,7 @@ public:
ParentType::registerParameters();
BlackoilModelParameters<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Properties::EnableTerminalOutput>("Do *NOT* use!");
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>("Do *NOT* use!");
Parameters::hideParam<TypeTag, Properties::DbhpMaxRel>();
Parameters::hideParam<TypeTag, Properties::DwellFractionMax>();
Parameters::hideParam<TypeTag, Properties::MaxResidualAllowed>();
@ -231,7 +227,7 @@ public:
Parameters::hideParam<TypeTag, Properties::UpdateEquationsScaling>();
Parameters::hideParam<TypeTag, Properties::UseUpdateStabilization>();
Parameters::hideParam<TypeTag, Properties::MatrixAddWellContributions>();
Parameters::hideParam<TypeTag, Properties::EnableTerminalOutput>();
Parameters::hideParam<TypeTag, Parameters::EnableTerminalOutput>();
}
// inherit the constructors

View File

@ -505,7 +505,7 @@ namespace Opm {
printFlowTrailer(mpi_size_, threads, total_setup_time_, deck_read_time_, report, simulator_->model().localAccumulatedReports());
detail::handleExtraConvergenceOutput(report,
Parameters::get<TypeTag, Properties::OutputExtraConvergenceInfo>(),
Parameters::get<TypeTag, Parameters::OutputExtraConvergenceInfo>(),
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))",
eclState().getIOConfig().getOutputDir(),
eclState().getIOConfig().getBaseName());

View File

@ -376,7 +376,7 @@ private:
int mpiRank = FlowGenericVanguard::comm().rank();
outputCout_ = false;
if (mpiRank == 0)
outputCout_ = Parameters::get<PreTypeTag, Properties::EnableTerminalOutput>();
outputCout_ = Parameters::get<PreTypeTag, Parameters::EnableTerminalOutput>();
if (deckFilename.empty()) {
if (mpiRank == 0) {

View File

@ -57,83 +57,55 @@
#include <utility>
#include <vector>
namespace Opm::Properties {
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableAdaptiveTimeStepping {
using type = UndefinedProperty;
};
struct EnableAdaptiveTimeStepping { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct OutputExtraConvergenceInfo
{
using type = UndefinedProperty;
};
struct OutputExtraConvergenceInfo { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct SaveStep
{
using type = UndefinedProperty;
};
struct SaveStep { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct LoadStep
{
using type = UndefinedProperty;
};
struct LoadStep { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct SaveFile
{
using type = UndefinedProperty;
};
struct SaveFile { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct LoadFile
{
using type = UndefinedProperty;
};
struct LoadFile { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, TTag::FlowProblem> {
static constexpr bool value = true;
};
struct EnableAdaptiveTimeStepping<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr bool value = true; };
template <class TypeTag>
struct OutputExtraConvergenceInfo<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = "none"; };
template<class TypeTag>
struct EnableAdaptiveTimeStepping<TypeTag, TTag::FlowProblem> {
static constexpr bool value = true;
};
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr bool value = true; };
template <class TypeTag>
struct OutputExtraConvergenceInfo<TypeTag, TTag::FlowProblem>
{
static constexpr auto* value = "none";
};
struct SaveStep<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = ""; };
template <class TypeTag>
struct SaveStep<TypeTag, TTag::FlowProblem>
{
static constexpr auto* value = "";
};
struct SaveFile<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = ""; };
template <class TypeTag>
struct SaveFile<TypeTag, TTag::FlowProblem>
{
static constexpr auto* value = "";
};
struct LoadFile<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = ""; };
template <class TypeTag>
struct LoadFile<TypeTag, TTag::FlowProblem>
{
static constexpr auto* value = "";
};
struct LoadStep<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr int value = -1; };
template <class TypeTag>
struct LoadStep<TypeTag, TTag::FlowProblem>
{
static constexpr int value = -1;
};
} // namespace Opm::Properties
} // namespace Opm::Parameters
namespace Opm {
@ -189,19 +161,19 @@ public:
, serializer_(*this,
FlowGenericVanguard::comm(),
simulator_.vanguard().eclState().getIOConfig(),
Parameters::get<TypeTag, Properties::SaveStep>(),
Parameters::get<TypeTag, Properties::LoadStep>(),
Parameters::get<TypeTag, Properties::SaveFile>(),
Parameters::get<TypeTag, Properties::LoadFile>())
Parameters::get<TypeTag, Parameters::SaveStep>(),
Parameters::get<TypeTag, Parameters::LoadStep>(),
Parameters::get<TypeTag, Parameters::SaveFile>(),
Parameters::get<TypeTag, Parameters::LoadFile>())
{
phaseUsage_ = phaseUsageFromDeck(eclState());
// Only rank 0 does print to std::cout, and only if specifically requested.
this->terminalOutput_ = false;
if (this->grid().comm().rank() == 0) {
this->terminalOutput_ = Parameters::get<TypeTag, Properties::EnableTerminalOutput>();
this->terminalOutput_ = Parameters::get<TypeTag, Parameters::EnableTerminalOutput>();
this->startConvergenceOutputThread(Parameters::get<TypeTag, Properties::OutputExtraConvergenceInfo>(),
this->startConvergenceOutputThread(Parameters::get<TypeTag, Parameters::OutputExtraConvergenceInfo>(),
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))");
}
}
@ -218,11 +190,11 @@ public:
SolverParameters::registerParameters();
TimeStepper::registerParameters();
Parameters::registerParam<TypeTag, Properties::EnableTerminalOutput>
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>
("Print high-level information about the simulation's progress to the terminal");
Parameters::registerParam<TypeTag, Properties::EnableAdaptiveTimeStepping>
Parameters::registerParam<TypeTag, Parameters::EnableAdaptiveTimeStepping>
("Use adaptive time stepping between report steps");
Parameters::registerParam<TypeTag, Properties::OutputExtraConvergenceInfo>
Parameters::registerParam<TypeTag, Parameters::OutputExtraConvergenceInfo>
("Provide additional convergence output "
"files for diagnostic purposes. "
"\"none\" gives no extra output and "
@ -231,25 +203,25 @@ public:
"\"iterations\" generates an INFOITER file. "
"Combine options with commas, e.g., "
"\"steps,iterations\" for multiple outputs.");
Parameters::registerParam<TypeTag, Properties::SaveStep>
Parameters::registerParam<TypeTag, Parameters::SaveStep>
("Save serialized state to .OPMRST file. "
"Either a specific report step, \"all\" to save "
"all report steps or \":x\" to save every x'th step."
"Use negative values of \"x\" to keep only the last "
"written step, or \"last\" to save every step, keeping "
"only the last.");
Parameters::registerParam<TypeTag, Properties::LoadStep>
Parameters::registerParam<TypeTag, Parameters::LoadStep>
("Load serialized state from .OPMRST file. "
"Either a specific report step, or 0 to load last "
"stored report step.");
Parameters::registerParam<TypeTag, Properties::SaveFile>
Parameters::registerParam<TypeTag, Parameters::SaveFile>
("FileName for .OPMRST file used for saving serialized state. "
"If empty, CASENAME.OPMRST is used.");
Parameters::hideParam<TypeTag, Properties::SaveFile>();
Parameters::registerParam<TypeTag, Properties::LoadFile>
Parameters::hideParam<TypeTag, Parameters::SaveFile>();
Parameters::registerParam<TypeTag, Parameters::LoadFile>
("FileName for .OPMRST file used to load serialized state. "
"If empty, CASENAME.OPMRST is used.");
Parameters::hideParam<TypeTag, Properties::LoadFile>();
Parameters::hideParam<TypeTag, Parameters::LoadFile>();
}
/// Run the simulation.
@ -281,7 +253,7 @@ public:
totalTimer_->start();
// adaptive time stepping
bool enableAdaptive = Parameters::get<TypeTag, Properties::EnableAdaptiveTimeStepping>();
bool enableAdaptive = Parameters::get<TypeTag, Parameters::EnableAdaptiveTimeStepping>();
bool enableTUNING = Parameters::get<TypeTag, Parameters::EnableTuning>();
if (enableAdaptive) {
const UnitSystem& unitSystem = this->simulator_.vanguard().eclState().getUnits();

View File

@ -78,14 +78,12 @@
#include <opm/simulators/utils/DeferredLogger.hpp>
namespace Opm::Properties {
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableTerminalOutput {
using type = UndefinedProperty;
};
struct EnableTerminalOutput { using type = Properties::UndefinedProperty; };
} // namespace Opm::Properties
} // namespace Opm::Parameters
namespace Opm {

View File

@ -77,7 +77,7 @@ namespace Opm {
, simulator_(simulator)
{
this->terminal_output_ = ((simulator.gridView().comm().rank() == 0) &&
Parameters::get<TypeTag, Properties::EnableTerminalOutput>());
Parameters::get<TypeTag, Parameters::EnableTerminalOutput>());
local_num_cells_ = simulator_.gridView().size(0);

View File

@ -78,11 +78,6 @@ struct MatrixAddWellContributions<TypeTag, TTag::TestTypeTag> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, TTag::TestTypeTag> {
static constexpr bool value = false;
};
// flow's well model only works with surface volumes
template<class TypeTag>
struct BlackoilConserveSurfaceVolume<TypeTag, TTag::TestTypeTag> {
@ -116,6 +111,10 @@ struct LinearSolverBackend<TTag::TestTypeTag, TTag::FlowIstlSolverParams> {
namespace Opm::Parameters {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = false; };
// if openMP is available, set the default the number of threads per process for the main
// simulation to 2 (instead of grabbing everything that is available).
#if _OPENMP

View File

@ -513,7 +513,7 @@ struct AquiferFixture {
};
AdaptiveTimeStepping<TT>::registerParameters();
BlackoilModelParameters<TT>::registerParameters();
Parameters::registerParam<TT, Properties::EnableTerminalOutput>("Do *NOT* use!");
Parameters::registerParam<TT, Parameters::EnableTerminalOutput>("Do *NOT* use!");
setupParameters_<TT>(2, argv, /*registerParams=*/true);
Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
}

View File

@ -68,11 +68,6 @@
namespace Opm::Properties {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, TTag::FlowBaseProblem> {
static constexpr bool value = true;
};
namespace TTag {
@ -100,8 +95,18 @@ template<class TypeTag>
struct EnableVapwat<TypeTag, TTag::TestEquilVapwatTypeTag> {
static constexpr bool value = true;
};
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowBaseProblem> {
static constexpr bool value = true;
};
} // namespace Opm::Parameters
template <class TypeTag>
std::unique_ptr<Opm::GetPropType<TypeTag, Opm::Properties::Simulator>>
initSimulator(const char *filename)
@ -237,7 +242,7 @@ struct EquilFixture {
BlackoilModelParameters<TypeTag>::registerParameters();
AdaptiveTimeStepping<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag,
Properties::EnableTerminalOutput>("Dummy added for the well model to compile.");
Parameters::EnableTerminalOutput>("Dummy added for the well model to compile.");
registerAllParameters_<TypeTag>();
}

View File

@ -87,7 +87,7 @@ initSimulator(const char *filename)
registerEclTimeSteppingParameters<TypeTag>();
BlackoilModelParameters<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Properties::EnableTerminalOutput>("Do *NOT* use!");
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>("Do *NOT* use!");
setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/true);
FlowGenericVanguard::readDeck(filename);