Commit Graph

119 Commits

Author SHA1 Message Date
Markus Blatt
d5180c793a Prevents unsigned-signed-comparison warnings for container with signed size.
Well, you never know. There are containers that use a signed integer
for storing its size. This results in a warning about comparing signed with
unsigned integers. This commit prevents this by explicitly casting the size
to std::size_t.
2015-02-19 09:13:39 +01:00
Markus Blatt
a1e5b55c3b [fixup] Use the correct function.
This should have been in the las commit and should be added there before
merging.
2015-02-13 11:00:28 +01:00
Markus Blatt
a31fae4507 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
086c405e9d 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
f544ccf308 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
8810c3e7fe 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
2f211f5469 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
0fb801dadc Add missing return statements. 2015-01-23 16:38:08 +01:00
Markus Blatt
420586d40c Calm warnings about excessive semi-colons, unused variables, and missing declarations. 2015-01-23 16:36:48 +01:00
Markus Blatt
d5ea991847 Fixes formatting according to Atgeirr's coding style. 2015-01-23 14:56:15 +01:00
Markus Blatt
566aee7896 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
060a2fea0f Merge pull request #702 from jorgekva/linsolver_petsc
PETSc support in OPM
2014-12-19 11:25:58 +01:00
Jørgen Kvalsvik
31fbb2f58d 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
ed18b283f1 Adds missing VecCreate. 2014-12-10 18:15:13 +01:00
Jørgen Kvalsvik
e2e6299ee6 Adds missing preconditoner destruction. 2014-12-10 18:09:13 +01:00
Jørgen Kvalsvik
33c7b48d06 Renamed variables to match Ax = b 2014-12-10 18:09:01 +01:00
Jørgen Kvalsvik
ef59c5afdb 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
2db194aca6 Removes unecessary whitespace. 2014-12-10 18:06:28 +01:00
Jørgen Kvalsvik
c6f42a63bd 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
114b335ce6 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
d380d1759e 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
4a79f2e2ca 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
2917387845 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
5ed0f73ba2 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
1dd215834b 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
53c539de6a use block{} guarantee for if and for statements. 2014-07-08 11:00:19 +08:00
Liu Ming
d8962ff1ce Add HAVE_PETSC macro. 2014-07-08 10:58:39 +08:00
Liu Ming
399a8f6884 use malloc instead of calloc and rename functions. 2014-05-23 11:11:07 +08:00
Liu Ming
afe51ae669 rename the private member. 2014-05-23 11:10:22 +08:00
Liu Ming
05d3f73390 use unordered_map for "string-enum" translations. 2014-05-23 11:09:04 +08:00
Liu Ming
55f348e4cd Throw information for Petsc. 2014-05-16 15:02:49 +08:00
Liu Ming
46fca4d9fc Initialize Petsc from constructor.
Remove private members for initializing Petsc.
2014-05-16 14:53:49 +08:00
Liu Ming
34dfb85919 Add Petsc to OPM. 2014-05-16 14:41:51 +08:00
Atgeirr Flø Rasmussen
2a29deff1c Change option name and generated header names. 2014-04-15 20:21:10 +02:00
Atgeirr Flø Rasmussen
c603103a3d Merge remote-tracking branch 'akva2/quell_dune_warnings' into suppress-external-warnings 2014-04-15 14:35:01 +02:00
Atgeirr Flø Rasmussen
0aa72eda5d Comment or add (void) usage of unused arguments. 2014-04-15 13:39:03 +02:00
Bård Skaflestad
ce687039b2 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
3375e313e5 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
3fceb968ea [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
58a7589d7d Throw an error when using a sequential solver in parallel 2014-03-27 11:49:41 +01:00
Markus Blatt
d1ccbf8446 [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
c1a7a03987 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
0cb3f861e7 Moved ISTL right and left hand side construction for ISTL to solveSystem 2014-03-25 09:37:41 +01:00
Markus Blatt
1e205adcf1 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
5777547219 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
e2ca18261d 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
b773c3de89 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
69a6a38856 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
cf7f07b179 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
50b2c9e56a add option to quell dune(-istl) warnings 2014-03-05 09:27:47 +01:00