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

Add a 1D dambreak shallow water example

parent c88661d7
No related branches found
No related tags found
No related merge requests found
......@@ -12,3 +12,8 @@ dune_add_formcompiler_system_test(UFLFILE shallowwater.ufl
BASENAME shallowwater
INIFILE shallowwater.mini
)
dune_add_formcompiler_system_test(UFLFILE shallowwater_1d.ufl
BASENAME shallowwater_1d
INIFILE shallowwater_1d.mini
)
__name = shallowwater_1d
extension = 10.0
upperright = 10.0
cells = 500
elementType = hexahedral
[instat]
T = 6.0
dt = 0.001
[wrapper.vtkcompare]
name = {__name}
extension = vtu
[formcompiler]
numerical_jacobian = 1
explicit_time_stepping = 1
cell = interval
x = SpatialCoordinate(cell)
f = conditional(x[0] <= 5., 0.005, 0.001)
V = FiniteElement("DG", cell, 1)
MV = MixedElement(V, V)
g = 10.0
n = FacetNormal(cell)('+')
u = TrialFunction(MV)
v = TestFunction(MV)
mass = inner(u, v)*dx
h, q = split(u)
flux = as_matrix([[q], [q*q/h + 0.5*g*h*h]])
b_flux = as_matrix([[-1.* q], [q*q/h + 0.5*g*h*h]])
# Define numerical fluxes to choose from
alpha = Max(abs(n[0]*q('+')) / h('+') + sqrt(g*h('+')), abs(n[0]*q('-')) / h('-') + sqrt(g*h('-')))
llf_flux = dot(avg(flux), n) - 0.5*alpha*jump(u)
alpha_b = abs(n[0]*q) / h + sqrt(g*h)
boundary_flux = 0.5*dot(flux + b_flux, n) + alpha_b * as_vector([0., q])
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% 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