Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test integral variant for Regge/HHJ #3839

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ jobs:
--install defcon \
--install gadopt \
--install asQ \
--package-branch fiat pbrubeck/h1curl \
--package-branch finat pbrubeck/hhj \
pbrubeck marked this conversation as resolved.
Show resolved Hide resolved
--package-branch tsfc pbrubeck/hhj \
|| (cat firedrake-install.log && /bin/false)
- name: Install test dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/test_interpolate_cross_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def parameters(request):
expected = np.asarray(
[np.outer(coords[i], coords[i]) for i in range(len(coords))]
)
V_src = FunctionSpace(m_src, "Regge", 2) # Not point evaluation nodes
V_src = FunctionSpace(m_src, "Regge", 2, variant="point") # Not point evaluation nodes
V_dest = TensorFunctionSpace(m_dest, "CG", 4)
V_dest_2 = TensorFunctionSpace(m_dest, "DQ", 2)
elif request.param == "spheresphere":
Expand Down
39 changes: 39 additions & 0 deletions tests/regression/test_tensor_elements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from firedrake import *
import pytest


rg = RandomGenerator(PCG64(seed=1))


@pytest.fixture(params=("square", "cube"))
def mesh(request):
if request.param == "square":
return UnitSquareMesh(2, 2)
elif request.param == "cube":
return UnitCubeMesh(2, 2, 2)
else:
raise ValueError("Unrecognized mesh type")


@pytest.mark.parametrize("degree", (0, 1, 2))
@pytest.mark.parametrize("family", ("Regge", "HHJ"))
def test_tensor_continuity(mesh, family, degree):
V = FunctionSpace(mesh, family, degree)
u = rg.beta(V, 1.0, 2.0)

dim = mesh.topological_dimension()
n = FacetNormal(mesh)

space = V.ufl_element().sobolev_space
if space == HDivDiv:
utrace = dot(n, dot(u, n))
elif space == HEin:
if dim == 2:
t = dot(as_matrix([[0, -1], [1, 0]]), n)
utrace = dot(t, dot(u, t))
else:
t = as_matrix([[0, n[2], -n[1]], [-n[2], 0, n[0]], [n[1], -n[0], 0]])
utrace = dot(t, dot(u, t.T))

ujump = utrace('+') - utrace('-')
assert assemble(inner(ujump, ujump)*dS) < 1E-10
2 changes: 1 addition & 1 deletion tests/vertexonly/test_interpolation_from_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def vfs(request, parentmesh):

@pytest.fixture(params=[("CG", 2, TensorFunctionSpace),
("BDM", 2, VectorFunctionSpace),
("Regge", 2, FunctionSpace)],
("Regge", 2, lambda *args: FunctionSpace(*args, variant="point"))],
ids=lambda x: f"{x[2].__name__}({x[0]}{x[1]})")
def tfs(request, parentmesh):
family = request.param[0]
Expand Down
Loading