-
Notifications
You must be signed in to change notification settings - Fork 167
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
base: master
Are you sure you want to change the base?
Conversation
from irksome import TimeStepper, Dt, SSPButcherTableau | ||
except ImportError: | ||
import sys | ||
warning("This demo requires Irksome to be installed.") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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'} |
There was a problem hiding this comment.
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 | |||
==================================== | |||
|
There was a problem hiding this comment.
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.
Description
Adding DG advection and Burgers irksome demos