Commit Graph

482 Commits

Author SHA1 Message Date
Andreas Lauser
6cf1eab4f4 ebos: export the ECL material law manager
this allows external code (i.e., flow_ebos) to reuse it.
2016-11-22 14:08:07 +01:00
Andreas Lauser
431cebaa21 EclFluxModule: make sure that the upwind and downwind directions are set
before, they were undefined for phases which exhibited zero mobility
in both directions. since in this case the flux is zero (and thus the
upstream direction does not matter), the correctness is unaffected by
this patch. (still, I consider it to bug and valgrind also complained
about it.)
2016-11-17 19:48:07 +01:00
Andreas Lauser
a5e859e4c6 discretizations: no longer depend on the problem to provide the mappers
Dune entity mappers seem to be dirt-cheap to create so there is not
much point in jumping through hoops to avoid this...
2016-11-17 19:44:17 +01:00
Andreas Lauser
759c2dbdaa move all applications into their top-level directory
thanks to [at]akva2 for the suggestion.
2016-11-11 15:04:04 +01:00
Andreas Lauser
67c978fe75 fix most pedantic compiler warnings in the basic infrastructure
i.e., using clang 3.8 to compile the test suite with the following
flags:

```
-Weverything
-Wno-documentation
-Wno-documentation-unknown-command
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-undef
-Wno-padded
-Wno-global-constructors
-Wno-exit-time-destructors
-Wno-weak-vtables
-Wno-float-equal
```

should not produce any warnings anymore. In my opinion the only flag
which would produce beneficial warnings is -Wdocumentation. This has
not been fixed in this patch because writing documentation is left for
another day (or, more likely, year).

note that this patch consists of a heavy dose of the OPM_UNUSED macro
and plenty of static_casts (to fix signedness issues). Fixing the
singedness issues were quite a nightmare and the fact that the Dune
API is quite inconsistent in that regard was not exactly helpful. :/

Finally this patch includes quite a few formatting changes (e.g., all
occurences of 'T &t' should be changed to `T& t`) and some fixes for
minor issues which I've found during the excercise.

I've made sure that all unit tests the test suite still pass
successfully and I've made sure that flow_ebos still works for Norne
and that it did not regress w.r.t. performance.

(Note that this patch does not fix compiler warnings triggered `ebos`
and `flow_ebos` but only those caused by the basic infrastructure or
the unit tests.)

v2: fix the warnings that occur if the dune-localfunctions module is
    not available. thanks to [at]atgeirr for testing.
v3: fix dune 2.3 build issue
2016-11-09 14:54:22 +01:00
Andreas Lauser
f951947773 use accessor methods to access the value and derivatives of Evaluation objects 2016-10-30 22:41:13 +01:00
Andreas Lauser
775ac1900f ebos: fix stupid bug 2016-10-30 22:40:25 +01:00
Andreas Lauser
f8b09de3ca ebos: more Dune 2.3 fixes to make travis happy 2016-10-30 21:24:08 +01:00
Andreas Lauser
11f95f582e fix build
that was a case of semantically conflicting concurrent merges.
2016-10-30 20:12:35 +01:00
Andreas Lauser
22681c3610 ebos: try to make travis happy 2016-10-30 19:34:33 +01:00
Andreas Lauser
b31fb57636 implement explicit prefetching
the main part of this patch is actually an API change of
Ewoms::ThreadedEntityIterator to faciliate the change (since we should
prefetch the data for the element which is to be linarized after the
current one.)  Also, this patch is only an 80% solution: it would be
good if the cached intensive quantities of the model and the stencil
of an element could also be prefetched, but that's currently not
easily possible in a performant way because iterating over the
intersections of an element negates the performance gains obtained by
prefetching.
2016-10-30 18:54:44 +01:00
Andreas Lauser
db5eb4249e add a container for grid data with a prefetch-friendly memory layout
the class is called "PffGridVector", which is short for "PreFetch
Friendly Grid Vector" ("Vector" in the sense of std::vector). The idea
is to store the data in question for the complete stencil of all
elements which makes the memory access pattern of the simulation much
more localized. this approach has the downsides that much more memory
is required to represent the data (for cartesian 3D grids this means
about factor 8 more), and that data cannot easily be changed for an
individual degree of freedom (because it would require to change the
representations of all stencils which contain the DOF).

