From 28d09169795b899a86e6401add0c48e643f4b6db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Hess?= <rhess@donkey.iwr.uni-heidelberg.de>
Date: Thu, 26 Jan 2017 16:49:19 +0100
Subject: [PATCH] Cleanup sumfact tests

---
 test/sumfact/poisson/CMakeLists.txt           | 33 ++++++++++++-------
 test/sumfact/poisson/poisson_2d.mini          | 10 +++---
 test/sumfact/poisson/poisson_3d.mini          | 14 ++++----
 test/sumfact/poisson/poisson_dg_2d.mini       |  2 +-
 test/sumfact/poisson/poisson_dg_2d.ufl        |  9 +++--
 test/sumfact/poisson/poisson_dg_3d.mini       |  2 +-
 test/sumfact/poisson/poisson_dg_3d.ufl        |  9 +++--
 test/sumfact/poisson/poisson_dg_tensor.ufl    | 11 ++++---
 ...son_fastdg.mini => poisson_fastdg_2d.mini} |  4 +--
 test/sumfact/poisson/poisson_fastdg_3d.mini   | 24 ++++++++++++++
 10 files changed, 80 insertions(+), 38 deletions(-)
 rename test/sumfact/poisson/{poisson_fastdg.mini => poisson_fastdg_2d.mini} (88%)
 create mode 100644 test/sumfact/poisson/poisson_fastdg_3d.mini

diff --git a/test/sumfact/poisson/CMakeLists.txt b/test/sumfact/poisson/CMakeLists.txt
index 062fc23d..23d7c96d 100644
--- a/test/sumfact/poisson/CMakeLists.txt
+++ b/test/sumfact/poisson/CMakeLists.txt
@@ -1,45 +1,54 @@
-# 1. Poisson Test Case in 2D
+#====================
+# Poisson CG in 2D/3D
+#====================
 dune_add_formcompiler_system_test(UFLFILE poisson_2d.ufl
                                   BASENAME sumfact_poisson_2d
                                   INIFILE poisson_2d.mini
                                   )
-
-# 2. Poisson Test case in 3D
 dune_add_formcompiler_system_test(UFLFILE poisson_3d.ufl
                                   BASENAME sumfact_poisson_3d
                                   INIFILE poisson_3d.mini
                                   )
 
-# Operator counting test
+#================
+# Opcounter tests
+#================
 dune_add_formcompiler_system_test(UFLFILE opcount_poisson_2d_order2.ufl
                                   BASENAME opcount_sumfact_poisson_2d_order2
                                   INIFILE opcount_poisson_2d_order2.mini
                                   )
-
 dune_add_formcompiler_system_test(UFLFILE poisson_dg_2d.ufl
                                   BASENAME opcount_sumfact_poisson_dg_2d_vec
                                   INIFILE opcount_sumfact_poisson_dg_2d_vec.mini
                                   )
 
-# 3. Poisson Test Case: DG in 2D
+#====================
+# Poisson DG in 2D/3D
+#====================
 dune_add_formcompiler_system_test(UFLFILE poisson_dg_2d.ufl
                                   BASENAME sumfact_poisson_dg_2d
                                   INIFILE poisson_dg_2d.mini
                                   )
-
-# 4. Poisson Test Case: DG in 3D
 dune_add_formcompiler_system_test(UFLFILE poisson_dg_3d.ufl
                                   BASENAME sumfact_poisson_dg_3d
                                   INIFILE poisson_dg_3d.mini
                                   )
 
-# Poisson DG using FastDGGridOperator
+#=============================================
+# Poisson DG using FastDGGridOperator in 2D/3D
+#=============================================
 dune_add_formcompiler_system_test(UFLFILE poisson_dg_2d.ufl
-                                  BASENAME sumfact_poisson_fastdg
-                                  INIFILE poisson_fastdg.mini
+                                  BASENAME sumfact_poisson_fastdg_2d
+                                  INIFILE poisson_fastdg_2d.mini
+                                  )
+dune_add_formcompiler_system_test(UFLFILE poisson_dg_3d.ufl
+                                  BASENAME sumfact_poisson_fastdg_3d
+                                  INIFILE poisson_fastdg_3d.mini
                                   )
 
