Commit Graph

107 Commits

Author SHA1 Message Date
Andreas Lauser
2f86c78dd8 Revert "Revert "[WIP] Evaluation: specialize evaluations for used numbers in Blackoil setting""
This reverts commit cfc79fd6d5.
2017-06-07 15:20:01 +02:00
Atgeirr Flø Rasmussen
a229ba0945 Silence warnings.
One shadowing and one unused variable.
2017-04-12 07:49:31 +02:00
Andreas Lauser
e88216d9d5 test_components: check the API comprehensively
for some reason some methods were untested up now.
2017-04-10 11:22:54 +02:00
Atgeirr Flø Rasmussen
cfc79fd6d5 Revert "[WIP] Evaluation: specialize evaluations for used numbers in Blackoil setting" 2017-03-28 13:26:10 +02:00
Andreas Lauser
2f44918a2b dense AD: fix a few stupid bugs
e.g., looping over the wrong range or an infinite loop. also, the
dense-AD unit test is shortend to test one specialization and the
unspecialized class.
2017-03-17 20:48:39 +01:00
Robert Kloefkorn
db46b907a2 Evaluation: specialize evaluations for used number in Blackoil setting
to increase performance. Also, change from unsigned to int because it's
better supported by compilers.
2017-03-14 14:49:24 +01:00
babrodtk
64bdc84a9f Add option to store/restore hysteresis parameters 2017-03-14 10:15:15 +01:00
Andreas Lauser
45da261142 move the '&' of references and the '*' of pointers to the type name
i.e., the new-style is `TypeName& var` instead of
`TypeName &var`. this patch is analogous to part of OPM/ewoms#83.
2017-01-18 17:57:54 +01:00
Andreas Lauser
19f1a27447 place the OPM_UNUSED macro after the variable name
this is analogous to OPM/ewoms#134.
2017-01-18 17:55:58 +01:00
Andreas Lauser
a607daa6e1 delete ClassName.hpp
it is now replaced in favour of Dune::className() from dune/common/classname.hh
2016-12-14 09:46:16 +01:00
Andreas Lauser
69b2ebc5c6 delete Unused.hpp
it is moved to opm-common. use that file instead.
2016-11-22 14:43:00 +01:00
Andreas Lauser
66ec787438 DenseAD: access the value and derivatives of Evaluations via accessor functions
this allows some flexibility of how an Evaluation object is
represented internally. the main motivation for this is to allow using
SIMD instruction which expect special data types as their operants.
2016-10-30 19:01:06 +01:00
Andreas Lauser
48d570afc5 DenseAD: add copyDerivatives(x) and clearDerivatives() methods to Evaluation
this makes it possible to implement these functions more
efficiently...
2016-10-30 19:01:06 +01:00
Jørgen Kvalsvik
2532f1e56e Update to shared_ptr-less parser interface. 2016-10-13 14:49:48 +02:00
Andreas Lauser
e33fc441b3 Dense AD convenience functions: introduce scalarValue(x) and getValue(x)
`getValue(x)` should be better called `value(x)` but this leads to
really cryptic compiler errors which seem to be related to the fact
that the Evaluation class has a `value` attribute (this is for GCC
5.2.1).
2016-08-11 16:54:15 +02:00
Andreas Lauser
d21a6fbefe dense AD convenience functions: add decay<LhsEval>()
with this, evaluation objects can be decayed via
`Opm::decay<Scalar>(x)`. since function templates do not require a
'template' qualifier, it is a bigger advantage for this function that
for the mathematical ones. (the conventional way to do this is way
more verbose:

```c++
Opm::MathToolbox<Evaluation>::template decay<Scalar>(x)
```
)
2016-08-11 16:43:10 +02:00
Andreas Lauser
9f465784a8 dense AD: introduce convenience functions
this PR was inspired by one of @atgeirr's recent comments. it allows
to get rid if the `MathToolbox<Eval>` detour for the dense AD code in
most cases: e.g. instead of writing

```c++
template <class Eval>
Eval f(const Eval& val)
{ return Opm::MathToolbox<Eval>::sqrt(val); }
```

one can simply write

```c++
template <class Eval>
Eval f(const Eval& val)
{ return Opm::sqrt(val); }
```

and it will work transparently with DenseAD `Evaluation` objects and
primitive floating point values.

