|
opm-common
|
File I/O management for reservoir description and dynamic results. More...
#include <EclipseIO.hpp>
Classes | |
| class | Impl |
| Internal implementation class for EclipseIO public interface. More... | |
Public Member Functions | |
| EclipseIO (const EclipseState &es, EclipseGrid grid, const Schedule &schedule, const SummaryConfig &summary_config, const std::string &basename=std::string{}, const bool writeEsmry=false) | |
| Constructor. | |
| EclipseIO (const EclipseIO &)=delete | |
| Deleted copy constructor. | |
| EclipseIO & | operator= (const EclipseIO &)=delete |
| Deleted assignment operator. | |
| ~EclipseIO () | |
| Destructor. | |
| void | writeInitial (data::Solution simProps=data::Solution(), std::map< std::string, std::vector< int > > int_data={}, const std::vector< NNCdata > &nnc={}) |
| Output static properties to EGRID and INIT files. | |
| void | writeInitial (std::vector< data::Solution >, std::map< std::string, std::vector< int > > int_data={}, const std::vector< NNCdata > &nnc={}) |
| void | writeInitial (std::vector< data::Solution >, std::map< std::string, std::vector< int > > int_data={}, const NNCCollection &nnc_col={}) |
| void | writeTimeStep (const Action::State &action_state, const WellTestState &wtest_state, const SummaryState &st, const UDQState &udq_state, int report_step, bool isSubstep, double seconds_elapsed, RestartValue value, const bool write_double=false, std::optional< int > time_step=std::nullopt, const bool isFinalWriteOut=false) |
| Write reservoir state and summary information to disk. | |
| void | writeTimeStep (const Action::State &action_state, const WellTestState &wtest_state, const SummaryState &st, const UDQState &udq_state, int report_step, bool isSubstep, double seconds_elapsed, std::vector< RestartValue > value, const bool write_double=false, std::optional< int > time_step=std::nullopt, const bool isFinalWriteOut=false) |
| Write reservoir state and summary information to disk for runs with local grid refinement. | |
| RestartValue | loadRestart (Action::State &action_state, SummaryState &summary_state, const std::vector< RestartKey > &solution_keys, const std::vector< RestartKey > &extra_keys={}) const |
| Load per-cell solution data and wellstate from restart file. | |
| data::Solution | loadRestartSolution (const std::vector< RestartKey > &solution_keys, const int report_step) const |
| Load per-cell solution data from restart file at specific time. | |
| const out::Summary & | summary () const |
| Access internal summary vector calculation engine. | |
| const SummaryConfig & | finalSummaryConfig () const |
| Access finalised summary configuration object. | |
File I/O management for reservoir description and dynamic results.
| Opm::EclipseIO::EclipseIO | ( | const EclipseState & | es, |
| EclipseGrid | grid, | ||
| const Schedule & | schedule, | ||
| const SummaryConfig & | summary_config, | ||
| const std::string & | basename = std::string{}, | ||
| const bool | writeEsmry = false ) |
Constructor.
| [in] | es | Run's static parameters such as region definitions. The EclipseIO object retains a reference to this object, whence the lifetime of es should exceed that of the EclipseIO object. |
| [in] | grid | Run's active cells. The EclipseIO object takes ownership of this grid object. |
| [in] | schedule | Run's dynamic objects. The EclipseIO object retains a reference to this object, whence the lifetime of schedule should exceed that of the EclipseIO object. |
| [in] | summary_config | Run's collection of summary vectors requested in the SUMMARY section of the model description. Used to initialise an internal SummaryConfig object that will additionally contain all vectors needed to evaluate the defining expressions of any user-defined quantities in the run. |
| [in] | basename | Name of main input data file, stripped of extensions and directory names. |
| [in] | writeEsmry | Whether or not to additionally create a "transposed" .ESMRY output file during the simulation run. ESMRY files typically load faster into post-processing tools such as qsummary and ResInsight than traditional SMSPEC/UNSMRY files, especially if the user only needs to view a small number of vectors. On the other hand, ESMRY files typically require more memory while writing. |
|
delete |
Deleted copy constructor.
There must be exactly one object of this type in any given simulation run.
|
default |
Destructor.
Needed for PIMPL idiom.
| const Opm::SummaryConfig & Opm::EclipseIO::finalSummaryConfig | ( | ) | const |
Access finalised summary configuration object.
Provided to enable callers to learn all summary vectors needed to evaluate defining expressions of user-defined quantities.
| Opm::RestartValue Opm::EclipseIO::loadRestart | ( | Action::State & | action_state, |
| SummaryState & | summary_state, | ||
| const std::vector< RestartKey > & | solution_keys, | ||
| const std::vector< RestartKey > & | extra_keys = {} ) const |
Load per-cell solution data and wellstate from restart file.
Name of restart file and report step from which to restart inferred from internal IOConfig and InitConfig objects.
The map keys should be a map of keyword names and their corresponding dimension object. In other words, loading the state from a simple two phase simulation you would pass:
keys = { {"PRESSURE" , UnitSystem::measure::pressure }, {"SWAT" , UnitSystem::measure::identity }, }
For a three phase black oil simulation you would add pairs for SGAS, RS and RV. If you request keys which are not found in the restart file an exception will be raised. This also happens if the size of a vector does not match the expected size.
The extra_keys argument can be used to request additional keywords from the restart value. The extra vectors will be stored in the 'extra' field of the return value. These values must have been added to the restart file previosuly with the extra argument to the writeTimeStep() method. If the bool value in the map is true the value is required, and the output layer will throw an exception if it is missing. Otherwise, if the bool is false missing, keywords will be ignored and there will not be an empty vector in the return value.
| [in,out] | action_state | Run's action system state. On input, a valid object. On exit, populated from restart file information. |
| [in,out] | summary_state | Run's container of summary vector values. On input, a valid object. On exit, populated from restart file information. Mostly relevant to cumulative quantities such as FOPT. |
| [in] | solution_keys | Descriptors of requisite and optional per-cell dynamic values to load from restart file. |
| [in] | extra_keys | Descriptors of additional dynamic values to load from restart file. Optional. |
| Opm::data::Solution Opm::EclipseIO::loadRestartSolution | ( | const std::vector< RestartKey > & | solution_keys, |
| const int | report_step ) const |
Load per-cell solution data from restart file at specific time.
Common use case is to load the initial volumes-in-place from time zero.
Name of restart file inferred from internal IOConfig and InitConfig objects.
The map keys should be a map of keyword names and their corresponding dimension object. In other words, loading the state from a simple two phase simulation you would pass:
keys = { {"PRESSURE" , UnitSystem::measure::pressure }, {"SWAT" , UnitSystem::measure::identity }, }
For a three phase black oil simulation you would add pairs for SGAS, RS and RV. If you request keys which are not found in the restart file an exception will be raised. This also happens if the size of a vector does not match the expected size.
| [in] | solution_keys | Descriptors of requisite and optional per-cell dynamic values to load from restart file. |
| [in] | report_step | One-based report step index for which load restart file information. |
report_step. Deleted assignment operator.
There must be exactly one object of this type in any given simulation run.
| const Opm::out::Summary & Opm::EclipseIO::summary | ( | ) | const |
Access internal summary vector calculation engine.
Mainly provided in order to allow callers to invoke Summary::eval().
| void Opm::EclipseIO::writeInitial | ( | data::Solution | simProps = data::Solution(), |
| std::map< std::string, std::vector< int > > | int_data = {}, | ||
| const std::vector< NNCdata > & | nnc = {} ) |
Output static properties to EGRID and INIT files.
Write static property data (grid, PVT curves, etc) to disk. Per-cell static property arrays are selected as follows:
| [in] | simProps | Initial per-cell properties such as transmissibilities. Will be output to the INIT file. |
| [in] | int_data | Additional integer arrays defined by simulator. May contain things like the MPI partition arrays. Will be output to the INIT file. |
| [in] | nnc | Run's non-neighbouring connections. Includes those connections that are derived from corner-point grid processing and those connections that are explicitly entered using keywords like NNC, EDITNNC, or EDITNNCR. The cell pairs will be output to the EGRID file while the associate transmissibility will be output to the INIT file. |
| void Opm::EclipseIO::writeInitial | ( | std::vector< data::Solution > | simProps, |
| std::map< std::string, std::vector< int > > | int_data = {}, | ||
| const std::vector< NNCdata > & | nnc = {} ) |
| [in] | simProps | Vector of initial per-cell properties such as transmissibilities. Will be output to the INIT file. simProps[0] is expected to contain the properties for the "Global" grid simProps[i] for i > 0 is expected to contain the properties for the "LGR" grid, if it exists. |
| [in] | int_data | Additional integer arrays defined by simulator. May contain things like the MPI partition arrays. Will be output to the INIT file. |
| [in] | nnc | Run's non-neighbouring connections. Includes those connections that are derived from corner-point grid processing and those connections that are explicitly entered using keywords like NNC, EDITNNC, or EDITNNCR. The cell pairs will be output to the EGRID file while the associate transmissibility will be output to the INIT file. |
| void Opm::EclipseIO::writeTimeStep | ( | const Action::State & | action_state, |
| const WellTestState & | wtest_state, | ||
| const SummaryState & | st, | ||
| const UDQState & | udq_state, | ||
| int | report_step, | ||
| bool | isSubstep, | ||
| double | seconds_elapsed, | ||
| RestartValue | value, | ||
| const bool | write_double = false, | ||
| std::optional< int > | time_step = std::nullopt, | ||
| const bool | isFinalWriteOut = false ) |
Write reservoir state and summary information to disk.
Calling this method is only meaningful after the first time step has been completed.
The RestartValue contains fields which have been calculated by the simulator and are written to the restart file. Examples of such fields would be the relative permeabilities KRO, KRW and KRG and fluxes. The keywords which can be added here are represented with mnemonics in the RPTRST keyword.
If the optional argument write_double is sent in as true the fields in the solution container will be written in double precision. OPM can load and restart from files with double precision keywords, but this is non-standard, and other third party applications might choke on those.
| [in] | action_state | Run's current action system state. Expected to hold current values for the number of times each action has run and the time of each action's last run. |
| [in] | wtest_state | Run's current WTEST information. Expected to hold information about those wells that have been closed due to various runtime conditions. |
| [in] | st | Summary values from most recent call to Summary::eval(). Source object from which to retrieve the values that go into the output buffer. |
| [in] | udq_state | Run's current UDQ values. |
| [in] | report_step | One-based report step index for which to create output. This is the number that gets incorporated into the file extension of "separate" restart and summary output files (e.g., .X000n and .S000n). Report_step=0 represents time zero. |
| [in] | isSubstep | Whether or not we're being called in the middle of a report step. We typically output summary file information only for sub-steps. |
| [in] | seconds_elapsed | Elapsed physical (i.e., simulated) time in seconds since start of simulation. |
| [in] | value | Collection of per-cell, per-well, per-connection, per-segment, per-group, and per-aquifer dynamic results pertaining to this time point. |
| [in] | write_double | Whether or not to output simulation results as double precision floating-point numbers. Compatibility considerations may dictate outputting arrays as single precision ("float") only. |
| [in] | time_step | Current time step index. Passing something different than nullopt will generate restart file output even for time steps that are not report steps. This is a poor-man's approximation of the BASIC=6 setting of the RPTRST keyword. |
| [in] | isFinalWriteOut | True if this is the final write. |
| void Opm::EclipseIO::writeTimeStep | ( | const Action::State & | action_state, |
| const WellTestState & | wtest_state, | ||
| const SummaryState & | st, | ||
| const UDQState & | udq_state, | ||
| int | report_step, | ||
| bool | isSubstep, | ||
| double | seconds_elapsed, | ||
| std::vector< RestartValue > | value, | ||
| const bool | write_double = false, | ||
| std::optional< int > | time_step = std::nullopt, | ||
| const bool | isFinalWriteOut = false ) |
Write reservoir state and summary information to disk for runs with local grid refinement.
Calling this method is only meaningful after the first time step has been completed.
The RestartValue contains fields which have been calculated by the simulator and are written to the restart file. Examples of such fields would be the relative permeabilities KRO, KRW and KRG and fluxes. The keywords which can be added here are represented with mnemonics in the RPTRST keyword.
If the optional argument write_double is sent in as true the fields in the solution container will be written in double precision. OPM can load and restart from files with double precision keywords, but this is non-standard, and other third party applications might choke on those.
| [in] | action_state | Run's current action system state. Expected to hold current values for the number of times each action has run and the time of each action's last run. |
| [in] | wtest_state | Run's current WTEST information. Expected to hold information about those wells that have been closed due to various runtime conditions. |
| [in] | st | Summary values from most recent call to Summary::eval(). Source object from which to retrieve the values that go into the output buffer. |
| [in] | udq_state | Run's current UDQ values. |
| [in] | report_step | One-based report step index for which to create output. This is the number that gets incorporated into the file extension of "separate" restart and summary output files (e.g., .X000n and .S000n). Report_step=0 represents time zero. |
| [in] | isSubstep | Whether or not we're being called in the middle of a report step. We typically output summary file information only for sub-steps. |
| [in] | seconds_elapsed | Elapsed physical (i.e., simulated) time in seconds since start of simulation. |
| [in] | value | Collection of per-cell, per-well, per-connection, per-segment, per-group, and per-aquifer dynamic results pertaining to this time point. One collection per grid, with being results for the main/global grid and each additional element being results for a separate local grid. |
| [in] | write_double | Whether or not to output simulation results as double precision floating-point numbers. Compatibility considerations may dictate outputting arrays as single precision ("float") only. |
| [in] | time_step | Current time step index. Passing something different than nullopt will generate restart file output even for time steps that are not report steps. This is a poor-man's approximation of the BASIC=6 setting of the RPTRST keyword. |
| [in] | isFinalWriteOut | True if this is the final write. |