- Use std::vector<HydroCarbonState> instead of std::vector<int>
- Use the initializer list to initialize members in constructors
- Fix indent
- Return OilOnly for cases without gas to avoid potential trouble
further down the line
The following hydroCarbonState are used
enum HydroCarbonState {
GasOnly = 0,
GasAndOil = 1,
OilOnly = 2
};
Cells almost filled with water are treated as a GasAndOil state
The hydroCarbonState is used to store the hydroCarbonState
State 1: Gas only
State 2: Gas and Oil
State 3: Oil only
An empty vector is return at initialization as
no default values are provided by the blackoilstate.
@bska We're merging as-is for now, and we've made a note to replace `shared_ptr` and maintain (and document!) this property. Those changes will obviously be internal and you won't notice a difference.
- Handle shut wells
- Use the groups control type to determine which phase to calculate
the guide rates from. i.e for a ORAT controlled group, calculate the
guide rates from the oil phase well potentials etc.
Note that this is quite strange since opm-core is upstream and not downstream
from opm-grid. However, when this file is used from opm-autodiff the macro is used.
The default guide rates are caculated using the well potentials.
The well potentials are calculated in the simulator and given as input
to the wellsManager.
Have removed the SimulatorState base class, and instead replaced with
the SimulationDatacontainer class from opm-common. The SimulatorState
objects were typcially created with a default constructor, and then
explicitly initialized with a SimulatorState::init() method. For the
SimulationDataContainer RAII is employed; the init( ) has been removed -
and there is no default constructor.
the typo was caused the surface density of the oil phase to be used
instead of the one of gas. This caused the density to be off by a
factor of typically about 900.
using saturated FVFs does not change much, but it does not hurt
because it is also done that way in the simulator.
This makes the defaults for the threshold pressures reasonable again,
but for some reason they are not exactly the same as in the old
implementation. (although the differences are very tolerable.)
On the question why only "Model 2" is affected by this: the other
decks don't use threshold pressures (SPE-X) or do not default any
values (Norne).
the dissolution factors used for the viscosities were always zero so
far. this was not discovered earlier because flow is completely
unaffected by this since the only place where this class is used in
flow is the equilibration code and the equilibration code does not
need phase viscosities.
thanks to @atgeirr for finding this.
the opm-material classes are the ones which are now used by
opm-autodiff and this patch makes it much easier to keep the opm-core
and opm-autodiff results consistent. Also, the opm-material classes
seem to be a bit faster than the opm-core ones (see
https://github.com/OPM/opm-autodiff/pull/576)
I ran the usual array of tests with `flow`: SPE1, SPE3, SPE9 and Norne
all produce the same results at the identical runtime (modulo noise)
and also "Model 2" seems to work.
Upstream (opm-parser) now provides a better Equil + EquilRecord, and
simultaneously deprecated EquilWrapper. This patch fixes the resulting
breakage.
One important note: The new Equil does not expose integers for live
oil/wet gas initialization procedure methods, but rather booleans
through constRs/constRv methods. This is how the variable behaves
according to the Eclipse reference manual (EQUIL keyword section).
Code has been updated to reflect this.
1. Added method setCellDataComponent()
2. Removed setFirstSat()
Implemented saturation initialisation using setCellDataComponent()
instead of setFirstSat(). This way the template<class Props> has been
removed from the SimulatorState class.
While the patch is quite trivial (some forgotten 'const'), the havoc
was caused because I usually configure my modules with --disable-tests
(to get much better turn-around times when switching all modules from
debug to optimization flags) and the usual way to force them to
compile ('make test-suite') does not work for opm-core...
opm-parser#677 changes the return types for the Deck family of classes.
This patch fixes all broken code from that patch set.
https://github.com/OPM/opm-parser/pull/677
at least, don't special case that much. This caused a discrepancy with
the opm-material PVT relations for Norne after 23 report steps. (which
takes an hour or two to get to with debugging options on my machine.)
As you can probably imagine, finding this was *a lot* of fun...
Several files stopped compiling due to relying on opm-parser headers
doing includes. From opm-parser PR-656
https://github.com/OPM/opm-parser/pull/656 this assumption is no longer
valid.
The volume in cells with pore volume less than the minpv threshold is
removed if minpvMode is ECLStd while it is added to the underlying cell
if minpvMode is OpmFil
I have doubts if this will change anything in the binaries (and in my
personal opinion, these 'const's look quite ugly and are sometimes a
(small) annoyance when debugging), but I don't mind using the coding
style used by most of the rest of opm-core here.
we're correcting the pressure at the cell center depths to get the
pressure at the face depth, not the other way around. This is
confusing...
thanks to [at]totto82 for discovering this.
This needs to be done if a equilibration region transition is
mentioned by the THPRES keyword, but no value is given for this record
in the third item. (it seems that this is used quite frequently.)
Also, the approach taken by this patch also does not collide with the
restart machinery as far as I can see. This is because the initial
condition is applied by the simulator before the state at the restart
time is loaded. (I interpreted the code that way, but I could be
wrong, could anyone verify this?)
since it is pretty elaborate to calculate initial condition, this
patch is pretty messy. I also do not know if Eclipse does include
capillary pressure in this calculation or not (this patch does). Huge
kudos go to [at]totto82 for reviewing, testing and debugging this.
This should prevent misunderstandings about what the
well_index_on_proc is. It is not the well_index according to
the eclipse state (on open wells count) but the index of the
wells that are stored on this process' domain.
In the parallel run there are cases where wells perforate cells
that are neighbors of overlap/halo cells. On other process only
parts of the well are seen as perforations. These wells should be
ignored there. While the well was indeed ignored, the perforations
found where mistakenly added to the well found due not clearing the
wellperf_data[well_index]. This commit now does this clearing and
results in the right handling of wells for e.g. SPE9.
This is needed in parallel runs where the rock properties will not
be read from the deck but be communicated from a master process. Nevertheless
we need to be able to initialize the data structures with the correct
container size. In addition we need to be able to change the container values
from opm-autodiff's BlackoilPropsDataHandle.
This silences warnings. It also makes it clear that
the cell thicknesses are not used in the current
algorithm, the doc comment has been updated to
reflect this.
This PR adds allow_cf to the wells structure that determine whether
crossflow is allowed or not. An extra argument is added to addWell(..)
to specify the allow_cf flag.
While hopefully not a bug it raises an exception with gcc's
libc debugging mode. Therefore we resort to using C++11's
std::vector::data instead.
The exception was rosen when running SPE9 in parallel.
This commit introduces a new public method, activeRegions(), that
retrieves those region IDs that contain at least one active cell.
We furthermore extend the cells() method to support lookup of
arbitrary region IDs. Non-active region IDs produce empty cell
ranges.
Intended use case is
for (const auto& reg : rmap.activeRegions()) {
const auto& c = rmap.cells(reg);
// use c
}
calculations
The dz calculated in WellDetails::getCubeDim is not correct in cases
where the face centroid of the horizontal faces is located above or
below the face centroid or the vertical faces. The cell thickness in
EclipseGrid, calculated using the Z-coordinates, is therefore used
instead.
Unused methods and arguments have been removed,
and we avoid including the EclMaterialLawManager
in the header. Clients IncompPropertiesFromDeck
and BlackoilPropertiesFromDeck have been updated.
There is a sligth difference between the cell depth taken from the
centroid (opm) and a straightforward average of corner coordinates
(ecl). For the initialisation of Norne this causes some differences
when deciding cell center positions relative contact depths.
If on one process a well completion is next to border then
it might also be stored in the neighbor process. Still not
all the completions of the well are known to the neighbor.
This breaks the previous assumption that for each well all
completions must belong to the partition of the process.
Therefore with this commit we allow wells that only have a
part of their completions assigned to the partition of the process.
This wells are deactivated under the assumption that they must
exist completely on another process due to the partitioning.
- use time stepping algorithm pid instead of pid + iter
Adjusting the time-steps on the number of linear iterations does
currently not give any improvents on the time-stepping.
- Change the pid tolerance. The time-stepper will take longer time-steps
and thus reduce the simulation time significantly. The Norne and the SPE
results does not degrade
- Less aggressive reduction of time-steps after convergence problems
Previously well with just some shut completions errorneously triggered an
exception in parallel runs. This is fixed with this commit.
Due to the logic shut completions will always be marked as existing
on a process. (Initially all completions are marked as found. For
each open completion we check whether the cartesian index belongs to
the local grid. If that is not the case we mark it as not found).
Therefore we now check whether the found number of completions
is either the number of shut completions or the number of all completions.
In the former case the well is not stored on this process, and in the latter
case it is. In other cases we throw an exception.
gcc-4.7.2 (Debian 4.7.2-5) complained about:
"‘for’ loop initial declarations are only allowed in C99 mode
note: use option -std=c99 or -std=gnu99 to compile your code"
when seeing a loop like
for(int i=0; i<end; ++i)
This is fixed by moving the declaration before the for loop with
this commit. Altenatively, we could use the above option.
Previously there was an assertion whether the time stepping is still
running when querying the time step. After commit 5af794cfd5 this
triggered an assertion for Norne. As there is no reason to limit querying
the current time step in this way. This commit simply removes the assertion
in AdaptiveSimulatorTimer::currentStepLength.
This closesOPM/opm-autodiff#446
Model 2 partly uses PORO=0.0 to signal inactive cells. This PR
prevents such cells from causing unwanted zcorn modifications in
the current min-pv algoritm. (The problem is however more general as
zero PORO or NTG should kill a cell whether MINPV is active or not,
refer kw ACTNUM.)
In a constructor initialisation list, the order should be the same
as the order in which the variables actually are initialised, which
is given by the order they are declared in the class and not by the
order in the initialisation list.
The function used integer abs() instead of fabs(), in C abs() only
takes integers so this is an error. Also needed to add comparison
with absolute tolerance to get reasonable behaviour (comparing 0 versus
0.0000000000001 is ok here).
this caused the hysteresis saturation shifts to be initially wrong and
was probably the source of a lot of my confusion w.r.t. the saturation
scaling and hysteresis shift code. I guess this also fixes a valgrind
complaint, but I haven't checked...
"old" == "gcc 4.4". the standard c++ library of this compiler seems to
invoke the copy operator when creating objects in a vector, whereas
newer versions of the library don't. The problem is that std::unique
pointer cannot be copied because it is -- err -- unique and thus the
implicit copy operator for the SatFuncMultiplexer class gets deleted
by the compiler.
the fix is to introduce a "fake" copy operator which does not do
anything but is present to make std::vector of stdlibc++-4.4
happy. this is obviously not very elegant, but I could not come up
with a better solution. (another fix would be to use raw pointers
instead of std::unique_ptr, but IMO this does not qualify as
"better".)
basically, we now store a pointer to the base class and convert this
to the concrete incarnation of the saturation function. the only
disadvantage of this is that it requires to allocate the concrete
objects dynamically, i.e., there's another layer of indirection. On
the plus side it saves a few bytes per object and it makes things
quite a bit simpler, so it is a win IMO.
thanks to [at]atgeirr for suggesting this.
this makes it possible to switch to different saturation functions
again. So far the only supported function besides the default one is
the one which implements the "Stone 2" model.
this means the following changes:
- the "SatFuncGwseg" class is converted
- for now, Gwseg is the only saturation function supported by
SaturationPropsFromDeck. (will be changed in later commits.)
- the funcForCell() method of SaturationPropsFromDeck is removed as it
just occludes things
in any reasonable simulator which reads an ECL deck the deck is going
to decide which saturation function is to be used and not the outside
code. also, the table this which function will be using is not really the
calling code's business. (for any reasonable deck it is always going to
be a non-uniform table so it makes a lot of sense to avoid unnecessary
complexity IMO.)
this patch temporarily removes the ability to use anything except the
ECL default saturation function ("Gwseg"). this ability will be
restored later in this patch series.
namely BlackoilStateToFluidState which takes a BlackoilState object
and exposes it as a opm-material like fluid state object. Similar for
ExplicitArraysFluidState, which takes raw arrays.
since fluid states are a local API, the index of the cell to be used
for these two classes must be set externally. The advantage of this
concept is that it is possible to make "saturation functions" which
not only depend on saturations but also on arbitrary other quanties
(like temperature or phase composition) without having to change the
API of the "saturation" functions.