move EnableTerminalOutput parameter to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-06 10:22:47 +02:00
parent 296c8ef73d
commit aab40a32e2
9 changed files with 11 additions and 33 deletions

View File

@ -122,10 +122,6 @@ struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
namespace Opm::Parameters { namespace Opm::Parameters {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = false; };
// currently, flowexp uses the non-multisegment well model by default to avoid // currently, flowexp uses the non-multisegment well model by default to avoid
// regressions. the --use-multisegment-well=true|false command line parameter is still // regressions. the --use-multisegment-well=true|false command line parameter is still
// available in flowexp, but hidden from view. // available in flowexp, but hidden from view.
@ -168,7 +164,7 @@ public:
ParentType::registerParameters(); ParentType::registerParameters();
BlackoilModelParameters<TypeTag>::registerParameters(); BlackoilModelParameters<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>("Do *NOT* use!"); Parameters::Register<Parameters::EnableTerminalOutput>("Do *NOT* use!");
Parameters::hideParam<TypeTag, Parameters::DbhpMaxRel>(); Parameters::hideParam<TypeTag, Parameters::DbhpMaxRel>();
Parameters::hideParam<TypeTag, Parameters::DwellFractionMax>(); Parameters::hideParam<TypeTag, Parameters::DwellFractionMax>();
Parameters::hideParam<TypeTag, Parameters::MaxResidualAllowed>(); Parameters::hideParam<TypeTag, Parameters::MaxResidualAllowed>();
@ -192,7 +188,7 @@ public:
Parameters::hideParam<TypeTag, Parameters::UpdateEquationsScaling>(); Parameters::hideParam<TypeTag, Parameters::UpdateEquationsScaling>();
Parameters::hideParam<TypeTag, Parameters::UseUpdateStabilization>(); Parameters::hideParam<TypeTag, Parameters::UseUpdateStabilization>();
Parameters::hideParam<TypeTag, Parameters::MatrixAddWellContributions>(); Parameters::hideParam<TypeTag, Parameters::MatrixAddWellContributions>();
Parameters::hideParam<TypeTag, Parameters::EnableTerminalOutput>(); Parameters::Hide<Parameters::EnableTerminalOutput>();
// if openMP is available, set the default the number of threads per process for the main // 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). // simulation to 2 (instead of grabbing everything that is available).
@ -209,6 +205,7 @@ public:
Parameters::SetDefault<Parameters::EclNewtonRelaxedTolerance<Scalar>>(1e-1); Parameters::SetDefault<Parameters::EclNewtonRelaxedTolerance<Scalar>>(1e-1);
Parameters::SetDefault<Parameters::EclNewtonRelaxedVolumeFraction<Scalar>>(0.0); Parameters::SetDefault<Parameters::EclNewtonRelaxedVolumeFraction<Scalar>>(0.0);
Parameters::SetDefault<Parameters::EclNewtonSumTolerance<Scalar>>(1e-5); Parameters::SetDefault<Parameters::EclNewtonSumTolerance<Scalar>>(1e-5);
Parameters::SetDefault<Parameters::EnableTerminalOutput>(false);
} }
// inherit the constructors // inherit the constructors

View File

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

View File