one complication of this is that the type of the `Evaluation` object
does not need to be explicitly defined. for functions which take more
than one argument (like e.g. `pow()`, `min()` and `max()`), it is thus
assumed that the type of the result is the same as the type of the
first argument.

another drawback is that when both, the contents of the `Opm::` and
the `std::` namespaces are implicitly available, it is not clear to me
what's used for primitive floating point values. (it seems to compile
but IMO it could lead to surprising behaviour. thus, please only merge
if you consider the benefits of these convenience functions to be
greater than their drawbacks.)
2016-08-11 15:54:03 +02:00
Pål Grønås Drange
e7a89ea838 use ref constructor for EclipseState 2016-08-08 10:04:45 +02:00
Andreas Lauser
9074f1ccca blackoil PVT: treat the maximum oil saturation for VAPPARS a constant
also, only calculate a factor if the currently observed oil saturation
is smaller than the maximum oil saturation. The new code is not
completely equivalent to the old one because derivatives are not
considered if the oil saturation increases, but the differences should
be small and they should be closer to how the current master version
of opm-simulators handles VAPPARS.
2016-08-02 15:10:49 +02:00
Andreas Lauser
30d3b68df4 implement the E100 VAPPARS keyword
this is yet another crazy Eclipse hack: it prevents the dissolved
component to be fully assimilated by solvent phases if the maximum oil
phase saturation seen during the simulation stays below a given
limit...
2016-07-05 17:16:58 +02:00
Andreas Lauser
9bbe67d19f rename "LocalAd" to "DenseAd"
Since "dense automatic differentiation" describes what this code is
all about much better in my opinion. ("Local AD" is just a possible
use case in the context of PDE discretization.)
2016-06-03 21:28:45 +02:00
Andreas Lauser
a33a1eac86 fix warnings from Evaluation.hpp when using Dune 2.3
these warnings were caused by the fmatrix.hh header being included
before Evaluation.hpp. While they were harmeless, they were annoying.

(I did not discover this earlier because I normally use Dune 2.4 which
does not have this particular issue.)
2016-05-14 12:04:50 +02:00
Pål Grønås Drange
a5b70b1119 Using getInputGrid API from Parser 2016-04-19 16:54:35 +02:00
Andreas Lauser
3e7e35a2a1 squelch masochisic compiler warnings
this is the clang-3.9 and GCC 6.0 edition for the OPM 2016.04 release.
2016-04-17 11:42:33 +02:00
Andreas Lauser
28333c3f54 make the unit tests for the flash solvers bite if they detect an error
so far, they only printed a warning. in this case the error message
was usually ignored and the test was counted as 'passed'. (before the
switch of the flash solvers to use automatic differentiation, this
happened in some cases where single precision floating point scalars
were used.)

