From 512263110c75ae1cca99548c05d7c36edec552bf Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 14 Jan 2025 08:02:30 +0100 Subject: [PATCH] OutputBlackoilModule: move some more code to GenericOutputBlackoilModule typetag less parameter system now allows us to initialize these variables in class that holds them. --- .../flow/GenericOutputBlackoilModule.cpp | 31 +++++++++++++++---- .../flow/GenericOutputBlackoilModule.hpp | 26 ++++++++++++---- opm/simulators/flow/OutputBlackoilModule.hpp | 29 +---------------- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/opm/simulators/flow/GenericOutputBlackoilModule.cpp b/opm/simulators/flow/GenericOutputBlackoilModule.cpp index 7647f8893..a3179668a 100644 --- a/opm/simulators/flow/GenericOutputBlackoilModule.cpp +++ b/opm/simulators/flow/GenericOutputBlackoilModule.cpp @@ -25,15 +25,13 @@ #include +#include + #include #include #include -#include - -#include - #include #include #include @@ -46,6 +44,10 @@ #include +#include + +#include + #include #include @@ -270,12 +272,29 @@ GenericOutputBlackoilModule(const EclipseState& eclState, break; } } + + forceDisableFipOutput_ = + Parameters::Get(); + forceDisableFipresvOutput_ = + Parameters::Get(); } template GenericOutputBlackoilModule:: ~GenericOutputBlackoilModule() = default; +template +void GenericOutputBlackoilModule:: +registerParameters() +{ + Parameters::Register + ("Do not print fluid-in-place values after each report step " + "even if requested by the deck."); + Parameters::Register + ("Do not print reservoir volumes values after each report step " + "even if requested by the deck."); +} + template void GenericOutputBlackoilModule:: outputTimeStamp(const std::string& lbl, @@ -361,9 +380,9 @@ outputFipAndResvLog(const Inplace& inplace, const bool substep, const Parallel::Communication& comm) { - if (comm.rank() != 0) + if (comm.rank() != 0) { return; - + } // For report step 0 we use the RPTSOL config, else derive from RPTSCHED std::unique_ptr fipSched; diff --git a/opm/simulators/flow/GenericOutputBlackoilModule.hpp b/opm/simulators/flow/GenericOutputBlackoilModule.hpp index 79fe86cd4..95d2cd87a 100644 --- a/opm/simulators/flow/GenericOutputBlackoilModule.hpp +++ b/opm/simulators/flow/GenericOutputBlackoilModule.hpp @@ -48,6 +48,13 @@ #include #include +namespace Opm::Parameters { + +struct ForceDisableFluidInPlaceOutput { static constexpr bool value = false; }; +struct ForceDisableResvFluidInPlaceOutput { static constexpr bool value = false; }; + +} // namespace Opm::Parameters + namespace Opm { namespace data { class Solution; } @@ -65,13 +72,20 @@ public: // Virtual destructor for safer inheritance. virtual ~GenericOutputBlackoilModule(); - Scalar* getPRESSURE_ptr(void) { - return (this->fluidPressure_.data()) ; - }; + Scalar* getPRESSURE_ptr() + { + return this->fluidPressure_.data(); + } - int getPRESSURE_size( void ) { - return (this->fluidPressure_.size()) ; - }; + int getPRESSURE_size() + { + return this->fluidPressure_.size(); + } + + /*! + * \brief Register all run-time parameters for the Vtk output module. + */ + static void registerParameters(); void outputTimeStamp(const std::string& lbl, double elapsed, diff --git a/opm/simulators/flow/OutputBlackoilModule.hpp b/opm/simulators/flow/OutputBlackoilModule.hpp index 9104e7deb..176d5181a 100644 --- a/opm/simulators/flow/OutputBlackoilModule.hpp +++ b/opm/simulators/flow/OutputBlackoilModule.hpp @@ -65,15 +65,7 @@ #include #include -namespace Opm::Parameters { - -struct ForceDisableFluidInPlaceOutput { static constexpr bool value = false; }; -struct ForceDisableResvFluidInPlaceOutput { static constexpr bool value = false; }; - -} // namespace Opm::Parameters - -namespace Opm -{ +namespace Opm { // forward declaration template @@ -146,12 +138,6 @@ public: this->setupBlockData(isCartIdxOnThisRank); - this->forceDisableFipOutput_ = - Parameters::Get(); - - this->forceDisableFipresvOutput_ = - Parameters::Get(); - if (! Parameters::Get()) { const std::string msg = "The output code does not support --owner-cells-first=false."; if (collectToIORank.isIORank()) { @@ -176,19 +162,6 @@ public: } } - /*! - * \brief Register all run-time parameters for the Vtk output module. - */ - static void registerParameters() - { - Parameters::Register - ("Do not print fluid-in-place values after each report step " - "even if requested by the deck."); - Parameters::Register - ("Do not print reservoir volumes values after each report step " - "even if requested by the deck."); - } - /*! * \brief Allocate memory for the scalar fields we would like to * write to ECL output files