move ebos/eclgenericvanguard.[hh|cc] to opm/simulators/flow

This commit is contained in:
Arne Morten Kvarving 2024-02-02 10:46:44 +01:00
parent 6949abbf0d
commit 1362143e48
16 changed files with 156 additions and 158 deletions

View File

@ -24,7 +24,6 @@
# find opm -name '*.c*' -printf '\t%p\n' | sort # find opm -name '*.c*' -printf '\t%p\n' | sort
list (APPEND MAIN_SOURCE_FILES list (APPEND MAIN_SOURCE_FILES
ebos/eclgenericproblem.cc ebos/eclgenericproblem.cc
ebos/eclgenericvanguard.cc
ebos/ecltransmissibility.cc ebos/ecltransmissibility.cc
opm/core/props/BlackoilPhases.cpp opm/core/props/BlackoilPhases.cpp
opm/core/props/phaseUsageFromDeck.cpp opm/core/props/phaseUsageFromDeck.cpp
@ -36,6 +35,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/ConvergenceOutputConfiguration.cpp opm/simulators/flow/ConvergenceOutputConfiguration.cpp
opm/simulators/flow/EclGenericWriter.cpp opm/simulators/flow/EclGenericWriter.cpp
opm/simulators/flow/ExtraConvergenceOutputThread.cpp opm/simulators/flow/ExtraConvergenceOutputThread.cpp
opm/simulators/flow/FlowGenericVanguard.cpp
opm/simulators/flow/FlowUtils.cpp opm/simulators/flow/FlowUtils.cpp
opm/simulators/flow/GenericCpGridVanguard.cpp opm/simulators/flow/GenericCpGridVanguard.cpp
opm/simulators/flow/GenericOutputBlackoilModule.cpp opm/simulators/flow/GenericOutputBlackoilModule.cpp
@ -409,10 +409,8 @@ list (APPEND TEST_DATA_FILES
# originally generated with the command: # originally generated with the command:
# find opm -name '*.h*' -a ! -name '*-pch.hpp' -printf '\t%p\n' | sort # find opm -name '*.h*' -a ! -name '*-pch.hpp' -printf '\t%p\n' | sort
list (APPEND PUBLIC_HEADER_FILES list (APPEND PUBLIC_HEADER_FILES
ebos/ebos.hh
ebos/eclgenericproblem.hh ebos/eclgenericproblem.hh
ebos/eclgenericproblem_impl.hh ebos/eclgenericproblem_impl.hh
ebos/eclgenericvanguard.hh
ebos/eclnewtonmethod.hh ebos/eclnewtonmethod.hh
ebos/eclproblem.hh ebos/eclproblem.hh
ebos/eclproblem_properties.hh ebos/eclproblem_properties.hh
@ -440,6 +438,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/FemCpGridCompat.hpp opm/simulators/flow/FemCpGridCompat.hpp
opm/simulators/flow/FIBlackoilModel.hpp opm/simulators/flow/FIBlackoilModel.hpp
opm/simulators/flow/FlowBaseVanguard.hpp opm/simulators/flow/FlowBaseVanguard.hpp
opm/simulators/flow/FlowGenericVanguard.hpp
opm/simulators/flow/FlowMain.hpp opm/simulators/flow/FlowMain.hpp
opm/simulators/flow/FlowUtils.hpp opm/simulators/flow/FlowUtils.hpp
opm/simulators/flow/FlowsData.hpp opm/simulators/flow/FlowsData.hpp

View File

@ -117,7 +117,7 @@ public:
AluGridVanguard(Simulator& simulator) AluGridVanguard(Simulator& simulator)
: FlowBaseVanguard<TypeTag>(simulator) : FlowBaseVanguard<TypeTag>(simulator)
{ {
this->mpiRank = EclGenericVanguard::comm().rank(); this->mpiRank = FlowGenericVanguard::comm().rank();
this->callImplementationInit(); this->callImplementationInit();
} }
@ -305,7 +305,7 @@ protected:
} }
#if HAVE_MPI #if HAVE_MPI
this->equilGrid_ = std::make_unique<Dune::CpGrid>(EclGenericVanguard::comm()); this->equilGrid_ = std::make_unique<Dune::CpGrid>(FlowGenericVanguard::comm());
#else #else
this->equilGrid_ = std::make_unique<Dune::CpGrid>(); this->equilGrid_ = std::make_unique<Dune::CpGrid>();
#endif #endif

View File

@ -27,11 +27,10 @@
#ifndef OPM_FLOW_BASE_VANGUARD_HPP #ifndef OPM_FLOW_BASE_VANGUARD_HPP
#define OPM_FLOW_BASE_VANGUARD_HPP #define OPM_FLOW_BASE_VANGUARD_HPP
#include <ebos/eclgenericvanguard.hh>
#include <opm/grid/common/GridEnums.hpp> #include <opm/grid/common/GridEnums.hpp>
#include <opm/grid/common/CartesianIndexMapper.hpp> #include <opm/grid/common/CartesianIndexMapper.hpp>
#include <opm/grid/LookUpCellCentroid.hh> #include <opm/grid/LookUpCellCentroid.hh>
#include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquiferCell.hpp> #include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquiferCell.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp> #include <opm/input/eclipse/EclipseState/EclipseState.hpp>
@ -41,6 +40,7 @@
#include <opm/models/utils/propertysystem.hh> #include <opm/models/utils/propertysystem.hh>
#include <opm/simulators/flow/BlackoilModelParameters.hpp> #include <opm/simulators/flow/BlackoilModelParameters.hpp>
#include <opm/simulators/flow/FlowGenericVanguard.hpp>
#include <array> #include <array>
#include <cstddef> #include <cstddef>
@ -212,7 +212,7 @@ namespace Opm {
*/ */
template <class TypeTag> template <class TypeTag>
class FlowBaseVanguard : public BaseVanguard<TypeTag>, class FlowBaseVanguard : public BaseVanguard<TypeTag>,
public EclGenericVanguard public FlowGenericVanguard
{ {
using ParentType = BaseVanguard<TypeTag>; using ParentType = BaseVanguard<TypeTag>;
using Implementation = GetPropType<TypeTag, Properties::Vanguard>; using Implementation = GetPropType<TypeTag, Properties::Vanguard>;
@ -324,7 +324,6 @@ public:
init(); init();
} }
const CartesianIndexMapper& cartesianMapper() const const CartesianIndexMapper& cartesianMapper() const
{ return asImp_().cartesianIndexMapper(); } { return asImp_().cartesianIndexMapper(); }

View File

@ -22,7 +22,7 @@
*/ */
#include <config.h> #include <config.h>
#include <ebos/eclgenericvanguard.hh> #include <opm/simulators/flow//FlowGenericVanguard.hpp>
#include <opm/common/utility/MemPacker.hpp> #include <opm/common/utility/MemPacker.hpp>
#include <opm/common/utility/Serializer.hpp> #include <opm/common/utility/Serializer.hpp>
@ -84,21 +84,21 @@
namespace Opm { namespace Opm {
std::unique_ptr<Parallel::Communication> EclGenericVanguard::comm_; std::unique_ptr<Parallel::Communication> FlowGenericVanguard::comm_;
EclGenericVanguard::SimulationModelParams EclGenericVanguard::modelParams_; FlowGenericVanguard::SimulationModelParams FlowGenericVanguard::modelParams_;
EclGenericVanguard::EclGenericVanguard() FlowGenericVanguard::FlowGenericVanguard()
: EclGenericVanguard(std::move(modelParams_)) : FlowGenericVanguard(std::move(modelParams_))
{} {}
EclGenericVanguard::EclGenericVanguard(SimulationModelParams&& params) FlowGenericVanguard::FlowGenericVanguard(SimulationModelParams&& params)
: python(std::make_shared<Python>()) : python(std::make_shared<Python>())
{ {
defineSimulationModel(std::move(params)); defineSimulationModel(std::move(params));
} }
EclGenericVanguard::SimulationModelParams FlowGenericVanguard::SimulationModelParams
EclGenericVanguard::serializationTestParams() FlowGenericVanguard::serializationTestParams()
{ {
SimulationModelParams result; SimulationModelParams result;
result.actionState_ = std::make_unique<Action::State>(Action::State::serializationTestObject()); result.actionState_ = std::make_unique<Action::State>(Action::State::serializationTestObject());
@ -109,9 +109,9 @@ EclGenericVanguard::serializationTestParams()
return result; return result;
} }
EclGenericVanguard::~EclGenericVanguard() = default; FlowGenericVanguard::~FlowGenericVanguard() = default;
void EclGenericVanguard::defineSimulationModel(SimulationModelParams&& params) void FlowGenericVanguard::defineSimulationModel(SimulationModelParams&& params)
{ {
actionState_ = std::move(params.actionState_); actionState_ = std::move(params.actionState_);
eclSchedule_ = std::move(params.eclSchedule_); eclSchedule_ = std::move(params.eclSchedule_);
@ -123,7 +123,7 @@ void EclGenericVanguard::defineSimulationModel(SimulationModelParams&& params)
summaryState_ = std::move(params.summaryState_); summaryState_ = std::move(params.summaryState_);
} }
void EclGenericVanguard::readDeck(const std::string& filename) void FlowGenericVanguard::readDeck(const std::string& filename)
{ {
Dune::Timer setupTimer; Dune::Timer setupTimer;
setupTimer.start(); setupTimer.start();
@ -140,7 +140,7 @@ void EclGenericVanguard::readDeck(const std::string& filename)
modelParams_.setupTime_ = setupTimer.stop(); modelParams_.setupTime_ = setupTimer.stop();
} }
std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName) std::string FlowGenericVanguard::canonicalDeckPath(const std::string& caseName)
{ {
const auto fileExists = [](const std::filesystem::path& f) -> bool const auto fileExists = [](const std::filesystem::path& f) -> bool
{ {
@ -165,7 +165,7 @@ std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName)
throw std::invalid_argument("Cannot find input case '"+caseName+"'"); throw std::invalid_argument("Cannot find input case '"+caseName+"'");
} }
void EclGenericVanguard::updateOutputDir_(std::string outputDir, void FlowGenericVanguard::updateOutputDir_(std::string outputDir,
bool enableEclCompatFile) bool enableEclCompatFile)
{ {
// update the location for output // update the location for output
@ -193,7 +193,7 @@ void EclGenericVanguard::updateOutputDir_(std::string outputDir,
ioConfig.setEclCompatibleRST(enableEclCompatFile); ioConfig.setEclCompatibleRST(enableEclCompatFile);
} }
void EclGenericVanguard::init() void FlowGenericVanguard::init()
{ {
// Make proper case name. // Make proper case name.
{ {
@ -228,7 +228,7 @@ void EclGenericVanguard::init()
// set communicator if not set as in opm flow // set communicator if not set as in opm flow
if(!comm_){ if(!comm_){
EclGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>()); FlowGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>());
} }
// set eclState if not already set as in opm flow // set eclState if not already set as in opm flow
@ -256,7 +256,7 @@ void EclGenericVanguard::init()
if (enableDistributedWells() ) if (enableDistributedWells() )
{ {
int hasMsWell = false; int hasMsWell = false;
const auto& comm = EclGenericVanguard::comm(); const auto& comm = FlowGenericVanguard::comm();
if (useMultisegmentWell_) if (useMultisegmentWell_)
{ {
@ -289,7 +289,7 @@ void EclGenericVanguard::init()
} }
} }
bool EclGenericVanguard::drsdtconEnabled() const bool FlowGenericVanguard::drsdtconEnabled() const
{ {
for (const auto& schIt : this->schedule()) { for (const auto& schIt : this->schedule()) {
const auto& oilVaporizationControl = schIt.oilvap(); const auto& oilVaporizationControl = schIt.oilvap();
@ -301,13 +301,14 @@ bool EclGenericVanguard::drsdtconEnabled() const
return false; return false;
} }
std::unordered_map<size_t, const NumericalAquiferCell*> EclGenericVanguard::allAquiferCells() const std::unordered_map<size_t, const NumericalAquiferCell*>
FlowGenericVanguard::allAquiferCells() const
{ {
return this->eclState_->aquifer().numericalAquifers().allAquiferCells(); return this->eclState_->aquifer().numericalAquifers().allAquiferCells();
} }
template<> template<>
void EclGenericVanguard:: void FlowGenericVanguard::
serializeOp<Serializer<Serialization::MemPacker>>(Serializer<Serialization::MemPacker>& serializer) serializeOp<Serializer<Serialization::MemPacker>>(Serializer<Serialization::MemPacker>& serializer)
{ {
serializer(*summaryState_); serializer(*summaryState_);
@ -316,7 +317,7 @@ serializeOp<Serializer<Serialization::MemPacker>>(Serializer<Serialization::MemP
serializer(*eclSchedule_); serializer(*eclSchedule_);
} }
bool EclGenericVanguard::operator==(const EclGenericVanguard& rhs) const bool FlowGenericVanguard::operator==(const FlowGenericVanguard& rhs) const
{ {
auto cmp_ptr = [](const auto& a, const auto& b) auto cmp_ptr = [](const auto& a, const auto& b)
{ {

View File

@ -22,10 +22,10 @@
*/ */
/*! /*!
* \file * \file
* \copydoc Opm::EclBaseVanguard * \copydoc Opm::FlowBaseVanguard
*/ */
#ifndef EWOMS_ECL_GENERIC_VANGUARD_HH #ifndef OPM_FLOW_GENERIC_VANGUARD_HPP
#define EWOMS_ECL_GENERIC_VANGUARD_HH #define OPM_FLOW_GENERIC_VANGUARD_HPP
#include <dune/common/parallel/communication.hh> #include <dune/common/parallel/communication.hh>
@ -35,14 +35,11 @@
#include <opm/simulators/utils/ParallelCommunication.hpp> #include <opm/simulators/utils/ParallelCommunication.hpp>
#include <array>
#include <cassert> #include <cassert>
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <stdexcept>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <unordered_set>
#include <utility> #include <utility>
#include <vector> #include <vector>
@ -60,7 +57,7 @@ class SummaryState;
class UDQState; class UDQState;
class WellTestState; class WellTestState;
class EclGenericVanguard { class FlowGenericVanguard {
public: public:
using ParallelWellStruct = std::vector<std::pair<std::string,bool>>; using ParallelWellStruct = std::vector<std::pair<std::string,bool>>;
@ -81,14 +78,14 @@ public:
* \brief Constructor. * \brief Constructor.
* \details Needs to be in compile unit. * \details Needs to be in compile unit.
*/ */
EclGenericVanguard(); FlowGenericVanguard();
explicit EclGenericVanguard(SimulationModelParams&& params); explicit FlowGenericVanguard(SimulationModelParams&& params);
/*! /*!
* \brief Destructor. * \brief Destructor.
* \details Empty, but needs to be in compile unit. * \details Empty, but needs to be in compile unit.
*/ */
~EclGenericVanguard(); ~FlowGenericVanguard();
static SimulationModelParams serializationTestParams(); static SimulationModelParams serializationTestParams();
@ -267,7 +264,7 @@ public:
void serializeOp(Serializer& serializer); void serializeOp(Serializer& serializer);
// Only compares dynamic state. // Only compares dynamic state.
bool operator==(const EclGenericVanguard& rhs) const; bool operator==(const FlowGenericVanguard& rhs) const;
protected: protected:
void updateOutputDir_(std::string outputDir, void updateOutputDir_(std::string outputDir,
@ -333,4 +330,4 @@ protected:
} // namespace Opm } // namespace Opm
#endif #endif // OPM_FLOW_GENERIC_VANGUARD_HPP

View File

@ -340,9 +340,10 @@ namespace Opm {
Dune::Timer setupTimerAfterReadingDeck; Dune::Timer setupTimerAfterReadingDeck;
setupTimerAfterReadingDeck.start(); setupTimerAfterReadingDeck.start();
int status = setupParameters_(this->argc_, this->argv_, EclGenericVanguard::comm()); int status = setupParameters_(this->argc_, this->argv_, FlowGenericVanguard::comm());
if (status) if (status) {
return status; return status;
}
setupParallelism(); setupParallelism();
setupModelSimulator(); setupModelSimulator();
@ -381,7 +382,7 @@ namespace Opm {
// determine the rank of the current process and the number of processes // determine the rank of the current process and the number of processes
// involved in the simulation. MPI must have already been initialized // involved in the simulation. MPI must have already been initialized
// here. (yes, the name of this method is misleading.) // here. (yes, the name of this method is misleading.)
auto comm = EclGenericVanguard::comm(); auto comm = FlowGenericVanguard::comm();
mpi_rank_ = comm.rank(); mpi_rank_ = comm.rank();
mpi_size_ = comm.size(); mpi_size_ = comm.size();
@ -422,7 +423,7 @@ namespace Opm {
void setupModelSimulator() void setupModelSimulator()
{ {
modelSimulator_ = std::make_unique<ModelSimulator>(EclGenericVanguard::comm(), /*verbose=*/false); modelSimulator_ = std::make_unique<ModelSimulator>(FlowGenericVanguard::comm(), /*verbose=*/false);
modelSimulator_->executionTimer().start(); modelSimulator_->executionTimer().start();
modelSimulator_->model().applyInitialSolution(); modelSimulator_->model().applyInitialSolution();

View File

@ -31,7 +31,7 @@
#include <opm/simulators/utils/ParallelFileMerger.hpp> #include <opm/simulators/utils/ParallelFileMerger.hpp>
#if HAVE_MPI #if HAVE_MPI
#include <ebos/eclgenericvanguard.hh> #include <opm/simulators/flow/FlowGenericVanguard.hpp>
#endif #endif
#include <fmt/format.h> #include <fmt/format.h>
@ -88,7 +88,7 @@ void handleExtraConvergenceOutput(SimulatorReport& report,
void checkAllMPIProcesses() void checkAllMPIProcesses()
{ {
#if HAVE_MPI #if HAVE_MPI
const auto& comm = EclGenericVanguard::comm(); const auto& comm = FlowGenericVanguard::comm();
if (comm.size() > 1) if (comm.size() > 1)
{ {
// we try to prevent the abort here. // we try to prevent the abort here.

View File

@ -127,7 +127,7 @@ GenericCpGridVanguard<ElementMapper,GridView,Scalar>::GenericCpGridVanguard()
this->mpiRank = 0; this->mpiRank = 0;
#if HAVE_MPI #if HAVE_MPI
this->mpiRank = EclGenericVanguard::comm().rank(); this->mpiRank = FlowGenericVanguard::comm().rank();
#endif // HAVE_MPI #endif // HAVE_MPI
} }
@ -149,7 +149,7 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
const GridView& gridView, const GridView& gridView,
const Schedule& schedule, const Schedule& schedule,
EclipseState& eclState1, EclipseState& eclState1,
EclGenericVanguard::ParallelWellStruct& parallelWells, FlowGenericVanguard::ParallelWellStruct& parallelWells,
const int numJacobiBlocks) const int numJacobiBlocks)
{ {
if (!this->zoltanParams().empty()) if (!this->zoltanParams().empty())
@ -285,7 +285,7 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const std::vector<double>& faceTrans, const std::vector<double>& faceTrans,
const std::vector<Well>& wells, const std::vector<Well>& wells,
EclipseState& eclState1, EclipseState& eclState1,
EclGenericVanguard::ParallelWellStruct& parallelWells) FlowGenericVanguard::ParallelWellStruct& parallelWells)
{ {
if (auto* eclState = dynamic_cast<ParallelEclipseState*>(&eclState1); if (auto* eclState = dynamic_cast<ParallelEclipseState*>(&eclState1);
eclState != nullptr) eclState != nullptr)
@ -321,7 +321,7 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const std::vector<double>& faceTrans, const std::vector<double>& faceTrans,
const std::vector<Well>& wells, const std::vector<Well>& wells,
ParallelEclipseState* eclState, ParallelEclipseState* eclState,
EclGenericVanguard::ParallelWellStruct& parallelWells) FlowGenericVanguard::ParallelWellStruct& parallelWells)
{ {
OPM_TIMEBLOCK(gridDistribute); OPM_TIMEBLOCK(gridDistribute);
const auto isIORank = this->grid_->comm().rank() == 0; const auto isIORank = this->grid_->comm().rank() == 0;
@ -372,7 +372,7 @@ void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Eclips
} }
OPM_TIMEBLOCK(createGrids); OPM_TIMEBLOCK(createGrids);
#if HAVE_MPI #if HAVE_MPI
this->grid_ = std::make_unique<Dune::CpGrid>(EclGenericVanguard::comm()); this->grid_ = std::make_unique<Dune::CpGrid>(FlowGenericVanguard::comm());
#else #else
this->grid_ = std::make_unique<Dune::CpGrid>(); this->grid_ = std::make_unique<Dune::CpGrid>();
#endif #endif
@ -481,7 +481,7 @@ doFilterConnections_(Schedule& schedule)
try { try {
// Broadcast another time to remove inactive peforations on // Broadcast another time to remove inactive peforations on
// slave processors. // slave processors.
eclBroadcast(EclGenericVanguard::comm(), schedule); eclBroadcast(FlowGenericVanguard::comm(), schedule);
} }
catch (const std::exception& broadcast_error) { catch (const std::exception& broadcast_error) {
OpmLog::error(fmt::format("Distributing properties to all processes failed\n" OpmLog::error(fmt::format("Distributing properties to all processes failed\n"

View File

@ -27,10 +27,10 @@
#ifndef OPM_GENERIC_CPGRID_VANGUARD_HPP #ifndef OPM_GENERIC_CPGRID_VANGUARD_HPP
#define OPM_GENERIC_CPGRID_VANGUARD_HPP #define OPM_GENERIC_CPGRID_VANGUARD_HPP
#include <ebos/eclgenericvanguard.hh>
#include <opm/grid/CpGrid.hpp> #include <opm/grid/CpGrid.hpp>
#include <opm/simulators/flow/FlowGenericVanguard.hpp>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <optional> #include <optional>
@ -155,7 +155,7 @@ protected:
const GridView& gridView, const GridView& gridView,
const Schedule& schedule, const Schedule& schedule,
EclipseState& eclState, EclipseState& eclState,
EclGenericVanguard::ParallelWellStruct& parallelWells, FlowGenericVanguard::ParallelWellStruct& parallelWells,
const int numJacobiBlocks); const int numJacobiBlocks);
void distributeFieldProps_(EclipseState& eclState); void distributeFieldProps_(EclipseState& eclState);
@ -172,7 +172,7 @@ private:
const std::vector<double>& faceTrans, const std::vector<double>& faceTrans,
const std::vector<Well>& wells, const std::vector<Well>& wells,
EclipseState& eclState, EclipseState& eclState,
EclGenericVanguard::ParallelWellStruct& parallelWells); FlowGenericVanguard::ParallelWellStruct& parallelWells);
void distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod, void distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst, const bool ownersFirst,
@ -183,7 +183,7 @@ private:
const std::vector<double>& faceTrans, const std::vector<double>& faceTrans,
const std::vector<Well>& wells, const std::vector<Well>& wells,
ParallelEclipseState* eclState, ParallelEclipseState* eclState,
EclGenericVanguard::ParallelWellStruct& parallelWells); FlowGenericVanguard::ParallelWellStruct& parallelWells);
protected: protected:
virtual const std::string& zoltanParams() const = 0; virtual const std::string& zoltanParams() const = 0;

View File

@ -77,7 +77,7 @@ Main::~Main()
int world_size; int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size); MPI_Comm_size(MPI_COMM_WORLD, &world_size);
if (world_size > 1) { if (world_size > 1) {
MPI_Comm new_comm = EclGenericVanguard::comm(); MPI_Comm new_comm = FlowGenericVanguard::comm();
int result; int result;
MPI_Comm_compare(MPI_COMM_WORLD, new_comm, &result); MPI_Comm_compare(MPI_COMM_WORLD, new_comm, &result);
assert(result == MPI_UNEQUAL); assert(result == MPI_UNEQUAL);
@ -87,7 +87,7 @@ Main::~Main()
#endif // HAVE_MPI #endif // HAVE_MPI
if (ownMPI_) { if (ownMPI_) {
EclGenericVanguard::setCommunication(nullptr); FlowGenericVanguard::setCommunication(nullptr);
} }
#if HAVE_DAMARIS #if HAVE_DAMARIS
@ -136,22 +136,22 @@ void Main::initMPI()
#elif HAVE_MPI #elif HAVE_MPI
MPI_Init(&argc_, &argv_); MPI_Init(&argc_, &argv_);
#endif #endif
EclGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>()); FlowGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>());
handleTestSplitCommunicatorCmdLine_(); handleTestSplitCommunicatorCmdLine_();
#if HAVE_MPI #if HAVE_MPI
if (test_split_comm_ && EclGenericVanguard::comm().size() > 1) { if (test_split_comm_ && FlowGenericVanguard::comm().size() > 1) {
int world_rank = EclGenericVanguard::comm().rank(); int world_rank = FlowGenericVanguard::comm().rank();
int color = (world_rank == 0); int color = (world_rank == 0);
MPI_Comm new_comm; MPI_Comm new_comm;
MPI_Comm_split(EclGenericVanguard::comm(), color, world_rank, &new_comm); MPI_Comm_split(FlowGenericVanguard::comm(), color, world_rank, &new_comm);
isSimulationRank_ = (world_rank > 0); isSimulationRank_ = (world_rank > 0);
EclGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>(new_comm)); FlowGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>(new_comm));
} }
#if HAVE_CUDA #if HAVE_CUDA
Opm::cuistl::setDevice(EclGenericVanguard::comm().rank(), EclGenericVanguard::comm().size()); Opm::cuistl::setDevice(FlowGenericVanguard::comm().rank(), FlowGenericVanguard::comm().size());
#endif #endif
#endif // HAVE_MPI #endif // HAVE_MPI
@ -201,7 +201,7 @@ void Main::readDeck(const std::string& deckFilename,
outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog); outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog);
if (outputCout_) { if (outputCout_) {
printPRTHeader(EclGenericVanguard::comm().size(), numThreads, printPRTHeader(FlowGenericVanguard::comm().size(), numThreads,
parameters, moduleVersion, compileTimestamp); parameters, moduleVersion, compileTimestamp);
OpmLog::info("Reading deck file '" + deckFilename + "'"); OpmLog::info("Reading deck file '" + deckFilename + "'");
} }
@ -210,7 +210,7 @@ void Main::readDeck(const std::string& deckFilename,
if (output_param >= 0) if (output_param >= 0)
outputInterval = output_param; outputInterval = output_param;
Opm::readDeck(EclGenericVanguard::comm(), Opm::readDeck(FlowGenericVanguard::comm(),
deckFilename, deckFilename,
eclipseState_, eclipseState_,
schedule_, schedule_,
@ -224,20 +224,20 @@ void Main::readDeck(const std::string& deckFilename,
outputCout_, outputCout_,
outputInterval); outputInterval);
verifyValidCellGeometry(EclGenericVanguard::comm(), *this->eclipseState_); verifyValidCellGeometry(FlowGenericVanguard::comm(), *this->eclipseState_);
outputFiles_ = (omode != FileOutputMode::OUTPUT_NONE); outputFiles_ = (omode != FileOutputMode::OUTPUT_NONE);
} }
void Main::setupVanguard() void Main::setupVanguard()
{ {
EclGenericVanguard::modelParams_.setupTime_ = this->setupTime_; FlowGenericVanguard::modelParams_.setupTime_ = this->setupTime_;
EclGenericVanguard::modelParams_.actionState_ = std::move(this->actionState_); FlowGenericVanguard::modelParams_.actionState_ = std::move(this->actionState_);
EclGenericVanguard::modelParams_.eclSchedule_ = this->schedule_; FlowGenericVanguard::modelParams_.eclSchedule_ = this->schedule_;
EclGenericVanguard::modelParams_.eclState_ = this->eclipseState_; FlowGenericVanguard::modelParams_.eclState_ = this->eclipseState_;
EclGenericVanguard::modelParams_.eclSummaryConfig_ = this->summaryConfig_; FlowGenericVanguard::modelParams_.eclSummaryConfig_ = this->summaryConfig_;
EclGenericVanguard::modelParams_.udqState_ = std::move(udqState_); FlowGenericVanguard::modelParams_.udqState_ = std::move(udqState_);
EclGenericVanguard::modelParams_.wtestState_ = std::move(wtestState_); FlowGenericVanguard::modelParams_.wtestState_ = std::move(wtestState_);
} }
#if HAVE_DAMARIS #if HAVE_DAMARIS
@ -251,7 +251,7 @@ void Main::setupDamaris(const std::string& outputDir )
//const auto find_replace_map; //const auto find_replace_map;
//const auto find_replace_map = Opm::DamarisOutput::DamarisKeywords<PreTypeTag>(EclGenericVanguard::comm(), outputDir); //const auto find_replace_map = Opm::DamarisOutput::DamarisKeywords<PreTypeTag>(EclGenericVanguard::comm(), outputDir);
std::map<std::string, std::string> find_replace_map; std::map<std::string, std::string> find_replace_map;
find_replace_map = Opm::DamarisOutput::getDamarisKeywords<PreTypeTag>(EclGenericVanguard::comm(), outputDir); find_replace_map = Opm::DamarisOutput::getDamarisKeywords<PreTypeTag>(FlowGenericVanguard::comm(), outputDir);
// By default EnableDamarisOutputCollective is true so all simulation results will // By default EnableDamarisOutputCollective is true so all simulation results will
// be written into one single file for each iteration using Parallel HDF5. // be written into one single file for each iteration using Parallel HDF5.
@ -259,8 +259,8 @@ void Main::setupDamaris(const std::string& outputDir )
// node are aggregated by dedicated Damaris cores and stored to separate files per Damaris core. // node are aggregated by dedicated Damaris cores and stored to separate files per Damaris core.
// Irrespective of mode, output is written asynchronously at the end of each timestep. // Irrespective of mode, output is written asynchronously at the end of each timestep.
// Using the ModifyModel class to set the XML file for Damaris. // Using the ModifyModel class to set the XML file for Damaris.
DamarisOutput::initializeDamaris(EclGenericVanguard::comm(), DamarisOutput::initializeDamaris(FlowGenericVanguard::comm(),
EclGenericVanguard::comm().rank(), FlowGenericVanguard::comm().rank(),
find_replace_map); find_replace_map);
int is_client; int is_client;
MPI_Comm new_comm; MPI_Comm new_comm;
@ -270,7 +270,7 @@ void Main::setupDamaris(const std::string& outputDir )
isSimulationRank_ = (is_client > 0); isSimulationRank_ = (is_client > 0);
if (isSimulationRank_ && err == DAMARIS_OK) { if (isSimulationRank_ && err == DAMARIS_OK) {
damaris_client_comm_get(&new_comm); damaris_client_comm_get(&new_comm);
EclGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>(new_comm)); FlowGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>(new_comm));
} }
if (err != DAMARIS_OK) { if (err != DAMARIS_OK) {

View File

@ -313,7 +313,7 @@ private:
using PreProblem = GetPropType<PreTypeTag, Properties::Problem>; using PreProblem = GetPropType<PreTypeTag, Properties::Problem>;
PreProblem::setBriefDescription("Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project."); PreProblem::setBriefDescription("Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project.");
int status = FlowMain<PreTypeTag>::setupParameters_(argc_, argv_, EclGenericVanguard::comm()); int status = FlowMain<PreTypeTag>::setupParameters_(argc_, argv_, FlowGenericVanguard::comm());
if (status != 0) { if (status != 0) {
// if setupParameters_ returns a value smaller than 0, there was no error, but // if setupParameters_ returns a value smaller than 0, there was no error, but
// the program should abort. This is the case e.g. for the --help and the // the program should abort. This is the case e.g. for the --help and the
@ -341,7 +341,7 @@ private:
enableDamarisOutput_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableDamarisOutput); enableDamarisOutput_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableDamarisOutput);
// Reset to false as we cannot use Damaris if there is only one rank. // Reset to false as we cannot use Damaris if there is only one rank.
if ((enableDamarisOutput_ == true) && (EclGenericVanguard::comm().size() == 1)) { if ((enableDamarisOutput_ == true) && (FlowGenericVanguard::comm().size() == 1)) {
std::string msg ; std::string msg ;
msg = "\nUse of Damaris (command line argument --enable-damaris-output=true) has been disabled for run with only one rank.\n" ; msg = "\nUse of Damaris (command line argument --enable-damaris-output=true) has been disabled for run with only one rank.\n" ;
OpmLog::warning(msg); OpmLog::warning(msg);
@ -371,7 +371,7 @@ private:
return true; return true;
} }
int mpiRank = EclGenericVanguard::comm().rank(); int mpiRank = FlowGenericVanguard::comm().rank();
outputCout_ = false; outputCout_ = false;
if (mpiRank == 0) if (mpiRank == 0)
outputCout_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableTerminalOutput); outputCout_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableTerminalOutput);
@ -401,7 +401,7 @@ private:
std::string cmdline_params; std::string cmdline_params;
if (outputCout_) { if (outputCout_) {
printFlowBanner(EclGenericVanguard::comm().size(), printFlowBanner(FlowGenericVanguard::comm().size(),
getNumThreads<PreTypeTag>(), getNumThreads<PreTypeTag>(),
Opm::moduleVersionName()); Opm::moduleVersionName());
std::ostringstream str; std::ostringstream str;

View File

@ -187,7 +187,7 @@ public:
SimulatorFullyImplicitBlackoil(Simulator& simulator) SimulatorFullyImplicitBlackoil(Simulator& simulator)
: simulator_(simulator) : simulator_(simulator)
, serializer_(*this, , serializer_(*this,
EclGenericVanguard::comm(), FlowGenericVanguard::comm(),
simulator_.vanguard().eclState().getIOConfig(), simulator_.vanguard().eclState().getIOConfig(),
EWOMS_GET_PARAM(TypeTag, std::string, SaveStep), EWOMS_GET_PARAM(TypeTag, std::string, SaveStep),
EWOMS_GET_PARAM(TypeTag, int, LoadStep), EWOMS_GET_PARAM(TypeTag, int, LoadStep),

View File

@ -20,7 +20,6 @@
#include <config.h> #include <config.h>
#include <ebos/ebos.hh> #include <ebos/ebos.hh>
#include <ebos/eclgenericvanguard.hh>
#include <opm/common/utility/Serializer.hpp> #include <opm/common/utility/Serializer.hpp>
@ -32,11 +31,13 @@
#include <opm/output/eclipse/Inplace.hpp> #include <opm/output/eclipse/Inplace.hpp>
#include <opm/input/eclipse/EclipseState/WagHysteresisConfig.hpp> #include <opm/input/eclipse/EclipseState/WagHysteresisConfig.hpp>
#include <opm/material/fluidmatrixinteractions/EclHysteresisTwoPhaseLawParams.hpp> #include <opm/material/fluidmatrixinteractions/EclHysteresisTwoPhaseLawParams.hpp>
#include <opm/models/blackoil/blackoilprimaryvariables.hh> #include <opm/models/blackoil/blackoilprimaryvariables.hh>
#include <opm/simulators/flow/FemCpGridCompat.hpp> #include <opm/simulators/flow/FemCpGridCompat.hpp>
#include <opm/simulators/flow/FlowGenericVanguard.hpp>
#include <opm/simulators/timestepping/AdaptiveTimeStepping.hpp> #include <opm/simulators/timestepping/AdaptiveTimeStepping.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp> #include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/timestepping/SimulatorTimer.hpp> #include <opm/simulators/timestepping/SimulatorTimer.hpp>
@ -203,24 +204,24 @@ BOOST_AUTO_TEST_CASE(WGState)
BOOST_AUTO_TEST_CASE(EclGenericVanguard) BOOST_AUTO_TEST_CASE(EclGenericVanguard)
{ {
auto in_params = Opm::EclGenericVanguard::serializationTestParams(); auto in_params = Opm::FlowGenericVanguard::serializationTestParams();
Opm::EclGenericVanguard val1(std::move(in_params)); Opm::FlowGenericVanguard val1(std::move(in_params));
Opm::Serialization::MemPacker packer; Opm::Serialization::MemPacker packer;
Opm::Serializer ser(packer); Opm::Serializer ser(packer);
ser.pack(val1); ser.pack(val1);
const size_t pos1 = ser.position(); const size_t pos1 = ser.position();
Opm::EclGenericVanguard::SimulationModelParams out_params; Opm::FlowGenericVanguard::SimulationModelParams out_params;
out_params.setupTime_ = 0.0; out_params.setupTime_ = 0.0;
out_params.actionState_ = std::make_unique<Opm::Action::State>(); out_params.actionState_ = std::make_unique<Opm::Action::State>();
out_params.udqState_ = std::make_unique<Opm::UDQState>(); out_params.udqState_ = std::make_unique<Opm::UDQState>();
out_params.eclSchedule_ = std::make_shared<Opm::Schedule>(); out_params.eclSchedule_ = std::make_shared<Opm::Schedule>();
out_params.summaryState_ = std::make_unique<Opm::SummaryState>(); out_params.summaryState_ = std::make_unique<Opm::SummaryState>();
Opm::EclGenericVanguard val2(std::move(out_params)); Opm::FlowGenericVanguard val2(std::move(out_params));
ser.unpack(val2); ser.unpack(val2);
const size_t pos2 = ser.position(); const size_t pos2 = ser.position();
BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for EclGenericVanguard"); BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for FlowGenericVanguard");
BOOST_CHECK_MESSAGE(val1 == val2, "Deserialized EclGenericVanguard differ"); BOOST_CHECK_MESSAGE(val1 == val2, "Deserialized FlowGenericVanguard differ");
} }
BOOST_AUTO_TEST_CASE(EclGenericProblem) BOOST_AUTO_TEST_CASE(EclGenericProblem)
@ -448,7 +449,7 @@ struct AquiferFixture {
}; };
Opm::AdaptiveTimeStepping<TT>::registerParameters(); Opm::AdaptiveTimeStepping<TT>::registerParameters();
Opm::setupParameters_<TT>(2, argv, /*registerParams=*/true); Opm::setupParameters_<TT>(2, argv, /*registerParams=*/true);
Opm::EclGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>()); Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
} }
}; };
@ -460,7 +461,7 @@ BOOST_GLOBAL_FIXTURE(AquiferFixture);
BOOST_AUTO_TEST_CASE(TYPE) \ BOOST_AUTO_TEST_CASE(TYPE) \
{ \ { \
using TT = Opm::Properties::TTag::TestRestartTypeTag; \ using TT = Opm::Properties::TTag::TestRestartTypeTag; \
Opm::EclGenericVanguard::readDeck("GLIFT1.DATA"); \ Opm::FlowGenericVanguard::readDeck("GLIFT1.DATA"); \
using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>; \ using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>; \
Simulator sim; \ Simulator sim; \
auto data_out = Opm::TYPE<TT>::serializationTestObject(sim); \ auto data_out = Opm::TYPE<TT>::serializationTestObject(sim); \
@ -481,7 +482,7 @@ TEST_FOR_AQUIFER(AquiferFetkovich)
BOOST_AUTO_TEST_CASE(AquiferNumerical) BOOST_AUTO_TEST_CASE(AquiferNumerical)
{ {
using TT = Opm::Properties::TTag::TestRestartTypeTag; using TT = Opm::Properties::TTag::TestRestartTypeTag;
Opm::EclGenericVanguard::readDeck("GLIFT1.DATA"); Opm::FlowGenericVanguard::readDeck("GLIFT1.DATA");
using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>; using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>;
Simulator sim; Simulator sim;
auto data_out = Opm::AquiferNumerical<TT>::serializationTestObject(sim); auto data_out = Opm::AquiferNumerical<TT>::serializationTestObject(sim);
@ -499,7 +500,7 @@ BOOST_AUTO_TEST_CASE(AquiferNumerical)
BOOST_AUTO_TEST_CASE(AquiferConstantFlux) BOOST_AUTO_TEST_CASE(AquiferConstantFlux)
{ {
using TT = Opm::Properties::TTag::TestRestartTypeTag; using TT = Opm::Properties::TTag::TestRestartTypeTag;
Opm::EclGenericVanguard::readDeck("GLIFT1.DATA"); Opm::FlowGenericVanguard::readDeck("GLIFT1.DATA");
using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>; using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>;
Simulator sim; Simulator sim;
auto data_out = Opm::AquiferConstantFlux<TT>::serializationTestObject(sim); auto data_out = Opm::AquiferConstantFlux<TT>::serializationTestObject(sim);

View File

@ -25,7 +25,6 @@
#define BOOST_TEST_MODULE Equil #define BOOST_TEST_MODULE Equil
#include <ebos/eclproblem.hh> #include <ebos/eclproblem.hh>
#include <ebos/eclgenericvanguard.hh>
#include <opm/grid/UnstructuredGrid.h> #include <opm/grid/UnstructuredGrid.h>
#include <opm/grid/GridManager.hpp> #include <opm/grid/GridManager.hpp>
@ -39,6 +38,7 @@
#include <opm/models/utils/start.hh> #include <opm/models/utils/start.hh>
#include <opm/simulators/flow/BlackoilModelParameters.hpp> #include <opm/simulators/flow/BlackoilModelParameters.hpp>
#include <opm/simulators/flow/FlowGenericVanguard.hpp>
#include <opm/simulators/flow/equil/EquilibrationHelpers.hpp> #include <opm/simulators/flow/equil/EquilibrationHelpers.hpp>
#include <opm/simulators/linalg/parallelbicgstabbackend.hh> #include <opm/simulators/linalg/parallelbicgstabbackend.hh>
#include <opm/simulators/wells/BlackoilWellModel.hpp> #include <opm/simulators/wells/BlackoilWellModel.hpp>
@ -119,7 +119,7 @@ initSimulator(const char *filename)
Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/false); Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/false);
Opm::EclGenericVanguard::readDeck(filename); Opm::FlowGenericVanguard::readDeck(filename);
return std::make_unique<Simulator>(); return std::make_unique<Simulator>();
} }
@ -233,7 +233,7 @@ struct EquilFixture {
#else #else
Dune::MPIHelper::instance(argc, argv); Dune::MPIHelper::instance(argc, argv);
#endif #endif
Opm::EclGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>()); Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
Opm::BlackoilModelParameters<TypeTag>::registerParameters(); Opm::BlackoilModelParameters<TypeTag>::registerParameters();
Opm::AdaptiveTimeStepping<TypeTag>::registerParameters(); Opm::AdaptiveTimeStepping<TypeTag>::registerParameters();
Opm::Parameters::registerParam<TypeTag, bool>("EnableTerminalOutput", Opm::Parameters::registerParam<TypeTag, bool>("EnableTerminalOutput",

View File

@ -89,7 +89,7 @@ initSimulator(const char *filename)
Opm::registerEclTimeSteppingParameters<TypeTag>(); Opm::registerEclTimeSteppingParameters<TypeTag>();
Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/true); Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/true);
Opm::EclGenericVanguard::readDeck(filename); Opm::FlowGenericVanguard::readDeck(filename);
return std::make_unique<Simulator>(); return std::make_unique<Simulator>();
} }
@ -106,7 +106,7 @@ struct GliftFixture {
#else #else
Dune::MPIHelper::instance(argc, argv); Dune::MPIHelper::instance(argc, argv);
#endif #endif
Opm::EclGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>()); Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
using TypeTag = Opm::Properties::TTag::FlowProblem; using TypeTag = Opm::Properties::TTag::FlowProblem;
Opm::registerAllParameters_<TypeTag>(); Opm::registerAllParameters_<TypeTag>();
} }

View File

@ -192,7 +192,7 @@ int main(int argc, char** argv)
Dune::MPIHelper::instance(argcDummy, argvDummy); Dune::MPIHelper::instance(argcDummy, argvDummy);
#endif #endif
Opm::EclGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>()); Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
return boost::unit_test::unit_test_main(&init_unit_test_func, argc, argv); return boost::unit_test::unit_test_main(&init_unit_test_func, argc, argv);
} }