From 752473e9139f46385b26f8606f2ce9937f541edd Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Wed, 30 Jul 2025 14:19:50 +0100 Subject: [PATCH 1/4] Test consistent facet orientation for non-point variants --- .../regression/test_facet_orientation.py | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/tests/firedrake/regression/test_facet_orientation.py b/tests/firedrake/regression/test_facet_orientation.py index 438613302c..7f5f05dba0 100644 --- a/tests/firedrake/regression/test_facet_orientation.py +++ b/tests/firedrake/regression/test_facet_orientation.py @@ -3,28 +3,31 @@ """ from os.path import abspath, dirname, join +from functools import partial import pytest import numpy as np from firedrake import * cwd = abspath(dirname(__file__)) +meshes = [ + partial(UnitSquareMesh, 5, 5, quadrilateral=False), + partial(UnitSquareMesh, 5, 5, quadrilateral=True), + partial(UnitIcosahedralSphereMesh, 2), + partial(UnitCubedSphereMesh, 3), + partial(Mesh, join(cwd, "..", "meshes", "unitsquare_unstructured_quadrilaterals.msh")), +] -@pytest.mark.parametrize('mesh_thunk', - [lambda: UnitSquareMesh(5, 5, quadrilateral=False), - lambda: UnitSquareMesh(5, 5, quadrilateral=True), - lambda: UnitIcosahedralSphereMesh(2), - lambda: UnitCubedSphereMesh(3), - lambda: Mesh(join(cwd, "..", "meshes", - "unitsquare_unstructured_quadrilaterals.msh"))]) -def test_consistent_facet_orientation(mesh_thunk): - mesh = mesh_thunk() + +def run_consistent_facet_orientation(mesh_thunk, variant="equispaced", **kwargs): + mesh = mesh_thunk(**kwargs) x = SpatialCoordinate(mesh) degree = 3 - fe_cg = FiniteElement("CG", mesh.ufl_cell(), degree, variant="equispaced") - V = FunctionSpace(mesh, fe_cg) # continuous space - fe_dg = FiniteElement("DG", mesh.ufl_cell(), degree, variant="equispaced") - W = FunctionSpace(mesh, fe_dg) # discontinuous space + V = FunctionSpace(mesh, "CG", degree, variant=variant) # continuous space + if variant == "equispaced": + W = FunctionSpace(mesh, "DG", degree, variant=variant) # discontinuous space + else: + W = FunctionSpace(mesh, BrokenElement(V.ufl_element())) # discontinuous space Q = FunctionSpace(mesh, "DG", 0) # result space @@ -32,7 +35,7 @@ def test_consistent_facet_orientation(mesh_thunk): f = Function(V).interpolate(expression) g = Function(W).interpolate(expression) - q = Function(Q).interpolate(Constant(0.0)) + q = Function(Q) domain = "{[i]: 0 <= i < C.dofs}" instructions = """ @@ -43,3 +46,16 @@ def test_consistent_facet_orientation(mesh_thunk): par_loop((domain, instructions), dx, {'C': (f, READ), 'D': (g, READ), 'R': (q, RW)}) assert np.allclose(q.dat.data, 0.0) + + +@pytest.mark.parametrize('mesh_thunk', meshes) +def test_consistent_facet_orientation(mesh_thunk): + run_consistent_facet_orientation(mesh_thunk) + + +@pytest.mark.parallel(nprocs=2) +@pytest.mark.parametrize('variant', ("equispaced", "integral")) +@pytest.mark.parametrize('mesh_thunk', meshes) +def test_consistent_facet_orientation_parallel(mesh_thunk, variant): + dp = {"overlap_type": (DistributedMeshOverlapType.NONE, 0)} + run_consistent_facet_orientation(mesh_thunk, variant=variant, distribution_parameters=dp) From ad003239b577f0d8f474af9f370d8732ccd5f975 Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Wed, 30 Jul 2025 14:21:38 +0100 Subject: [PATCH 2/4] DROP BEFORE MERGE --- .github/workflows/core.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index fece42b1fd..74f8a733d0 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -205,6 +205,7 @@ jobs: --extra-index-url https://download.pytorch.org/whl/cpu \ "$(echo ./firedrake-repo/dist/firedrake-*.tar.gz)[ci,docs]" + pip install -I "firedrake-fiat @ git+https://github.com/firedrakeproject/fiat.git@pbrubeck/fix/permutations" firedrake-clean pip list From ddf8040c15aaa658d1bc0532b27e485d6574ea9e Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Mon, 8 Sep 2025 12:00:36 +0100 Subject: [PATCH 3/4] Update .github/workflows/core.yml Co-authored-by: ksagiyam <46749170+ksagiyam@users.noreply.github.com> --- .github/workflows/core.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index b0b243da90..997992cb44 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -219,7 +219,6 @@ jobs: --extra-index-url https://download.pytorch.org/whl/cpu \ "$(echo ./firedrake-repo/dist/firedrake-*.tar.gz)[ci,docs]" - pip install -I "firedrake-fiat @ git+https://github.com/firedrakeproject/fiat.git@pbrubeck/fix/permutations" firedrake-clean pip list From c96a194888d58c905d8515c86a854092db3e759c Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Fri, 22 Aug 2025 09:32:19 +0100 Subject: [PATCH 4/4] Fix solver parameters for Stokes test (#4514) --- tests/firedrake/macro/test_macro_solve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/firedrake/macro/test_macro_solve.py b/tests/firedrake/macro/test_macro_solve.py index 454e04a285..b30c2a74c1 100644 --- a/tests/firedrake/macro/test_macro_solve.py +++ b/tests/firedrake/macro/test_macro_solve.py @@ -151,7 +151,7 @@ def test_stokes(mh, variant, mixed_element): Z, [Z.sub(0), VectorSpaceBasis(constant=True, comm=COMM_WORLD)] ) - solve(a == L, zh, bcs=bcs, nullspace=nullspace, solver_parameters={"ksp_type": "preonly", "pc_type": "cholesky", "pc_factor_mat_solver_type": "mumps"}) + solve(a == L, zh, bcs=bcs, nullspace=nullspace) uh, ph = zh.subfunctions u_err.append(errornorm(as_vector(uexact), uh))