Commit Graph

380 Commits

Author SHA1 Message Date
Andreas Lauser
dbb707ede5 convert the flash constraints solvers to use automatic differentiation
this fixes some precision issues with single-precision floating point
values as a nice side effect.
2016-04-17 11:42:33 +02:00
Andreas Lauser
7a27c5398e allow the Peng-Robinson EOS to be used with nested automatic differentiation 2016-04-17 11:42:33 +02:00
Andreas Lauser
d55f213653 make it possible to nest function evaluation objects
IMO this is pretty cool because it allows to transparantly calculate
higher order derivatives. for example this enables to implement the
linearization stage of higher-order non-linear solvers without much
additional effort compared to just evaluating the function in
question. (essentially, such higher order non-linear solvers are based
on truncating the Taylor series not after the first term -- like for the
Newton scheme -- but later. That said, they require to solve linear
systems of equations which involve tensors of orders greater than 2,
so they are not really practical as far as I can see.)

A more practical motivation for this is to allow the constraint
solvers to be used in "nested mode", i.e., linearizing the system of
equations they need to solve using automatic differentiation, but
allowing the value objects which are passed to the constraint solvers
be function evaluations themselves. (E.g. the result of a flash
calculation can also include the derivatives with regard to the
primary variables of the flow model. Note that the individual
constraint solvers need to some patches to make this work.)
2016-04-17 11:42:33 +02:00
Andreas Lauser
573e45d1a4 remove MathToolbox::passThroughOrCreateConstant()
this method is an artifact from the beginning of the automatic
differentiation code and is not needed anymore: its original pupose
was to be able to retain a full function evaluation object if it was
available or a function evaluation object representing a constant
function if only a primitive scalar is available. Nowadays, the method
can be replaced by a direct initialization:

template <class T, class V>
T fn(const V& v)
{ return T(v); }

is equivalent to

template <class T, class V>
T fn(const V& v)
{
    typedef Opm::MathToolbox<T> Toolbox;
    return passThroughOrCreateConstant(v);
}
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
d44dd50cb7 reduce the execution time of test_fluidsystems
this is done by reducing the default resolution of tabulated
components for the relevant fluid systems.
2016-04-17 11:28:02 +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
ac0652805d Using API get3DProperties() 2016-04-11 14:59:01 +02:00
Pål Grønås Drange
02beac295c Merge branch 'use-eclipse3dproperties' of github.com:pgdr/opm-material into use-eclipse3dproperties 2016-04-08 15:39:16 +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
Pål Grønås Drange
65d9ee2924 opm-material uses new Eclipse3DProperties API 2016-04-05 11:47:40 +02:00
Pål Grønås Drange
6eddf22fc4 added lacking references in auto types (SimpleTable) 2016-04-01 16:44:23 +02:00
Pål Grønås Drange
88249811fc update opm-material repo to use Eclipse3DProperties API 2016-04-01 15:52:25 +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
Joakim Hove
0f36222f7b Merge pull request #134 from qilicun/rename-ParseMode
rename ParserMode as ParseContext.
2016-03-17 09:51:38 +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
Tor Harald Sandve
78fcbb1ed3 Merge pull request #132 from andlaus/ecl_water_viscosibility
handle the "viscosibility" of water with constant compressibility as documented by the ECL RM
2016-03-09 11:31:58 +01:00
Andreas Lauser
03c2ee8b4e handle the "viscosibility" of water with constant compressibility as documented by the ECL RM
this is basically a revert of 1d2ad56ba1.
2016-03-07 15:56:36 +01:00
Andreas Lauser
9e6c38b06b Merge pull request #131 from andlaus/always_copy_on_toLhs
make MathToolbox::toLhs() always return a copy again
2016-03-07 13:56:49 +01:00
Andreas Lauser
ea6899d032 Merge pull request #130 from atgeirr/silence-warnings
Silence unused argument warnings.
2016-03-05 19:06:49 +01:00
Andreas Lauser
362374daea make MathToolbox::toLhs() always return a copy again
in my testing, the GCC SVN version from 4th of March causes problems
if lvalue references are just passed through and neither GCC-5 nor
clang 3.6 show any obvious differences in performance. (I guess that's
because of the copy elision compiler optimizations in conjunction with
inlining.)

