Skip to content
Snippets Groups Projects
Commit 063714c3 authored by René Heß's avatar René Heß
Browse files

Add heat equation DG tests

parent dc055221
No related branches found
No related tags found
No related merge requests found
#============
# 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)
......
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]
__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
__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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment