Broadcast UDQState and Action state after restart loading

This commit is contained in:
Joakim Hove 2021-09-24 14:42:15 +02:00
parent edb2c4abb2
commit 8943e90e17
3 changed files with 22 additions and 6 deletions

View File

@ -26,7 +26,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SICD.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/MSW/SICD.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp>
@ -40,12 +41,16 @@
namespace Opm { namespace Opm {
void eclStateBroadcast(EclipseState& eclState, Schedule& schedule, void eclStateBroadcast(EclipseState& eclState, Schedule& schedule,
SummaryConfig& summaryConfig) SummaryConfig& summaryConfig,
UDQState& udqState,
Action::State& actionState)
{ {
Opm::EclMpiSerializer ser(Dune::MPIHelper::getCollectiveCommunication()); Opm::EclMpiSerializer ser(Dune::MPIHelper::getCollectiveCommunication());
ser.broadcast(eclState); ser.broadcast(eclState);
ser.broadcast(schedule); ser.broadcast(schedule);
ser.broadcast(summaryConfig); ser.broadcast(summaryConfig);
ser.broadcast(udqState);
ser.broadcast(actionState);
} }
void eclScheduleBroadcast(Schedule& schedule) void eclScheduleBroadcast(Schedule& schedule)

View File

@ -24,6 +24,12 @@ namespace Opm {
class EclipseState; class EclipseState;
class Schedule; class Schedule;
class SummaryConfig; class SummaryConfig;
class UDQState;
namespace Action {
class State;
}
/*! \brief Broadcasts an eclipse state from root node in parallel runs. /*! \brief Broadcasts an eclipse state from root node in parallel runs.
*! \param eclState EclipseState to broadcast *! \param eclState EclipseState to broadcast
@ -31,7 +37,9 @@ class SummaryConfig;
*! \param summaryConfig SummaryConfig to broadcast *! \param summaryConfig SummaryConfig to broadcast
*/ */
void eclStateBroadcast(EclipseState& eclState, Schedule& schedule, void eclStateBroadcast(EclipseState& eclState, Schedule& schedule,
SummaryConfig& summaryConfig); SummaryConfig& summaryConfig,
UDQState& udqState,
Action::State& actionState);
/// \brief Broadcasts an schedule from root node in parallel runs. /// \brief Broadcasts an schedule from root node in parallel runs.
void eclScheduleBroadcast(Schedule& schedule); void eclScheduleBroadcast(Schedule& schedule);

View File

@ -280,8 +280,8 @@ void readDeck(int rank, std::string& deckFilename, std::shared_ptr<Opm::Deck>& d
} }
udqState = std::make_unique<UDQState>((*schedule)[0].udq().params().undefinedValue()); udqState = std::make_unique<UDQState>((*schedule)[0].udq().params().undefinedValue());
udqState->load_rst(rst_state);
actionState = std::make_unique<Action::State>(); actionState = std::make_unique<Action::State>();
udqState->load_rst(rst_state);
actionState->load_rst(schedule->operator[](report_step).actions(), rst_state); actionState->load_rst(schedule->operator[](report_step).actions(), rst_state);
} }
else { else {
@ -290,7 +290,6 @@ void readDeck(int rank, std::string& deckFilename, std::shared_ptr<Opm::Deck>& d
*parseContext, *errorGuard, *parseContext, *errorGuard,
python); python);
} }
udqState = std::make_unique<UDQState>((*schedule)[0].udq().params().undefinedValue()); udqState = std::make_unique<UDQState>((*schedule)[0].udq().params().undefinedValue());
actionState = std::make_unique<Action::State>(); actionState = std::make_unique<Action::State>();
} }
@ -326,6 +325,10 @@ void readDeck(int rank, std::string& deckFilename, std::shared_ptr<Opm::Deck>& d
schedule = std::make_unique<Opm::Schedule>(python); schedule = std::make_unique<Opm::Schedule>(python);
if (!eclipseState) if (!eclipseState)
eclipseState = std::make_unique<Opm::ParallelEclipseState>(); eclipseState = std::make_unique<Opm::ParallelEclipseState>();
if (!udqState)
udqState = std::make_unique<UDQState>(0);
if (!actionState)
actionState = std::make_unique<Action::State>();
} }
// In case of parse errors eclipseState/schedule might be null // In case of parse errors eclipseState/schedule might be null
@ -337,7 +340,7 @@ void readDeck(int rank, std::string& deckFilename, std::shared_ptr<Opm::Deck>& d
{ {
if (parseSuccess) if (parseSuccess)
{ {
Opm::eclStateBroadcast(*eclipseState, *schedule, *summaryConfig); Opm::eclStateBroadcast(*eclipseState, *schedule, *summaryConfig, *udqState, *actionState);
} }
} }
catch(const std::exception& broadcast_error) catch(const std::exception& broadcast_error)