mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3611 from joakim-hove/broadcast-wtest-state
Broadcast wtest state
This commit is contained in:
commit
89adc1919b
@ -46,7 +46,7 @@ void eclStateBroadcast(Parallel::Communication comm, EclipseState& eclState, Sch
|
|||||||
SummaryConfig& summaryConfig,
|
SummaryConfig& summaryConfig,
|
||||||
UDQState& udqState,
|
UDQState& udqState,
|
||||||
Action::State& actionState,
|
Action::State& actionState,
|
||||||
WellTestState& /* wtestState */)
|
WellTestState& wtestState)
|
||||||
{
|
{
|
||||||
Opm::EclMpiSerializer ser(comm);
|
Opm::EclMpiSerializer ser(comm);
|
||||||
ser.broadcast(eclState);
|
ser.broadcast(eclState);
|
||||||
@ -54,7 +54,7 @@ void eclStateBroadcast(Parallel::Communication comm, EclipseState& eclState, Sch
|
|||||||
ser.broadcast(summaryConfig);
|
ser.broadcast(summaryConfig);
|
||||||
ser.broadcast(udqState);
|
ser.broadcast(udqState);
|
||||||
ser.broadcast(actionState);
|
ser.broadcast(actionState);
|
||||||
//ser.broadcast(wtestState);
|
ser.broadcast(wtestState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void eclScheduleBroadcast(Parallel::Communication comm, Schedule& schedule)
|
void eclScheduleBroadcast(Parallel::Communication comm, Schedule& schedule)
|
||||||
|
@ -180,6 +180,7 @@ namespace {
|
|||||||
std::shared_ptr<Opm::Schedule>& schedule,
|
std::shared_ptr<Opm::Schedule>& schedule,
|
||||||
std::unique_ptr<Opm::UDQState>& udqState,
|
std::unique_ptr<Opm::UDQState>& udqState,
|
||||||
std::unique_ptr<Opm::Action::State>& actionState,
|
std::unique_ptr<Opm::Action::State>& actionState,
|
||||||
|
std::unique_ptr<Opm::WellTestState>& wtestState,
|
||||||
Opm::ErrorGuard& errorGuard)
|
Opm::ErrorGuard& errorGuard)
|
||||||
{
|
{
|
||||||
if (schedule == nullptr) {
|
if (schedule == nullptr) {
|
||||||
@ -192,6 +193,7 @@ namespace {
|
|||||||
((*schedule)[0].udq().params().undefinedValue());
|
((*schedule)[0].udq().params().undefinedValue());
|
||||||
|
|
||||||
actionState = std::make_unique<Opm::Action::State>();
|
actionState = std::make_unique<Opm::Action::State>();
|
||||||
|
wtestState = std::make_unique<Opm::WellTestState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Opm::Deck>
|
std::shared_ptr<Opm::Deck>
|
||||||
@ -276,7 +278,7 @@ namespace {
|
|||||||
else {
|
else {
|
||||||
createNonRestartDynamicObjects(*deck, *eclipseState,
|
createNonRestartDynamicObjects(*deck, *eclipseState,
|
||||||
*parseContext, std::move(python),
|
*parseContext, std::move(python),
|
||||||
schedule, udqState, actionState,
|
schedule, udqState, actionState, wtestState,
|
||||||
errorGuard);
|
errorGuard);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,6 +304,7 @@ namespace {
|
|||||||
std::shared_ptr<Opm::Schedule>& schedule,
|
std::shared_ptr<Opm::Schedule>& schedule,
|
||||||
std::unique_ptr<Opm::UDQState>& udqState,
|
std::unique_ptr<Opm::UDQState>& udqState,
|
||||||
std::unique_ptr<Opm::Action::State>& actionState,
|
std::unique_ptr<Opm::Action::State>& actionState,
|
||||||
|
std::unique_ptr<Opm::WellTestState>& wtestState,
|
||||||
std::shared_ptr<Opm::SummaryConfig>& summaryConfig)
|
std::shared_ptr<Opm::SummaryConfig>& summaryConfig)
|
||||||
{
|
{
|
||||||
if (eclipseState == nullptr) {
|
if (eclipseState == nullptr) {
|
||||||
@ -320,6 +323,10 @@ namespace {
|
|||||||
actionState = std::make_unique<Opm::Action::State>();
|
actionState = std::make_unique<Opm::Action::State>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wtestState == nullptr) {
|
||||||
|
wtestState = std::make_unique<Opm::WellTestState>();
|
||||||
|
}
|
||||||
|
|
||||||
if (summaryConfig == nullptr) {
|
if (summaryConfig == nullptr) {
|
||||||
summaryConfig = std::make_shared<Opm::SummaryConfig>();
|
summaryConfig = std::make_shared<Opm::SummaryConfig>();
|
||||||
}
|
}
|
||||||
@ -464,7 +471,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
|||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
else {
|
else {
|
||||||
defineStateObjectsOnNonIORank(comm, std::move(python), eclipseState,
|
defineStateObjectsOnNonIORank(comm, std::move(python), eclipseState,
|
||||||
schedule, udqState, actionState,
|
schedule, udqState, actionState, wtestState,
|
||||||
summaryConfig);
|
summaryConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ initFromRestartFile(const RestartValue& restartValues,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this->active_wgstate_.well_test_state = std::move(wtestState);
|
this->active_wgstate_.wtest_state(std::move(wtestState));
|
||||||
this->commitWGState();
|
this->commitWGState();
|
||||||
initial_step_ = false;
|
initial_step_ = false;
|
||||||
}
|
}
|
||||||
|
@ -28,4 +28,10 @@ WGState::WGState(const PhaseUsage& pu) :
|
|||||||
well_test_state{}
|
well_test_state{}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void WGState::wtest_state(WellTestState wtest_state)
|
||||||
|
{
|
||||||
|
wtest_state.filter_wells( this->well_state.wells() );
|
||||||
|
this->well_test_state = std::move(wtest_state);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ struct PhaseUsage;
|
|||||||
|
|
||||||
struct WGState {
|
struct WGState {
|
||||||
WGState(const PhaseUsage& pu);
|
WGState(const PhaseUsage& pu);
|
||||||
|
void wtest_state(WellTestState wtest_state);
|
||||||
|
|
||||||
WellState well_state;
|
WellState well_state;
|
||||||
GroupState group_state;
|
GroupState group_state;
|
||||||
|
@ -157,6 +157,15 @@ public:
|
|||||||
throw std::logic_error("No such well");
|
throw std::logic_error("No such well");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> wells() const {
|
||||||
|
std::vector<std::string> wlist;
|
||||||
|
for (const auto& [wname, _] : this->index_map) {
|
||||||
|
(void)_;
|
||||||
|
wlist.push_back(wname);
|
||||||
|
}
|
||||||
|
return wlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update_if(std::size_t index, const std::string& name, const WellContainer<T>& other) {
|
void update_if(std::size_t index, const std::string& name, const WellContainer<T>& other) {
|
||||||
|
@ -73,6 +73,10 @@ public:
|
|||||||
return this->wells_.size();
|
return this->wells_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> wells() const {
|
||||||
|
return this->wells_.wells();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int numWells() const
|
int numWells() const
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define BOOST_TEST_MODULE WellStateFIBOTest
|
#define BOOST_TEST_MODULE WellStateFIBOTest
|
||||||
|
|
||||||
@ -440,6 +442,9 @@ BOOST_AUTO_TEST_CASE(TESTWellContainer) {
|
|||||||
BOOST_CHECK_EQUAL(wc.well_name(1), "W2");
|
BOOST_CHECK_EQUAL(wc.well_name(1), "W2");
|
||||||
BOOST_CHECK_THROW(wc.well_name(10), std::exception);
|
BOOST_CHECK_THROW(wc.well_name(10), std::exception);
|
||||||
|
|
||||||
|
const auto& wells = wc.wells();
|
||||||
|
std::vector<std::string> expected = {"W1", "W2"};
|
||||||
|
BOOST_CHECK( std::is_permutation( wells.begin(), wells.end(), expected.begin(), expected.end()) );
|
||||||
|
|
||||||
Opm::WellContainer<int> wc2;
|
Opm::WellContainer<int> wc2;
|
||||||
wc2.copy_welldata(wc);
|
wc2.copy_welldata(wc);
|
||||||
|
Loading…
Reference in New Issue
Block a user