Skip to content
Snippets Groups Projects
Commit d4e905a1 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Port all the hyperbolic tests

parent 26a2467d
No related branches found
No related tags found
No related merge requests found
...@@ -118,7 +118,9 @@ def define_timesteppingmethod(name): ...@@ -118,7 +118,9 @@ def define_timesteppingmethod(name):
if explicit: if explicit:
return "{} {};".format(tsm_type, name) return "{} {};".format(tsm_type, name)
else: 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(): def name_timesteppingmethod():
......
...@@ -103,7 +103,11 @@ def define_boundary_lambda(name, boundary): ...@@ -103,7 +103,11 @@ def define_boundary_lambda(name, boundary):
from dune.perftool.ufl.visitor import UFL2LoopyVisitor from dune.perftool.ufl.visitor import UFL2LoopyVisitor
from dune.perftool.pdelab import PDELabInterface from dune.perftool.pdelab import PDELabInterface
visitor = UFL2LoopyVisitor(PDELabInterface(), "exterior_facet", {}) 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 from dune.perftool.loopy.target import numpy_to_cpp_dtype
return "auto {} = [&](const auto& x){{ return ({}){}; }};".format(name, return "auto {} = [&](const auto& x){{ return ({}){}; }};".format(name,
numpy_to_cpp_dtype("float64"), numpy_to_cpp_dtype("float64"),
visitor(boundary)) ccm(expr))
...@@ -18,7 +18,3 @@ extension = vtu ...@@ -18,7 +18,3 @@ extension = vtu
[formcompiler] [formcompiler]
numerical_jacobian = 1, 0 | expand diff numerical_jacobian = 1, 0 | expand diff
explicit_time_stepping = 0 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
cell = quadrilateral cell = quadrilateral
x = SpatialCoordinate(cell) x = SpatialCoordinate(cell)
#V = FiniteElement("DG", cell, 1)
MV = VectorElement("DG", cell=cell, degree=1, dim=3) MV = VectorElement("DG", cell=cell, degree=1, dim=3)
n = FacetNormal(cell)('+') n = FacetNormal(cell)('+')
......
...@@ -20,7 +20,4 @@ extension = vtu ...@@ -20,7 +20,4 @@ extension = vtu
[formcompiler] [formcompiler]
numerical_jacobian = 1, 0 | expand diff numerical_jacobian = 1, 0 | expand diff
explicit_time_stepping = 0, 1 | expand scheme 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 compare_l2errorsquared = 1e-10
\ No newline at end of file
...@@ -2,13 +2,12 @@ cell = triangle ...@@ -2,13 +2,12 @@ cell = triangle
x = SpatialCoordinate(cell) 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) 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) dirichlet = conditional(x[0] + x[1] < 1.0, 1, 0)
dsd = ds(subdomain_data=dirichlet, subdomain_id=1) dsd = ds(subdomain_data=dirichlet, subdomain_id=1)
dso = ds(subdomain_data=dirichlet, subdomain_id=0) 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) u = TrialFunction(V)
v = TestFunction(V) v = TestFunction(V)
...@@ -26,4 +25,7 @@ r = -1.*u*inner(beta, grad(v))*dx \ ...@@ -26,4 +25,7 @@ r = -1.*u*inner(beta, grad(v))*dx \
+ inner(beta, n)*u*v*dso \ + inner(beta, n)*u*v*dso \
+ numerical_flux(n, g, u('-'))*v*dsd + numerical_flux(n, g, u('-'))*v*dsd
forms = [mass, r] forms = [mass, r]
\ No newline at end of file is_dirichlet = dirichlet
dirichlet_expression = initial
exact_solution = 0
\ No newline at end of file
...@@ -19,7 +19,3 @@ extension = vtu ...@@ -19,7 +19,3 @@ extension = vtu
numerical_jacobian = 1, 0 | expand diff numerical_jacobian = 1, 0 | expand diff
explicit_time_stepping = 0 explicit_time_stepping = 0
sumfact = 1 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
...@@ -19,5 +19,4 @@ sumfact = 1 ...@@ -19,5 +19,4 @@ sumfact = 1
#fastdg = 1 #fastdg = 1
# This tests that all mass is transported out of the domain. # 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. # While this is not the best of tests, it is something easily checked for.
exact_solution_expression = g
compare_l2errorsquared = 1e-10 compare_l2errorsquared = 1e-10
...@@ -2,13 +2,12 @@ cell = quadrilateral ...@@ -2,13 +2,12 @@ cell = quadrilateral
x = SpatialCoordinate(cell) 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) 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) dirichlet = conditional(x[0] + x[1] < 1.0, 1, 0)
dsd = ds(subdomain_data=dirichlet, subdomain_id=1) dsd = ds(subdomain_data=dirichlet, subdomain_id=1)
dso = ds(subdomain_data=dirichlet, subdomain_id=0) 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) u = TrialFunction(V)
v = TestFunction(V) v = TestFunction(V)
...@@ -26,4 +25,7 @@ r = -1.*u*inner(beta, grad(v))*dx \ ...@@ -26,4 +25,7 @@ r = -1.*u*inner(beta, grad(v))*dx \
+ inner(beta, n)*u*v*dso \ + inner(beta, n)*u*v*dso \
+ numerical_flux(n, g, u('-'))*v*dsd + numerical_flux(n, g, u('-'))*v*dsd
forms = [mass, r] forms = [mass, r]
\ No newline at end of file exact_solution = 0.0
is_dirichlet = dirichlet
dirichlet_expression = initial
\ No newline at end of file
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