From 063714c376ea0d53082876bb279b16ec114c415f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20He=C3=9F?= <rene.hess@iwr.uni-heidelberg.de>
Date: Mon, 29 Aug 2016 16:54:17 +0200
Subject: [PATCH] Add heat equation DG tests

---
 test/heatequation/CMakeLists.txt              | 37 +++++++++++++++++++
 test/heatequation/heatequation_dg.ufl         | 28 ++++++++++++++
 .../heatequation_dg_explicit.mini             | 11 ++++++
 .../heatequation_dg_implicit.mini             | 11 ++++++
 4 files changed, 87 insertions(+)
 create mode 100644 test/heatequation/heatequation_dg.ufl
 create mode 100644 test/heatequation/heatequation_dg_explicit.mini
 create mode 100644 test/heatequation/heatequation_dg_implicit.mini

diff --git a/test/heatequation/CMakeLists.txt b/test/heatequation/CMakeLists.txt
index 543dd2d0..9afc1a3e 100644
--- a/test/heatequation/CMakeLists.txt
+++ b/test/heatequation/CMakeLists.txt
@@ -1,3 +1,7 @@
+#============
+# CG implicit
+#============
+
 add_generated_executable(UFLFILE heatequation.ufl
                          TARGET heatequation_implicit
                          FORM_COMPILER_ARGS --exact-solution-expression g --compare-l2errorsquared 1e-7
@@ -8,6 +12,10 @@ dune_add_system_test(TARGET heatequation_implicit
                      INIFILE heatequation_implicit.mini
                      )
 
+#============
+# CG explicit
+#============
+
 add_generated_executable(UFLFILE heatequation.ufl
                          TARGET heatequation_explicit
                          FORM_COMPILER_ARGS --explicit-time-stepping --exact-solution-expression g --compare-l2errorsquared 1e-7
@@ -18,6 +26,35 @@ dune_add_system_test(TARGET heatequation_explicit
                      INIFILE heatequation_explicit.mini
                      )
 
+#============
+# DG implicit
+#============
+
+add_generated_executable(UFLFILE heatequation_dg.ufl
+                         TARGET heatequation_dg_implicit
+                         FORM_COMPILER_ARGS --exact-solution-expression g --compare-l2errorsquared 1e-5
+                         )
+
+
+dune_add_system_test(TARGET heatequation_dg_implicit
+                     INIFILE heatequation_dg_implicit.mini
+                     )
+
+#============
+# DG explicit
+#============
+
+add_generated_executable(UFLFILE heatequation_dg.ufl
+                         TARGET heatequation_dg_explicit
+                         FORM_COMPILER_ARGS --exact-solution-expression g --compare-l2errorsquared 1e-5
+                         )
+
+
+dune_add_system_test(TARGET heatequation_dg_explicit
+                     INIFILE heatequation_dg_explicit.mini
+                     )
+
+
 # Hand written reference solutions
 add_executable(heatequation_implicit_ref heatequation_implicit_ref.cc)
 dune_symlink_to_source_files(FILES heatequation_implicit_ref.ini)
diff --git a/test/heatequation/heatequation_dg.ufl b/test/heatequation/heatequation_dg.ufl
new file mode 100644
index 00000000..80114e54
--- /dev/null
+++ b/test/heatequation/heatequation_dg.ufl
@@ -0,0 +1,28 @@
+f = Expression("Dune::FieldVector<double,2> c(0.5); c-= x; return 4.*(1.-c.two_norm2())*std::exp(-1.*c.two_norm2());")
+g = Expression("Dune::FieldVector<double,2> c(0.5); c-= x; return std::exp(-1.*c.two_norm2());", on_intersection=True)
+
+cell = triangle
+V = FiniteElement("DG", cell, 1, dirichlet_expression=g)
+
+u = TrialFunction(V)
+v = TestFunction(V)
+
+n = FacetNormal(cell)('+')
+
+gamma = 1.0
+theta = 1.0
+
+poisson = 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 \
+  - inner(n, grad(u))*v*ds \
+  + gamma*u*v*ds \
+  - theta*u*inner(grad(v), n)*ds \
+  - f*v*dx \
+  + theta*g*inner(grad(v), n)*ds \
+  - gamma*g*v*ds
+
+mass = (u*v)*dx
+
+forms = [mass, poisson]
diff --git a/test/heatequation/heatequation_dg_explicit.mini b/test/heatequation/heatequation_dg_explicit.mini
new file mode 100644
index 00000000..7374c7b6
--- /dev/null
+++ b/test/heatequation/heatequation_dg_explicit.mini
@@ -0,0 +1,11 @@
+__name = heatequation_dg_explicit
+
+lowerleft = 0.0 0.0
+upperright = 1.0 1.0
+elements = 32 32
+elementType = simplical
+
+[wrapper.vtkcompare]
+name = {__name}
+reference = heatequation_ref
+extension = vtu
diff --git a/test/heatequation/heatequation_dg_implicit.mini b/test/heatequation/heatequation_dg_implicit.mini
new file mode 100644
index 00000000..9296d825
--- /dev/null
+++ b/test/heatequation/heatequation_dg_implicit.mini
@@ -0,0 +1,11 @@
+__name = heatequation_dg_implicit
+
+lowerleft = 0.0 0.0
+upperright = 1.0 1.0
+elements = 32 32
+elementType = simplical
+
+[wrapper.vtkcompare]
+name = {__name}
+reference = heatequation_ref
+extension = vtu
-- 
GitLab