[Dune] C++ question

Mike Rosing eresrch at sdf.org
Tue Aug 26 15:57:07 CEST 2025


Howdy Markus,

I've spent many years attempting to understand the book "Nodal 
Discontinous Galerkin Methods" by Hesthaven & Warburton. I finally
figured out how to get low Lebesgue measure for point distribution
and actually got better values than Warburton for N>6. What I'd like
to do is assemble the matrix for N>=5. Each tetrahedron has
n_p = (N+1)(N+2)(N+3)/6 node points and n_p functions. So each variable
is broken down into an n_p x n_p matrix inside each tetrahedron.

The location of each variable is on the diagonal or between a face, so
the majority of the stiffness matrix is empty. But where variables 
interact in an equation there is an n_p x n_p matrix.

I think I have the matrix assembled - I ran some statistics and plotted
the occupation (1 pixel per n_p x n_p matrix!) and it seems like I'm on
the right track. I'm now trying to figure out how to compute the right 
hand side vectors and I think I'm on the right track so far. But I've
found so many mistakes while doing things, that I'm sure I'll be re-doing
things again.

I spent so much time trying to understand the NDG book without success
that once I ran across DUNE and how flexable it is I figured it would be
worth another try. Finding equal or better Lebesgue values than Warburton
really got me excited about beating my head against the wall some more :-)

Thanks,
Mike

On Tue, 26 Aug 2025, Markus Blatt wrote:

> Date: Tue, 26 Aug 2025 09:50:18 +0200
> From: Markus Blatt <markus at dr-blatt.de>
> To: dune at lists.dune-project.org
> Subject: Re: [Dune] C++ question
> 
> Hi,
>
> Am Tue, Aug 19, 2025 at 04:41:51PM +0200 schrieb Oliver Sander:
>> Hi Mike,
>> 
>> thanks for your interest in Dune.  Your specific matrix setup is unusual,
>> but it should work.  Your code looks like a decent start:
>>
>>>  typedef Matrix<double> occupy(np, np);
>> 
>> [snip]
>> 
>> Do you have a copy of the Dune book? It explains how to set up BCRSMatrix
>> objects in some detail.  Try to start from one of the examples there,
>> and modify it to get Matrix<double> matrix entries.  Feel free to ask
>> again if you get stuck there.
>> 
>>> In dune/istl/bcrsmatrix.hh it says " - VariableBCRSMatrix is not yet 
>>> implemented."  Does that mean I can't do what I'm attempting: to create
>>> a BCRSMatrix with variable dimensions?
>> 
>> Yes and no.  A BCRSMatrix<Matrix<double> > and a (hypothetical) 
>> VariableBCRSMatrix
>> both implement the same matrix: A sparse matrix with dense blocks of sizes
>> specified at run-time. The difference is the internal memory allocation:
>> BCRSMatrix<Matrix<double> > stores each of its entries by a separate heap 
>> allocation,
>> while VariableBCRSMatrix will store its entire content in a single heap 
>> allocation.
>> This can have important performance benefits.
>> 
>
> But isn't the question after setting up the matrix what you do with it 
> afterwards?
>
> Do we have any solvers that one could use with this matrix? Did anyone try 
> this yet?
>
> Mike, maybe you should describe a bit what you want to use the matrix for.
>
> Best,
>
> Markus
> -- 
>
> Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
> Pedettistr. 38, 85072 Eichstätt, Germany,  USt-Id: DE279960836
> Tel.: +49 (0) 160 97590858
>
> _______________________________________________
> Dune mailing list
> Dune at lists.dune-project.org
> https://lists.dune-project.org/mailman/listinfo/dune
>
>

Mike Rosing
Engineering Research
Madison WI USA
Elliptic Curve Crypto:  http://mng.bz/D9NA


More information about the Dune mailing list