Commit Graph

46 Commits

Author SHA1 Message Date
Atgeirr Flø Rasmussen
f1ae040aef Removed erroneous comment. 2014-01-31 14:07:30 +01:00
Atgeirr Flø Rasmussen
9f253eb9ae Add summary output of bottom hole pressures. 2014-01-30 14:18:09 +01:00
Atgeirr Flø Rasmussen
445800f738 Fix summary output, now contains output for all steps.
Previously, the summary output was rewritten for each step,
leaving only the last step's data in the summary data file.
2014-01-30 11:36:31 +01:00
Roland Kaufmann
392c6b3892 Actually use transformation function that was passed 2013-11-28 19:34:47 +01:00
Roland Kaufmann
7eeb381f45 Fix grammatical error in comment 2013-11-28 11:37:39 +01:00
Roland Kaufmann
039e549033 Allow sequentially layed out arrays to be indexed
If we want to index into two arrays that has been concatenated (for
instance oil phase pressure continuously, then water phase pressure
continuously), then this variant (courtesy of @bska) will cover both
variants (intermixed striding (where offset < stride) and sequentially
striding (where offset > stride)).
2013-11-28 11:10:52 +01:00
Roland Kaufmann
a997c17a51 Offset is irrelevant for the number of records
We are interested in how many records there are, since we extract one
item per record. The offset is just used to index into each record, and
doesn't affect the total number of records.
2013-11-28 01:04:03 +01:00
Roland Kaufmann
a0a574b01a Use the previous step length to calculate historic rate 2013-11-27 00:37:40 +01:00
Roland Kaufmann
9cba2591e9 Do without the timestep index adjustment
If the output routines are called at the right place in the simulator,
then the numbering scheme coincide with that of Eclipse, and no
adjustments are necessary.
2013-11-27 00:24:30 +01:00
Roland Kaufmann
9bcb7aed30 Convert permeability to milli-Darcy when writing 2013-11-26 23:43:58 +01:00
Roland Kaufmann
d62226dd3c Introduce conversion function to avoid explicit copy
We already copy the data once from the OPM state into the ERT-managed
memory, so we may as well fudge a conversion routine in there (at the
expense of having to do this everywhere).
2013-11-26 23:22:25 +01:00
Roland Kaufmann
c3e0b83927 Write initial solution when the writer is initialized 2013-11-26 22:34:42 +01:00
Roland Kaufmann
7e349636c1 Propagate initial state to the writer as well
The writeTimeStep method is called *after* each timestep and does
not include the initial state of the reservoir. If the writer wants
to dump the initial state of the reservoir, this must be done in
writeInit, which is called before the simulator is run, but after
the initial state has been set up.
2013-11-26 22:34:42 +01:00
Roland Kaufmann
1c0051b40e Factor out code that writes solution field variables
We will reuse this later for also writing the initial solution.
2013-11-26 22:34:42 +01:00
Roland Kaufmann
e7da0053cf Allow timestep index to be overridden
The Eclipse timestep index can not always be retrieved from the
SimulatorTimer object; the initial state is 0 in Eclipse (and does not
have an index in OPM), and the timestep in OPM is not increased until
*after* the timestep is completed (i.e. it is not initialized to -1).
2013-11-26 22:34:42 +01:00
Roland Kaufmann
6becc16567 Don't use the wrong index for the timestep 2013-11-26 14:08:17 +01:00
Roland Kaufmann
d15056be11 Added comment about header/data for each timestep
We would like to build up and write the header only once (with
ecl_sum_fwrite_smspec) and then the data for each timestep (with
ecl_sum_fwrite_step), but since the data attach to the summary
object and so does the header, how do we keep the header in memory
without also accumulating all the data?
2013-11-26 12:28:56 +01:00
Roland Kaufmann
d67088b15d Let timestep and well report be owned by summary
Instead of calling the destroy functions for the timestep and well
report objects, the ERT memory allocated for these are contained in
the summary handle and freed together with that.

The timestep and well report objects thus becomes only views into this
memory; it is no longer allowed for these to outlive the summary section
(not that this was ever sensible in the first place).
2013-11-26 10:46:10 +01:00
Roland Kaufmann
e806be8f83 Setup a new summary section for each timestep
Although this will lead to parsing the same input data over and over
again (setting up the smspecs for the wells), the summary files contain
this redundant information because in Eclipse, wells can appear and
disappear during the run.
2013-11-26 10:16:30 +01:00
Roland Kaufmann
aff6fad661 Use more generic simulator state
We can dump the state of the two-phase incompressible simulators as
well as the blackoil simulators by just using the common interface.
2013-11-25 14:14:51 +01:00
Roland Kaufmann
754ff4c2ee Use std namespace for div function
Although GCC 4.6.3 implements div by including stdlib.h (where
everything is put in the global namespace), and then importing these
into std, not every compiler does this (one could for instance think
that in #include <stdlib.h> inside the namespace).
2013-11-25 14:14:50 +01:00
Roland Kaufmann
f45f7d19a0 Don't copy data needlessly 2013-11-25 14:14:50 +01:00
Roland Kaufmann
f83d581e42 Correct number of elements taken from strided arrays
If we have a stride > 1, then we take fewer elements from the array;
the old code would fill in a bunch of unrelated data at the end.
2013-11-25 14:14:50 +01:00
Roland Kaufmann
06fffedc4f Revert "Data copying takes an iterator"
The original rationale for commit c39d367 was to pass a pointer since
this was all we got from one of the APIs. However, just after the code
was changed to copy the data anyway since it would have to be converted
from double to float.

Reverting actually serves a purpose; as @bska pointed out, taking
&data[0] of an empty vector is undefined, whereas it now checks the
size and assert here (and not in the standard library) on that condition.
2013-11-25 14:14:50 +01:00
Roland Kaufmann
24b6bd8254 Refactor common code into a function 2013-11-25 14:14:50 +01:00
Andreas Lauser
e57d1697c2 Get dimensions for Cartesian grids
For SPE1, the output writer must also support specifying the grid
via the D[XYZ]V keywords instead of relying on the SPECGRID keyword
2013-11-25 14:14:50 +01:00
Andreas Lauser
f980350af2 Handle empty outputDir setting
The output dir must not be empty or else file names like "/FOO.INIT"
are generated which normally result in a segfault.
2013-11-25 14:14:50 +01:00
Roland Kaufmann
419cffe73b Define destructor in .cpp to handle forward-def field
The EclipseSummary field is just forward declared in the header, and
the compiler cannot create a proper destructor based on just that. If
we define it in the compilation unit, it will get instantiated there
once and for all and the compiler won't try to create it (and leave it
to the linker to sort out duplicates) everywhere the header is used
(which may be in another module, even).

