Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amendments to support upcoming DUNE 2.10 release #4202

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

blattms
Copy link
Member

@blattms blattms commented Sep 16, 2024

DUNE 2,10 moves a step closer to being used by just using find_package(dune-module) with targets. It is not completely there as upstream still sets up the targets in dune_finalize_project.

Unfortunately, it sets the (unused since 2.7) alias HAVE_UMFPACK in a included header. The compiler warns about this as we explicitly set it 1 instead of HAVE_SUITESPARSE_UMFPACK. Hence we remove it in OPM.

It also set HAVE_DUNE_MODULE to TRUE in the CMake package configuration files. This causes compile errors because we get a #define HAVE_DUNE_ISTL TRUE in config.h but TRUE is not defined. Therefore reset the value before we do the out compile check.

Still needs to be battle-tested, but works on my system.

Related PRs:

This is not used even in DUNE 2.7 and we get annoying redefined
warnings with it.
For 2.10 this is set by the *-config.cmake file to TRUE which
suddenly resulted in
```
```
appearing in config.h. As TRUE is not defined we would pretend that there
is no dune-istl and compilation would fail where we pack BlockVectors
for serialization.
@blattms
Copy link
Member Author

blattms commented Sep 16, 2024

jenkins build this opm-grid=758 opm-simulators=5585 please

@blattms
Copy link
Member Author

blattms commented Sep 16, 2024

I really do not understand, why line FlexibleSolver_impl.hpp#L202 works with master.

Matrix type is Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>> and I doubt that the compiler would accept usage of UMFPack<Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>> because there is no specialization of UMFPackVectorChooser for a BCRSMatrix with block type Opm::MatrixBlock<double, 1, 1> in DUNE or OPM. That one seems needed when looking at: dune/istl/umfpack.hh#L172, because UMFPack is derived from InverseOperator<UMFPackVectorChooser<MatrixType>::doman_type, UMFPackVectorChooser<MatrixType>::range_type>

I must be missing something important, here.

@atgeirr
Copy link
Member

atgeirr commented Sep 20, 2024

I must be missing something important, here.

Indeed the trick is in matrixblock.hh lines 272-290:

#if HAVE_UMFPACK
/// \brief UMFPack specialization for Opm::MatrixBlock to make AMG happy
///
/// Without this the empty default implementation would be used.
template <typename T, typename A, int n, int m>
class UMFPack<BCRSMatrix<Opm::MatrixBlock<T, n, m>, A> >
    : public UMFPack<BCRSMatrix<FieldMatrix<T, n, m>, A> >
{
    using Base = UMFPack<BCRSMatrix<FieldMatrix<T, n, m>, A> >;
    using Matrix = BCRSMatrix<FieldMatrix<T, n, m>, A>;

public:
    using RealMatrix = BCRSMatrix<Opm::MatrixBlock<T, n, m>, A>;

    UMFPack(const RealMatrix& matrix, int verbose, bool)
        : Base(reinterpret_cast<const Matrix&>(matrix), verbose)
    {}
};
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants