From 21a4b1fd3a01de52eae3a486df3ed8e7d5b2029c Mon Sep 17 00:00:00 2001 From: ksagiyam Date: Fri, 22 Nov 2024 01:58:13 +0000 Subject: [PATCH 1/2] hex: add tests for interior facet integration of geometric quantities --- tests/regression/test_integral_hex.py | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/regression/test_integral_hex.py b/tests/regression/test_integral_hex.py index 4d9a68e538..395ceed4d4 100644 --- a/tests/regression/test_integral_hex.py +++ b/tests/regression/test_integral_hex.py @@ -53,3 +53,42 @@ def test_integral_hex_interior_facet_solve(mesh_from_file): solve(a == L, sol, bcs=[bc]) err = assemble((sol - f)**2 * dx)**0.5 assert err < 1.e-14 + + +def make_nonuniform_box_mesh(): + mesh = BoxMesh(2, 1, 1, 2., 1., 1., hexahedral=True) + coordV = mesh.coordinates.function_space() + coords = Function(coordV).assign(mesh.coordinates) + bc = DirichletBC(coordV.sub(0), 3., 2) + bc.apply(coords) + return Mesh(coords) + + +@pytest.mark.parametrize('GQ_expected', [(CellSize, sqrt(6.)), + (CellVolume, 2.), + (FacetArea, 1.)]) +def test_integral_hex_interior_facet_geometric_quantities(GQ_expected): + GQ, expected = GQ_expected + mesh = make_nonuniform_box_mesh() + x, y, z = SpatialCoordinate(mesh) + e = y('+') * z('-')**2 + E = assemble(e * dS) + assert abs(E - 1. / 6.) < 1.e-14 + a = GQ(mesh)('-') + A = assemble(a * dS) + assert abs(A - expected) < 1.e-14 + EA = assemble(e * a * dS) + assert abs(EA - E * A) < 1.e-14 + + +def test_integral_hex_interior_facet_facet_avg(): + mesh = make_nonuniform_box_mesh() + x, y, z = SpatialCoordinate(mesh) + e = y('+') * z('-')**2 + E = assemble(e * dS) + assert abs(E - 1. / 6.) < 1.e-14 + a = facet_avg(y('-')**3 * z('+')**4) + A = assemble(a * dS) + assert abs(A - 1. / 20.) < 1.e-14 + EA = assemble(e * a * dS) + assert abs(EA - E * A) < 1.e-14 From fc824211c3b57369a1a221784de571a62d0865c7 Mon Sep 17 00:00:00 2001 From: ksagiyam Date: Fri, 22 Nov 2024 01:59:07 +0000 Subject: [PATCH 2/2] DROP BEFORE MERGE --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0fff428f43..be9f6ab3f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,6 +83,7 @@ jobs: --install defcon \ --install gadopt \ --install asQ \ + --package-branch tsfc ksagiyam/use_canonical_quadrature_point_ordering \ || (cat firedrake-install.log && /bin/false) - name: Install test dependencies run: |