opm-common icon indicating copy to clipboard operation
opm-common copied to clipboard

Amendments to support upcoming DUNE 2.10 release

Open blattms opened this issue 1 year ago • 3 comments

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:

  • OPM/opm-grid#758
  • OPM/opm-simulators#5585

blattms avatar Sep 16 '24 13:09 blattms

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

blattms avatar Sep 16 '24 13:09 blattms

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.

blattms avatar Sep 16 '24 18:09 blattms

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

atgeirr avatar Sep 20 '24 10:09 atgeirr

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

blattms avatar Oct 03 '24 10:10 blattms

Indeed. I just thought it would have more patches. Seems I lost speed in the process and stop adding things here to save time...

More Debian patches will be coming here...

blattms avatar Mar 27 '25 08:03 blattms

Well if we are to learn from history you should take your approval and get the bits you can in ;)

akva2 avatar Mar 27 '25 08:03 akva2

Seems like the other patches were in PRs without the DUNE 2.10 flag and are already part of master. :sweat_smile:

I'll check the other modules, then.

blattms avatar Mar 27 '25 08:03 blattms

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

blattms avatar Mar 27 '25 09:03 blattms

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

blattms avatar Mar 27 '25 09:03 blattms

With the addtional cleanups (about UMFPACK and superluous version macros for old DUNE versions), this should work jenkins now. Would be cool if @akva2 would review the new commits.

blattms avatar Mar 27 '25 12:03 blattms

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

blattms avatar Mar 27 '25 12:03 blattms

Still looks fine.

akva2 avatar Mar 27 '25 12:03 akva2

Someone needs to double check my jenkins skills. Jenkins seems to use the master branch for all downstream modules,

blattms avatar Mar 27 '25 13:03 blattms

my fault. if somebody comments between triggering and jenkins starting the job, jenkins see the last comment instead of the trigger text..

akva2 avatar Mar 27 '25 13:03 akva2

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

akva2 avatar Mar 27 '25 13:03 akva2

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

blattms avatar Mar 27 '25 13:03 blattms