Commit Graph

96 Commits

Author SHA1 Message Date
Markus Blatt
50aba2c8f6 Makes right hand side passed to linear solver consistent.
Due to the size of the overlap layer and the discretization scheme
the rhs might not contain correct values for overlap cells. This
commit makes sure they are correct by an additional communication step.
2015-02-12 21:00:32 +01:00
Markus Blatt
2caaca4160 Do not rely on begin()/end() of the containers to compute reductions.
One would think that such an assumption is safe in any case,
wouldn't one? But foen Eigen'S container this does not hold.
They do not provide STL compliant iterators, and access to them.
With this patch make the even stricter assumption that the containers
are random access and use operator[] instead of iterators.
2015-01-30 16:10:41 +01:00
Markus Blatt
2a3adf7591 Constified the compute reduction functions.
These should and have to be used with a const object.
2015-01-28 21:55:35 +01:00
Markus Blatt
aac4cb7d66 Correctly compute the minimum and maximum values.
As there are no functors for computing the minimum and maximum,
we convert the std::max and std::min function pointers to
functors (which is not really nice.) Previously we were somehow
tricked into using std::greater and std::less, which of course do
return true or false and not what we need. Additionally, do more
excessive testing with different ranges.
2015-01-23 20:48:53 +01:00
Markus Blatt
6fe660a3d5 Do recurse in the recursive funtion computeGlobalReduction!
Somehow this was missed and only the first entry in the tuple
was computed globally.
2015-01-23 20:46:46 +01:00
Markus Blatt
033f290392 Add missing return statements. 2015-01-23 16:38:08 +01:00
Markus Blatt
d137b0c144 Calm warnings about excessive semi-colons, unused variables, and missing declarations. 2015-01-23 16:36:48 +01:00
Markus Blatt
4a80474782 Fixes formatting according to Atgeirr's coding style. 2015-01-23 14:56:15 +01:00
Markus Blatt
7bce15c04b Added methods for computing global reductions.
We need to compute quite a few global reductions in the
Newton method of opm-autodiff. This commit adds the functionality
to compute several reductions combined using only one global
communication. Compiles and test succeeds with one or more process.
2015-01-21 16:19:35 +01:00
Atgeirr Flø Rasmussen
dea6e8c044 Merge pull request #702 from jorgekva/linsolver_petsc
PETSc support in OPM
2014-12-19 11:25:58 +01:00
Jørgen Kvalsvik
263e1a6928 Sets initial guess to zero.
Setting it to nonzero means starting to approximate from memory garbage values.
2014-12-10 18:15:33 +01:00
Jørgen Kvalsvik
294ec58bed Adds missing VecCreate. 2014-12-10 18:15:13 +01:00
Jørgen Kvalsvik
b3ebe04e14 Adds missing preconditoner destruction. 2014-12-10 18:09:13 +01:00
Jørgen Kvalsvik
8fbbdad722 Renamed variables to match Ax = b 2014-12-10 18:09:01 +01:00
Jørgen Kvalsvik
37a47711e5 Vector construction is now value oriented.
No longer initialised and constructed in two places.
2014-12-10 18:07:45 +01:00
Jørgen Kvalsvik
6c70d2938d Removes unecessary whitespace. 2014-12-10 18:06:28 +01:00
Jørgen Kvalsvik
43d82a232c Fixes performance bug in matrix construction.
At the same time changes the construction to be value-oriented, not
constructing it in OEM_DATA, but rather in to_petsc_mat
2014-12-10 18:05:04 +01:00
Jørgen Kvalsvik
e69d92cca3 Moved KSPCreate to the Data constructor
This is where it was always intended to be called, so this fixes a mistake in
earlier development.
2014-11-12 20:41:21 +01:00
Jørgen Kvalsvik
7c78afa13d Reduces CHKERRXX usage to where necessary.
The error checking macro makes it harder to read and harder to write, so
instead we now only check for functions  that can contain errors. Bounds and
range checks are handled by PETSc and not OPM.
2014-10-14 14:43:42 +02:00
Jørgen Kvalsvik
93a8430339 Petsc constructor now uses intialiser list.
The previous implementation set plenty of values in the initialization list and
immediately overwrote these values with values looked up from the param group.
This patch makes it look up the parameteres from the param group argument,
making the constructor simpler.
2014-10-14 14:43:42 +02:00
Jørgen Kvalsvik
ce3981a55e Makes using wrong constructor a compile-time error
Petsc only supports initialisation through the ParameterGroup constructor.
Calling the default, non-arg constructor is a static error, and not
implementing it makes using it break compiles.
2014-10-14 14:43:42 +02:00
Jørgen Kvalsvik
ade7aa658e Removes call_petsc.c and calls the lib from C++
call_petsc.c was really a thin C wrapper around the call to petsc itself and
turns out was mostly unnecessary C++ emulation. This removes the file entirely
and ports its functionality into LinearSolverPetsc.cpp.

