diff --git a/test/heatequation/CMakeLists.txt b/test/heatequation/CMakeLists.txt index 543dd2d08e6b2c862c2f990b1cc992bb559a0c26..9afc1a3e53d17dedc93242270c01ceb3b7c6c293 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 0000000000000000000000000000000000000000..80114e5461b1be6fa898d8a2f28b72d1df5d2e16 --- /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 0000000000000000000000000000000000000000..7374c7b64e2e0ac05e7d3720d2483bf39103b64f --- /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 0000000000000000000000000000000000000000..9296d825dcbe56b913013dc322819f9ab92fc95a --- /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