Skip to content

adding DG & Burgers irksome demos#4262

Closed
katieharveson wants to merge 3 commits into
masterfrom
kharveson/irksome_demos
Closed

adding DG & Burgers irksome demos#4262
katieharveson wants to merge 3 commits into
masterfrom
kharveson/irksome_demos

Conversation

@katieharveson
Copy link
Copy Markdown

Description

Adding DG advection and Burgers irksome demos

@katieharveson katieharveson requested a review from rckirby April 28, 2025 17:42
from irksome import TimeStepper, Dt, SSPButcherTableau
except ImportError:
import sys
warning("This demo requires Irksome to be installed.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point user to Irksome installation instructions/URL?

warning("This demo requires Irksome to be installed.")
sys.exit(0)

butcher_tableau = SSPButcherTableau(3, 3)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentary: Explicit 3-stage SSP RK method. Also, suggest alternatives like Gauss-Legendre if an implicit method is desired.

We now define our right-hand-side form ``F`` as :math:`\Delta t` times the
sum of four integrals.

The first integral is a straightforward cell integral of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the math lines up with the (new and improved) semidiscrete equation.

+ (phi('+') - phi('-'))*(un('+')*q('+') - un('-')*q('-'))*dS)

We then set our parameters. Since the DG mass matrices
are block-diagonal, we use the 'preconditioner' ILU(0) to solve the linear
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the ILU(0) preconditioner is exact, so iteration is not required"


params = {'ksp_type': 'preonly', 'pc_type': 'bjacobi', 'sub_pc_type': 'ilu'}

We now use our time stepper with the stage type explicit using the parameters
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit --> "explicit"

from irksome import TimeStepper, RadauIIA, Dt, MeshConstant
except ImportError:
import sys
warning("This demo requires Irksome to be installed.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, suggestion on installation/Irksome web site.

warning("This demo requires Irksome to be installed.")
sys.exit(0)

We will create the Butcher tableau for the Radau IIA method. Note that Radau IIA is backward
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RadauIIA(1) is backward Euler, RadauIIA(k) generalizes it to higher order.


nu = Constant(0.0001)

F = inner(Dt(u), v)*dx + inner(dot(u, grad(u)), v)*dx + nu*inner(grad(u),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion for better line breaking

    F = (inner(Dt(u), v) * dx + inner(dot(u, grad(u)), v)*dx
           + nu * inner(grad(u), grad(v)) * dx)

dt = MC.Constant(1.0 / n)
t = MC.Constant(0.0)

luparams = {"mat_type": "aij",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't getting passed to the stepper and in a first demo, should just be deleted.

preconditioner. This allows the code to be executed in parallel without any
further changes being necessary. ::

params = {'ksp_type': 'preonly', 'pc_type': 'bjacobi', 'sub_pc_type': 'ilu'}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, 'snes_type': 'ksponly' is desired here since we have a linear problem at each time step but the time stepper doesn't know that.

@@ -0,0 +1,299 @@
DG advection equation with upwinding
====================================

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should credit yourself here.

@dham dham closed this Jul 9, 2025
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.

3 participants