From 372f03337e7f112d6da0ae55606f292d69e5558c Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Thu, 3 Aug 2017 14:47:24 +0200 Subject: [PATCH] Port the stokes tests --- test/stokes/stokes_dg.mini | 1 - test/stokes/stokes_dg.ufl | 3 +-- test/stokes/stokes_dg_quadrilateral.mini | 1 - test/stokes/stokes_dg_quadrilateral.ufl | 3 +-- test/stokes/stokes_quadrilateral.mini | 1 - test/stokes/stokes_quadrilateral.ufl | 7 ++++--- test/stokes/stokes_stress.mini | 1 - test/stokes/stokes_stress.ufl | 6 ++++-- test/stokes/stokes_stress_sym.mini | 1 - test/stokes/stokes_stress_sym.ufl | 6 ++++-- test/stokes/stokes_sym.mini | 3 --- test/stokes/stokes_sym.ufl | 8 ++++---- 12 files changed, 18 insertions(+), 23 deletions(-) diff --git a/test/stokes/stokes_dg.mini b/test/stokes/stokes_dg.mini index eb271101..9d65b4a9 100644 --- a/test/stokes/stokes_dg.mini +++ b/test/stokes/stokes_dg.mini @@ -16,5 +16,4 @@ zeroThreshold.data_1 = 1e-6 [formcompiler] numerical_jacobian = 0, 1 | expand num -exact_solution_expression = g compare_l2errorsquared = 1e-8 diff --git a/test/stokes/stokes_dg.ufl b/test/stokes/stokes_dg.ufl index f1995c8b..74b85742 100644 --- a/test/stokes/stokes_dg.ufl +++ b/test/stokes/stokes_dg.ufl @@ -2,8 +2,6 @@ cell = triangle x = SpatialCoordinate(cell) g_v = as_vector((4*x[1]*(1.-x[1]), 0.0)) -g_p = 8*(1.-x[0]) -g = (g_v, g_p) bctype = conditional(x[0] < 1. - 1e-8, 1, 0) P2 = VectorElement("DG", cell, 2) @@ -35,3 +33,4 @@ r = inner(grad(u), grad(v))*dx \ - q*inner(g_v, n)*ds forms = [r] +exact_solution = g_v, 8*(1.-x[0]) \ No newline at end of file diff --git a/test/stokes/stokes_dg_quadrilateral.mini b/test/stokes/stokes_dg_quadrilateral.mini index e8b76346..7f250996 100644 --- a/test/stokes/stokes_dg_quadrilateral.mini +++ b/test/stokes/stokes_dg_quadrilateral.mini @@ -11,5 +11,4 @@ extension = vtu [formcompiler] numerical_jacobian = 0, 1 | expand num -exact_solution_expression = g compare_l2errorsquared = 1e-8 diff --git a/test/stokes/stokes_dg_quadrilateral.ufl b/test/stokes/stokes_dg_quadrilateral.ufl index 0995ec6e..1beb3356 100644 --- a/test/stokes/stokes_dg_quadrilateral.ufl +++ b/test/stokes/stokes_dg_quadrilateral.ufl @@ -2,8 +2,6 @@ cell = quadrilateral x = SpatialCoordinate(cell) g_v = as_vector((4*x[1]*(1.-x[1]), 0.0)) -g_p = 8*(1.-x[0]) -g = (g_v, g_p) bctype = conditional(x[0] < 1. - 1e-8, 1, 0) P2 = VectorElement("DG", cell, 2) @@ -35,3 +33,4 @@ r = inner(grad(u), grad(v))*dx \ - q*inner(g_v, n)*ds forms = [r] +exact_solution = g_v, 8*(1.-x[0]) diff --git a/test/stokes/stokes_quadrilateral.mini b/test/stokes/stokes_quadrilateral.mini index 36ce9d61..e9440771 100644 --- a/test/stokes/stokes_quadrilateral.mini +++ b/test/stokes/stokes_quadrilateral.mini @@ -12,5 +12,4 @@ extension = vtu [formcompiler] numerical_jacobian = 1, 0 | expand num -exact_solution_expression = g compare_l2errorsquared = 1e-10 diff --git a/test/stokes/stokes_quadrilateral.ufl b/test/stokes/stokes_quadrilateral.ufl index 0d7c58aa..c8f630b8 100644 --- a/test/stokes/stokes_quadrilateral.ufl +++ b/test/stokes/stokes_quadrilateral.ufl @@ -3,10 +3,8 @@ cell = quadrilateral x = SpatialCoordinate(cell) v_bctype = conditional(x[0] < 1. - 1e-8, 1, 0) g_v = as_vector((4.*x[1]*(1.-x[1]), 0.0)) -g_p = 8.*(1.-x[0]) -g = (g_v, g_p) -P2 = VectorElement("Lagrange", cell, 2, dirichlet_constraints=v_bctype, dirichlet_expression=g_v) +P2 = VectorElement("Lagrange", cell, 2) P1 = FiniteElement("Lagrange", cell, 1) TH = P2 * P1 @@ -16,3 +14,6 @@ u, p = TrialFunctions(TH) r = (inner(grad(v), grad(u)) - div(v)*p - q*div(u))*dx forms = [r] +is_dirichlet = v_bctype, v_bctype, 0 +dirichlet_expression = g_v, None +exact_solution = g_v, 8.*(1.-x[0]) diff --git a/test/stokes/stokes_stress.mini b/test/stokes/stokes_stress.mini index a724a0a0..af72867f 100644 --- a/test/stokes/stokes_stress.mini +++ b/test/stokes/stokes_stress.mini @@ -17,5 +17,4 @@ extension = vtu [formcompiler] # numerical_jacobian = 0, 1 | expand num numerical_jacobian = 1 -exact_solution_expression = g compare_l2errorsquared = 1e-11 diff --git a/test/stokes/stokes_stress.ufl b/test/stokes/stokes_stress.ufl index d5c41e30..2efd1420 100644 --- a/test/stokes/stokes_stress.ufl +++ b/test/stokes/stokes_stress.ufl @@ -2,10 +2,9 @@ v_bctype = Expression("if (x[0] < 1. - 1e-8) return 1; else return 0;", on_inter g_v = Expression(("4*x[1]*(1.-x[1])", "0.0")) g_p = Expression("8*(1.-x[0])") g_S = Expression(("0.0", "0.0", "-8*x[1] + 4.", "0.0")) -g = g_v * g_p * g_S cell = triangle -P2 = VectorElement("Lagrange", cell, 2, dirichlet_constraints=v_bctype, dirichlet_expression=g_v) +P2 = VectorElement("Lagrange", cell) P1 = FiniteElement("Lagrange", cell, 1) P2_stress = TensorElement("DG", cell, 1) @@ -17,3 +16,6 @@ u, p, S = TrialFunctions(TH) r = (inner(grad(v), S) + inner(grad(u) - S, T) - div(v)*p - q*div(u))*dx forms = [r] +is_dirichlet = v_bctype, v_bctype, 0, 0, 0, 0, 0 +dirichlet_expression = g_v, None, None, None, None, None, None +exact_solution = g_v, g_p, g_S \ No newline at end of file diff --git a/test/stokes/stokes_stress_sym.mini b/test/stokes/stokes_stress_sym.mini index 328f5e89..1aa3d6f0 100644 --- a/test/stokes/stokes_stress_sym.mini +++ b/test/stokes/stokes_stress_sym.mini @@ -14,5 +14,4 @@ extension = vtu [formcompiler] numerical_jacobian = 1 -exact_solution_expression = g compare_l2errorsquared = 1e-6 diff --git a/test/stokes/stokes_stress_sym.ufl b/test/stokes/stokes_stress_sym.ufl index 47e41380..cff1dee5 100644 --- a/test/stokes/stokes_stress_sym.ufl +++ b/test/stokes/stokes_stress_sym.ufl @@ -2,10 +2,9 @@ v_bctype = Expression("if (x[0] < 1. - 1e-8) return 1; else return 0;", on_inter g_v = Expression(("4*x[1]*(1.-x[1])", "0.0")) g_p = Expression("8*(1.-x[0])") g_S = Expression(("0.0", "-8*x[1] + 4.", "0.0")) -g = g_v * g_p * g_S cell = triangle -P2 = VectorElement("Lagrange", cell, 2, dirichlet_constraints=v_bctype, dirichlet_expression=g_v) +P2 = VectorElement("Lagrange", cell, 2) P1 = FiniteElement("Lagrange", cell, 1) P2_stress = TensorElement("DG", cell, 1, symmetry={(0, 1): (1, 0)}) @@ -23,3 +22,6 @@ r = (inner(grad(v), S) + inner(2*sym(grad(u)) - S, T) - div(v)*p - q*div(u))*dx # + inner(S.T*n, v)*ds forms = [r] +is_dirichlet = v_bctype, v_bctype, 0, 0, 0, 0 +dirichlet_expression = g_v, None, None, None, None, None +exact_solution = g_v, g_p, g_S \ No newline at end of file diff --git a/test/stokes/stokes_sym.mini b/test/stokes/stokes_sym.mini index 75c34604..74bcae0d 100644 --- a/test/stokes/stokes_sym.mini +++ b/test/stokes/stokes_sym.mini @@ -14,7 +14,4 @@ extension = vtu [formcompiler] numerical_jacobian = 0, 1 | expand num -exact_solution_expression = g compare_l2errorsquared = 1e-11 -print_transformations = True -print_transformations_dir = . diff --git a/test/stokes/stokes_sym.ufl b/test/stokes/stokes_sym.ufl index 6c2b5e54..0fe8fea4 100644 --- a/test/stokes/stokes_sym.ufl +++ b/test/stokes/stokes_sym.ufl @@ -1,11 +1,8 @@ v_bctype = Expression("if (x[0] < 1. - 1e-8) return 1; else return 0;", on_intersection=True) g_v = Expression(("4*x[1]*(1.-x[1])", "0.0")) -g_p = Expression("8*(1.-x[0])") - -g = g_v * g_p cell = triangle -P2 = VectorElement("Lagrange", cell, 2, dirichlet_constraints=v_bctype, dirichlet_expression=g_v) +P2 = VectorElement("Lagrange", cell, 2) P1 = FiniteElement("Lagrange", cell, 1) TH = P2 * P1 @@ -18,3 +15,6 @@ n = FacetNormal(triangle)('+') r = (inner(2*sym(grad(u)), grad(v)) - div(v)*p - q*div(u))*dx - inner(grad(u).T*n,v)*ds forms = [r] +is_dirichlet = v_bctype, v_bctype, 0 +dirichlet_expression = g_v, None +exact_solution = g_v, 8.*(1.-x[0]) -- GitLab