All features from the file should now be more readable as well as properly
utilising modern C++ features.

The patch uses the CHKERRXX macro from petsc to handle errors reported by
petsc, and currently does not handle this and give the control back to OPM's
error/throw system.
2014-10-14 14:43:42 +02:00
Atgeirr Flø Rasmussen
33a91b59f9 Refactor third-party warning suppression.
Use header files from opm/core/utility/platform_dependent instead of
build-system generated ones for suppressing warnings from dune or Eigen.
2014-09-20 10:36:10 +02:00
Liu Ming
28b354c625 Add HAVE_PETSC macro. 2014-07-08 10:58:39 +08:00
Liu Ming
8a118f45fe rename the private member. 2014-05-23 11:10:22 +08:00
Liu Ming
9d985f7421 use unordered_map for "string-enum" translations. 2014-05-23 11:09:04 +08:00
Liu Ming
6f2d28d08a Throw information for Petsc. 2014-05-16 15:02:49 +08:00
Liu Ming
ccb83a8503 Initialize Petsc from constructor.
Remove private members for initializing Petsc.
2014-05-16 14:53:49 +08:00
Liu Ming
4491eb7a6a Add Petsc to OPM. 2014-05-16 14:41:51 +08:00
Atgeirr Flø Rasmussen
be5af2378a Change option name and generated header names. 2014-04-15 20:21:10 +02:00
Atgeirr Flø Rasmussen
bd4eef5a86 Merge remote-tracking branch 'akva2/quell_dune_warnings' into suppress-external-warnings 2014-04-15 14:35:01 +02:00
Atgeirr Flø Rasmussen
798ef0d070 Comment or add (void) usage of unused arguments. 2014-04-15 13:39:03 +02:00
Bård Skaflestad
99d7f61822 Don't reference OwnerOverlap* unless MPI is available
The class OwnerOverlapCopyCommunication is not defined unless MPI is
avilable.  Therefore, we cannot reference the type unless we know
that MPI is available in the current translation unit.
2014-04-07 20:01:18 +02:00
Markus Blatt
7fd5b65691 Merge remote-tracking branch 'upstream/master' into parallel-solver-support
Removed conflicts in:
	opm/core/linalg/LinearSolverIstl.cpp
2014-04-04 20:38:52 +02:00
Markus Blatt
8653ffe327 [bugfix] Use the size of the vector for the copying.
The last patch did not compile as there was no size member
in scope. Therefore this patch resorts to using the size of
the vector.
2014-03-27 11:53:13 +01:00
Markus Blatt
23f19584cb Throw an error when using a sequential solver in parallel 2014-03-27 11:49:41 +01:00
Markus Blatt
7495bfa6c4 [bugfix] Use the size of the vector for the copying.
The last patch did not compile as there was no size member
in scope. Therefore this patch resorts to using the size of
the vector.
2014-03-26 10:23:11 +01:00
Markus Blatt
3115b7868f Moved ISTL right and left hand side construction for ISTL to solveSystem
cherry-picked from add-scalarproduct and ported.
2014-03-25 09:58:07 +01:00
Markus Blatt
909d3c9019 Moved ISTL right and left hand side construction for ISTL to solveSystem 2014-03-25 09:37:41 +01:00
Markus Blatt
bdc4573e2a Added support for the parallel solvers of dune-istl.
To support this the solveSystem methods of the LinearSolverInterface gets
an optional additional template parameter of type boost::any. It can hold any
copy constructable object. In our case it is used to pass the information about
the parallelization into the solvers of dune-istl without the compiler needing to know
their type. Inside of LinearSolverIstl::solveSystem we check whether the type stored inside of
boost::any is the new ParallelIstlInformation. If this is the case we extract the information
and use the parallel solvers if available, otherwise we solve serial/sequential.