-# Poisson DG with a full tensor
+#================================
+# 'Poisson' DG with a full tensor
+#================================
 dune_add_formcompiler_system_test(UFLFILE poisson_dg_tensor.ufl
                                   BASENAME sumfact_poisson_dg_tensor
                                   INIFILE poisson_dg_tensor.mini
diff --git a/test/sumfact/poisson/poisson_2d.mini b/test/sumfact/poisson/poisson_2d.mini
index 6f70b71d..572837d1 100644
--- a/test/sumfact/poisson/poisson_2d.mini
+++ b/test/sumfact/poisson/poisson_2d.mini
@@ -1,9 +1,9 @@
 __name = sumfact_poisson_2d_{__exec_suffix}
-__exec_suffix = {deg_suffix}_{diff_suffix}_{vec_suffix}
+__exec_suffix = {deg_suffix}_{diff_suffix}_{gradvec_suffix}
 
-diff_suffix = numdiff, symdiff | expand num
-vec_suffix = vec, nonvec | expand vec
 deg_suffix = deg{formcompiler.ufl_variants.degree}
+diff_suffix = numdiff, symdiff | expand num
+gradvec_suffix = gradvec, nongradvec | expand grad
 
 cells = 8 8
 extension = 1. 1.
@@ -16,9 +16,9 @@ extension = vtu
 [formcompiler]
 numerical_jacobian = 1, 0 | expand num
 exact_solution_expression = g
-compare_l2errorsquared = 1e-4
+compare_l2errorsquared = 4e-5, 4e-9 | expand deg
 sumfact = 1
-vectorize_quad = 1, 0 | expand vec
+vectorize_grads = 1, 0 | expand grad
 
 [formcompiler.ufl_variants]
 degree = 1, 2 | expand deg
diff --git a/test/sumfact/poisson/poisson_3d.mini b/test/sumfact/poisson/poisson_3d.mini
index a5e2d647..b1cc845d 100644
--- a/test/sumfact/poisson/poisson_3d.mini
+++ b/test/sumfact/poisson/poisson_3d.mini
@@ -1,10 +1,10 @@
 __name = sumfact_poisson_3d_{__exec_suffix}
-__exec_suffix = {deg_suffix}_{diff_suffix}_{vecq_suffix}_{vecg_suffix}
+__exec_suffix = {deg_suffix}_{diff_suffix}_{quadvec_suffix}_{gradvec_suffix}
 
-diff_suffix = numdiff, symdiff | expand num
-vecq_suffix = quadvec, nonquadvec | expand vec_q
-vecg_suffix = gradvec, nongradvec | expand vec_g
 deg_suffix = deg{formcompiler.ufl_variants.degree}
+diff_suffix = numdiff, symdiff | expand num
+quadvec_suffix = quadvec, nonquadvec | expand quad
+gradvec_suffix = gradvec, nongradvec | expand grad
 
 cells = 8 8 8
 extension = 1. 1. 1.
@@ -17,10 +17,10 @@ extension = vtu
 [formcompiler]
 numerical_jacobian = 1, 0 | expand num
 exact_solution_expression = g
-compare_l2errorsquared = 2e-4
+compare_l2errorsquared = 1e-4, 1e-8 | expand deg
 sumfact = 1
-vectorize_quad = 1, 0 | expand vec_q
-vectorize_grads = 1, 0 | expand vec_g
+vectorize_quad = 1, 0 | expand quad
+vectorize_grads = 1, 0 | expand grad
 
 [formcompiler.ufl_variants]
 degree = 1, 2 | expand deg
diff --git a/test/sumfact/poisson/poisson_dg_2d.mini b/test/sumfact/poisson/poisson_dg_2d.mini
index ed6b6795..8785a3b1 100644
--- a/test/sumfact/poisson/poisson_dg_2d.mini
+++ b/test/sumfact/poisson/poisson_dg_2d.mini
@@ -17,7 +17,7 @@ extension = vtu
 numerical_jacobian = 1, 0 | expand num
 sumfact = 1
 exact_solution_expression = g
-compare_l2errorsquared = 1e-4
+compare_l2errorsquared = 5e-5, 5e-7 | expand deg
 vectorize_quad = 1, 0 | expand quad
 vectorize_grads = 1, 0 | expand grad
 
diff --git a/test/sumfact/poisson/poisson_dg_2d.ufl b/test/sumfact/poisson/poisson_dg_2d.ufl
index 5ef70869..19ac68ee 100644
--- a/test/sumfact/poisson/poisson_dg_2d.ufl
+++ b/test/sumfact/poisson/poisson_dg_2d.ufl
@@ -12,18 +12,21 @@ v = TestFunction(V)
 
 n = FacetNormal(cell)('+')
 
+# penalty factor
 gamma = 1.0
+
+# SSIP: -1.0, IIPG: 0.0, NIPG: 1.0
 theta = 1.0
 
 r = inner(grad(u), grad(v))*dx \
   + inner(n, avg(grad(u)))*jump(v)*dS \
   + gamma*jump(u)*jump(v)*dS \
-  + theta*jump(u)*inner(avg(grad(v)), n)*dS \
+  - theta*jump(u)*inner(avg(grad(v)), n)*dS \
   - inner(n, grad(u))*v*ds \
   + gamma*u*v*ds \
-  - theta*u*inner(grad(v), n)*ds \
+  + theta*u*inner(grad(v), n)*ds \
   - f*v*dx \
-  + theta*g*inner(grad(v), n)*ds \
+  - theta*g*inner(grad(v), n)*ds \
   - gamma*g*v*ds
 
 forms = [r]
diff --git a/test/sumfact/poisson/poisson_dg_3d.mini b/test/sumfact/poisson/poisson_dg_3d.mini
index 7bab7f81..6d7d2e75 100644
--- a/test/sumfact/poisson/poisson_dg_3d.mini
+++ b/test/sumfact/poisson/poisson_dg_3d.mini
@@ -17,7 +17,7 @@ extension = vtu
 numerical_jacobian = 1, 0 | expand num
 sumfact = 1
 exact_solution_expression = g
-compare_l2errorsquared = 1e-4
+compare_l2errorsquared = 1e-4, 5e-6 | expand deg
 vectorize_quad = 1, 0 | expand quad
 vectorize_grads = 1, 0 | expand grad
 
diff --git a/test/sumfact/poisson/poisson_dg_3d.ufl b/test/sumfact/poisson/poisson_dg_3d.ufl
index d9172368..00a17a02 100644
--- a/test/sumfact/poisson/poisson_dg_3d.ufl
+++ b/test/sumfact/poisson/poisson_dg_3d.ufl
@@ -12,18 +12,21 @@ v = TestFunction(V)
 
 n = FacetNormal(cell)('+')
 
+# penalty factor
 gamma = 1.0
+
+# SSIP: -1.0, IIPG: 0.0, NIPG: 1.0
 theta = 1.0
 
 r = inner(grad(u), grad(v))*dx \
   + inner(n, avg(grad(u)))*jump(v)*dS \
   + gamma*jump(u)*jump(v)*dS \
-  + theta*jump(u)*inner(avg(grad(v)), n)*dS \
+  - theta*jump(u)*inner(avg(grad(v)), n)*dS \
   - inner(n, grad(u))*v*ds \
   + gamma*u*v*ds \
-  - theta*u*inner(grad(v), n)*ds \
+  + theta*u*inner(grad(v), n)*ds \
   - f*v*dx \
-  + theta*g*inner(grad(v), n)*ds \
+  - theta*g*inner(grad(v), n)*ds \
   - gamma*g*v*ds
 
 forms = [r]
diff --git a/test/sumfact/poisson/poisson_dg_tensor.ufl b/test/sumfact/poisson/poisson_dg_tensor.ufl
index ceecebc5..8ef34003 100644
--- a/test/sumfact/poisson/poisson_dg_tensor.ufl
+++ b/test/sumfact/poisson/poisson_dg_tensor.ufl
@@ -15,18 +15,21 @@ v = TestFunction(V)
 
 n = FacetNormal(cell)('+')
 
+# penalty factor
 gamma = 1.0
-theta = -1.0
+
+# SSIP: -1.0, IIPG: 0.0, NIPG: 1.0
+theta = 1.0
 
 r = (inner(A*grad(u), grad(v)) + c*u*v)*dx \
   + inner(n, A*avg(grad(u)))*jump(v)*dS \
   + gamma*jump(u)*jump(v)*dS \
-  + theta*jump(u)*inner(A*avg(grad(v)), n)*dS \
+  - theta*jump(u)*inner(A*avg(grad(v)), n)*dS \
   - inner(n, A*grad(u))*v*ds \
   + gamma*u*v*ds \
-  - theta*u*inner(A*grad(v), n)*ds \
+  + theta*u*inner(A*grad(v), n)*ds \
   - f*v*dx \
-  + theta*g*inner(A*grad(v), n)*ds \
+  - theta*g*inner(A*grad(v), n)*ds \
   - gamma*g*v*ds
 
 forms = [r]
diff --git a/test/sumfact/poisson/poisson_fastdg.mini b/test/sumfact/poisson/poisson_fastdg_2d.mini
similarity index 88%
rename from test/sumfact/poisson/poisson_fastdg.mini
rename to test/sumfact/poisson/poisson_fastdg_2d.mini
index e0cf2f26..2aebce29 100644
--- a/test/sumfact/poisson/poisson_fastdg.mini
+++ b/test/sumfact/poisson/poisson_fastdg_2d.mini
@@ -1,4 +1,4 @@
-__name = sumfact_poisson_fastdg_{__exec_suffix}
+__name = sumfact_poisson_fastdg_2d_{__exec_suffix}
 __exec_suffix = {quadvec_suffix}_{gradvec_suffix}
 
 quadvec_suffix = quadvec, nonquadvec | expand quadvec
@@ -21,4 +21,4 @@ vectorize_grads = 1, 0 | expand gradvec
 fastdg = 1
 
 [formcompiler.ufl_variants]
-degree = 1
+degree = 2
\ No newline at end of file
diff --git a/test/sumfact/poisson/poisson_fastdg_3d.mini b/test/sumfact/poisson/poisson_fastdg_3d.mini
new file mode 100644
index 00000000..aa4ff193
--- /dev/null
+++ b/test/sumfact/poisson/poisson_fastdg_3d.mini
@@ -0,0 +1,24 @@
+__name = sumfact_poisson_fastdg_3d_{__exec_suffix}
+__exec_suffix = {quadvec_suffix}_{gradvec_suffix}
+
+quadvec_suffix = quadvec, nonquadvec | expand quadvec
+gradvec_suffix = gradvec, nongradvec | expand gradvec
+
+cells = 8 8 8
+extension = 1. 1. 1.
+
+[wrapper.vtkcompare]
+name = {__name}
+extension = vtu
+
+[formcompiler]
+numerical_jacobian = 0
+sumfact = 1
+exact_solution_expression = g
+compare_l2errorsquared = 1e-4
+vectorize_quad = 1, 0 | expand quadvec
+vectorize_grads = 1, 0 | expand gradvec
+fastdg = 1
+
+[formcompiler.ufl_variants]
+degree = 2
-- 
GitLab