[feature][Simulator] allow parameters to be passed from outside to

simulator. The default behavior is unchanged and the parameters are
empty.
This commit is contained in:
Robert Kloefkorn 2017-08-23 15:49:53 +02:00
parent 79fc6c68cd
commit f18b1cdf59
2 changed files with 29 additions and 16 deletions

View File

@ -134,18 +134,27 @@ public:
if (myRank == 0)
std::cout << "Reading the deck file '" << fileName << "'" << std::endl;
Opm::Parser parser;
typedef std::pair<std::string, Opm::InputError::Action> ParseModePair;
typedef std::vector<ParseModePair> ParseModePairs;
ParseModePairs tmp;
tmp.push_back(ParseModePair(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE));
tmp.push_back(ParseModePair(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN));
tmp.push_back(ParseModePair(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN));
tmp.push_back(ParseModePair(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN));
Opm::ParseContext parseContext(tmp);
if( ! simulator.simulatorParameter().first )
{
Opm::Parser parser;
typedef std::pair<std::string, Opm::InputError::Action> ParseModePair;
typedef std::vector<ParseModePair> ParseModePairs;
ParseModePairs tmp;
tmp.push_back(ParseModePair(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE));
tmp.push_back(ParseModePair(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN));
tmp.push_back(ParseModePair(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN));
tmp.push_back(ParseModePair(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN));
Opm::ParseContext parseContext(tmp);
deck_ = parser.parseFile(fileName , parseContext);
eclState_.reset(new Opm::EclipseState(deck_, parseContext));
deck_.reset( new Opm::Deck(parser.parseFile(fileName , parseContext)) );
eclState_.reset(new Opm::EclipseState(deck(), parseContext));
}
else
{
deck_ = simulator.simulatorParameter().first;
assert( simulator.simulatorParameter().second );
eclState_ = simulator.simulatorParameter().second;
}
asImp_().createGrids_();
@ -156,10 +165,10 @@ public:
* \brief Return a pointer to the parsed ECL deck
*/
const Opm::Deck& deck() const
{ return deck_; }
{ return *deck_; }
Opm::Deck& deck()
{ return deck_; }
{ return *deck_; }
/*!
* \brief Return a pointer to the internalized ECL deck
@ -260,8 +269,8 @@ private:
{ return *static_cast<const Implementation*>(this); }
std::string caseName_;
Opm::Deck deck_;
std::unique_ptr<Opm::EclipseState> eclState_;
std::shared_ptr<Opm::Deck> deck_;
std::shared_ptr<Opm::EclipseState> eclState_;
};
} // namespace Ewoms

View File

@ -240,6 +240,10 @@ SET_BOOL_PROP(EclBaseProblem, EnableDebuggingChecks, true);
// ebos handles the SWATINIT keyword by default
SET_BOOL_PROP(EclBaseProblem, EnableSwatinit, true);
//! Set the ParameterMetaData property
SET_TYPE_PROP(EclBaseProblem, SimulatorParameter, std::pair< std::shared_ptr<Opm::Deck>, std::shared_ptr<Opm::EclipseState> > );
} // namespace Properties
/*!
@ -489,7 +493,7 @@ public:
this->model().invalidateIntensiveQuantitiesCache(/*timeIdx=*/0);
this->model().updateMaxOilSaturations();
if (GET_PROP_VALUE(TypeTag, EnablePolymer))
updateMaxPolymerAdsorption_();