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

Small fixes to the linear acoustics example

parent 0d1e2f08
No related branches found
No related tags found
No related merge requests found
...@@ -254,7 +254,8 @@ def define_power_gfs(element, is_dirichlet, name, subgfs): ...@@ -254,7 +254,8 @@ def define_power_gfs(element, is_dirichlet, name, subgfs):
gv = name_leafview() gv = name_leafview()
fem = name_fem(element.sub_elements()[0]) fem = name_fem(element.sub_elements()[0])
gfstype = type_gfs(element, is_dirichlet) gfstype = type_gfs(element, is_dirichlet)
return "{} {}({}, {});".format(gfstype, name, gv, fem) return ["{} {}({}, {});".format(gfstype, name, gv, fem),
"{}.name(\"{}\");".format(name, name)]
@preamble @preamble
......
...@@ -8,8 +8,9 @@ cells = 20 20 ...@@ -8,8 +8,9 @@ cells = 20 20
elementType = hexahedral elementType = hexahedral
[instat] [instat]
T = 1.5 T = 0.5
dt = 0.0025 dt = 0.005
theta = 0.0
[wrapper.vtkcompare] [wrapper.vtkcompare]
name = {__name} name = {__name}
......
...@@ -12,15 +12,18 @@ n = FacetNormal(cell)('+') ...@@ -12,15 +12,18 @@ n = FacetNormal(cell)('+')
u = TrialFunction(MV) u = TrialFunction(MV)
v = TestFunction(MV) v = TestFunction(MV)
rho, q0, q1 = split(u)
rhot, q0t, q1t = split(v)
mass = inner(u, v)*dx mass = inner(u, v)*dx
flux = as_matrix([[q0, q1], [rho, 0.], [0., rho]]) def flux(s):
rho, q0, q1 = split(s)
return as_matrix([[q0, q1], [rho, 0.], [0., rho]])
# Define numerical fluxes to choose from
llf_flux = dot(avg(flux(u)), n) - 0.5*jump(u)
numerical_flux = llf_flux
r = -1.*inner(flux, grad(v))*dx \ r = -1. * inner(flux(u), grad(v))*dx \
+ inner(dot(avg(flux), n) + 0.5*jump(u), jump(v))*dS \ - inner(numerical_flux, jump(v))*dS \
+ inner(u, v)*ds + inner(u, v)*ds
forms = [mass, r] forms = [mass, r]
......
...@@ -8,8 +8,9 @@ cells = 20 20 ...@@ -8,8 +8,9 @@ cells = 20 20
elementType = hexahedral elementType = hexahedral
[instat] [instat]
T = 1.5 T = 0.5
dt = 0.0025 dt = 0.005
theta = 0.0
[wrapper.vtkcompare] [wrapper.vtkcompare]
name = {__name} name = {__name}
......
...@@ -12,15 +12,18 @@ n = FacetNormal(cell)('+') ...@@ -12,15 +12,18 @@ n = FacetNormal(cell)('+')
u = TrialFunction(MV) u = TrialFunction(MV)
v = TestFunction(MV) v = TestFunction(MV)
rho, q0, q1 = split(u)
rhot, q0t, q1t = split(v)
mass = inner(u, v)*dx mass = inner(u, v)*dx
flux = as_matrix([[q0, q1], [rho, 0.], [0., rho]]) def flux(s):
rho, q0, q1 = split(s)
return as_matrix([[q0, q1], [rho, 0.], [0., rho]])
# Define numerical fluxes to choose from
llf_flux = dot(avg(flux(u)), n) - 0.5*jump(u)
numerical_flux = llf_flux
r = -1.*inner(flux, grad(v))*dx \ r = -1. * inner(flux(u), grad(v))*dx \
+ inner(dot(avg(flux), n) + 0.5*jump(u), jump(v))*dS \ - inner(numerical_flux, jump(v))*dS \
+ inner(u, v)*ds + inner(u, v)*ds
forms = [mass, r] forms = [mass, r]
......
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