@ -85,10 +85,6 @@ template <class TypeTag>
struct OutputExtraConvergenceInfo<TypeTag, Properties::TTag::FlowProblem> struct OutputExtraConvergenceInfo<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = "none"; }; { static constexpr auto* value = "none"; };
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr bool value = true; };
template <class TypeTag> template <class TypeTag>
struct SaveStep<TypeTag, Properties::TTag::FlowProblem> struct SaveStep<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = ""; }; { static constexpr auto* value = ""; };
@ -171,7 +167,7 @@ public:
// Only rank 0 does print to std::cout, and only if specifically requested. // Only rank 0 does print to std::cout, and only if specifically requested.
this->terminalOutput_ = false; this->terminalOutput_ = false;
if (this->grid().comm().rank() == 0) { if (this->grid().comm().rank() == 0) {
this->terminalOutput_ = Parameters::get<TypeTag, Parameters::EnableTerminalOutput>(); this->terminalOutput_ = Parameters::Get<Parameters::EnableTerminalOutput>();
this->startConvergenceOutputThread(Parameters::get<TypeTag, Parameters::OutputExtraConvergenceInfo>(), this->startConvergenceOutputThread(Parameters::get<TypeTag, Parameters::OutputExtraConvergenceInfo>(),
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))"); R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))");
@ -190,7 +186,7 @@ public:
SolverParameters::registerParameters(); SolverParameters::registerParameters();
TimeStepper::registerParameters(); TimeStepper::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput> Parameters::Register<Parameters::EnableTerminalOutput>
("Print high-level information about the simulation's progress to the terminal"); ("Print high-level information about the simulation's progress to the terminal");
Parameters::registerParam<TypeTag, Parameters::EnableAdaptiveTimeStepping> Parameters::registerParam<TypeTag, Parameters::EnableAdaptiveTimeStepping>
("Use adaptive time stepping between report steps"); ("Use adaptive time stepping between report steps");

View File

@ -80,8 +80,7 @@
namespace Opm::Parameters { namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag> struct EnableTerminalOutput { static constexpr bool value = true; };
struct EnableTerminalOutput { using type = Properties::UndefinedProperty; };
} // namespace Opm::Parameters } // namespace Opm::Parameters

View File

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

View File

@ -97,10 +97,6 @@ struct LinearSolverBackend<TTag::TestTypeTag, TTag::FlowIstlSolverParams> {
namespace Opm::Parameters { namespace Opm::Parameters {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = false; };
// set some parameters that are only required by the well model // set some parameters that are only required by the well model
template<class TypeTag> template<class TypeTag>
struct MatrixAddWellContributions<TypeTag, Properties::TTag::TestTypeTag> struct MatrixAddWellContributions<TypeTag, Properties::TTag::TestTypeTag>

View File

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

View File

@ -98,15 +98,6 @@ struct EnableVapwat<TypeTag, TTag::TestEquilVapwatTypeTag> {
} // namespace Opm::Properties } // 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> template <class TypeTag>
std::unique_ptr<Opm::GetPropType<TypeTag, Opm::Properties::Simulator>> std::unique_ptr<Opm::GetPropType<TypeTag, Opm::Properties::Simulator>>
initSimulator(const char *filename) initSimulator(const char *filename)
@ -242,8 +233,7 @@ struct EquilFixture {
Opm::ThreadManager<TypeTag>::registerParameters(); Opm::ThreadManager<TypeTag>::registerParameters();
BlackoilModelParameters<TypeTag>::registerParameters(); BlackoilModelParameters<TypeTag>::registerParameters();
AdaptiveTimeStepping<TypeTag>::registerParameters(); AdaptiveTimeStepping<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::Register<Parameters::EnableTerminalOutput>("Dummy added for the well model to compile.");
Parameters::EnableTerminalOutput>("Dummy added for the well model to compile.");
registerAllParameters_<TypeTag>(); registerAllParameters_<TypeTag>();
} }

View File

@ -89,7 +89,7 @@ initSimulator(const char *filename)
registerAllParameters_<TypeTag>(false); registerAllParameters_<TypeTag>(false);
registerEclTimeSteppingParameters<TypeTag>(); registerEclTimeSteppingParameters<TypeTag>();
BlackoilModelParameters<TypeTag>::registerParameters(); BlackoilModelParameters<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>("Do *NOT* use!"); Parameters::Register<Parameters::EnableTerminalOutput>("Do *NOT* use!");
Opm::Parameters::SetDefault<Opm::Parameters::ThreadsPerProcess>(2); Opm::Parameters::SetDefault<Opm::Parameters::ThreadsPerProcess>(2);
Parameters::endRegistration(); Parameters::endRegistration();
setupParameters_<TypeTag>(/*argc=*/sizeof(argv) / sizeof(argv[0]), setupParameters_<TypeTag>(/*argc=*/sizeof(argv) / sizeof(argv[0]),