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
10^-4 lead to sporadic results if the final tolerance of the solution
really was 10^-4. (it currently is usually better because each time
step experiences an additional update after the Newton method deems it
to be converged.)
this problem did not work properly anyway: it oscillated like hell
(very likely to the spatial discretization used being inappropriate)
and it did not even converge if more than a single iteration was
required.
these are:
- remove the unused methods "baseEpsilon()" and "numericEpsilon()"
from FvBaseAdLocalLinearizer. (they are only meaningful in the
context of finite differences.)
- correct/update some comments
- replace most occurences of Toolbox::createConstant() with
assignments to floating point values to unclutter the code a bit.
this broke with 94006531. I actually fixed the reservoir problem
yesterday before pushing 94006531 but forgot to include the fix in my
local branch before pushing. Stupid me!
now, the dune-alugrid module is required if these tests are to be
run. (note that due to the fact that the OPM build system has not been
detecting the legacy alugrid library for a while, the practical
implications of this patch should be small to non-existant.)
this is necessary to allow non-trivial ParameterCache objects with
Local-AD evaluations. So far, the only fluid system in opm-material
which needs this is the Spe5 fluid system (which is unused by eWoms),
but sooner or later this change would have been required anyway.
Note that it is possible that this patch is errornous if Evaluation !=
Scalar for a fluid system that uses a non-trivial ParameterCache
object, but the errors should be relatively easy to fix...
i.e., the simulation for the CO2-injection problem which uses the
flash solver to handle its thermodynamics and element centered finite
volume method as the spatial discretization. The intention is to
ensure that opm-material's NcpFlash constraint solver works with
non-primitive types as Scalars. (or rather: that it will be quickly
detected if it breaks in that case.)
the in-file lists of authors has been removed in favor of a global
list of authors in the LICENSE file. this is done because (a)
maintaining a list of authors at the beginning of a file is a major
pain in the a**, (b) 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 removing
the lists...)
the only exception of this is the eWoms fork of dune-istl's solvers.hh
file. This is beneficial because the authors of that file do not
appear in the global list. Further, carrying the fork of that file is
required because we would like to use a reasonable convergence
criterion for the linear solver. (the solvers from dune-istl do
neither support user-defined convergence criteria not do the
developers want support for it. (my patch was rejected a few years
ago.))
the changes enable the storage cache and the intensive quantity cache
for all simulators of the lens problem and automatic differentiation
for the one which uses the ECFV discretization.
while the performance improvements are not worthwhile for the problem
in its default incarnation (using automatic diffentiation even
slightly degrades performance), it speeds up linearization by about
30% if the grid exhibits 16 times as many elements (e.g. by passing
the --grid-global-refinements=2) parameter.
at least, they compile as far as eWoms is concerned. Some external
libraries (in particular everything which uses SuperLU) still have
issues.
Also, there seem to be issues with the precision that is achievable
by the Newton method when using float.
this is because the reference solution changes for newer versions of
dune-alugrid and one of the main purposes of the lens problem is to
allow comparison with Dumux relatively easily. (Dumux usese YaspGrid
for its version of the lens problem.)
- start with an initial "do nothing" episode of 100 days to get
hydrostatic conditions.
- after that, produce oil and inject water for 900 days. (thereafter
the reservoir will be empty.)
- make the problem work with element centered FV discretizations. this
requires to make the width of the injection/production areas at
least one cell wide. This is achieved by using the new "WellWidth"
property which specifies the with of wells as a factor of the total
domain width.
- make the problem work with fully compositional models. This implied
to calculate the full composition for the fluid states which specify
the initial condition and the thermodynamic state at the wells.
- add tests and reference solutions for any combination of the {ECFV,
VCFV} discretizations and the {black-oil, NCP} models.
- the residual now does not consider constraints anymore
- instead, the central place for constraints is the linearizer:
- it gets a constraintsMap() method which is analogous to residual()
but it stores (DOF index, constraints vector) pairs because
typically only very few DOFs need to be constraint.
- the newton method consults the linearizer's constraint map to update
the error and the current iterative solution. the primary variables
for constraint degrees of freedom are now directly copied from the
'Constraints' object to correctly handle pseudo primary variables.
- the abilility to specify partial constraints is removed, i.e., it is
no longer possible to constrain some equations/primary variables of
a degree of freedom without having to specify all of them. The
reason is that is AFAICS with partial constraint DOFs it is
impossible to specify the pseudo primary variables for models which
require them (PVS, black-oil).
because of this, the reference solution for the Navier-Stokes test
is updated. the test still oscillates like hell, but fixing this
would require to implement spatial discretizations that are either
better in general (e.g., DG methods) or adapted to Navier-Stokes
problems (e.g., staggered grid FV methods). since both of these are
currently quite low on my list of priorities, let's just accept the
osscillations for now.
* github.com:OPM/ewoms:
adaptation works, needs revision.
[dune-fem] using discrete function works.
some further work on grid adaptivity
dune.module: add dune-fem as a noptional dependency
Conflicts:
ewoms/common/start.hh
ewoms/io/basegridmanager.hh
ewoms/parallel/mpihelper.hh
this is not needed anymore because the grid manager is no longer a
singleton and the grid is thus is always destructed before
MPI_Finalize() is called.
i.e., removing redundant namespace open- and closings due to the fact
that the property system now resides in the 'Ewoms' namspace instead
of in 'Opm', and making the headercheck work for all headers.
for the Richards model we can't use the CO2 injection problem because
this problem cannot be simulated by the Richards model. (Well,
strictly speaking the Richards model *can* simulate it, but it would
only produce garbage because the assumptions of the Richards model are
violated by that problem.)
this works by introducing a splice called "LocalLinearizerSplice". The
the current local linearizer (which is based on the finite difference
method) is the default and can be set explicitly by setting the splice
to "FiniteDifferenceLocalLinearizer", the new linearizer using
automatic differentiation can be selected by setting the splice to
"AutoDiffLocalLinearizer".
now the generic part of the update of the solution vector is done in
the base class and the derived classes can chose to only do the update
of the primary variables of the individual DOFs.
This reverts commit c6c271f3ee. After a
more thorough investigation, the cannonical name of these quantities
turned out to be "* formation volume factor"...
this also fixes the SuperLU backend with __float128 on Dune 2.4. The
problem is that due to some hacks within dune-istl, the AMG solver
can't be used because it calls the direct solver directly without an
option to disable this. (This could be fixed in a similar fashion as
the SuperLU backend by copying everything into data structures which
use 'double' before calling into ISTL, but this is a thing for another
time.)
... and use the parallel AMG solver for the CO2 injection problem.
this makes performance comparisions with Dumux much easier as the
solver performance should be more similar.
this helps to keep the core blackoil model code lean and mean and it
is also less confusing for newbies because the ECL blackoil simulator
is not a "test" anymore.
in case somebody wonders, "ebos" stands for "&eWoms &Black-&Oil
&Simulator". I picked this name because it is short, a syllable, has
not been taken by anything else (as far as I know) and "descriptive"
names are rare for programs anyway: everyone who does not yet know
about 'git' or 'emacs' and tells me that based on their names they
must be a source-code managment system and an editor gets a crate of
beer sponsored by me!
This code is required in the first place because opm-material always
specifies all parameters in terms of the wetting saturations while the
gas is the non-wetting phase in a gas-oil system.
this does not disrupt the block nature of the linearized matrix
(i.e. Dune::BCRSMatrix is still used), but if the number of auxiliary
equations is smaller than that of the "main" discretization, the
superfluous equations are padded. if the number of additional
equations are larger than that of the equation, additional DOFs are
added.
the biggest change is that it is now based on a new approach: the well
model now always calculates the bottom hole pressure for the full well
when asked for a source term. This change makes it possible to
implement cross flow within wells properly and should also make the
well model physically correct.
Also, the well model now uses the connection transmissibility factor
which makes it possible to use this quantity if it is specified by the
deck...
the goal is to make it faster on computers with many cores: The
easiest way to do this is to ensure that the longest running tests are
not taking too much time and that they need about the same time. Thus
this patch contains the following changes which limits the CPU time
taken by each test to about two minutes in debug mode on my machine:
- the water-air problem using the non-isothermal primary variable
switching model now uses an 16x16 instead of a 32x32 grid. as a
compensation it now runs for a year instead of 5000 seconds and the
global grid refinement is now tested.
- the end time of the lens problem ctests is now 3000 instead of
30000 seconds. The binary itself does not change at all.
- sort the tests in the CMakeLists.txt roughly in the order of their
required time. (this will cause ctest not having to wait for long
running test which were started late for too long.)
it was used for debugging intersection mappers. to make this include
work, dune-cornerpoint must be available and that the intersection
mapper PR must be merged.
this means that all code which could potentially throw an exception is
moved to this method(). (In particular FluidSystem::init() proved
troublesome in the past.) Besides avoiding segmentation the faults
which stem from exceptions thrown in constructors, this also has the
advantage that simulations which spend a noticable amount of time to
initialize stop at the "correct" place, i.e. after the "Finish init of
the problem" message was printed by the simulator...
this regressed after time step index of the initial solution was
changed from 0 (actually, this was also 0 for the first time step...)
to -1 in b30af664.
this method checks that the difference in the storage terms before and
after a time step is the same as the accumulated fluxes over the
domain boundary plus the source terms.
... and actually use it for the lens problems. This seems to have been
disabled for debugging and later it was probably forgotten to turn it
on again. This led to some minor bit-rot in that code...
The reason for this is to be able to modify the tolerance according to
grid size: The NewtonTolerance parameter has been renamed to
NewtonRawTolerance and for the porous media models is divided by the
square root of the volume of the smallst finite volume in the grid to
get the final tolerance for the Newton method. This is necessary
because very large grids need to achive a higher volumetric accuracy
in the residual than very small ones...
basically the init() method was split into a finishInit() method which
fills the data structures allocated in the constructor with meaningful
data and into applyInitialSolution() which does just that (and no
more!)
"intensive" means that the value of these quantities at a given
spatial location does not depend on any value of the neighboring
intensive quantities. In contrast, "extensive" quantities depend in
the intensive quantities of the environment of the spatial location.
this change is necessary is because the previous nomenclature was very
specific to finite volume discretizations, but the models themselves
were already rather generic. (i.e., "volume variables" are the
intensive quantities of finite volume methods and "flux variables"
are the extensive ones.)
because "manager" sounds less religious than "creator" and the
GridCreators did all kinds of other stuff besides creating the grid.
this patch also gets rid of the static function inside these classes,
which should make them easier to understand...
this also comes with moving responsibilities around and some smaller
cleanups for the grid creation. (although grid creation could be
possibly done by the simulator now, the GridCreator concept has not
been abandoned, yet...)
These used to be needed to be enabled by the problem, but doing it in
the generic code is more fool proof and thus better.
On my laptop, volume variable caching caused the linearization time
for first time step of the isothermal vertex-centered CO2 injection
problem using the flash model go from 33.7 to 15.7 seconds, and
enabling thermodynamic hints in addition yielded a linearization time
of "only" 9.5 seconds. (that is for a debug build compiled with clang
3.3.)
this is implemented by extending the existing functionality for hints
and leads to a significant reduction of the volume variables updates
required. unfortunately, the performance with cached volume variables
is basically identical to the non-cached case, so they are disabled by
default...
anyway, this makes the thermodynamic hints code more robust and
cleaner, so it does not hurt to add it...
this allows to retrieve the name of the problem before it is
instantiated. this is required to be able to print the "Initializing
problem" message at the correct point (i.e., before instantiating the
problem).
and some other minor changes. (if you need line search the issue is
probably caused a different problem and line search would be just a
work-around anyway.)
This should make things a much more robust, partially because now the
linear and the non-linear solvers use the same convergence criterion.
Also, this patch includes some collateral indentation improvements.
This makes eWoms multi-discretization capable. Along the way, this
fixes some bugs and does a medium sized reorganization of the source tree.
This is a squashed patch of the following commits:
--------
1st commit message:
add initial version of the element centered finite volume discretization
currently, it is a misnomer as it is just a copy of the vertex
centered discretization plus some renames...
--------
2nd commit message:
rename [VE]cfvModel -> [VE]cfvDiscretization
--------
3rd commit message:
ecfv: prelimary changes required to make it compile
but not work yet...
--------
4th commit message:
Rename *FvElementGeometry to *Stencil
"Stencil" seems to be the standard expression for this concept...
(also, it is not specific to finite volume methods and is shorter.)
--------
5th commit message:
refactor the stencil class for the element centered finite volume discretization
--------
6th commit message:
ECFV: some work on the stencil class
--------
7th commit message:
ECFV: make the boundary handling code compile
--------
8th commit message:
rename elemContext() to elementContext()
--------
9th commit message:
ECFV: make the VTK output modules compile
--------
10th commit message:
stencil: introduce the concept of primary DOFs
also save an vector of all element pointers in the stencil.
--------
11th commit message:
ECFV: try to fix assembly; add missing timeIdx arguments to the num*() methods
--------
12th commit message:
ECFV: fix stupid mistake in the assembler
--------
13th commit message:
ECFV: remove a few implicit DOF == vertex assumptions
the black-oil example now runs without valgrind complaints until it encounters
a negative oil mole fraction.
--------
14th commit message:
VCFV: make everything compile again
all vertex centered FV examples should now work again...
--------
15th commit message:
rename [ev]cfvmodel.hh to [ev]cfvdiscretization.hh
the classes have already been renamed.
--------
16th commit message:
ECFV: make it work to the point where it can write out the initial solution.
--------
17th commit message:
ECFV: make it work
the local residual/jacobian needed some work in distinguishing primary
and secondary DOFs and there was an minor issue with the serialization
code.
for some reason, it seems still not correct. (-> convergence is too slow.)
--------
18th commit message:
VCFV: make it compile for the black oil model again
--------
19th commit message:
VCFV: make it compile with the remaining models again
--------
20th commit message:
flash model: make it work with ECFV
although this breaks its compatibility with VCFV. (-> next commit)
--------
21st commit message:
adapt the VCFV to make it compatible with the flash model again
--------
22nd commit message:
make all models compile with VCFV again
--------
23rd commit message:
VCFV: more cleanups of the stencil
VcfvStencil now does not have any public attributes anymore. TODO: do
not export attributes in the SubControlVolume and SubControlVolumeFace
classes.
--------
24th commit message:
VCFV: actually update the element pointer
--------
25th commit message:
change the blackoil model back to ECFV
--------
26th commit message:
immiscible model: make it compatible with the ECFV discretization
--------
27th commit message:
PVS model: make it work with ECFV
--------
28th commit message:
NCP model: make it work with ECFV
--------
29th commit message:
rename Vcfv*VelocityModule to *VelocityModule
--------
30th commit message:
richards model: make it work with ECFV
--------
31st commit message:
unify the ECFV and the VCFV VTK output modules
and other cleanups
--------
32nd commit message:
unify the common code of the VCFV and the ECFV disctretizations
--------
33rd commit message:
unify the element contexts between element and vertex centered finite volumes
--------
34th commit message:
unify the local jacobian class of the finite volume discretizations
--------
35th commit message:
replace [VE]vcf(LocalResidual|ElementContext|BoundaryContext|ConstraintsContext) by generic code
--------
36th commit message:
replace the [EV]cfvLocalResidual by generic code
--------
37th commit message:
unify the MultiPhaseProblem and Problem classes, introduce NullBorderListCreator
--------
38th commit message:
remove the discretization specific boundary context
--------
39th commit message:
unify the [EV]cfvDiscretization classes
--------
40th commit message:
Unify [EV]cfvMultiPhaseFluxVariables
--------
41st commit message:
Unify the [EC]cfvNewton* classes
--------
42nd commit message:
Unify [EV]cfvVolumeVariables
--------
43rd commit message:
unify [EV]cfvAssembler
--------
44th commit message:
unified flux variables: fix stupid mistake when calculating pressure gradients
--------
45th commit message:
unify what's to unify for the [EV]CFV properties
--------
46th commit message:
make the method to calculate gradients and values at flux approximation points changeable
Currently, this is used by the vertex centered finite volume method to
be able to use P1-finite element gradients instead of two-point
ones...
--------
47th commit message:
make the restart code work correctly, use the correct DofMapper for VCFV
--------
48th commit message:
actually use the gradient calculator in a model
the immiscible model in this case
--------
49th commit message:
move some files around to where they belong, use the new gradient calculation code in all models
TODO: proper handling of boundary gradients
--------
50th commit message:
fix the stokes model
currently it only works with the vertex centered finite volume
discretization, but the plan is to soon move it to a staggered grid
scheme anyway...
--------
51st commit message:
move all models back to using the vertex centered finite volume discretization by default
--------
52nd commit message:
models: some variable renames and documentation fixes
- scv -> dof
- vert -> dof
- vertex -> dof
- replace 'VCFV'
- fix some typos
--------
53rd commit message:
don't expect UG anymore
since it is quite non-free and hard to get. we now use ALUGrid instead!
--------
54th commit message:
temporarily disable jacobian recycling
--------
55th commit message:
fix writing/reading restart files using the generic code
--------
56th commit message:
fix bug where fluxes were only counted once in the stencil
this only affected the vertex centered finite volumes discretization...
--------
57th commit message:
boundary gradients: use the center of the sub-control volume adjacent to a boundary segment
--------
58th commit message:
make it compile on GCC
--------
59th commit message:
get rid of most hacks
for this, partial reassemble and jacobian recycling was brought
back. For the this and the remaining stuff the main trick is the
introduction of the GridCommHandleFactory concept which constructs
communication handles suited for the respective spatial
discretization...
--------
60th commit message:
fix a few annoying bugs
first, default the convergence criterion for the linear solver did not
honor the initial residual which lead to linear solver breakdowns,
then some debugging code was left in the discrete fracture model and
then there was a bug in the TP gradient approximation class...
this has the consequence that we need a new reference solution for the
discrete fracture problem...
--------
61st commit message:
iterative linear solver: remove the code for the non-default convergence criteria
--------
62nd commit message:
provide the FE cache instead of the local FE
this fixes a segfault in the stokes model caused by the fact that the
local FE was not initialized at this point.
--------
63rd commit message:
(Navier-)Stokes: fix bug due to the transition to unit normals
now, all tests pass for this branch. The only things which need to be
fixed are some annoying performance regressions compared to master and
some bug in the splices feature of the property system...
--------
64th commit message:
some fix for the local residual of the immiscible model
--------
65th commit message:
Navier-Stokes: implement SCV center gradients
There seems to be a bug in the previous implementation (the jacobian
inverse transposed is evaluated using the local, not the global
geometry), so the reference solution for the stokes2c test problem has
also been updated...
--------
66th commit message:
remove the ALUGrid specialization of the LensGridCreator and the YaspGrid one for the fingerproblem
using different grid seems to sometimes cause a different vertex
order, which in turn causes the respective test to fail if the
reference solution was computed using the other grid...
--------
67th commit message:
VCFV: use the correct BorderListCreator
this makes MPI parallel computations work again. apart from
performance regressions, this branch does not exhibit any known
regressions compared to master anymore...
--------
68th commit message:
make verything compile with the element centered finite volume discretization
except the Navier-Stokes and the two-phase DFM models, of course...
--------
69th commit message:
minor fixes
- make the navier-stokes model slighly more generic by using the
proper (in,ex)teriorIndex() methods on sub-control volumes
- make the signature of the calculateValue() template method of the
common two-point gradient approximator match the one of the vertex
centered finite volume one
--------
70th commit message:
fix fallout from the Big Rebase
--------
71st commit message:
ECFV: some bugs in the boundary
--------
72nd commit message:
make computeFlux() compute area-specific quantities
--------
73rd commit message:
fix more bugs in the element centered FV discretization
now eWoms should match Dumux pretty closely...
--------
74th commit message:
coalesce the common code of the multi phase porous medium models into "MultiPhaseBaseModel"
--------
75th commit message:
update reference solutions
these were changed because of the screw-up with the area of boundary
segments...
--------
76th commit message:
rename "ImplicitBase" to "FvBase"
because in eWoms, everything is implicit and these are currently the
base classes for all finite volume discretizations.
--------
77th commit message:
make the spatial discretization selectable using a splice
This requires an opm-core with a the patches from
https://github.com/OPM/opm-core/pull/446 merged...
--------
78th commit message:
rename the properties used for splices to *Splice
--------
79th commit message:
move the files in 'tests/models' to 'tests'
since 'tests' was empty except for the 'models' subdirectory...
--------
80th commit message:
improve and fix the tutorial
--------
81st commit message:
remove the -fno-strict-aliasing flag from the provided option files
seems like recent versions of Dune have been adapted...
--------
82nd commit message:
also compile all CO2 injection simulations using the element centered finite volume discretization
--------
83rd commit message:
PVS model: make it work properly with the element-centered finite volume discretiation
because DOF != number of vertices