This is similar to commit 18b9f2b for SimulatorOutput.
2013-11-25 14:14:50 +01:00
Roland Kaufmann
8e6ccadfc3 Convert timestep numbers to correct base 2013-11-25 14:14:50 +01:00
Roland Kaufmann
c3bcd6c83c Use all uppercase in filenames
ERT already does the conversion for *some* of the files; we might as
well convert all the names so that there is no confusion.
2013-11-25 14:14:50 +01:00
Roland Kaufmann
d83d7d829c Writing output should not change the state
Therefore we take const parameters across the board. (This is a
follow-up to the patch which declared the UnstructuredGrid const).
2013-11-25 14:14:50 +01:00
Roland Kaufmann
eb276f79e1 Eliminate redundant timestep class
Since all construction should go through the wrapper method, and the
class otherwise just handed everything down to the base class, we might
as well inline everything in there to avoid someone starting to make
their own objects of this type.
2013-11-25 14:14:49 +01:00
Roland Kaufmann
06c370009a Add timesteps to a list and write at once in summary
Instead of having each timestep available just locally in the
writeTimeStep method, which will free the memory and create a
corruption error, keep all timesteps on a free list in the summary,
and do all the writing in the destructor there (the memory of the
individual timesteps will have to linger on anyway).
2013-11-25 14:14:49 +01:00
Roland Kaufmann
04ed5b23b4 Use timestep number as is
Why add one? They are already one based.
2013-11-25 14:14:49 +01:00
Roland Kaufmann
b9c667214d Write pressure and saturation as single-precision 2013-11-25 14:14:49 +01:00
Roland Kaufmann
f3df8d9cf9 Data copying takes an iterator, not necessarily vector 2013-11-25 14:14:49 +01:00
Roland Kaufmann
358f5f75c4 Use float instead of double keywords
ERT requires the type of the keywords that are passed to the grid
allocation routine to be float (and it is checked - causes abort if
there is a mismatch!)
2013-11-25 14:14:49 +01:00
Roland Kaufmann
1baf7369ef Use constant grid in output writing
Grid manager returns a const UnstructuredGrid*, and the entire chain
of pointer-passing glory should adhere to this const-ness.
2013-11-25 14:14:48 +01:00
Roland Kaufmann
e02f0cd7de Use processed grid to figure out active cell map 2013-11-25 14:14:48 +01:00
Roland Kaufmann
cec6f12f50 Store reference to UnstructuredGrid in EclipseWriter 2013-11-25 14:14:48 +01:00
Roland Kaufmann
ce7eb44836 Propagate UnstructuredGrid to the EclipseWriter ctor
The writer will need to know which cells are the active cells after
post-processing (because these are the cells there is stored results
for in the pressure and saturation arrays), and thus not only the
raw input grid (to get the COORD and ZCORN arrays which is not easily
detainable from the UnstructuredGrid), *and* the UnstructuredGrid
needs to be available.
2013-11-25 14:14:48 +01:00
Roland Kaufmann
568e597561 Use shared_ptr to signal lifetime requirement
The code is now allowed to use C++11, where shared_ptr is available
in the standard. To specify that the parser object must be present
for the output writer in its entire lifetime, we require to be passed
a shared_ptr. (This can be faked for local storage anyway).
2013-11-25 14:14:47 +01:00
Roland Kaufmann
7ea2f32bca Use correct order of saturation names
Due to a glitch the order of the names was put incorrectly in the file,
even though the comment stressed that it was important it was right!

Hat tip: @bska
2013-11-25 14:14:47 +01:00
Roland Kaufmann
39e7943618 Accomodate older versions of boost::filesystem
The return type of the path methods has changed in newer version of
Boost; by wrapping them with a new path object we can get a string
in a way that is compatible for both version 2 and 3.

Hat tip: @bska
2013-11-25 14:14:47 +01:00
Roland Kaufmann
b0b50618d0 Only write the declared phases to file
Only the phases that are specified in the input deck should be written.
Hence the class should work with both two- and three-phase simulations.
2013-11-25 14:14:47 +01:00
Roland Kaufmann
6f32b92f6c Renamed away extraneous verbosity in filenames 2013-11-25 14:14:47 +01:00