From 244e7ee39f2fda83ae709c56096a76e5a889539c Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Wed, 5 Dec 2018 10:12:28 +0100 Subject: [PATCH] Equidistant PDELab geometrys and test adaption --- python/dune/codegen/pdelab/geometry.py | 17 +++++++++++------ test/hyperbolic/linearacoustics.mini | 1 + .../navierstokes_2d_dg_quadrilateral.mini | 1 + .../navierstokes_3d_dg_quadrilateral.mini | 1 + test/nonlinear/diffusivewave.mini | 1 + .../poisson_2d_cg_quadrilateral.mini | 1 + .../poisson_2d_dg_quadrilateral.mini | 1 + .../poisson_3d_cg_hexahedron.mini | 1 + .../poisson_3d_dg_hexahedron.mini | 1 + test/poisson/opcount_poisson_dg_symdiff.mini | 1 + test/poisson/poisson_dg_quadrilateral.mini | 2 +- test/poisson/poisson_dg_tensor.mini | 1 + test/stokes/stokes_3d_dg_quadrilateral.mini | 1 + test/stokes/stokes_3d_quadrilateral.mini | 1 + test/stokes/stokes_dg_quadrilateral.mini | 1 + test/stokes/stokes_quadrilateral.mini | 1 + 16 files changed, 26 insertions(+), 7 deletions(-) diff --git a/python/dune/codegen/pdelab/geometry.py b/python/dune/codegen/pdelab/geometry.py index 0efd5a27..e1f2bd4b 100644 --- a/python/dune/codegen/pdelab/geometry.py +++ b/python/dune/codegen/pdelab/geometry.py @@ -235,13 +235,16 @@ class AxiparallelGeometryMixin(GenericPDELabGeometryMixin): # embedded into higher dimensional world space. return self.jacobian_determinant(o) - @preamble def define_facet_jacobian_determinant(self, name): + valuearg(name) + self._define_facet_jacobian_determinant(name) + + @preamble + def _define_facet_jacobian_determinant(self, name): # NB: In the equidistant case, this might be optimized to store *d* values on the operator level # We don't do that right now for laziness. geo = name_geometry() pos = name_localcenter() - valuearg(name) return "auto {} = {}.integrationElement({});".format(name, geo, @@ -251,16 +254,18 @@ class AxiparallelGeometryMixin(GenericPDELabGeometryMixin): @geometry_mixin("equidistant") class EquidistantGeometryMixin(AxiparallelGeometryMixin): - @class_member(classtag="operator") def define_jacobian_determinant(self, name): valuearg(name) - self._define_jacobian_determinant_eval(name) + self._define_jacobian_determinant(name) + + @class_member(classtag="operator") + def _define_jacobian_determinant(self, name): from dune.codegen.pdelab.localoperator import lop_template_ansatz_gfs gfst = lop_template_ansatz_gfs() return "typename {}::Traits::GridView::template Codim<0>::Geometry::ctype {};".format(gfst, name) @preamble(kernel="operator") - def _define_jacobian_determinant_eval(name): + def _define_jacobian_determinant_eval(self, name): from dune.codegen.pdelab.localoperator import name_ansatz_gfs_constructor_param, lop_template_range_field gfs = name_ansatz_gfs_constructor_param() rft = lop_template_range_field() @@ -276,7 +281,7 @@ class EquidistantGeometryMixin(AxiparallelGeometryMixin): return "typename {}::Traits::GridView::template Codim<0>::Geometry::JacobianInverseTransposed {};".format(gfst, name) @preamble(kernel="operator") - def _define_jacobian_inverse_transposed_eval(name): + def _define_jacobian_inverse_transposed_eval(self, name): from dune.codegen.pdelab.localoperator import name_ansatz_gfs_constructor_param, lop_template_range_field gfs = name_ansatz_gfs_constructor_param() rft = lop_template_range_field() diff --git a/test/hyperbolic/linearacoustics.mini b/test/hyperbolic/linearacoustics.mini index ad1cc95b..77ecbf4d 100644 --- a/test/hyperbolic/linearacoustics.mini +++ b/test/hyperbolic/linearacoustics.mini @@ -15,6 +15,7 @@ extension = vtu [formcompiler] explicit_time_stepping = 1 operators = mass, r +geometry_mixins = equidistant [formcompiler.mass] numerical_jacobian = 1 diff --git a/test/navier-stokes/navierstokes_2d_dg_quadrilateral.mini b/test/navier-stokes/navierstokes_2d_dg_quadrilateral.mini index 5700107d..460c5c14 100644 --- a/test/navier-stokes/navierstokes_2d_dg_quadrilateral.mini +++ b/test/navier-stokes/navierstokes_2d_dg_quadrilateral.mini @@ -23,6 +23,7 @@ l2error_tree_path = 1, 1, 0 explicit_time_stepping = 0 yaspgrid_offset = 1 overlapping = 1 +geometry_mixins = equidistant [formcompiler.mass] numerical_jacobian = 0, 1 | expand num diff --git a/test/navier-stokes/navierstokes_3d_dg_quadrilateral.mini b/test/navier-stokes/navierstokes_3d_dg_quadrilateral.mini index 8823cb1b..968e9894 100644 --- a/test/navier-stokes/navierstokes_3d_dg_quadrilateral.mini +++ b/test/navier-stokes/navierstokes_3d_dg_quadrilateral.mini @@ -18,6 +18,7 @@ compare_l2errorsquared = 5e-4 # Only calculate error for the velocity part l2error_tree_path = 1, 1, 1, 0 operators = mass, r +geometry_mixins = equidistant [formcompiler.mass] numerical_jacobian = 0, 1 | expand num diff --git a/test/nonlinear/diffusivewave.mini b/test/nonlinear/diffusivewave.mini index c82f8ed2..7aa66686 100644 --- a/test/nonlinear/diffusivewave.mini +++ b/test/nonlinear/diffusivewave.mini @@ -15,6 +15,7 @@ T = 0.01 [formcompiler] operators = mass, poisson +geometry_mixins = equidistant [formcompiler.mass] sumfact = 0, 1 | expand sf diff --git a/test/poisson/dimension-grid-variations/poisson_2d_cg_quadrilateral.mini b/test/poisson/dimension-grid-variations/poisson_2d_cg_quadrilateral.mini index c5ec6e72..2bdf9174 100644 --- a/test/poisson/dimension-grid-variations/poisson_2d_cg_quadrilateral.mini +++ b/test/poisson/dimension-grid-variations/poisson_2d_cg_quadrilateral.mini @@ -9,3 +9,4 @@ extension = vtu [formcompiler] compare_l2errorsquared = 9e-8 +geometry_mixins = equidistant diff --git a/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini b/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini index cce6d681..6b4182ce 100644 --- a/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini +++ b/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini @@ -9,3 +9,4 @@ extension = vtu [formcompiler] compare_l2errorsquared = 6e-7 +geometry_mixins = equidistant diff --git a/test/poisson/dimension-grid-variations/poisson_3d_cg_hexahedron.mini b/test/poisson/dimension-grid-variations/poisson_3d_cg_hexahedron.mini index 1d4c4e96..9365f433 100644 --- a/test/poisson/dimension-grid-variations/poisson_3d_cg_hexahedron.mini +++ b/test/poisson/dimension-grid-variations/poisson_3d_cg_hexahedron.mini @@ -9,3 +9,4 @@ extension = vtu [formcompiler] compare_l2errorsquared = 9e-5 +geometry_mixins = equidistant diff --git a/test/poisson/dimension-grid-variations/poisson_3d_dg_hexahedron.mini b/test/poisson/dimension-grid-variations/poisson_3d_dg_hexahedron.mini index 14429885..fa0b3a6d 100644 --- a/test/poisson/dimension-grid-variations/poisson_3d_dg_hexahedron.mini +++ b/test/poisson/dimension-grid-variations/poisson_3d_dg_hexahedron.mini @@ -9,3 +9,4 @@ extension = vtu [formcompiler] compare_l2errorsquared = 1e-4 +geometry_mixins = equidistant diff --git a/test/poisson/opcount_poisson_dg_symdiff.mini b/test/poisson/opcount_poisson_dg_symdiff.mini index d98044df..186c4344 100644 --- a/test/poisson/opcount_poisson_dg_symdiff.mini +++ b/test/poisson/opcount_poisson_dg_symdiff.mini @@ -10,3 +10,4 @@ extension = vtu [formcompiler] opcounter = 1 instrumentation_level = 3 +geometry_mixins = equidistant diff --git a/test/poisson/poisson_dg_quadrilateral.mini b/test/poisson/poisson_dg_quadrilateral.mini index 162e2479..be6d3e2a 100644 --- a/test/poisson/poisson_dg_quadrilateral.mini +++ b/test/poisson/poisson_dg_quadrilateral.mini @@ -11,7 +11,7 @@ extension = vtu [formcompiler] compare_l2errorsquared = 7e-7 -geometry = equidistant +geometry_mixins = equidistant [formcompiler.r] numerical_jacobian = 1, 0 | expand num diff --git a/test/poisson/poisson_dg_tensor.mini b/test/poisson/poisson_dg_tensor.mini index d696cebc..c799f45d 100644 --- a/test/poisson/poisson_dg_tensor.mini +++ b/test/poisson/poisson_dg_tensor.mini @@ -13,6 +13,7 @@ extension = vtu [formcompiler] compare_l2errorsquared = 4e-6 +geometry_mixins = equidistant [formcompiler.r] numerical_jacobian = 1, 0 | expand num \ No newline at end of file diff --git a/test/stokes/stokes_3d_dg_quadrilateral.mini b/test/stokes/stokes_3d_dg_quadrilateral.mini index 59396277..8cb5d51d 100644 --- a/test/stokes/stokes_3d_dg_quadrilateral.mini +++ b/test/stokes/stokes_3d_dg_quadrilateral.mini @@ -11,6 +11,7 @@ extension = vtu [formcompiler] compare_l2errorsquared = 6e-8 +geometry_mixins = equidistant [formcompiler.r] numerical_jacobian = 0, 1 | expand num diff --git a/test/stokes/stokes_3d_quadrilateral.mini b/test/stokes/stokes_3d_quadrilateral.mini index 17f3d9f5..ecf02f57 100644 --- a/test/stokes/stokes_3d_quadrilateral.mini +++ b/test/stokes/stokes_3d_quadrilateral.mini @@ -12,6 +12,7 @@ extension = vtu [formcompiler] compare_l2errorsquared = 1e-10 +geometry_mixins = equidistant [formcompiler.r] numerical_jacobian = 1, 0 | expand num diff --git a/test/stokes/stokes_dg_quadrilateral.mini b/test/stokes/stokes_dg_quadrilateral.mini index 78954b12..e91ad9c8 100644 --- a/test/stokes/stokes_dg_quadrilateral.mini +++ b/test/stokes/stokes_dg_quadrilateral.mini @@ -11,6 +11,7 @@ extension = vtu [formcompiler] compare_l2errorsquared = 1e-8 +geometry_mixins = equidistant [formcompiler.r] numerical_jacobian = 0, 1 | expand num diff --git a/test/stokes/stokes_quadrilateral.mini b/test/stokes/stokes_quadrilateral.mini index 6ee36e82..6954f227 100644 --- a/test/stokes/stokes_quadrilateral.mini +++ b/test/stokes/stokes_quadrilateral.mini @@ -12,6 +12,7 @@ extension = vtu [formcompiler] compare_l2errorsquared = 1e-10 +geometry_mixins = equidistant [formcompiler.r] numerical_jacobian = 1, 0 | expand num -- GitLab