It is also worthwhile to know that clang 3.6 is about 20% faster with
ebos than both, GCC-6 and GCC-5. I can only speculate why this is the
case, but since the performance improvement seems to evenly apply to
the linearization and linear-solve parts, the auto-vectorizer of clang
possibly works better for ebos than the one of GCC...
2016-03-05 15:22:05 +01:00
Atgeirr Flø Rasmussen
46d1a512c2 Silence unused argument warnings. 2016-02-29 10:35:33 +01:00
Andreas Lauser
8eadacde62 Merge pull request #129 from jokva/fix-header-parser-695
Add missing opm-parser headers
2016-02-26 12:24:50 +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
Andreas Lauser
88e85042e0 Merge pull request #127 from andlaus/fix_twophase_ecl_decks
black-oil PVT: bail out from trying to initialize PVT objects for inactive phases
2016-02-21 18:05:13 +01:00
Andreas Lauser
9b9816d8e9 Merge pull request #128 from andlaus/fix_deprecation_warnings
fix a bunch of deprecation warnings caused by OPM/opm-parser#687
2016-02-19 23:36:45 +01:00
Andreas Lauser
e30b43ad7e fix a bunch of deprecation warnings caused by OPM/opm-parser#687 2016-02-19 23:32:52 +01:00
Andreas Lauser
32980c57d9 black-oil PVT: bail out from trying to initialize PVT objects for inactive phases
this should fix twophase decks, see
https://github.com/OPM/opm-autodiff/pull/576#issuecomment-185770114.
2016-02-19 14:22:40 +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
Andreas Lauser
d5bf1b637a Merge pull request #126 from andlaus/export_drainage_eps_points
EclMaterialLawManager: make the method which provides the scaled drainage end points public
2016-02-17 18:59:37 +01:00
Andreas Lauser
b8d08e7b52 EclMaterialLawManager: make the function which provides the scaled drainage end points public
That is because they might have to modified externally (e.g. if
SWATINIT is computed and applied externally).
2016-02-17 18:56:54 +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
09f02eb2f4 fluid states: clean up the remaining modules w.r.t. references vs values 2016-02-12 18:43:15 +01:00
Andreas Lauser
307cc6c0f0 clean up the overlay fluid state w.r.t. the type which they return
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.)
2016-02-12 18:43:15 +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
3ad0c087ca distinguish between rvalues and lvalues in MathToolbox::toLhs<LhsEval>()
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...
2016-02-12 18:43:08 +01:00
Andreas Lauser
460dd578d0 Merge pull request #124 from andlaus/valgrind_fix
test_fluidsystems: fix valgrind complaints about unused memory
2016-02-12 11:52:51 +01:00
Andreas Lauser
78db8b01d5 test_fluidsystems: fix valgrind complaints about unused memory
I doubt that this is the reason for this test's segfault on Jenkins,
but it that was a real (if minor) issue...
2016-02-12 11:49:38 +01:00
Andreas Lauser
76af0dd218 Merge pull request #120 from andlaus/fix_toLhs
MathToolbox: return a constant reference for toLhs() (if possible)
2016-02-05 18:56:39 +01:00
Andreas Lauser
39933a747b MathToolbox: return a constant reference for toLhs() (if possible)
also improve the documentation somewhat. (it was a bit "raw on its
teeth".)
2016-02-05 18:53:05 +01:00
Andreas Lauser
47e89e2c9d Merge pull request #118 from andlaus/fix_blackoil_pvt_unit_test
fix the unit test for the blackoil PVT API
2016-02-03 16:13:01 +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
3d9397d274 Merge pull request #115 from andlaus/fix_headercheck
squelch extra-pedantic clang and GCC warnings and fix the headercheck
2016-02-01 13:41:28 +01:00
Andreas Lauser
4dc417fcca squelch extra-pedantic clang and GCC warnings and fix the headercheck
once more, OPM/opm-parser#661 was the culprit for the headercheck.
2016-02-01 13:39:29 +01:00
Atgeirr Flø Rasmussen
051a17cdf4 Merge pull request #114 from andlaus/blackoil_improvements
Blackoil improvements
2016-02-01 13:38:26 +01:00