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
if the base fluid state returns a reference, the overlay fluid state
should just pass it through instead if copying it. The difference
became relevant with the introduction of Evaluations for localized
AD. (is not relevant if Scalars are floating point values, which was
the only choice when the overlay fluid states were written.)
the problem is that references to lvalues can be just passed through,
whilst the objects the rvalue references point are temporary and thus
need need to be copied. Fixing this issue forced me to go into the
rabbit hole of the c++ memory model, but at least I guess I now know
what rvalue references ('Foo&&' instead of 'Foo&') are good for...
this avoids converting Rs and Rv to mass fractions (as provided by the
generic fluid system API) just to immediately convert them back to
dissolution factors (as required by the blackoil PVT objects).
Note that the implementation of this is a bit ugly because it requires
advanced C-preprocessor usage and higher
template-meta-programming-foo. Any ideas of how to do this in a
simpler fashion are welcome.
the primary goal of this patch is to implement what's currently
provided by the opm-core PVT classes, and it is thus not very
comprehensive: some non-standard keywords are required (e.g.,
GCOMPIDX), there has been some guess-working going on, some approaches
are only consequences of what the ECL documentation says (but is not
mentioned explicitly anywhere) and the relations for enthalpy are
still missing (i.e., the quanties provided are insufficient to
implement an energy conservation equation).
the patch works by adding a boolean 'enableTemperature' template
parameter to the multiplexer classes which is set to 'true' by
default. if it is detected that the PVT properties are thermally
dependent the respective *PvtThermal class is used (which in turn
creates an isothermal multiplexer internally).
the schema for the names of the thermal PVT classes
(${PHASE}PvtThermal) is a bit inconsistent with that used for
isothermal PVT classes (${APPROACH}${PHASE}Pvt) which was done to
avoid naming conflicts with the current opm-core PVT classes.
this makes things go less in circles: before this patch, the
interpolation happened on the inverse formation volume factors, the
PVT classes inverted the result to get the FVF and then the calling
code divided by what fell out of this. Now, the calling code can
directly multiply with the result of the interpolation.
now if the object is initialized using the initFromDeck() method, a
call to initEnd() is not required anymore. IMO, this makes the API
easier to use and more bullet-proof.
i.e., after this all headers are supposed to be fully autonomous again
and can thus be included without preconditions. this property broke
when OPM/opm-parser#656 was merged.
for some unit tests the precision of `float` is insufficient. To at
least enforce that the tested code compiles with `float` as Scalar,
they are wrapped by `while(false)` statements.
normally this is not a problem, but template functions which take two
arguments, will break, i.e., the following will not compile
```c++
float f = 1.23;
std::max(f, 2.0*f);
```
this is because the second argument for max gets silently cast to
`double` which causes the compiler to be confused because it cannot
determine a uniform type for the arguments passed to
std::max<T>(a, b)...