Commit Graph

5802 Commits

Author SHA1 Message Date
Bård Skaflestad
b1067dbc98
Merge pull request #793 from joakim-hove/serialize-summary-state
Add serialization of SummaryState
2019-06-05 15:45:13 +02:00
Bård Skaflestad
4cde0ac8a8
Merge pull request #796 from bska/ERst-separate-files
Teach ERst About Separate Restart Files
2019-06-04 23:53:06 +02:00
Bård Skaflestad
a3074d12b5 Teach ERst About Separate Restart Files
This commit makes class 'Opm::EclIO::ERst' able to open separate
restart files (*.X000n, *.F000n).  Specifically, we refactor the
existing class constructor body into a new helper function
'initUnified'.  We add a new helper function 'initSeparate' that
builds the requisite indices in the case of a single report step,
and make the constructor body call 'initUnified' or 'initSeparate'
depending on whether or not the SEQNUM keyword exists in the restart
stream.

Add two new unit tests to exercise the new ability.
2019-06-04 11:01:13 +02:00
Joakim Hove
6af9b00bee
Merge pull request #792 from bska/save-using-EclOutput
Re-implement RestartIO::save() in Terms of OutputStream::Restart
2019-06-03 22:57:39 +02:00
Joakim Hove
ec20274fa3 Add serialization of SummaryState 2019-06-03 14:55:38 +02:00
Bård Skaflestad
8d65ba4e49 OutputStream::Restart: Don't Mention 'prepareStep'
The member function does not exist.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
16e49a0223 RestartIO: Reimplement save() in Terms of OutputStream::Restart
This commit switches the file handling operations of the gateway
function RestartIO::save() to using the OutputStream::Restart
component.  Briefly, this means replacing write_kw() function calls
with calls to Restart::write(), especially since the latter natively
handles PaddedString<8> data.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
c98bf7d4c8 Ecl Output: Add write<>() Support for PaddedOutputString<8>
This is in preparation of using the EclOutput output facility in

    RestartIO::save()
2019-06-03 14:19:48 +02:00
Bård Skaflestad
725ac521ba Promote 'CharArrayNullTerm' to EclIO::PaddedOutputString
Space-padded vectors of N (usually 8) characters is the typical
representation of character data in ECLIPSE output files.  Support
this type natively in the ECLIPSE IO library.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
82b0a2d82b ECLIPSE I/O: Rename Namespace Opm::ecl -> Opm::EclIO
This reduces the risk of conflicting with the 'ecl' namespace from
LibECL, especially when the latter name is used from within the Opm
namespace.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
cb106240bf
Merge pull request #794 from joakim-hove/summary-state-totals
Correctly detect totals in SummaryState
2019-06-03 14:17:34 +02:00
Joakim Hove
89c8cb886b Correctly detect totals in SummaryState 2019-06-03 12:42:51 +02:00
Bård Skaflestad
9aee2bee71
Merge pull request #668 from joakim-hove/udq-fieldset
UDQ field and group variables
2019-06-03 12:01:37 +02:00
Bård Skaflestad
0757bd97cf
Merge pull request #791 from bska/restart-output-code-reformat
Restart Output Code Reformatting
2019-05-29 11:07:17 +02:00
Bård Skaflestad
add1a96d99 Restart Well Data: Restore Indentation
Whitespace only.
2019-05-29 09:28:40 +02:00
Bård Skaflestad
8eda3aaa15 Restart::save(): Prune 'sim_step' Where Possible
Enabled by commit 94b16025.
2019-05-29 09:12:58 +02:00
Joakim Hove
32a1c3b5da
Merge pull request #762 from joakim-hove/well-controls
Well controls
2019-05-29 06:46:47 +02:00
Arne Morten Kvarving
7ec2ee9bff
Merge pull request #789 from akva2/fix_filesystem_generic
fixed: avoid usage of boost::filesystem::path::generic()
2019-05-28 09:11:37 +02:00
Arne Morten Kvarving
c9d1c50986 fixed: avoid usage of boost::filesystem::path::generic()
this is not supported in older version of boost::filesystem.
furthermore, it was always an experimental feature and
and has been deprecated in newer versions.

