From d4e905a1b4c04a6c5ab9c95f51557570c1bc36ee Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Fri, 4 Aug 2017 11:44:50 +0200
Subject: [PATCH] Port all the hyperbolic tests

---
 python/dune/perftool/pdelab/driver/instationary.py | 4 +++-
 python/dune/perftool/pdelab/driver/interpolate.py  | 6 +++++-
 test/hyperbolic/linearacoustics.mini               | 4 ----
 test/hyperbolic/linearacoustics.ufl                | 2 --
 test/hyperbolic/lineartransport.mini               | 3 ---
 test/hyperbolic/lineartransport.ufl                | 8 +++++---
 test/sumfact/hyperbolic/linearacoustics.mini       | 4 ----
 test/sumfact/hyperbolic/lineartransport.mini       | 1 -
 test/sumfact/hyperbolic/lineartransport.ufl        | 8 +++++---
 9 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/python/dune/perftool/pdelab/driver/instationary.py b/python/dune/perftool/pdelab/driver/instationary.py
index bf8759e7..7cefddb5 100644
--- a/python/dune/perftool/pdelab/driver/instationary.py
+++ b/python/dune/perftool/pdelab/driver/instationary.py
@@ -118,7 +118,9 @@ def define_timesteppingmethod(name):
     if explicit:
         return "{} {};".format(tsm_type, name)
     else:
-        return "{} {}(1.0);".format(tsm_type, name)
+        ini = name_initree()
+        return "{} {}({}.get<double>(\"instat.theta\",1.0));".format(tsm_type, name, ini)
+
 
 
 def name_timesteppingmethod():
diff --git a/python/dune/perftool/pdelab/driver/interpolate.py b/python/dune/perftool/pdelab/driver/interpolate.py
index 9a79c554..626896c1 100644
--- a/python/dune/perftool/pdelab/driver/interpolate.py
+++ b/python/dune/perftool/pdelab/driver/interpolate.py
@@ -103,7 +103,11 @@ def define_boundary_lambda(name, boundary):
             from dune.perftool.ufl.visitor import UFL2LoopyVisitor
             from dune.perftool.pdelab import PDELabInterface
             visitor = UFL2LoopyVisitor(PDELabInterface(), "exterior_facet", {})
+            from pymbolic.mapper.c_code import CCodeMapper
+            ccm = CCodeMapper()
+            expr = visitor(boundary)
+
             from dune.perftool.loopy.target import numpy_to_cpp_dtype
             return "auto {} = [&](const auto& x){{ return ({}){}; }};".format(name,
                                                                               numpy_to_cpp_dtype("float64"),
-                                                                              visitor(boundary))
+                                                                              ccm(expr))
diff --git a/test/hyperbolic/linearacoustics.mini b/test/hyperbolic/linearacoustics.mini
index 4b14be57..5cb5ba59 100644
--- a/test/hyperbolic/linearacoustics.mini
+++ b/test/hyperbolic/linearacoustics.mini
@@ -18,7 +18,3 @@ extension = vtu
 [formcompiler]
 numerical_jacobian = 1, 0 | expand diff
 explicit_time_stepping = 0
-# This tests that all mass is transported out of the domain.
-# While this is not the best of tests, it is something easily checked for.
-#exact_solution_expression = g
-#compare_l2errorsquared = 1e-10
diff --git a/test/hyperbolic/linearacoustics.ufl b/test/hyperbolic/linearacoustics.ufl
index 09386752..97627f23 100644
--- a/test/hyperbolic/linearacoustics.ufl
+++ b/test/hyperbolic/linearacoustics.ufl
@@ -1,8 +1,6 @@
 cell = quadrilateral
 x = SpatialCoordinate(cell)
 
-#V = FiniteElement("DG", cell, 1)
-
 MV = VectorElement("DG", cell=cell, degree=1, dim=3)
 
 n = FacetNormal(cell)('+')
diff --git a/test/hyperbolic/lineartransport.mini b/test/hyperbolic/lineartransport.mini
index be1a17c4..1ca4dede 100644
--- a/test/hyperbolic/lineartransport.mini
+++ b/test/hyperbolic/lineartransport.mini
@@ -20,7 +20,4 @@ extension = vtu
 [formcompiler]
 numerical_jacobian = 1, 0 | expand diff
 explicit_time_stepping = 0, 1 | expand scheme
