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

Add more tests for dS(hex_mesh) #3878

Open
wants to merge 2 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
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
39 changes: 39 additions & 0 deletions tests/regression/test_integral_hex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading