From 2f9e7dbc178f1a8b56dfd1a0c3dc63f51403c0c8 Mon Sep 17 00:00:00 2001
From: Alexandru Fikl <alexfikl@gmail.com>
Date: Wed, 22 Apr 2020 15:21:18 -0500
Subject: [PATCH] add 1d case to test_convergence_advec

---
 examples/advection/weak.py |  2 +-
 requirements.txt           |  3 ++-
 test/test_grudge.py        | 16 ++++++++++++----
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/examples/advection/weak.py b/examples/advection/weak.py
index 68eeafe0..85545303 100644
--- a/examples/advection/weak.py
+++ b/examples/advection/weak.py
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
 logging.basicConfig(level=logging.INFO)
 
 
-def main(ctx_factory, dim=1, order=4, visualize=True):
+def main(ctx_factory, dim=2, order=4, visualize=True):
     cl_ctx = ctx_factory()
     queue = cl.CommandQueue(cl_ctx)
 
diff --git a/requirements.txt b/requirements.txt
index deb09394..4997171b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,4 +7,5 @@ git+https://gitlab.tiker.net/inducer/dagrt.git
 git+https://gitlab.tiker.net/inducer/leap.git
 git+https://github.com/inducer/meshpy.git
 git+https://github.com/inducer/modepy.git
-git+https://github.com/inducer/meshmode.git
+# git+https://github.com/inducer/meshmode.git
+git+https://gitlab.tiker.net/fikl2/meshmode.git@face-connection-1d
diff --git a/test/test_grudge.py b/test/test_grudge.py
index e373e133..35f72a8d 100644
--- a/test/test_grudge.py
+++ b/test/test_grudge.py
@@ -204,18 +204,18 @@ def test_2d_gauss_theorem(ctx_factory):
 
 
 @pytest.mark.parametrize(("mesh_name", "mesh_pars"), [
+    ("segment", [8, 16, 32]),
     ("disk", [0.1, 0.05]),
     ("rect2", [4, 8]),
     ("rect3", [4, 6]),
     ])
 @pytest.mark.parametrize("op_type", ["strong", "weak"])
-@pytest.mark.parametrize("flux_type", ["upwind"])
+@pytest.mark.parametrize("flux_type", ["central"])
 @pytest.mark.parametrize("order", [3, 4, 5])
 # test: 'test_convergence_advec(cl._csc, "disk", [0.1, 0.05], "strong", "upwind", 3)'
 def test_convergence_advec(ctx_factory, mesh_name, mesh_pars, op_type, flux_type,
         order, visualize=False):
     """Test whether 2D advection actually converges"""
-
     cl_ctx = cl.create_some_context()
     queue = cl.CommandQueue(cl_ctx)
 
@@ -223,7 +223,16 @@ def test_convergence_advec(ctx_factory, mesh_name, mesh_pars, op_type, flux_type
     eoc_rec = EOCRecorder()
 
     for mesh_par in mesh_pars:
-        if mesh_name == "disk":
+        if mesh_name == "segment":
+            from meshmode.mesh.generation import generate_box_mesh
+            mesh = generate_box_mesh(
+                [np.linspace(-1.0, 1.0, mesh_par)],
+                order=order)
+
+            h = 2.0 / mesh_par
+            dim = 1
+            dt_factor = 1.0
+        elif mesh_name == "disk":
             pytest.importorskip("meshpy")
 
             from meshpy.geometry import make_circle, GeometryBuilder
@@ -241,7 +250,6 @@ def test_convergence_advec(ctx_factory, mesh_name, mesh_pars, op_type, flux_type
             h = np.sqrt(mesh_par)
             dim = 2
             dt_factor = 4
-
         elif mesh_name.startswith("rect"):
             dim = int(mesh_name[4:])
             from meshmode.mesh.generation import generate_regular_rect_mesh
-- 
GitLab