-# This tests that all mass is transported out of the domain.
-# While this is not the best of tests, it is something easily checked for.
-exact_solution_expression = g
 compare_l2errorsquared = 1e-10
\ No newline at end of file
diff --git a/test/hyperbolic/lineartransport.ufl b/test/hyperbolic/lineartransport.ufl
index 116813a2..c54388bd 100644
--- a/test/hyperbolic/lineartransport.ufl
+++ b/test/hyperbolic/lineartransport.ufl
@@ -2,13 +2,12 @@ cell = triangle
 
 x = SpatialCoordinate(cell)
 initial = conditional(And(And(x[0] > 0.1, x[0] < 0.2), And(x[1] > 0.1, x[1] < 0.2)), 1, 0)
-g = 0.0
 dirichlet = conditional(x[0] + x[1] < 1.0, 1, 0)
 
 dsd = ds(subdomain_data=dirichlet, subdomain_id=1)
 dso = ds(subdomain_data=dirichlet, subdomain_id=0)
 
-V = FiniteElement("DG", cell, 1, dirichlet_constraints=dirichlet, dirichlet_expression=initial)
+V = FiniteElement("DG", cell, 1)
 
 u = TrialFunction(V)
 v = TestFunction(V)
@@ -26,4 +25,7 @@ r = -1.*u*inner(beta, grad(v))*dx \
   + inner(beta, n)*u*v*dso \
   + numerical_flux(n, g, u('-'))*v*dsd
 
-forms = [mass, r]
\ No newline at end of file
+forms = [mass, r]
+is_dirichlet = dirichlet
+dirichlet_expression = initial
+exact_solution = 0
\ No newline at end of file
diff --git a/test/sumfact/hyperbolic/linearacoustics.mini b/test/sumfact/hyperbolic/linearacoustics.mini
index 9ac464c0..43090314 100644
--- a/test/sumfact/hyperbolic/linearacoustics.mini
+++ b/test/sumfact/hyperbolic/linearacoustics.mini
@@ -19,7 +19,3 @@ extension = vtu
 numerical_jacobian = 1, 0 | expand diff
 explicit_time_stepping = 0
 sumfact = 1
-# This tests that all mass is transported out of the domain.
-# While this is not the best of tests, it is something easily checked for.
-#exact_solution_expression = g
-#compare_l2errorsquared = 1e-10
diff --git a/test/sumfact/hyperbolic/lineartransport.mini b/test/sumfact/hyperbolic/lineartransport.mini
index 81738269..08ca7476 100644
--- a/test/sumfact/hyperbolic/lineartransport.mini
+++ b/test/sumfact/hyperbolic/lineartransport.mini
@@ -19,5 +19,4 @@ sumfact = 1
 #fastdg = 1
 # This tests that all mass is transported out of the domain.
 # While this is not the best of tests, it is something easily checked for.
-exact_solution_expression = g
 compare_l2errorsquared = 1e-10
diff --git a/test/sumfact/hyperbolic/lineartransport.ufl b/test/sumfact/hyperbolic/lineartransport.ufl
index 2b47ffea..e41a2dca 100644
--- a/test/sumfact/hyperbolic/lineartransport.ufl
+++ b/test/sumfact/hyperbolic/lineartransport.ufl
@@ -2,13 +2,12 @@ cell = quadrilateral
 
 x = SpatialCoordinate(cell)
 initial = conditional(And(And(x[0] > 0.1, x[0] < 0.2), And(x[1] > 0.1, x[1] < 0.2)), 1, 0)
-g = 0.0
 dirichlet = conditional(x[0] + x[1] < 1.0, 1, 0)
 
 dsd = ds(subdomain_data=dirichlet, subdomain_id=1)
 dso = ds(subdomain_data=dirichlet, subdomain_id=0)
 
-V = FiniteElement("DG", cell, 3, dirichlet_constraints=dirichlet, dirichlet_expression=initial)
+V = FiniteElement("DG", cell, 3)
 
 u = TrialFunction(V)
 v = TestFunction(V)
@@ -26,4 +25,7 @@ r = -1.*u*inner(beta, grad(v))*dx \
   + inner(beta, n)*u*v*dso \
   + numerical_flux(n, g, u('-'))*v*dsd
 
-forms = [mass, r]
\ No newline at end of file
+forms = [mass, r]
+exact_solution = 0.0
+is_dirichlet = dirichlet
+dirichlet_expression = initial
\ No newline at end of file
-- 
GitLab