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

Add poisson tensor test examples

parent ad360799
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,18 @@ dune_add_formcompiler_system_test(UFLFILE poisson_dg_quadrilateral.ufl ...@@ -60,6 +60,18 @@ dune_add_formcompiler_system_test(UFLFILE poisson_dg_quadrilateral.ufl
INIFILE poisson_dg_quadrilateral.mini INIFILE poisson_dg_quadrilateral.mini
) )
# 10. Poisson Test Case with a full permeability tensor
dune_add_formcompiler_system_test(UFLFILE poisson_tensor.ufl
BASENAME poisson_tensor
INIFILE poisson_tensor.mini
)
# 11. Poisson Test Case: DG with full permeability tensor
dune_add_formcompiler_system_test(UFLFILE poisson_dg_tensor.ufl
BASENAME poisson_dg_tensor
INIFILE poisson_dg_tensor.mini
)
# the reference vtk file # the reference vtk file
add_executable(poisson_dg_ref reference_main.cc) add_executable(poisson_dg_ref reference_main.cc)
set_target_properties(poisson_dg_ref PROPERTIES EXCLUDE_FROM_ALL 1) set_target_properties(poisson_dg_ref PROPERTIES EXCLUDE_FROM_ALL 1)
__name = poisson_dg_tensor_{__exec_suffix}
__exec_suffix = numdiff, symdiff | expand num
lowerleft = 0.0 0.0
extension = 1.0 1.0
cells = 32 32
elementType = quadrilateral
[wrapper.vtkcompare]
name = {__name}
reference = poisson_dg_ref
extension = vtu
[formcompiler]
numerical_jacobian = 1, 0 | expand num
exact_solution_expression = g
compare_l2errorsquared = 2e-5
cell = quadrilateral
x = SpatialCoordinate(cell)
I = Identity(2)
A = as_matrix([[x[i]*x[j] + I[i,j] for j in range(2)] for i in range(2)])
g = x[0]**2 + x[1]**2
c = 8.
f = -4.
V = FiniteElement("DG", cell, 1)
u = TrialFunction(V)
v = TestFunction(V)
n = FacetNormal(cell)('+')
gamma = 1.0
theta = -1.0
r = (inner(A*grad(u), grad(v)) + c*u*v)*dx \
+ inner(n, A*avg(grad(u)))*jump(v)*dS \
+ gamma*jump(u)*jump(v)*dS \
+ theta*jump(u)*inner(A*avg(grad(v)), n)*dS \
- inner(n, A*grad(u))*v*ds \
+ gamma*u*v*ds \
- theta*u*inner(A*grad(v), n)*ds \
- f*v*dx \
+ theta*g*inner(A*grad(v), n)*ds \
- gamma*g*v*ds
forms = [r]
__name = poisson_tensor_{__exec_suffix}
__exec_suffix = numdiff, symdiff | expand num
lowerleft = 0.0 0.0
upperright = 1.0 1.0
elements = 32 32
elementType = quadrilateral
[wrapper.vtkcompare]
name = {__name}
reference = poisson_ref
extension = vtu
[formcompiler]
numerical_jacobian = 1, 0 | expand num
exact_solution_expression = g
compare_l2errorsquared = 1e-6
cell = triangle
x = SpatialCoordinate(cell)
I = Identity(2)
A = as_matrix([[x[i]*x[j] + I[i,j] for j in range(2)] for i in range(2)])
g = x[0]**2 + x[1]**2
c = 8.
f = -4.
V = FiniteElement("CG", cell, 1, dirichlet_expression=g)
u = TrialFunction(V)
v = TestFunction(V)
forms = [(inner(A*grad(u), grad(v)) + c*u*v -f*v)*dx]
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