[petsc-users] Fw: DG methods in PETSc

Matteo Leone matteo4.leone at mail.polimi.it
Thu Feb 19 11:13:54 CST 2026



Inviato da Outlook per Android<https://urldefense.us/v3/__https://aka.ms/AAb9ysg__;!!G_uCfscf7eWS!esCSra9pt1Q2VQtIwFRk5ds5BQ6-sbeQ66hUETSln-bCt8DbHI1HPvjOPOT6hyKlCgM8Xa4rlvZ6s9Gz4-MYSg9RvFGxWhhnjWc$ >
________________________________
From: Matteo Leone <matteo4.leone at mail.polimi.it>
Sent: Thursday, February 19, 2026 3:36:44 PM
To: Mark Adams <mfadams at lbl.gov>
Subject: R: [petsc-users] DG methods in PETSc

Hello, I now have tested quite a bit the code, and I have some doubts.
Note I am quite new to PETSc.

I have modified a bit your code to test it and I tried to print from the functions to check if they were actually called with negative results.
The Riemann solver is never called and also the solution is just static in time.
I share the code. It's a bit modified and no more c but c++ (I do not know to write the csv file fom c, in case is a dealbreaker I'll try to give a look on how to do it).
(For reference I use PETSc 3.24.4 by means of nix, the nix flake is in the shared docs if you are used to it lmk).

There is also a small .py to handle the visualization (It was made by Claude code, but it just plots the results)
Hopefully we can go deep into this PETSc DG stuff.


Thanks in advace.
Matteo


________________________________
Da: Mark Adams <mfadams at lbl.gov>
Inviato: mercoledì 11 febbraio 2026 17:25
A: Matteo Leone <matteo4.leone at mail.polimi.it>; PETSc users list <petsc-users at mcs.anl.gov>
Oggetto: Re: [petsc-users] DG methods in PETSc

Great, and keep it on the list. Lots of people here to help!

On Wed, Feb 11, 2026 at 9:46 AM Matteo Leone <matteo4.leone at mail.polimi.it<mailto:matteo4.leone at mail.polimi.it>> wrote:
Wow thank you so much! I was almost hopeless, I'll deep dive into it and I'll give you a feedback.

Matteo

________________________________
From: Mark Adams <mfadams at lbl.gov<mailto:mfadams at lbl.gov>>
Sent: Wednesday, February 11, 2026 3:38:30 PM
To: Matteo Leone <matteo4.leone at mail.polimi.it<mailto:matteo4.leone at mail.polimi.it>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] DG methods in PETSc

DG (discontinuous Galerkin) is done with a "Broken" FE. Yikes I do not see a test.
Here is a test but it is not well verified.
Mark

On Tue, Feb 10, 2026 at 10:25 AM Matteo Leone via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
Hello, I already posted on Reddit but just to be sure I write even here.

First thanks for the job you do for PETSc, I have used it for several projects and is  always nice.

I am writing cause  I am getting mad trying to implement DG solver in PETSc, the target is the Euler equations, however I am failing even with just the simplest transport equation (u/t + u/x = 0). I was wondering if I am missing somenthing. I tried with the DSSetReimannSolver and DualSpaces, and more, but I keep failing, I tried also with LLMs, but seems like there is no DG code with PETSc on the web, however I see many papers that do it.

I was  wondering if I am maybe missing  something out or what.

For reference I use PETSc 3.24.3 by means of nix.

Thanks in advance, cheers.

Matteo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260219/bbb4a228/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dg_transp_eq.cpp
Type: text/x-c++src
Size: 16452 bytes
Desc: dg_transp_eq.cpp
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260219/bbb4a228/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot.py
Type: text/x-python
Size: 7225 bytes
Desc: plot.py
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260219/bbb4a228/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flake.nix
Type: application/x-mix-transfer
Size: 2748 bytes
Desc: flake.nix
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260219/bbb4a228/attachment-0003.bin>


More information about the petsc-users mailing list