Skip to content

adding DG & Burgers irksome demos #4262

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

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

Conversation

katieharveson
Copy link
Collaborator

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
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
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
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
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
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
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
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
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
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
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
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.

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