diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index 8ae4b6c5768931901df1a2812be9a08366525d3b..9a0bc6c8295063cae57273b8c48ad33ce40fb087 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -36,6 +36,8 @@ def get_form_compiler_arguments(): parser.add_argument("--ini-file", type=str, help="An inifile to use. A generated driver will be hard-coded to it, a [formcompiler] section will be used as default values to form compiler arguments (use snake case)") parser.add_argument("--timer", action="store_true", help="measure times") parser.add_argument("--project-basedir", type=str, help="The base (build) directory of the dune-perftool project") + # TODO at some point this help description should be updated + parser.add_argument("--sumfact", action="store_true", help="Use sumfactorization") # Modify the positional argument to not be a list args = vars(parser.parse_args()) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d41b93944ed9bdad71cf18b0d3fbd337589c6012..f0812d3ee192ce780fc9288ca995f58d28c95475 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,3 +3,5 @@ add_subdirectory(laplace) add_subdirectory(nonlinear) add_subdirectory(poisson) add_subdirectory(stokes) + +add_subdirectory(sumfact) diff --git a/test/sumfact/CMakeLists.txt b/test/sumfact/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ef2765c02a5e22303da1bfe440916c3fce78d26 --- /dev/null +++ b/test/sumfact/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(poisson) diff --git a/test/sumfact/poisson/CMakeLists.txt b/test/sumfact/poisson/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cdc670b122dc2ab4337206661773cd840aace71 --- /dev/null +++ b/test/sumfact/poisson/CMakeLists.txt @@ -0,0 +1,11 @@ +# 1. Poisson Test Case: source f, bc g +dune_add_formcompiler_system_test(UFLFILE poisson.ufl + BASENAME sumfact_poisson + INIFILE poisson.mini + ) + +# 2. Poisson Test Case: DG, f + pure dirichlet +dune_add_formcompiler_system_test(UFLFILE poisson_dg.ufl + BASENAME sumfact_poisson_dg + INIFILE poisson_dg.mini + ) diff --git a/test/sumfact/poisson/poisson.mini b/test/sumfact/poisson/poisson.mini new file mode 100644 index 0000000000000000000000000000000000000000..5f07c985767d2ef9bfbe5e5bebcf82d801222833 --- /dev/null +++ b/test/sumfact/poisson/poisson.mini @@ -0,0 +1,18 @@ +__name = sumfact_poisson_{__exec_suffix} +__exec_suffix = numdiff, symdiff | expand num + +lowerleft = 0.0 0.0 +upperright = 1.0 1.0 +elements = 32 32 +elementType = simplical + +[wrapper.vtkcompare] +name = {__name} +reference = poisson_ref +extension = vtu + +[formcompiler] +numerical_jacobian = 1, 0 | expand num +exact_solution_expression = g +compare_l2errorsquared = 1e-6 +sumfact = 1 diff --git a/test/sumfact/poisson/poisson.ufl b/test/sumfact/poisson/poisson.ufl new file mode 100644 index 0000000000000000000000000000000000000000..8c62dd3a24d2f64a3aec350c2096fd65967498d8 --- /dev/null +++ b/test/sumfact/poisson/poisson.ufl @@ -0,0 +1,8 @@ +f = Expression("Dune::FieldVector<double,2> c(0.5); c-= x; return 4.*(1.-c.two_norm2())*std::exp(-1.*c.two_norm2());") +g = Expression("Dune::FieldVector<double,2> c(0.5); c-= x; return std::exp(-1.*c.two_norm2());") + +V = FiniteElement("CG", "triangle", 1, dirichlet_expression=g) +u = TrialFunction(V) +v = TestFunction(V) + +forms = [(inner(grad(u), grad(v)) - f*v)*dx] diff --git a/test/sumfact/poisson/poisson_dg.mini b/test/sumfact/poisson/poisson_dg.mini new file mode 100644 index 0000000000000000000000000000000000000000..8a2000a43db23777bd2a16ef034a794460bd3b98 --- /dev/null +++ b/test/sumfact/poisson/poisson_dg.mini @@ -0,0 +1,18 @@ +__name = sumfact_poisson_dg_{__exec_suffix} +__exec_suffix = numdiff, symdiff | expand num + +lowerleft = 0.0 0.0 +upperright = 1.0 1.0 +elements = 32 32 +elementType = simplical + +[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 +sumfact = 1 diff --git a/test/sumfact/poisson/poisson_dg.ufl b/test/sumfact/poisson/poisson_dg.ufl new file mode 100644 index 0000000000000000000000000000000000000000..0ee5a857931d2ceea62b8cf5e52c5aed2b696851 --- /dev/null +++ b/test/sumfact/poisson/poisson_dg.ufl @@ -0,0 +1,26 @@ +f = Expression("Dune::FieldVector<double,2> c(0.5); c-= x; return 4.*(1.-c.two_norm2())*std::exp(-1.*c.two_norm2());") +g = Expression("Dune::FieldVector<double,2> c(0.5); c-= x; return std::exp(-1.*c.two_norm2());", on_intersection=True) + +cell = triangle +V = FiniteElement("DG", cell, 1) + +u = TrialFunction(V) +v = TestFunction(V) + +n = FacetNormal(cell)('+') + +gamma = 1.0 +theta = 1.0 + +r = inner(grad(u), grad(v))*dx \ + + inner(n, avg(grad(u)))*jump(v)*dS \ + + gamma*jump(u)*jump(v)*dS \ + + theta*jump(u)*inner(avg(grad(v)), n)*dS \ + - inner(n, grad(u))*v*ds \ + + gamma*u*v*ds \ + - theta*u*inner(grad(v), n)*ds \ + - f*v*dx \ + + theta*g*inner(grad(v), n)*ds \ + - gamma*g*v*ds + +forms = [r]