also, use this new class to store the transmissbility values of
ebos. it is pretty easy to extent the number of quantities stored this
way, but it seems like the performance of linearization stays flat or
is slightly worse if the PffGridVector is used for more quantities...
2016-10-30 18:48:06 +01:00
Andreas Lauser
2bedc2df3c EclFluxModule: fix bug in comment 2016-10-30 18:42:00 +01:00
Andreas Lauser
2e0a8323f3 ebos: change the signature of transmissibility()
we now pass the context plus the local element indices instead of the
global ones. this allows more flexibility in how that data is stored
internally.
2016-10-30 18:41:58 +01:00
Andreas Lauser
323e4f1570 ebos: use the PVTNUM grid property instead of the PVTNUM keyword
besides enabling support for the modifier keywords, this should also
be slightly faster (because no traversal of a binary is needed for
every element anymore.)
2016-10-30 11:23:23 +01:00
Andreas Lauser
70e55bf0ca add a stand alone copy of boost::alignment::aligned_allocator
unfortunately, this is necessary because
boost::alignment::aligned_allocator requires a fairly recent version
of boost (i.e., 1.56) while the oldest platform supported by OPM
(i.e., Ubuntu 14.04LTS) only ships boost 1.54. Anyway, I'm wondering
why there is no std:: version of this class in c++-2011...
2016-10-27 20:02:40 +02:00
Andreas Lauser
911abfd05b fix alignment issues
these occured with the AVX proof of concept: when a variable that is
used by an AVX instruction is not aligned at a 32-byte boundary, the
program receives a (very non-obvious) segfault. this patch gets around
this by using (the GCC specific?)  aligned_alloc() function and the
aligned_allocator from boost for heap objects
2016-10-27 19:06:48 +02:00
Andreas Lauser
d1b884f666 Merge pull request #78 from dr-robertk/PR/use-correct-cellcenterdepth
Use correct cellcenterdepth
2016-10-25 23:03:55 +02:00
Andreas Lauser
988b0e7361 ebos: shortcut flux calculation if the mobilities of both DOFs is zero
this implies a small speedup of the linearization stage.
2016-10-25 17:56:26 +02:00
Andreas Lauser
6fb838aad4 ebos: make the code which handles threshold pressure slightly faster
I don't really understand this, but I suppose the profiler does not
lie...
2016-10-25 17:56:26 +02:00
Robert Kloefkorn
26e5abf699 [bugfix] use DUNE compatible way of computing cell center depth. 2016-10-25 16:45:50 +02:00
Andreas Lauser
8784c81a4e ebos: precalculate the depth of the center of an element
turns out that this is quite slow in Dune::CpGrid.
2016-10-25 16:45:50 +02:00
Andreas Lauser
171ccb0926 ebos: fix "unused variable" warning when using optimized flags 2016-10-21 00:45:27 +02:00
Jørgen Kvalsvik
df9f59dd03 Update to shared_ptr-less parser interface. 2016-10-20 17:59:43 +02:00
Andreas Lauser
77b5bb3114 ebos: always call the loadBalance() method of the grid again
It was disabled because Dune::CpGrid::loadBalance() dropped all cells
which were disconnected from the main part of the grid. since the
problem was fixed in https://github.com/OPM/opm-grid/pull/245, let's
re-enable load balancing.
2016-10-20 17:13:28 +02:00
Andreas Lauser
c271daec01 ebos: add support for geology changes during the simulation
this code currently has the same limitations as the one in
opm-simulators: these geologic events may only change the porosity of
some cells or the values of the transmissibility, i.e., changes to the
grid topology are not possible.
2016-10-17 14:02:09 +02:00
Andreas Lauser
1196ac5937 ebos: fix a compiler warning about a missing case in a switch statement 2016-10-12 18:27:22 +02:00
Andreas Lauser
460f839a80 threshold presure defaults: only consider phases which exhibit a non-zero mobility
i.e., if a phase is not present in the upwind DOF, it should not be
considered. this handles things analogous to the opm-simulators
code. (which uses the residual saturation of the phase for the
decision, but fundamentally applies the same logic.)
2016-09-28 16:19:13 +02:00
Andreas Lauser
e21f0b964e threshold pressures: take advantage of the fact that opm-parser handles them symmetrically
i.e., thpres->hasRegionBarrier(i, j) == thpres->hasRegionBarrier(j, i)

