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

Add shallow water test cases

parent 95ec7ad0
No related branches found
No related tags found
No related merge requests found
...@@ -36,21 +36,11 @@ from dune.perftool.options import get_option ...@@ -36,21 +36,11 @@ from dune.perftool.options import get_option
def solve_instationary(): def solve_instationary():
# Test if form is linear in ansatzfunction
linear = is_linear()
# Test wether we want to do matrix free operator evaluation
matrix_free = get_option('matrix_free')
# Create time loop # Create time loop
if linear and matrix_free: if get_option('matrix_free'):
assert False raise NotImplementedError("Instationary matrix free not implemented!")
elif linear and not matrix_free: else:
time_loop() time_loop()
if not linear and matrix_free:
assert False
elif not linear and not matrix_free:
assert False
print_residual() print_residual()
print_matrix() print_matrix()
......
...@@ -7,3 +7,8 @@ dune_add_formcompiler_system_test(UFLFILE linearacoustics.ufl ...@@ -7,3 +7,8 @@ dune_add_formcompiler_system_test(UFLFILE linearacoustics.ufl
BASENAME linearacoustics BASENAME linearacoustics
INIFILE linearacoustics.mini INIFILE linearacoustics.mini
) )
dune_add_formcompiler_system_test(UFLFILE shallowwater.ufl
BASENAME shallowwater
INIFILE shallowwater.mini
)
__name = shallowwater_{__exec_suffix}
__exec_suffix = {diff_suffix}
diff_suffix = numdiff, symdiff | expand diff
extension = 10.0 10.0
upperright = 10.0 10.0
cells = 20 20
elementType = simplical
elements = 20 20
[instat]
T = 0.5
dt = 0.005
[wrapper.vtkcompare]
name = {__name}
extension = vtu
[formcompiler]
numerical_jacobian = 1, 0 | expand diff
explicit_time_stepping = 1
cell = quadrilateral
x = SpatialCoordinate(cell)
f = 0.2 * exp(-(pow((x[0] - 5), 2) / 2 + pow(x[1] - 5, 2) / 2)) + 1.
V = FiniteElement("DG", cell, 1)
MV = MixedElement(V, V, V)
g = 10.0
n = FacetNormal(cell)('+')
u = TrialFunction(MV)
v = TestFunction(MV)
mass = inner(u, v)*dx
h, q0, q1 = split(u)
flux = as_matrix([[q0, q1],
[h*q0*q0 + 0.5*g*h*h, h*q0*q1],
[h*q0*q1, h*q1*q1 + 0.5*g*h*h]])
bflux = as_matrix([[-q0, -q1],
[h*q0*q0 + 0.5*g*h*h, h*q0*q1],
[h*q0*q1, h*q1*q1 + 0.5*g*h*h]])
# Define numerical fluxes to choose from
llf_flux = dot(avg(flux), n) - 0.5*jump(u)
boundary_flux = 0.5*dot(flux + bflux, n) + as_vector([0., q0, q1])
numerical_flux = llf_flux
r = -1. * inner(flux, grad(v))*dx \
- inner(numerical_flux, jump(v))*dS \
+ inner(boundary_flux, v)*ds
forms = [mass, r]
dirichlet_expression = f, 0.0, 0.0
...@@ -7,3 +7,8 @@ dune_add_formcompiler_system_test(UFLFILE linearacoustics.ufl ...@@ -7,3 +7,8 @@ dune_add_formcompiler_system_test(UFLFILE linearacoustics.ufl
BASENAME sumfact_linearacoustics BASENAME sumfact_linearacoustics
INIFILE linearacoustics.mini INIFILE linearacoustics.mini
) )
dune_add_formcompiler_system_test(UFLFILE shallowwater.ufl
BASENAME sumfact_shallowwater
INIFILE shallowwater.mini
)
__name = sumfact_shallowwater
extension = 10.0 10.0
cells = 20 20
elementType = hexahedral
[instat]
T = 0.5
dt = 0.005
[wrapper.vtkcompare]
name = {__name}
extension = vtu
[formcompiler]
explicit_time_stepping = 1
sumfact = 1
cell = quadrilateral
x = SpatialCoordinate(cell)
f = 0.2 * exp(-(pow((x[0] - 5), 2) / 2 + pow(x[1] - 5, 2) / 2)) + 1.
V = FiniteElement("DG", cell, 1)
MV = MixedElement(V, V, V)
g = 10.0
n = FacetNormal(cell)('+')
u = TrialFunction(MV)
v = TestFunction(MV)
mass = inner(u, v)*dx
h, q0, q1 = split(u)
flux = as_matrix([[q0, q1],
[h*q0*q0 + 0.5*g*h*h, h*q0*q1],
[h*q0*q1, h*q1*q1 + 0.5*g*h*h]])
bflux = as_matrix([[-q0, -q1],
[h*q0*q0 + 0.5*g*h*h, h*q0*q1],
[h*q0*q1, h*q1*q1 + 0.5*g*h*h]])
# Define numerical fluxes to choose from
llf_flux = dot(avg(flux), n) - 0.5*jump(u)
boundary_flux = 0.5*dot(flux + bflux, n) + as_vector([0., q0, q1])
numerical_flux = llf_flux
r = -1. * inner(flux, grad(v))*dx \
- inner(numerical_flux, jump(v))*dS \
+ inner(boundary_flux, v)*ds
forms = [mass, r]
dirichlet_expression = f, 0.0, 0.0
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