making OutputModule template parameter of EclWriter

This commit is contained in:
Kai Bao 2024-10-21 16:14:03 +02:00
parent 197282ccfc
commit 3635132d95
3 changed files with 22 additions and 12 deletions

View File

@ -30,23 +30,30 @@
#include <dune/grid/common/partitionset.hh> #include <dune/grid/common/partitionset.hh>
#include <opm/common/TimingMacros.hpp> // OPM_TIMEBLOCK
#include <opm/common/OpmLog/OpmLog.hpp> #include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/Schedule/RPTConfig.hpp> #include <opm/input/eclipse/Schedule/RPTConfig.hpp>
#include <opm/input/eclipse/Units/UnitSystem.hpp> #include <opm/input/eclipse/Units/UnitSystem.hpp>
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/output/eclipse/Inplace.hpp>
#include <opm/output/eclipse/RestartValue.hpp> #include <opm/output/eclipse/RestartValue.hpp>
#include <opm/models/blackoil/blackoilproperties.hh> // Properties::EnableMech, EnableTemperature, EnableSolvent
#include <opm/models/common/multiphasebaseproperties.hh> // Properties::FluidSystem
#include <opm/simulators/flow/CollectDataOnIORank.hpp> #include <opm/simulators/flow/CollectDataOnIORank.hpp>
#include <opm/simulators/flow/countGlobalCells.hpp> #include <opm/simulators/flow/countGlobalCells.hpp>
#include <opm/simulators/flow/EclGenericWriter.hpp> #include <opm/simulators/flow/EclGenericWriter.hpp>
#include <opm/simulators/flow/FlowBaseVanguard.hpp> #include <opm/simulators/flow/FlowBaseVanguard.hpp>
#include <opm/simulators/flow/OutputCompositionalModule.hpp>
#include <opm/simulators/timestepping/SimulatorTimer.hpp> #include <opm/simulators/timestepping/SimulatorTimer.hpp>
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp> #include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/utils/ParallelRestart.hpp> #include <opm/simulators/utils/ParallelRestart.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp> #include <opm/simulators/utils/ParallelSerialization.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <limits> #include <limits>
#include <map> #include <map>
#include <memory> #include <memory>
@ -101,7 +108,7 @@ namespace Opm {
* - This class requires to use the black oil model with the element * - This class requires to use the black oil model with the element
* centered finite volume discretization. * centered finite volume discretization.
*/ */
template <class TypeTag> template <class TypeTag, class OutputModule>
class EclWriter : public EclGenericWriter<GetPropType<TypeTag, Properties::Grid>, class EclWriter : public EclGenericWriter<GetPropType<TypeTag, Properties::Grid>,
GetPropType<TypeTag, Properties::EquilGrid>, GetPropType<TypeTag, Properties::EquilGrid>,
GetPropType<TypeTag, Properties::GridView>, GetPropType<TypeTag, Properties::GridView>,
@ -120,7 +127,7 @@ class EclWriter : public EclGenericWriter<GetPropType<TypeTag, Properties::Grid>
using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>; using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>;
using ElementIterator = typename GridView::template Codim<0>::Iterator; using ElementIterator = typename GridView::template Codim<0>::Iterator;
using BaseType = EclGenericWriter<Grid,EquilGrid,GridView,ElementMapper,Scalar>; using BaseType = EclGenericWriter<Grid,EquilGrid,GridView,ElementMapper,Scalar>;
typedef Dune::MultipleCodimMultipleGeomTypeMapper< GridView > VertexMapper; typedef Dune::MultipleCodimMultipleGeomTypeMapper< GridView > VertexMapper;
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() }; enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
@ -132,7 +139,7 @@ public:
static void registerParameters() static void registerParameters()
{ {
OutputCompositionalModule<TypeTag>::registerParameters(); OutputModule::registerParameters();
Parameters::Register<Parameters::EnableAsyncEclOutput> Parameters::Register<Parameters::EnableAsyncEclOutput>
("Write the ECL-formated results in a non-blocking way " ("Write the ECL-formated results in a non-blocking way "
@ -169,13 +176,13 @@ public:
eclBroadcast(this->simulator_.vanguard().grid().comm(), smryCfg); eclBroadcast(this->simulator_.vanguard().grid().comm(), smryCfg);
this->outputModule_ = std::make_unique<OutputCompositionalModule<TypeTag>> this->outputModule_ = std::make_unique<OutputModule>
(simulator, smryCfg, this->collectOnIORank_); (simulator, smryCfg, this->collectOnIORank_);
} }
else else
#endif #endif
{ {
this->outputModule_ = std::make_unique<OutputCompositionalModule<TypeTag>> this->outputModule_ = std::make_unique<OutputModule>
(simulator, this->eclIO_->finalSummaryConfig(), this->collectOnIORank_); (simulator, this->eclIO_->finalSummaryConfig(), this->collectOnIORank_);
} }
@ -660,10 +667,10 @@ public:
} }
} }
const OutputCompositionalModule<TypeTag>& outputModule() const const OutputModule& outputModule() const
{ return *outputModule_; } { return *outputModule_; }
OutputCompositionalModule<TypeTag>& mutableOutputModule() const OutputModule& mutableOutputModule() const
{ return *outputModule_; } { return *outputModule_; }
Scalar restartTimeStepSize() const Scalar restartTimeStepSize() const
@ -825,8 +832,8 @@ private:
} }
Simulator& simulator_; Simulator& simulator_;
// TODO: OutputCompositionalModule needs to be part of the TypeTag // TODO: OutputModule needs to be part of the TypeTag
std::unique_ptr<OutputCompositionalModule<TypeTag> > outputModule_; std::unique_ptr<OutputModule> outputModule_;
Scalar restartTimeStepSize_; Scalar restartTimeStepSize_;
int rank_ ; int rank_ ;
Inplace inplace_; Inplace inplace_;

