this makes creating the grid a bit slower because the
transmissibilities need to be calculated twice: once for the
sequential grid and once for the distributed one. while corresponds to
the way `flow_legacy` does the load balancing and it should allow
better results, this does not seem to be the case for the Norne deck
if ZOLTAN is not available:
After loadbalancing process 3 has 4413 cells.
After loadbalancing process 2 has 12390 cells.
After loadbalancing process 0 has 13629 cells.
After loadbalancing process 1 has 21253 cells.
i.e., process 1 is responsible for almost 5 as many cells as process
3.
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.)
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
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.
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...
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.)
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...
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
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.
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.
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.)