Pass sim start argument to SummaryState constructor

This commit is contained in:
Joakim Hove 2019-09-20 00:49:40 +02:00
parent 37854bcdcb
commit bbb9cd3483
8 changed files with 33 additions and 23 deletions

View File

@ -51,9 +51,10 @@
#include <mpi.h>
#endif // HAVE_MPI
#include <vector>
#include <unordered_set>
#include <array>
#include <chrono>
#include <unordered_set>
#include <vector>
namespace Opm {
template <class TypeTag>
@ -343,6 +344,7 @@ public:
}
else
eclSchedule_ = externalEclSchedule_;
this->summaryState_.reset( new Opm::SummaryState( std::chrono::system_clock::from_time_t(this->eclSchedule_->getStartTime() )));
if (!externalEclSummaryConfig_) {
// create the schedule object. Note that if eclState is supposed to represent
@ -444,10 +446,10 @@ public:
* the UDQ, WTEST and ACTIONX calculations.
*/
Opm::SummaryState& summaryState()
{ return summaryState_; }
{ return *summaryState_; }
const Opm::SummaryState& summaryState() const
{ return summaryState_; }
{ return *summaryState_; }
/*!
* \brief Parameter deciding the edge-weight strategy of the load balancer.
@ -588,6 +590,7 @@ private:
std::unique_ptr<Opm::EclipseState> internalEclState_;
std::unique_ptr<Opm::Schedule> internalEclSchedule_;
std::unique_ptr<Opm::SummaryConfig> internalEclSummaryConfig_;
std::unique_ptr<Opm::SummaryState> summaryState_;
// these attributes point either to the internal or to the external version of the
// parser objects.
@ -598,8 +601,6 @@ private:
Opm::Schedule* eclSchedule_;
Opm::SummaryConfig* eclSummaryConfig_;
Opm::SummaryState summaryState_;
Dune::EdgeWeightMethod edgeWeightsMethod_;
};

View File

@ -53,6 +53,7 @@
#include <list>
#include <utility>
#include <string>
#include <chrono>
#ifdef HAVE_MPI
#include <mpi.h>
@ -426,7 +427,7 @@ public:
cumulatives will be counted doubly, we therefor use a temporary
SummaryState instance in this call to loadRestart().
*/
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(simulator_.vanguard().schedule().getStartTime()));
auto restartValues = eclIO_->loadRestart(summaryState, solutionKeys, extraKeys);
for (unsigned elemIdx = 0; elemIdx < numElements; ++elemIdx) {

View File

@ -18,8 +18,10 @@
*/
#include <config.h>
#include <chrono>
#define BOOST_TEST_MODULE StoppedWellsTests
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
@ -46,7 +48,7 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Schedule sched(deck, grid, eclipseProperties, runspec);
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
double target_surfacerate_inj;
double target_surfacerate_prod;

View File

@ -16,6 +16,7 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <chrono>
#include <config.h>
@ -44,7 +45,7 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Runspec runspec(deck);
const Schedule sched(deck, grid, eclipseProperties, runspec);
SummaryState summaryState;
SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
WellCollection collection;
@ -83,7 +84,7 @@ BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Runspec runspec(deck);
const Schedule sched(deck, grid, eclipseProperties, runspec);
SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
size_t timestep = 2;
WellCollection collection;

View File

@ -23,6 +23,8 @@
#define BOOST_TEST_MODULE WellModelTest
#include <chrono>
#include <opm/common/utility/platform_dependent/disable_warnings.h>
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
@ -73,6 +75,7 @@ struct SetupTest {
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, ecl_state->getInputGrid());
const Opm::Runspec runspec (deck);
schedule.reset( new Opm::Schedule(deck, ecl_state->getInputGrid(), eclipseProperties, runspec));
summaryState.reset( new Opm::SummaryState(std::chrono::system_clock::from_time_t(schedule->getStartTime())));
}
// Create grid.
@ -87,7 +90,7 @@ struct SetupTest {
// Create wells.
wells_manager.reset(new Opm::WellsManager(*ecl_state,
*schedule,
summaryState,
*summaryState,
current_timestep,
Opm::UgGridHelpers::numCells(grid),
Opm::UgGridHelpers::globalCell(grid),
@ -103,7 +106,7 @@ struct SetupTest {
std::unique_ptr<const Opm::WellsManager> wells_manager;
std::unique_ptr<const Opm::EclipseState> ecl_state;
std::unique_ptr<const Opm::Schedule> schedule;
Opm::SummaryState summaryState;
std::unique_ptr<Opm::SummaryState> summaryState;
int current_timestep;
};

View File

@ -23,6 +23,7 @@
#define BOOST_TEST_MODULE WellsGroupTest
#include <chrono>
#include <memory>
#include <vector>
@ -50,8 +51,8 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Schedule sched(deck, grid, eclipseProperties, runspec);
SummaryState summaryState;
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
auto wells = sched.getWells2atEnd();
@ -89,7 +90,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Schedule sched(deck, grid, eclipseProperties, runspec);
SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
for( const auto& grp_name : sched.groupNames() ) {
const auto& group = sched.getGroup2(grp_name, 2);
@ -127,7 +128,7 @@ BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Schedule sched(deck, grid, eclipseProperties, runspec);
SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
for( const auto& grp_name : sched.groupNames() ) {
const auto& group = sched.getGroup2(grp_name, 2);

View File

@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) {
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
{
Opm::WellsManager wellsManager(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE(WellsEqual) {
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
Opm::WellsManager wellsManager0(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE(ControlsEqual) {
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
Opm::WellsManager wellsManager0(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
@ -274,7 +274,7 @@ BOOST_AUTO_TEST_CASE(WellShutOK) {
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
Opm::WellsManager wellsManager2(eclipseState, sched, summaryState, 2, *vanguard.c_grid());
@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(WellSTOPOK) {
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
Opm::WellsManager wellsManager(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
@ -319,7 +319,7 @@ BOOST_AUTO_TEST_CASE(removeWellWithNoPerforation) {
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, inputGrid);
const Opm::Runspec runspec (deck);
Opm::Schedule sched(deck, inputGrid, eclipseProperties, runspec);
Opm::SummaryState summaryState;
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
const auto eclipseGrid = Opm::UgGridHelpers::createEclipseGrid(*gridManager.c_grid(), inputGrid);
sched.filterConnections(eclipseGrid);

View File

@ -37,6 +37,7 @@
#include <opm/grid/GridManager.hpp>
#include <chrono>
#include <cstddef>
#include <string>
@ -51,7 +52,7 @@ struct Setup
, pu (Opm::phaseUsageFromDeck(es))
, grid (es.getInputGrid())
, sched(deck, es)
, st()
, st(std::chrono::system_clock::from_time_t(sched.getStartTime()))
{}
Opm::EclipseState es;