adding DG & Burgers irksome demos#4262
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.
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.
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.
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.
"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 |
| 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.
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.
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.
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.
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.
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 | |||
| ==================================== | |||
|
|
|||
Description
Adding DG advection and Burgers irksome demos