Merge pull request #2317 from akva2/simplify_tuning

update for simplified Tuning data structure in opm-common
This commit is contained in:
Joakim Hove 2020-02-05 07:50:33 +01:00 committed by GitHub
commit 50d35c1dde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 236 deletions

View File

@ -675,12 +675,12 @@ public:
if (enableTuning_) {
// if support for the TUNING keyword is enabled, we get the initial time
// steping parameters from it instead of from command line parameters
const auto& tuning = schedule.getTuning();
initialTimeStepSize_ = tuning.getTSINIT(0);
maxTimeStepAfterWellEvent_ = tuning.getTMAXWC(0);
maxTimeStepSize_ = tuning.getTSMAXZ(0);
restartShrinkFactor_ = 1./tuning.getTSFCNV(0);
minTimeStepSize_ = tuning.getTSMINZ(0);
const auto& tuning = schedule.getTuning(0);
initialTimeStepSize_ = tuning.TSINIT;
maxTimeStepAfterWellEvent_ = tuning.TMAXWC;
maxTimeStepSize_ = tuning.TSMAXZ;
restartShrinkFactor_ = 1./tuning.TSFCNV;
minTimeStepSize_ = tuning.TSMINZ;
}
initFluidSystem_();
@ -839,12 +839,12 @@ public:
bool tuningEvent = false;
if (episodeIdx > 0 && enableTuning_ && events.hasEvent(Opm::ScheduleEvents::TUNING_CHANGE, episodeIdx))
{
const auto& tuning = schedule.getTuning();
initialTimeStepSize_ = tuning.getTSINIT(episodeIdx);
maxTimeStepAfterWellEvent_ = tuning.getTMAXWC(episodeIdx);
maxTimeStepSize_ = tuning.getTSMAXZ(episodeIdx);
restartShrinkFactor_ = 1./tuning.getTSFCNV(episodeIdx);
minTimeStepSize_ = tuning.getTSMINZ(episodeIdx);
const auto& tuning = schedule.getTuning(episodeIdx);
initialTimeStepSize_ = tuning.TSINIT;
maxTimeStepAfterWellEvent_ = tuning.TMAXWC;
maxTimeStepSize_ = tuning.TSMAXZ;
restartShrinkFactor_ = 1./tuning.TSFCNV;
minTimeStepSize_ = tuning.TSMINZ;
tuningEvent = true;
}

View File