not anymore: now an exception is thrown and the test is aborted if an
error is detected.
2016-04-17 11:42:33 +02:00
Andreas Lauser
f94770092e move the approximate comparison code from the Evaluation to the Toolbox
i.e. the isSame() method. The reason is that this way it works
transparently with primitive floating point types.
2016-04-17 11:42:33 +02:00
Andreas Lauser
47c3d11403 Evaluation<>: remove the concept of "tags"
In my recent experience it did more harm than good: tags often made
the compiler errors mucht longer and more unreadable, and I have not
encountered a single instance where they were really helpful...
2016-04-17 11:40:59 +02:00
Andreas Lauser
8679d3a23c initialize MPI for all unit tests
This started to cause crashes for me. I don't really have an idea why,
but it is not too bad of a thing to do anyway...
2016-04-17 11:28:06 +02:00
Andreas Lauser
6f9451ba06 fluid systems: make the ParameterCache mechanism work with Evaluation<>
so far, using function evaluation objects instead of primitive
floating point scalars only worked for trivial parameter caches which
do not store any values (most of the time, this means that the
ParameterCache is `NullParameterCache`), or it explicitly did not work
(like for `Spe5ParameterCache`). this patch fixes the problem by
making the parameter caches of fluid systems template classes which
are templated on the type of scalar values. On the flipside, this
requires changes to all downstream modules that use fluid systems.
2016-04-17 11:28:04 +02:00
Andreas Lauser
801b1fef77 make test_pengrobinson faster
again, we just use less samples...
2016-04-17 11:28:00 +02:00
Andreas Lauser
35b5ad833b reduce the excution time needed by test_tabulation
instead of 200 samples in the pressure direction, let's be confident
with only 50...
2016-04-17 11:27:57 +02:00
Pål Grønås Drange
f1405bbafd Updated opm-material to use new opm-parser Eclipse3DProperties API 2016-04-08 15:31:32 +02:00
Andreas Lauser
013eb6c17e Merge pull request #133 from andlaus/cleanup_preambles
clean up the licensing preable of source files
2016-03-17 13:12:51 +01:00
Liu Ming
bbf8d5d3a3 rename ParserMode as ParseContext. 2016-03-17 08:49:02 +08:00
Andreas Lauser
da401551be clean up the licensing preable of source files
this patch removes the in-file lists in favor of a global list of in
the COPYING file. this is done because (a) maintaining a list of
authors at the beginning of each source file is a major pain in the
a**, (b) for this reason, the list of authors was not accurate in
about 85% of all cases where more than one person was involved and (c)
this list is not legally binding in any way (the copyright is at the
person who authored a given change; if these lists had any legal
relevance, one could "aquire" the copyright of the module by forking
it and replacing the lists...)
2016-03-15 00:58:09 +01:00
Jørgen Kvalsvik
e467684137 Add missing opm-parser headers
opm-parser pull #695
https://github.com/OPM/opm-parser/pull/695
2016-02-26 11:38:53 +01:00
Joakim Hove
54542d997b Merge pull request #122 from jokva/unique-auto-deck
Change Deck access methods/types to references
2016-02-18 22:59:51 +01:00
Jørgen Kvalsvik
cedb629f6d Change Deck access methods/types to references
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
2016-02-16 16:09:56 +01:00
Andreas Lauser
20c78f5757 test_fluidsystems: improve the naming of the template arguments of the test functions 2016-02-12 18:43:15 +01:00
Andreas Lauser
7b35935099 fix the unit test for the blackoil PVT API
mea culpa, I forgot to remove the calls to the initEnd() method after
fc933ef94d.
2016-02-03 15:56:49 +01:00
Andreas Lauser
abc0caea7a black-oil PVT: provide inverse formation volume factors
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.
2016-01-29 19:42:09 +01:00
Andreas Lauser
c780233ad1 black-oil PVT: remove the density related methods
instead, the calling code needs to directly use the formation volume
factors to calculate it.
2016-01-29 19:27:52 +01:00
Andreas Lauser
fa5a2f66a1 make the meat of the unit tests for fluid states and fluid systems available publicly 2016-01-29 19:27:52 +01:00
Jørgen Kvalsvik
3bbfa75644 Improve includes from opm-parser
Adopting to opm-parser PR#661, add previously missing includes.

https://github.com/OPM/opm-parser/pull/661
2016-01-26 13:27:25 +01:00
Andreas Lauser
54cb64bcb0 enable testing for Scalar == float for all unit tests
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.
2016-01-15 16:07:40 +01:00
Robert Kloefkorn
2a2b5b91de tests: added checks with Scalar=float. All tests compile with Scalar=float, but only
some work.
2016-01-14 17:28:07 -07:00
Andreas Lauser
7068aa3669 fix clang-3.5 and GCC-4.9 extra-pedantic warnings
hopefully this fixes all of them. While doing this, I noticed that the
warnings produced by GCC 5 and GCC 4.9 differ. I did not try to
compile it with GCC 5, though.
2016-01-04 15:31:43 +01:00
Andreas Lauser
91508eb6e1 black-oil fluid system: introduce black-oil specific variants of the methods
i.e., the PVT region index is passed directly to them and the
ParameterCache objects are not required. also:

- convert all methods to fluid states instead of passing the dependent
  parameters directly.
- do no longer encode the phase or component names in the method names
  of the fluid system.
2016-01-04 15:31:30 +01:00
Andreas Lauser
862f808e74 black-oil fluid system: introduce methods to convert Rs and Rv to their respective mass and mole fractions
going from Rs/Rv to the mole fractions is intentionally a bit clumsy
because it is relatively expensive computationally.
2016-01-04 15:31:28 +01:00
Andreas Lauser
f1548f5c72 improve the API of the low-level blackoil PVT classes
- they are not concerned with fugacity anymore:
  - as a consequence, they are now more self contained:
    - they do not need to know the molar mass of each component anymore
    - they do not need to call methods of the other PVT classes
      anymore (that was only needed to be able to calculate the
      fugacity coefficients consistently.)
    - quite a few methods could be removed
- also, some methods where renamed for consistency.
2016-01-04 15:31:21 +01:00