generic_string is available in all versions, so use that.
2019-05-28 06:28:57 +02:00
Joakim Hove
48c363dafa
Merge pull request #783 from bska/add-restart-io-operations
Add Restart I/O Operations to New ECLIPSE I/O Classes
2019-05-27 23:06:54 +02:00
Bård Skaflestad
a2ec7d7f6d OutputStream::Restart: Pull File Creation Into Constructor
Then we don't have to store copies of the 'formatted' and 'unified'
flags, and are also able to remove the 'prepareStep()' function.  We
will reintroduce these features if we decide to add support for
keeping the output stream open between separate restart output
requests (i.e., between calls to EclipseIO::writeTimeStep()).
2019-05-27 21:00:52 +02:00
Bård Skaflestad
df1a011b78 Redo Public Interface of OutputStream::Restart
In particular, make the stream() function into a private detail of
the implementation and add an overload set for outputting keyword
data and messages to the underlying output stream.  Update unit test
accordingly.

Suggested by: Atgeirr F. Rasmussen
2019-05-27 21:00:52 +02:00
Bård Skaflestad
992d3b0ce5 Restart Output: Add File Management Facility
This commit introduces a new class,

    Opm::ecl::OutputStream::Restart

that handles the details of opening restart output streams (all
combinations of formatted/unformatted and unified/separate), as well
as correctly positioning the stream 'put' indicator if we're opening
an existing unified restart file.  In most cases, this will be a
simple append operation (std::ios_base::app), but there are some
subtleties that require more precise control.  The new class is
befriended by EclOutput and ERst in order to access private member
functions and data members of these classes.  That is needed in
order to handle file resize operations since some of the requisite
information is only available in those two classes.

We use Boost.Filesystem to implement file resize, as if by POSIX
function ::truncate(), and also to simplify filename generation.
These calls can be switched to std::filesystem once the project
requires C++17.

Intended use of the Restart class is

    Restart rst(resultSet, formatted, unified);
    rst.prepareStep(17);  // Report step/SEQNUM 17.

    rst.write("INTEHEAD", ihead);
    // ...

The 'prepareStep' operation opens the file stream (if needed) and
also outputs a SEQNUM record in the case of a unified output stream.
Moreover, the 'resultSet' is a pair of output directory and case's
base name (e.g., "./mpi.np4/2019.05.14.01" and "NORNE_ATW2013") and
the formatted/unified flags are bools wrapped in structures.

The Restart class is intended to take over the role of the
'filename' string parameter of RestartIO::save().

Add a set of unit tests to demontrate usage and abilities of class
Restart.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
c71f57f635 Ecl Output: Add Support for Opening File in Specific Mode
This commit extends the EclOutput constructor to support letting the
client specify a particular open mode.  This in turn prepares using
EclOutput as the basis for a restart file writer.  Passing
mode=openmode::out is the common case for a new restart file, while
mode=openmode::app is the common case for an existing restart file.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
2580a273f4 Ecl Output: Add Support for Generating Messages
Specifically, add a member function

    EclOutput::message(const std::string&)

that outputs the string as an 'eclArrType::MESS'.  This is in order
to support outputting 'STARTSOL' and 'ENDSOL' demarcations in a
restart file.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
b9aeeab005 ERst: Support Retrieving File Position of Particular SEQNUM
This commit introduces a new member function,

    ERst::restartStepWritePosition(seqnum)

that translates a SEQNUM ID into a std::streampos object pointing to
the start of the data for that SEQNUM ID.  Return std::streampos(-1)
if the sequence number exceeds all known sequence numbers in this
restart set.

The member function is private because it is supposed to be called
only by the class itself and a select set of class friends.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
0dfe6ce7da Ecl File: Add Method to Convert Linear Array Index to File Position
This commit introduces a new member function

    EclFile::seekPosition(arrayIndex)

