-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test integral variant for Regge/HHJ (#3839)
* DO NOT MERGE * Test VOM with point variant * Update .github/workflows/build.yml * Test Regge point variant * add continuity test * Test H(curl div) element (#3843) * Test H(curl div) element * test Hu-Zhang * checkout ufl master branch * checkout master branches
- Loading branch information
Showing
4 changed files
with
76 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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("family, degree", [ | ||
("Regge", 0), | ||
("Regge", 1), | ||
("Regge", 2), | ||
("HHJ", 0), | ||
("HHJ", 1), | ||
("HHJ", 2), | ||
("GLS", 1), | ||
("GLS", 2), | ||
]) | ||
def test_tensor_continuity(mesh, family, degree): | ||
V = FunctionSpace(mesh, family, degree) | ||
u = rg.beta(V, 1.0, 2.0) | ||
|
||
n = FacetNormal(mesh) | ||
|
||
space = V.ufl_element().sobolev_space | ||
if space == HDivDiv: | ||
utrace = dot(n, dot(u, n)) | ||
elif space == HEin: | ||
if mesh.topological_dimension() == 2: | ||
t = perp(n) | ||
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)) | ||
else: | ||
if mesh.topological_dimension() == 2: | ||
t = perp(n) | ||
utrace = dot(t, dot(u, n)) | ||
else: | ||
utrace = cross(n, dot(u, n)) | ||
|
||
ujump = utrace('+') - utrace('-') | ||
assert assemble(inner(ujump, ujump)*dS) < 1E-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters