|
opm-common
|
Collection of all user-defined quantities in the current simulation run. More...
#include <UDQConfig.hpp>
Classes | |
| class | DynamicSelector |
| Container of entities from a dynamic context. More... | |
Public Member Functions | |
| UDQConfig ()=default | |
| Default constructor. | |
| UDQConfig (const UDQParams ¶ms) | |
| Constructor. | |
| UDQConfig (const UDQParams ¶ms, const RestartIO::RstState &rst_state) | |
| Constructor. | |
| const std::string & | unit (const std::string &key) const |
| Retrieve unit string for a particular UDQ. | |
| bool | has_unit (const std::string &keyword) const |
| Query whether or not a particular UDQ has an associated unit string. | |
| bool | has_keyword (const std::string &keyword) const |
| Query whether or not a particular UDQ exists in the collection. | |
| std::optional< std::string > | add_record (SegmentMatcherFactory create_segment_matcher, const DeckRecord &record, const KeywordLocation &location, std::size_t report_step, const std::optional< DynamicSelector > &dynamic_selector=std::nullopt) |
| Incorporate a single UDQ record into the known collection. | |
| void | add_unit (const std::string &keyword, const std::string &unit) |
| Incorporate a unit string for a UDQ. | |
| void | add_update (const std::string &keyword, std::size_t report_step, const KeywordLocation &location, const std::vector< std::string > &data) |
| Incorporate update status change for a UDQ. | |
| void | add_assign (const std::string &quantity, SegmentMatcherFactory create_segment_matcher, const std::vector< std::string > &selector, double value, std::size_t report_step, const std::optional< DynamicSelector > &dynamic_selector=std::nullopt) |
| Incorporate a UDQ assignment. | |
| void | add_define (const std::string &quantity, const KeywordLocation &location, const std::vector< std::string > &expression, std::size_t report_step) |
| Incorporate a UDQ defining expressions. | |
| void | add_table (const std::string &name, UDT udt) |
| Incorporate a user defined table. | |
| bool | clear_pending_assignments () |
| Clear all pending assignments. | |
| bool | clear_update_next_for_new_report_step () |
| Clear "UPDATE NEXT" flags for all pertinent UDQ definitions. | |
| void | eval_assign (const WellMatcher &wm, const GroupOrder &go, SegmentMatcherFactory create_segment_matcher, SummaryState &st, UDQState &udq_state) const |
| Apply all pending assignments. | |
| void | eval (std::size_t report_step, const WellMatcher &wm, const GroupOrder &go, SegmentMatcherFactory create_segment_matcher, RegionSetMatcherFactory create_region_matcher, SummaryState &st, UDQState &udq_state) const |
| Compute new values for all UDQs. | |
| const UDQDefine & | define (const std::string &key) const |
| Retrieve defining expression and evaluation object for a single UDQ. | |
| const UDQAssign & | assign (const std::string &key) const |
| Retrieve any pending assignment object for a single UDQ. | |
| std::vector< UDQDefine > | definitions () const |
| Retrieve defining expressions and evaluation objects for all known UDQs. | |
| std::vector< UDQDefine > | definitions (UDQVarType var_type) const |
| Retrieve defining expressions and evaluation objects for all known UDQs of a particular category. | |
| std::vector< UDQInput > | input () const |
| Retrieve unprocessed input objects for all UDQs. | |
| void | exportTypeCount (std::array< int, static_cast< std::size_t >(UDQVarType::NumTypes)> &count) const |
| Export count of all known UDQ categories in the current run. | |
| std::size_t | size () const |
| Total number of active DEFINE and ASSIGN statements. | |
| UDQInput | operator[] (const std::string &keyword) const |
| Unprocessed input object for named quantity. | |
| UDQInput | operator[] (std::size_t insert_index) const |
| Unprocessed input object for enumerated quantity. | |
| std::vector< UDQAssign > | assignments () const |
| Retrieve pending assignment objects for all known UDQs. | |
| std::vector< UDQAssign > | assignments (UDQVarType var_type) const |
| Retrieve pending assignment objects for all known UDQs of a particular category. | |
| const UDQParams & | params () const |
| Retrieve run's active UDQ parameters. | |
| const UDQFunctionTable & | function_table () const |
| Retrieve run's active UDQ function table. | |
| const std::unordered_map< std::string, UDT > & | tables () const |
| Retrieve run's active user defined tables. | |
| bool | operator== (const UDQConfig &config) const |
| Equality predicate. | |
| void | required_summary (std::unordered_set< std::string > &summary_keys) const |
| Export all summary vectors needed to compute values for the current collection of user defined quantities. | |
| template<class Serializer> | |
| void | serializeOp (Serializer &serializer) |
| Convert between byte array and object representation. | |
Static Public Member Functions | |
| static UDQConfig | serializationTestObject () |
| Create a serialisation test object. | |
Collection of all user-defined quantities in the current simulation run.
|
explicit |
Constructor.
Main constructor for a base run.
| [in] | params | UDQ parameters from UDQPARAM keyword. |
| Opm::UDQConfig::UDQConfig | ( | const UDQParams & | params, |
| const RestartIO::RstState & | rst_state ) |
Constructor.
Main constructor for a restarted simulation run.
| [in] | params | UDQ parameters from UDQPARAM keyword. |
| [in] | rst_state | Object state from restart file information. |
| void Opm::UDQConfig::add_assign | ( | const std::string & | quantity, |
| SegmentMatcherFactory | create_segment_matcher, | ||
| const std::vector< std::string > & | selector, | ||
| double | value, | ||
| std::size_t | report_step, | ||
| const std::optional< DynamicSelector > & | dynamic_selector = std::nullopt ) |
Incorporate a UDQ assignment.
Implements the ASSIGN statement.
| [in] | quantity | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
| [in] | create_segment_matcher | Factory function for constructing segment set matchers. |
| [in] | selector | UDQ set element selection to which this assignment applies. Might be a well name pattern if quantity is a well level UDQ. |
| [in] | value | Numeric value from ASSIGN record. |
| [in] | report_step | Time at which this assignment statement is encountered. |
| [in] | dynamic_selector | Named entities in a dynamic context, such as the wells matching an ACTIONX condition. Nullopt if no such dynamic entities apply to this UDQ record. |
| void Opm::UDQConfig::add_define | ( | const std::string & | quantity, |
| const KeywordLocation & | location, | ||
| const std::vector< std::string > & | expression, | ||
| std::size_t | report_step ) |
Incorporate a UDQ defining expressions.
Implements the DEFINE statement.
| [in] | quantity | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
| [in] | location | Input file/line information for the UDQ record. Mostly for diagnostic purposes. |
| [in] | expression | Defining expression for the UDQ. Function add_define() parses this expression into an abstract syntax tree which is used in subsequent evaluation contexts. |
| [in] | report_step | Time at which this assignment statement is encountered. |
| std::optional< std::string > Opm::UDQConfig::add_record | ( | SegmentMatcherFactory | create_segment_matcher, |
| const DeckRecord & | record, | ||
| const KeywordLocation & | location, | ||
| std::size_t | report_step, | ||
| const std::optional< DynamicSelector > & | dynamic_selector = std::nullopt ) |
Incorporate a single UDQ record into the known collection.
| [in] | create_segment_matcher | Factory function for constructing segment set matchers. |
| [in] | record | UDQ keyword record, such as a DEFINE, ASSIGN, UPDATE, or UNIT statement. |
| [in] | location | Input file/line information for the UDQ record. Mostly for diagnostic purposes. |
| [in] | report_step | Time at which this record is encountered. |
| [in] | dynamic_selector | Named entities in a dynamic context, such as the wells matching an ACTIONX condition. Nullopt if no such dynamic entities apply to this UDQ record. |
| void Opm::UDQConfig::add_table | ( | const std::string & | name, |
| UDT | udt ) |
Incorporate a user defined table.
Implements the UDT keyword.
| [in] | name | Name of user defined table. |
| [in] | udt | Tabulated values. |
| void Opm::UDQConfig::add_unit | ( | const std::string & | keyword, |
| const std::string & | unit ) |
Incorporate a unit string for a UDQ.
Implements the UNIT statement.
| [in] | keyword | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
| [in] | unit | Unit string for UDQ keyword. |
| void Opm::UDQConfig::add_update | ( | const std::string & | keyword, |
| std::size_t | report_step, | ||
| const KeywordLocation & | location, | ||
| const std::vector< std::string > & | data ) |
Incorporate update status change for a UDQ.
Implements the UPDATE statement
| [in] | keyword | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
| [in] | report_step | Time at which this record is encountered. |
| [in] | location | Input file/line information for the UDQ record. Mostly for diagnostic purposes. |
| [in] | data | Update status. Should be a single element vector containing one of the status strings ON, OFF, or NEXT. |
| const UDQAssign & Opm::UDQConfig::assign | ( | const std::string & | key | ) | const |
Retrieve any pending assignment object for a single UDQ.
| [in] | key | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
key. Throws an exception of type if no such object exists for the UDQ key. | std::vector< UDQAssign > Opm::UDQConfig::assignments | ( | UDQVarType | var_type | ) | const |
Retrieve pending assignment objects for all known UDQs of a particular category.
| [in] | var_type | UDQ category. |
var_type. | bool Opm::UDQConfig::clear_pending_assignments | ( | ) |
Clear all pending assignments.
Clears all internal data structures of any assignment records. Typically called at the end of a report step in order to signify that all assignments have been applied.
| bool Opm::UDQConfig::clear_update_next_for_new_report_step | ( | ) |
Clear "UPDATE NEXT" flags for all pertinent UDQ definitions.
This is required by the way we form ScheduleState objects. The function resets UPDATE NEXT to UPDATE OFF, and should typically be called at the end of a report step. If we do not do this, then all UDQs with an UPDATE NEXT status will behave as if there is an implicit UPDATE NEXT statement at the beginning of each subsequent report step and that, in turn, will generate unwanted value updates for the quantity.
| const UDQDefine & Opm::UDQConfig::define | ( | const std::string & | key | ) | const |
Retrieve defining expression and evaluation object for a single UDQ.
| [in] | key | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
key. Throws an exception of type if no such object exists for the UDQ key. | std::vector< UDQDefine > Opm::UDQConfig::definitions | ( | UDQVarType | var_type | ) | const |
Retrieve defining expressions and evaluation objects for all known UDQs of a particular category.
| [in] | var_type | UDQ category. |
var_type. | void Opm::UDQConfig::eval | ( | std::size_t | report_step, |
| const WellMatcher & | wm, | ||
| const GroupOrder & | go, | ||
| SegmentMatcherFactory | create_segment_matcher, | ||
| RegionSetMatcherFactory | create_region_matcher, | ||
| SummaryState & | st, | ||
| UDQState & | udq_state ) const |
Compute new values for all UDQs.
Uses both assignment and defining expressions as applicable. Assigns new UDQ values to both the summary and UDQ state objects.
| [in] | report_step | Current report step. |
| [in] | wm | Well name pattern matcher. |
| [in] | go | Group name pattern matcher. |
| [in] | create_segment_matcher | Factory function for constructing segment set matchers. |
| [in] | create_region_matcher | Factory function for constructing region set matchers. |
| [in,out] | st | Summary vectors. For output and evaluating ACTION condition purposes. Values pertaining to UDQs being assigned here will be updated. |
| [in,out] | udq_state | Dynamic values for all known UDQs. Values pertaining to UDQs being assigned here will be updated. |
| void Opm::UDQConfig::eval_assign | ( | const WellMatcher & | wm, |
| const GroupOrder & | go, | ||
| SegmentMatcherFactory | create_segment_matcher, | ||
| SummaryState & | st, | ||
| UDQState & | udq_state ) const |
Apply all pending assignments.
Assigns new UDQ values to both the summary and UDQ state objects.
| [in] | wm | Well name pattern matcher. |
| [in] | go | Group name pattern matcher. |
| [in] | create_segment_matcher | Factory function for constructing segment set matchers. |
| [in,out] | st | Summary vectors. For output and evaluating ACTION condition purposes. Values pertaining to UDQs being assigned here will be updated. |
| [in,out] | udq_state | Dynamic values for all known UDQs. Values pertaining to UDQs being assigned here will be updated. |
| void Opm::UDQConfig::exportTypeCount | ( | std::array< int, static_cast< std::size_t >(UDQVarType::NumTypes)> & | count | ) | const |
Export count of all known UDQ categories in the current run.
| [out] | count | Count of all active UDQs of all categories in the current run. |
| bool Opm::UDQConfig::has_keyword | ( | const std::string & | keyword | ) | const |
Query whether or not a particular UDQ exists in the collection.
| [in] | keyword | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
keyword exists in the collection. | bool Opm::UDQConfig::has_unit | ( | const std::string & | keyword | ) | const |
Query whether or not a particular UDQ has an associated unit string.
| [in] | keyword | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
keyword. | std::vector< UDQInput > Opm::UDQConfig::input | ( | ) | const |
Retrieve unprocessed input objects for all UDQs.
Needed for restart file output purposes.
| bool Opm::UDQConfig::operator== | ( | const UDQConfig & | config | ) | const |
Equality predicate.
| [in] | config | Object against which will be tested for equality. |
config. | UDQInput Opm::UDQConfig::operator[] | ( | const std::string & | keyword | ) | const |
Unprocessed input object for named quantity.
| [in] | keyword | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
keyword. Throws an exception of type if no such named UDQ exists. | UDQInput Opm::UDQConfig::operator[] | ( | std::size_t | insert_index | ) | const |
Unprocessed input object for enumerated quantity.
| [in] | insert_index | Linear index in order of appearance for an individual UDQ. |
keyword. Throws an exception of type if no such numbered UDQ exists. | void Opm::UDQConfig::required_summary | ( | std::unordered_set< std::string > & | summary_keys | ) | const |
Export all summary vectors needed to compute values for the current collection of user defined quantities.
| [in,out] | summary_keys | Named summary vectors. Upon completion, any additional summary vectors needed to evaluate the current set of user defined quantities will be included in this set. |
|
inline |
Convert between byte array and object representation.
| Serializer | Byte array conversion protocol. |
| [in,out] | serializer | Byte array conversion object. |
| std::size_t Opm::UDQConfig::size | ( | ) | const |
Total number of active DEFINE and ASSIGN statements.
Corresponds to the length of the vector returned from input().
| const std::string & Opm::UDQConfig::unit | ( | const std::string & | key | ) | const |
Retrieve unit string for a particular UDQ.
| [in] | key | Unqualified UDQ name such as FUNNY, GUITAR, WURST, or SUSHI. |
key. Throws an exception of type if no unit string exists for key.