The new ParallelIstlInformation is needed as the OwnerOverlapCopyCommunication is not copy
constructable. This is indeed a design flaw that should and will fixed upstream, but for the
time being we need ParallelIstlInformation to transfer the ParallelIndexSet and RemoteIndices
objects.
2014-03-20 21:59:29 +01:00
Markus Blatt
cec51280e7 Explicitly construct the ScalarProduct, and SequentialInformation.
This patch refactors the calls to the dune-istl solvers.
The SeqScalarProduct, and SequentialInformation is now explicitly
constructed and later used to construct the smoothers
generically. Aditionally the linear operator (MatrixAdapter) is
constructed before calling the various solver dependent solve
routines.

While this does not change the behaviour of the code it is a
preparatory step to support parallel solvers. These parallel
solvers only differ in the type of the scalarproduct and
linear operator used from the sequential ones.
2014-03-20 12:09:24 +01:00
Markus Blatt
e1d0995104 Explicitly construct the ScalarProduct, and SequentialInformation.
This patch refactors the calls to the dune-istl solvers.
The SeqScalarProduct, and SequentialInformation is now explicitly
constructed and later used to construct the smoothers
generically. Aditionally the linear operator (MatrixAdapter) is
constructed before calling the various solver dependent solve
routines.

While this does not change the behaviour of the code it is a
preparatory step to support parallel solvers. These parallel
solvers only differ in the type of the scalarproduct and
linear operator used from the sequential ones.
2014-03-20 10:39:48 +01:00
Markus Blatt
8f60175d04 Include fastamg.hh for dune-istl 2.3
For the inofficial 2.2 release this was included automatically with amg.hh.
2014-03-19 19:51:17 +01:00
Markus Blatt
d333f413d1 Complete cf7f07b PR #530 to support FastAMG with dune-istl 2.3
This fixes further occurences of DUNE_HAS_FASTAMG that were
missed in pull request #530.

Previously we relied on the define DUNE_HAS_FAST_AMG to detect
whether these preconditioners are available. This define is only
available in the 2.2 release with cmake support. Therfore we now
addtionally test whether we are using dune-istl 2.3 or newer.
2014-03-19 17:40:02 +01:00
Markus Blatt
8c8bb67aa0 Makes KAMG and FastAMG solver available with dune-istl 2.3
Previously we relied on the define DUNE_HAS_FAST_AMG to detect
whether these preconditioners are available. This define is only
available in the 2.2 release with cmake support. Therfore we now
addtionally test whether we are using dune-isl 2.3 or newer.
2014-03-19 11:19:25 +01:00
Arne Morten Kvarving
bb1e21d764 add option to quell dune(-istl) warnings 2014-03-05 09:27:47 +01:00
Atgeirr Flø Rasmussen
cb99938c62 Fix initialisation warning. 2014-02-05 13:05:33 +01:00
Roland Kaufmann
88a38a8e3f Fix LinearSolverIstl cleanup also for fast AMG branch
To avoid deprecation warnings the number of smoothing steps was passed
through the Criterion instead of directly to the constructor in commit
a7f32b934b.

However, due to an insufficient test matrix this was not tested using
the fast AMG variant of DUNE so it breaks the builds if
`-DHAS_DUNE_FAST_AMG` is defined.

This change should apply the same type of change to this branch as for
the others. The number of smoothing steps is put into a constant to
avoid the magic number 1 to appear in too many places (although I am
not sure the number for pre- and post-smoothing always should be the
same).
2013-09-20 10:00:21 +02:00
Roland Kaufmann
5f00467f02 Set linear solver steps in criterion instead of ctor
The constructor that takes the number of steps is deprecated; this
generates needless warnings.
2013-09-19 10:32:49 +02:00
Andreas Lauser
cb76a0fd7f convert THROW to OPM_THROW 2013-09-05 13:04:37 +02:00