@ -146,7 +146,7 @@ public:
bool enableTUNING = EWOMS_GET_PARAM(TypeTag, bool, EnableTuning);
if (enableAdaptive) {
if (enableTUNING) {
adaptiveTimeStepping.reset(new TimeStepper(schedule().getTuning(), timer.currentStepNum(), terminalOutput_));
adaptiveTimeStepping.reset(new TimeStepper(schedule().getTuning(timer.currentStepNum()), terminalOutput_));
}
else {
adaptiveTimeStepping.reset(new TimeStepper(terminalOutput_));
@ -216,7 +216,7 @@ public:
if (adaptiveTimeStepping) {
if (enableTUNING) {
if (events.hasEvent(ScheduleEvents::TUNING_CHANGE,timer.currentStepNum())) {
adaptiveTimeStepping->updateTUNING(schedule().getTuning(), timer.currentStepNum());
adaptiveTimeStepping->updateTUNING(schedule().getTuning(timer.currentStepNum()));
}
}

View File

@ -126,12 +126,11 @@ namespace Opm {
//! \param tuning Pointer to ecl TUNING keyword
//! \param timeStep current report step
AdaptiveTimeSteppingEbos(const Tuning& tuning,
size_t timeStep,
const bool terminalOutput = true)
: timeStepControl_()
, restartFactor_(tuning.getTSFCNV(timeStep))
, growthFactor_(tuning.getTFDIFF(timeStep))
, maxGrowth_(tuning.getTSFMAX(timeStep))
, restartFactor_(tuning.TSFCNV)
, growthFactor_(tuning.TFDIFF)
, maxGrowth_(tuning.TSFMAX)
, maxTimeStep_(EWOMS_GET_PARAM(TypeTag, double, SolverMaxTimeStepInDays)*24*60*60) // 365.25
, minTimeStep_(EWOMS_GET_PARAM(TypeTag, double, SolverMinTimeStep)) // 0.0
, solverRestartMax_(EWOMS_GET_PARAM(TypeTag, int, SolverMaxRestarts)) // 10
@ -467,14 +466,14 @@ namespace Opm {
void setSuggestedNextStep(const double x)
{ suggestedNextTimestep_ = x; }
void updateTUNING(const Tuning& tuning, size_t timeStep)
void updateTUNING(const Tuning& tuning)
{
restartFactor_ = tuning.getTSFCNV(timeStep);
growthFactor_ = tuning.getTFDIFF(timeStep);
maxGrowth_ = tuning.getTSFMAX(timeStep);
maxTimeStep_ = tuning.getTSMAXZ(timeStep);
suggestedNextTimestep_ = tuning.getTSINIT(timeStep);
timestepAfterEvent_ = tuning.getTMAXWC(timeStep);
restartFactor_ = tuning.TSFCNV;
growthFactor_ = tuning.TFDIFF;
maxGrowth_ = tuning.TSFMAX;
maxTimeStep_ = tuning.TSMAXZ;
suggestedNextTimestep_ = tuning.TSINIT;
timestepAfterEvent_ = tuning.TMAXWC;
}

View File

@ -462,6 +462,7 @@ HANDLE_AS_POD(ROCKRecord)
HANDLE_AS_POD(SatFuncControls)
HANDLE_AS_POD(Tabdims)
HANDLE_AS_POD(TimeStampUTC::YMD)
HANDLE_AS_POD(Tuning)
HANDLE_AS_POD(VISCREFRecord)
HANDLE_AS_POD(WATDENTRecord)
HANDLE_AS_POD(WellBrineProperties)
@ -1683,48 +1684,6 @@ std::size_t packSize(const Deck& data,
packSize(data.unitSystemAccessCount(), comm);
}
std::size_t packSize(const Tuning& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getTSINIT(), comm) +
packSize(data.getTSMAXZ(), comm) +
packSize(data.getTSMINZ(), comm) +
packSize(data.getTSMCHP(), comm) +
packSize(data.getTSFMAX(), comm) +
packSize(data.getTSFMIN(), comm) +
packSize(data.getTSFCNV(), comm) +
packSize(data.getTFDIFF(), comm) +
packSize(data.getTHRUPT(), comm) +
packSize(data.getTMAXWC(), comm) +
packSize(data.getTMAXWC_has_value(), comm) +
packSize(data.getTRGTTE(), comm) +
packSize(data.getTRGCNV(), comm) +
packSize(data.getTRGMBE(), comm) +
packSize(data.getTRGLCV(), comm) +
packSize(data.getXXXTTE(), comm) +
packSize(data.getXXXCNV(), comm) +
packSize(data.getXXXMBE(), comm) +
packSize(data.getXXXLCV(), comm) +
packSize(data.getXXXWFL(), comm) +
packSize(data.getTRGFIP(), comm) +
packSize(data.getTRGSFT(), comm) +
packSize(data.getTRGSFT_has_value(), comm) +
packSize(data.getTHIONX(), comm) +
packSize(data.getTRWGHT(), comm) +
packSize(data.getNEWTMX(), comm) +
packSize(data.getNEWTMN(), comm) +
packSize(data.getLITMAX(), comm) +
packSize(data.getLITMIN(), comm) +
packSize(data.getMXWSIT(), comm) +
packSize(data.getMXWPIT(), comm) +
packSize(data.getDDPLIM(), comm) +
packSize(data.getDDSLIM(), comm) +
packSize(data.getTRGDPR(), comm) +
packSize(data.getXXXDPR(), comm) +
packSize(data.getXXXDPR_has_value(), comm) +
packSize(data.getResetValues(), comm);
}
std::size_t packSize(const Action::ASTNode& data,
Dune::MPIHelper::MPICommunicator comm)
{
@ -3510,49 +3469,6 @@ void pack(const Deck& data,
pack(data.unitSystemAccessCount(), buffer, position, comm);
}
void pack(const Tuning& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getTSINIT(), buffer, position, comm);
pack(data.getTSMAXZ(), buffer, position, comm);
pack(data.getTSMINZ(), buffer, position, comm);
pack(data.getTSMCHP(), buffer, position, comm);
pack(data.getTSFMAX(), buffer, position, comm);
pack(data.getTSFMIN(), buffer, position, comm);
pack(data.getTSFCNV(), buffer, position, comm);
pack(data.getTFDIFF(), buffer, position, comm);
pack(data.getTHRUPT(), buffer, position, comm);
pack(data.getTMAXWC(), buffer, position, comm);
pack(data.getTMAXWC_has_value(), buffer, position, comm);
pack(data.getTRGTTE(), buffer, position, comm);
pack(data.getTRGCNV(), buffer, position, comm);
pack(data.getTRGMBE(), buffer, position, comm);
pack(data.getTRGLCV(), buffer, position, comm);
pack(data.getXXXTTE(), buffer, position, comm);
pack(data.getXXXCNV(), buffer, position, comm);
pack(data.getXXXMBE(), buffer, position, comm);
pack(data.getXXXLCV(), buffer, position, comm);
pack(data.getXXXWFL(), buffer, position, comm);
pack(data.getTRGFIP(), buffer, position, comm);
pack(data.getTRGSFT(), buffer, position, comm);
pack(data.getTRGSFT_has_value(), buffer, position, comm);
pack(data.getTHIONX(), buffer, position, comm);
pack(data.getTRWGHT(), buffer, position, comm);
pack(data.getNEWTMX(), buffer, position, comm);
pack(data.getNEWTMN(), buffer, position, comm);
pack(data.getLITMAX(), buffer, position, comm);
pack(data.getLITMIN(), buffer, position, comm);
pack(data.getMXWSIT(), buffer, position, comm);
pack(data.getMXWPIT(), buffer, position, comm);
pack(data.getDDPLIM(), buffer, position, comm);
pack(data.getDDSLIM(), buffer, position, comm);
pack(data.getTRGDPR(), buffer, position, comm);
pack(data.getXXXDPR(), buffer, position, comm);
pack(data.getXXXDPR_has_value(), buffer, position, comm);
pack(data.getResetValues(), buffer, position, comm);
}
void pack(const Action::ASTNode& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
@ -6083,93 +5999,6 @@ void unpack(Deck& data, std::vector<char>& buffer, int& position,
activeUnitSystem.get(), dataFile, inputPath, accessCount);
}
void unpack(Tuning& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
DynamicState<double> TSINIT;
DynamicState<double> TSMAXZ;
DynamicState<double> TSMINZ;
DynamicState<double> TSMCHP;
DynamicState<double> TSFMAX;
DynamicState<double> TSFMIN;
DynamicState<double> TSFCNV;
DynamicState<double> TFDIFF;
DynamicState<double> THRUPT;
DynamicState<double> TMAXWC;
DynamicState<int> TMAXWC_has_value;
DynamicState<double> TRGTTE;
DynamicState<double> TRGCNV;
DynamicState<double> TRGMBE;
DynamicState<double> TRGLCV;
DynamicState<double> XXXTTE;
DynamicState<double> XXXCNV;
DynamicState<double> XXXMBE;
DynamicState<double> XXXLCV;
DynamicState<double> XXXWFL;
DynamicState<double> TRGFIP;
DynamicState<double> TRGSFT;
DynamicState<int> TRGSFT_has_value;
DynamicState<double> THIONX;
DynamicState<int> TRWGHT;
DynamicState<int> NEWTMX;
DynamicState<int> NEWTMN;
DynamicState<int> LITMAX;
DynamicState<int> LITMIN;
DynamicState<int> MXWSIT;
DynamicState<int> MXWPIT;
DynamicState<double> DDPLIM;
DynamicState<double> DDSLIM;
DynamicState<double> TRGDPR;
DynamicState<double> XXXDPR;
DynamicState<int> XXXDPR_has_value;
std::map<std::string, bool> ResetValue;
unpack(TSINIT, buffer, position, comm);
unpack(TSMAXZ, buffer, position, comm);
unpack(TSMINZ, buffer, position, comm);
unpack(TSMCHP, buffer, position, comm);
unpack(TSFMAX, buffer, position, comm);
unpack(TSFMIN, buffer, position, comm);
unpack(TSFCNV, buffer, position, comm);
unpack(TFDIFF, buffer, position, comm);
unpack(THRUPT, buffer, position, comm);
unpack(TMAXWC, buffer, position, comm);
unpack(TMAXWC_has_value, buffer, position, comm);
unpack(TRGTTE, buffer, position, comm);
unpack(TRGCNV, buffer, position, comm);
unpack(TRGMBE, buffer, position, comm);
unpack(TRGLCV, buffer, position, comm);
unpack(XXXTTE, buffer, position, comm);
unpack(XXXCNV, buffer, position, comm);
unpack(XXXMBE, buffer, position, comm);
unpack(XXXLCV, buffer, position, comm);
unpack(XXXWFL, buffer, position, comm);
unpack(TRGFIP, buffer, position, comm);
unpack(TRGSFT, buffer, position, comm);
unpack(TRGSFT_has_value, buffer, position, comm);
unpack(THIONX, buffer, position, comm);
unpack(TRWGHT, buffer, position, comm);
unpack(NEWTMX, buffer, position, comm);
unpack(NEWTMN, buffer, position, comm);
unpack(LITMAX, buffer, position, comm);
unpack(LITMIN, buffer, position, comm);
unpack(MXWSIT, buffer, position, comm);
unpack(MXWPIT, buffer, position, comm);
unpack(DDPLIM, buffer, position, comm);
unpack(DDSLIM, buffer, position, comm);
unpack(TRGDPR, buffer, position, comm);
unpack(XXXDPR, buffer, position, comm);
unpack(XXXDPR_has_value, buffer, position, comm);
unpack(ResetValue, buffer, position, comm);
data = Tuning(TSINIT, TSMAXZ, TSMINZ, TSMCHP, TSFMAX, TSFMIN, TSFCNV,
TFDIFF, THRUPT, TMAXWC, TMAXWC_has_value, TRGTTE,
TRGCNV, TRGMBE, TRGLCV, XXXTTE, XXXCNV, XXXMBE, XXXLCV,
XXXWFL, TRGFIP, TRGSFT, TRGSFT_has_value, THIONX, TRWGHT,
NEWTMX, NEWTMN, LITMAX, LITMIN, MXWSIT, MXWPIT, DDPLIM,
DDSLIM, TRGDPR, XXXDPR, XXXDPR_has_value, ResetValue);
}
void unpack(Action::ASTNode& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@ -6257,7 +6086,7 @@ void unpack(Schedule& data, std::vector<char>& buffer, int& position,
DynamicState<OilVaporizationProperties> oilVapProps;
Events events;
DynamicVector<Deck> modifierDeck;
Tuning tuning;
DynamicState<Tuning> tuning;
MessageLimits messageLimits;
Runspec runspec;
Schedule::VFPProdMap vfpProdTables;

View File

@ -408,43 +408,10 @@ Opm::DeckRecord getDeckRecord()
Opm::Tuning getTuning()
{
return Opm::Tuning(Opm::DynamicState<double>(std::vector<double>{1.0}, 1), //TSINIT
Opm::DynamicState<double>(std::vector<double>{2.0}, 1), //TSMAXZ
Opm::DynamicState<double>(std::vector<double>{3.0}, 1), //TSMINZ
Opm::DynamicState<double>(std::vector<double>{4.0}, 1), //TSMCHP
Opm::DynamicState<double>(std::vector<double>{5.0}, 1), //TSFMAX
Opm::DynamicState<double>(std::vector<double>{6.0}, 1), //TSFMIN
Opm::DynamicState<double>(std::vector<double>{7.0}, 1), //TSFCNV
Opm::DynamicState<double>(std::vector<double>{8.0}, 1), //TFDIFF
Opm::DynamicState<double>(std::vector<double>{9.0}, 1), //THRUPT
Opm::DynamicState<double>(std::vector<double>{10.0}, 1), //TMAXWC
Opm::DynamicState<int>(std::vector<int>{1}, 1), //TMAXWC_has_value
Opm::DynamicState<double>(std::vector<double>{11.0}, 1), //TRGTTE
Opm::DynamicState<double>(std::vector<double>{12.0}, 1), //TRGCNV
Opm::DynamicState<double>(std::vector<double>{13.0}, 1), //TRGMBE
Opm::DynamicState<double>(std::vector<double>{14.0}, 1), //TRGLCV
Opm::DynamicState<double>(std::vector<double>{15.0}, 1), //XXXTTE
Opm::DynamicState<double>(std::vector<double>{16.0}, 1), //XXXCNV
Opm::DynamicState<double>(std::vector<double>{17.0}, 1), //XXXMBE
Opm::DynamicState<double>(std::vector<double>{18.0}, 1), //XXXLCV
Opm::DynamicState<double>(std::vector<double>{19.0}, 1), //XXXWFL
Opm::DynamicState<double>(std::vector<double>{20.0}, 1), ///TRGFIP
Opm::DynamicState<double>(std::vector<double>{21.0}, 1), //TRGSFT
Opm::DynamicState<int>(std::vector<int>{2}, 1), //TRGSFT_has_value
Opm::DynamicState<double>(std::vector<double>{22.0}, 1), // THIONX
Opm::DynamicState<int>(std::vector<int>{3}, 1), //TRWGHT
Opm::DynamicState<int>(std::vector<int>{4}, 1), //NEWTMX
Opm::DynamicState<int>(std::vector<int>{5}, 1), //NEWTMN
Opm::DynamicState<int>(std::vector<int>{6}, 1), //LITMAX
Opm::DynamicState<int>(std::vector<int>{7}, 1), //LITMIN
Opm::DynamicState<int>(std::vector<int>{8}, 1), //MXWSIT
Opm::DynamicState<int>(std::vector<int>{9}, 1), //MXWPIT
Opm::DynamicState<double>(std::vector<double>{23.0}, 1), //DDPLIM
Opm::DynamicState<double>(std::vector<double>{24.0}, 1), //DDSLIM
Opm::DynamicState<double>(std::vector<double>{25.0}, 1), //TGRDPR
Opm::DynamicState<double>(std::vector<double>{26.0}, 1), //XXXDPR
Opm::DynamicState<int>(std::vector<int>{10}, 1), //XXDPR_has_value
std::map<std::string,bool>{{"test", false}}); // resetValue
return Opm::Tuning{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, true,
11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0,
20.0, 21.0, false, 22.0, 3, 4, 5, 6, 7, 8, 9, 23.0, 24.0,
25.0, 26.0, true};
}
@ -2217,7 +2184,7 @@ BOOST_AUTO_TEST_CASE(Schedule)
oilvap,
events,
modifierDeck,
getTuning(),
Opm::DynamicState<Opm::Tuning>({getTuning()}, 1),
messageLimits,
runspec,
vfpProd,