Internalize WSEGITER settings in Tuning implementation
This commit is contained in:
parent
71ba9ae6fd
commit
53f78a02fe
@ -460,6 +460,7 @@ namespace Opm
|
||||
void handleDRVDTR( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleVAPPARS( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWSEGITER( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleWHISTCTL(const DeckKeyword& keyword, std::size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleMESSAGES(const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleRPTSCHED(const DeckKeyword& keyword, size_t currentStep);
|
||||
|
@ -22,10 +22,12 @@
|
||||
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/T.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>
|
||||
|
||||
namespace Opm {
|
||||
struct Tuning {
|
||||
using TuningKw = ParserKeywords::TUNING;
|
||||
using WsegIterKW = ParserKeywords::WSEGITER;
|
||||
|
||||
static Tuning serializeObject()
|
||||
{
|
||||
@ -114,6 +116,19 @@ namespace Opm {
|
||||
double XXXDPR = 0.0 * Metric::Pressure;
|
||||
bool XXXDPR_has_value = false;
|
||||
|
||||
/*
|
||||
In addition to the values set in the TUNING keyword this Tuning
|
||||
implementation also contains the result of the WSEGITER keyword, which
|
||||
is special tuning parameters to be applied to the multisegment well
|
||||
model. Observe that the maximum number of well iterations - MXWSIT -
|
||||
is specified by both the TUNING keyword and the WSEGITER keyword, but
|
||||
with different defaults.
|
||||
*/
|
||||
int WSEG_MAX_RESTART = WsegIterKW::MAX_TIMES_REDUCED::defaultValue;
|
||||
double WSEG_REDUCTION_FACTOR = WsegIterKW::REDUCTION_FACTOR::defaultValue;
|
||||
double WSEG_INCREASE_FACTOR = WsegIterKW::INCREASING_FACTOR::defaultValue;
|
||||
|
||||
|
||||
bool operator==(const Tuning& data) const {
|
||||
return TSINIT == data.TSINIT &&
|
||||
TSMAXZ == data.TSMAXZ &&
|
||||
@ -150,7 +165,10 @@ namespace Opm {
|
||||
DDSLIM == data.DDSLIM &&
|
||||
TRGDPR == data.TRGDPR &&
|
||||
XXXDPR == data.XXXDPR &&
|
||||
XXXDPR_has_value == data.XXXDPR_has_value;
|
||||
XXXDPR_has_value == data.XXXDPR_has_value &&
|
||||
WSEG_MAX_RESTART == data.WSEG_MAX_RESTART &&
|
||||
WSEG_REDUCTION_FACTOR == data.WSEG_REDUCTION_FACTOR &&
|
||||
WSEG_INCREASE_FACTOR == data.WSEG_INCREASE_FACTOR;
|
||||
}
|
||||
|
||||
bool operator !=(const Tuning& data) const {
|
||||
@ -198,6 +216,10 @@ namespace Opm {
|
||||
serializer(TRGDPR);
|
||||
serializer(XXXDPR);
|
||||
serializer(XXXDPR_has_value);
|
||||
|
||||
serializer(WSEG_MAX_RESTART);
|
||||
serializer(WSEG_REDUCTION_FACTOR);
|
||||
serializer(WSEG_INCREASE_FACTOR);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -440,6 +440,9 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
else if (keyword.name() == "TUNING")
|
||||
handleTUNING(keyword, currentStep);
|
||||
|
||||
else if (keyword.name() == "WSEGITER")
|
||||
handleWSEGITER(keyword, currentStep);
|
||||
|
||||
else if (keyword.name() == "WRFT")
|
||||
rftProperties.push_back( std::make_pair( &keyword , currentStep ));
|
||||
|
||||
@ -1928,10 +1931,24 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
}
|
||||
|
||||
|
||||
void Schedule::handleWSEGITER( const DeckKeyword& keyword, size_t currentStep) {
|
||||
using WI = ParserKeywords::WSEGITER;
|
||||
Tuning tuning(m_tuning.get(currentStep));
|
||||
{
|
||||
const auto& record = keyword.getRecord(0);
|
||||
tuning.MXWSIT = record.getItem<WI::MAX_WELL_ITERATIONS>().get<int>(0);
|
||||
tuning.WSEG_MAX_RESTART = record.getItem<WI::MAX_TIMES_REDUCED>().get<int>(0);
|
||||
tuning.WSEG_REDUCTION_FACTOR = record.getItem<WI::REDUCTION_FACTOR>().get<double>(0);
|
||||
tuning.WSEG_INCREASE_FACTOR = record.getItem<WI::INCREASING_FACTOR>().get<double>(0);
|
||||
}
|
||||
m_tuning.update(currentStep, tuning);
|
||||
m_events.addEvent( ScheduleEvents::TUNING_CHANGE , currentStep);
|
||||
}
|
||||
|
||||
|
||||
void Schedule::handleTUNING( const DeckKeyword& keyword, size_t currentStep) {
|
||||
|
||||
int numrecords = keyword.size();
|
||||
|
||||
using TU = ParserKeywords::TUNING;
|
||||
auto numrecords = keyword.size();
|
||||
Tuning tuning(m_tuning.get(currentStep));
|
||||
if (numrecords > 0) {
|
||||
const auto& record1 = keyword.getRecord(0);
|
||||
@ -1994,10 +2011,11 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
tuning.XXXDPR_has_value = true;
|
||||
tuning.XXXDPR = XXXDPRdeckItem.getSIDouble(0);
|
||||
}
|
||||
}
|
||||
} else
|
||||
tuning.MXWSIT = TU::MXWSIT::defaultValue;
|
||||
|
||||
m_tuning.update(currentStep, tuning);
|
||||
m_events.addEvent( ScheduleEvents::TUNING_CHANGE , currentStep);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -327,5 +327,7 @@ BOOST_AUTO_TEST_CASE(TuningTest) {
|
||||
BOOST_CHECK(event.hasEvent(ScheduleEvents::TUNING_CHANGE, timestep));
|
||||
BOOST_CHECK_EQUAL(true, tuning.TMAXWC_has_value);
|
||||
BOOST_CHECK_CLOSE(tuning.TMAXWC, 10.0 * Metric::Time, diff);
|
||||
|
||||
BOOST_CHECK_EQUAL(tuning.MXWSIT, ParserKeywords::WSEGITER::MAX_WELL_ITERATIONS::defaultValue);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user