this allows to simplify the code a bit.
2016-09-26 16:42:43 +02:00
Andreas Lauser
97eda5bb55 ECL threshold pressure: fix stupid copy and pasto
(in the code which calculates the default threshold pressure.)
2016-09-26 16:42:43 +02:00
Andreas Lauser
14418092e1 ebos: make the porosity handling more general
i.e., it now uses the PORV grid property from opm-parser and does the
accumulation of the disabled cells manually. This patch should be
equivalent to the opm-simulators PR #806
( https://github.com/OPM/opm-simulators/pull/806 ).
2016-09-07 15:16:03 +02:00
Joakim Hove
118a701575 shared_ptr<EclipseGrid> -> const EclipseGrid& 2016-08-31 19:47:37 +02:00
Andreas Lauser
5b81aab882 Revert "implement MINPV treatment"
that approach seems to be incorrect:

https://github.com/OPM/opm-simulators/issues/785
2016-08-09 14:24:56 +02:00
Andreas Lauser
5fab3f09dd ebos: fix some build breakage
as usual, this was caused by some pointer-to-reference changes in opm-parser.
2016-08-09 12:45:03 +02:00
Andreas Lauser
e8b460fe10 implement MINPV treatment
this is done my modifying the NTG values. it is just a
straight-forward port of the corresponding functionality from
opm-simulators.
2016-08-09 12:45:03 +02:00
Pål Grønås Drange
461f3bba1a Reflect changes in parser api, removed shared_ptr 2016-08-09 08:33:06 +02:00
Andreas Lauser
6e9b13ad5a ebos: use grid.cellCenterDepth() instead of the Z coordinate of the centroid
grid.cellCenterDepth() is the average of the Z-coordinates of the
element vertices which, for distorted elements, is slightly different
from the depth of the centroid.

IMO this is conceptually a change for the worse, but ECL likes to do a
lot of things inconsistently, so let's budge.
2016-08-08 20:05:29 +02:00
Andreas Lauser
679651bca1 ebos: add accessor methods to the non-constant deck and eclipseState
these are required by fun things like applyModifierDeck().
2016-08-08 19:25:38 +02:00
Andreas Lauser
22ecf54d41 EclTransmissibility: reduce division-by-zero cutoff to 10^-30
transmissibilities of 10^-20 can occur in real decks. (i.e., Norne;
although the face which belongs to the transmissibility is tiny it
nonetheless affects convergence for some reason.)
2016-08-02 17:18:20 +02:00
Andreas Lauser
64a2c9df51 EclProblem: simplify the saturation hysteresis and VAPPARS handling
now it is always updated at the beginning of an episode. the reason
why this works is that both features do not affect the value of the
residual for the initial solution but only its derivatives. (if
something affects the values of some quantities which are needed to
calculate some parameters, then the first update needs to happen right
after the initial solution is applied and *before* the parameter is
determined.)
2016-08-02 16:01:29 +02:00
Andreas Lauser
c12eff0986 ebos: improve the upwinding code slightly
instead of falling back the global indices of the involved DOFs, use
the DOF which has the larger volume associated to it before.
2016-08-02 13:45:52 +02:00
Andreas Lauser
4334c6df58 EclTransmissibility: remove a version check for GCC < 4.8
This is not required anymore because the minimum GCC version which we
assume is GCC 4.8. (or, alternatively, any compiler with full C++-2011
support.)
2016-07-15 16:01:11 +02:00
Andreas Lauser
f818c8a2ec ebos: increase the maximum number of Newton iterations to 14
10 is a bit too little: the first time step of SPE9_CP now needs 13
iterations to converge. (before the transmissibility change of the
previous commit it was 8 iterations IIRC.)
2016-07-15 15:32:28 +02:00
Andreas Lauser
09cbc253f5 EclTransmissibility: calculate them like flow does
this may not be the nicest way to calculate transmissibilities
(because the coordinate of the cell center can be located outside of
the cell) but at least the results are the same as the ones obtained
by flow on Norne.
2016-07-15 15:32:19 +02:00
Andreas Lauser
3f9970cc2a ebos: implement support for the VAPPARS keyword 2016-07-06 14:56:25 +02:00
Andreas Lauser
57372d5fab ebos: only update the hysteresis parameters at the end of episodes
updating them at the end of each time step may make more sense from a
physical POV, but flow updates it only after each report step, so
let's do the same...
2016-06-29 17:47:52 +02:00
Arne Morten Kvarving
c0b07f6083 fixed: restore build of ebos after opm-parser changes
the WellConstPtr typedef is gone
2016-06-28 13:53:36 +02:00
Andreas Lauser
deff4aab74 ebos: determine the upstream degree of freedom consistently
before, if the pressure gradient was zero the interior DOF was assumed
to be the upstream one. On the other side of the face it was done the
same which meant that the upstream cell was different depending on
which cell was looked at. This did not have any effect on the value of
the flux (because the pressure gradient was zero anyway), but when AD
was used this resulted in non-symmetric derivatives. In principle this
is okay because the point where the pressure difference between cells
is zero is a kink and thus the flux derivatives there are
undefined. In practice this made comparing with flow quite difficult,
so let's change it...
2016-06-14 11:28:55 +02:00
Andreas Lauser
4f539c0d4d ebos: make it possible to disable the debug-mode conservativeness check
this check produces some output on the terminal which may be
undesireable in some cases (i.e., flow_ebos).
2016-06-07 18:21:14 +02:00
Andreas Lauser
98cfa30f92 ebos: allow to completely disable the well treatment
this is useful if wells shall be handled externally (e.g. most
prominently the upcoming flow wrapper which uses ebos to linearize the
mass balance equations).

disabling the well treatment can be done by setting the DisableWells
property to "true".
2016-06-07 17:43:45 +02:00