Skip to content

Commit

Permalink
Merge pull request #82 from firedrakeproject/rckirby/reduceCITime
Browse files Browse the repository at this point in the history
Shortening some tests/demos
  • Loading branch information
rckirby authored Feb 28, 2024
2 parents 8dcaecf + 1047682 commit b113d6c
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 203 deletions.
158 changes: 0 additions & 158 deletions demos/cahnhilliard/demo_cahnhilliard.py.rst

This file was deleted.

2 changes: 1 addition & 1 deletion demos/monodomain/demo_monodomain_FHN.py.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ We start with standard Firedrake/Irksome imports::

And we set up the mesh and function space. Note this demo uses serendipity elements, but could just as easily use Lagrange on quads or triangles.::
mesh = RectangleMesh(100, 100, 70, 70, quadrilateral=True)
mesh = RectangleMesh(20, 20, 70, 70, quadrilateral=True)
polyOrder = 2
V = FunctionSpace(mesh, "S", polyOrder)
Expand Down
7 changes: 0 additions & 7 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ to deploy more efficient methods:
demos/demo_heat_rana.py
demos/demo_dirk_parameters.py

Yes, Irksome can handle nonlinear problems as well:

.. toctree::
:maxdepth: 1

demos/demo_cahnhilliard.py

We now have support for DIRKs:

.. toctree::
Expand Down
22 changes: 13 additions & 9 deletions tests/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
errornorm, grad, inner, pi, sin, split)
from irksome import Dt, MeshConstant, RadauIIA, TimeStepper
from irksome.tools import AI, IA
from pyop2.mpi import COMM_WORLD


@pytest.mark.parametrize('splitting', (AI, IA))
Expand Down Expand Up @@ -124,7 +125,7 @@ def NavierStokesSplitTest(N, num_stages, Fimp, Fexp):

MC = MeshConstant(mesh)
t = MC.Constant(0.0)
dt = MC.Constant(0.5 / N)
dt = MC.Constant(1.0 / N)

z_imp = Function(Z)
z_split = Function(Z)
Expand All @@ -138,22 +139,26 @@ def Ffull(z, test):
bcs = [DirichletBC(Z.sub(0), as_vector([x*(1-x), 0]), (4,)),
DirichletBC(Z.sub(0), as_vector([0, 0]), (1, 2, 3))]

nsp = [(1, VectorSpaceBasis(constant=True))]
nsp = [(1, VectorSpaceBasis(constant=True, comm=COMM_WORLD))]

lunl = {
"mat_type": "aij",
"snes_type": "newtonls",
"snes_rtol": 1e-10,
"snes_atol": 1e-10,
"snes_converged_reason": None,
"snes_linesearch_type": "l2",
"ksp_type": "preonly",
"pc_type": "lu",
"pc_factor_shift_type": "nonzero"}
"pc_factor_mat_solver_type": "mumps"
}

lulin = {
"mat_type": "aij",
"snes_type": "ksponly",
"ksp_type": "preonly",
"pc_type": "lu",
"pc_factor_shift_type": "nonzero"}
"pc_factor_mat_solver_type": "pastix",
"pc_factor_shift_type": "inblocks"}

F_full = Ffull(z_imp, test_z)
F_imp = Fimp(z_split, test_z)
Expand All @@ -174,9 +179,8 @@ def Ffull(z, test):
num_its_initial=10,
num_its_per_step=4)

while (float(t) < 1.0):
if (float(t) + float(dt) > 1.0):
dt.assign(1.0 - float(t))
nsteps = 6
for _ in range(nsteps):
imp_stepper.advance()
imex_stepper.advance()
t.assign(float(t) + float(dt))
Expand All @@ -196,7 +200,7 @@ def Ffull(z, test):
def test_SplitNavierStokes(N, num_stages, Fimp, Fexp):
error = NavierStokesSplitTest(N, num_stages, Fimp, Fexp)
print(abs(error))
assert abs(error) < 4e-8
assert abs(error) < 4e-7


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit b113d6c

Please sign in to comment.