that retrieves the file (seek) position of the start of the header
of the arrayIndex-th keyword.  The expected use case for this is
seeking to the start of a particular SEQNUM value in a unified
restart file.  If the array index exceeds all supported index
values, then we return the position of the file's EOF mark (captured
as the last item in the EclFile constructor).

The member function is protected to be accessible in derived classes
and by friends of derived classes.
2019-05-27 21:00:52 +02:00
Joakim Hove
2682eef9b3
Merge pull request #788 from joakim-hove/remove-welltest
Removed well testing from Schedule constructor
2019-05-27 20:13:45 +02:00
Joakim Hove
8189dd8c9f
Merge pull request #785 from joakim-hove/summary-state-num
Add size() and num_wells() methods to SummaryState
2019-05-27 20:13:35 +02:00
Joakim Hove
5c65299c0a Add size() and num_wells() methods to SummaryState 2019-05-27 17:56:27 +02:00
Joakim Hove
35a70310c6 Removed well testing from Schedule constructor 2019-05-27 17:47:55 +02:00
Joakim Hove
54af290cc0 Extend UDQ eval code
With this commit the code to evaluate UDQ values has been extended/refactored in
many ways:

 - There is an increased awarenwss of variable type, i.e. a well related UDQ
   versus a field related UDQ. The variable type flows through the AST, and it
   is verified that the expression to evaluate and the target variable are of
   compatible types.

 - Have added support for UDQ field variables and UDQ group variables.

 - The UDQSet type and the UDQDefine::eval() have been refactored to multiplex
   on all the UDQ types, and the specialized UDQWellSet has been removed.
2019-05-27 16:43:22 +02:00
Joakim Hove
c8b0988191 Add size() and num_wells() methods to SummaryState 2019-05-27 16:43:22 +02:00
Joakim Hove
e6b8e53d0a
Merge pull request #786 from joakim-hove/summarystate-group-var
Add group awareness to SummaryState
2019-05-27 16:43:00 +02:00
Joakim Hove
779a2b8d89 Add group awareness to SummaryState 2019-05-27 14:38:13 +02:00
Joakim Hove
0c23aafc34
Merge pull request #784 from joakim-hove/UDQ-test-only-one
UDQ error test - use correct well variablec
2019-05-27 12:32:01 +02:00
Joakim Hove
4439882402 UDQ error test - use correct well variablec 2019-05-27 09:44:14 +02:00
Joakim Hove
8e87ffc7da
Merge pull request #781 from akva2/janitoring
Remove unused variables and reduce scope
2019-05-24 15:44:48 +02:00
Joakim Hove
418241137c Rebase fixup 2019-05-24 15:31:27 +02:00
Joakim Hove
01db100439 WellProductionProperties and WellInjectionProperties are private 2019-05-24 15:31:27 +02:00
Joakim Hove
e3d9ef07eb Temporarily reverted UDA -> double in keyword def. 2019-05-24 15:31:27 +02:00
Joakim Hove
51aee6e8cb Add structs InjectionControls and ProductionControls 2019-05-24 15:31:27 +02:00
Joakim Hove
73667596fc Add some testing 2019-05-24 15:31:27 +02:00
Arne Morten Kvarving
9dacc42c8a reduce scope of variables 2019-05-24 14:31:26 +02:00
Arne Morten Kvarving
8fdb08b0ad remove unused variables 2019-05-24 14:31:21 +02:00
Joakim Hove
0942e2dce1
Merge pull request #720 from GitPaean/throw_for_problem_in_compsegs
throw when end distance not bigger than start distance in COMPSEGS
2019-05-24 13:34:45 +02:00
Kai Bao
01c0820d4c addressing reviewing comments from PR#720
and adding more tests
2019-05-24 10:19:50 +02:00
Kai Bao
d11d26a2f1 adding test WrongDistanceCOMPSEGS 2019-05-24 10:19:50 +02:00
Kai Bao
584defebe0 ParseContext is used to handle the exceptions when parsing COMPSEGS 2019-05-24 10:19:50 +02:00
Kai Bao
43c5d3509a throw when end distance not bigger than start distance in COMPSEGS 2019-05-24 10:19:50 +02:00