View File

@ -50,6 +50,7 @@
#include <opm/simulators/flow/FlowProblemBlackoilProperties.hpp> #include <opm/simulators/flow/FlowProblemBlackoilProperties.hpp>
#include <opm/simulators/flow/FlowThresholdPressure.hpp> #include <opm/simulators/flow/FlowThresholdPressure.hpp>
#include <opm/simulators/flow/MixingRateControls.hpp> #include <opm/simulators/flow/MixingRateControls.hpp>
#include <opm/simulators/flow/OutputBlackoilModule.hpp>
#include <opm/simulators/flow/VtkTracerModule.hpp> #include <opm/simulators/flow/VtkTracerModule.hpp>
#include <opm/simulators/utils/satfunc/SatfuncConsistencyCheckManager.hpp> #include <opm/simulators/utils/satfunc/SatfuncConsistencyCheckManager.hpp>
@ -141,7 +142,7 @@ class FlowProblemBlackoil : public FlowProblem<TypeTag>
using ModuleParams = typename BlackOilLocalResidualTPFA<TypeTag>::ModuleParams; using ModuleParams = typename BlackOilLocalResidualTPFA<TypeTag>::ModuleParams;
using InitialFluidState = typename EquilInitializer<TypeTag>::ScalarFluidState; using InitialFluidState = typename EquilInitializer<TypeTag>::ScalarFluidState;
using EclWriterType = EclWriter<TypeTag>; using EclWriterType = EclWriter<TypeTag, OutputBlackOilModule<TypeTag> >;
#if HAVE_DAMARIS #if HAVE_DAMARIS
using DamarisWriterType = DamarisWriter<TypeTag>; using DamarisWriterType = DamarisWriter<TypeTag>;
#endif #endif

View File

@ -32,6 +32,8 @@
#include <opm/simulators/flow/FlowProblem.hpp> #include <opm/simulators/flow/FlowProblem.hpp>
#include <opm/simulators/flow/OutputCompositionalModule.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp> #include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/thermal/EclThermalLawManager.hpp> #include <opm/material/thermal/EclThermalLawManager.hpp>
@ -82,7 +84,7 @@ class FlowProblemComp : public FlowProblem<TypeTag>
using typename FlowProblemType::RateVector; using typename FlowProblemType::RateVector;
using InitialFluidState = CompositionalFluidState<Scalar, FluidSystem>; using InitialFluidState = CompositionalFluidState<Scalar, FluidSystem>;
using EclWriterType = EclWriter<TypeTag>; using EclWriterType = EclWriter<TypeTag, OutputCompositionalModule<TypeTag> >;
public: public:
using FlowProblemType::porosity; using FlowProblemType::porosity;