Skip to content

Commit

Permalink
Add TPE to dt estimate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MTCam committed Feb 5, 2024
1 parent 7967767 commit a4dd3f0
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions test/test_dt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,48 @@ def rhs(x):

@pytest.mark.parametrize("dim", [1, 2])
@pytest.mark.parametrize("degree", [2, 4])
def test_wave_dt_estimate(actx_factory, dim, degree, visualize=False):
actx = actx_factory()
@pytest.mark.parametrize("tpe", [False, True])
def test_wave_dt_estimate(actx_factory, dim, degree, tpe, visualize=False):

import pyopencl as cl
from grudge.array_context import TensorProductArrayContext

if tpe:
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
actx = TensorProductArrayContext(queue)
else:
actx = actx_factory()

# {{{ cases

from meshmode.mesh import TensorProductElementGroup
group_cls = TensorProductElementGroup if tpe else None

import meshmode.mesh.generation as mgen

a = [0, 0, 0]
b = [1, 1, 1]
mesh = mgen.generate_regular_rect_mesh(
a=a[:dim], b=b[:dim],
nelements_per_axis=(3,)*dim)
nelements_per_axis=(3,)*dim,
group_cls=group_cls)

assert mesh.dim == dim

dcoll = DiscretizationCollection(actx, mesh, order=degree)
from meshmode.discretization.poly_element import \
LegendreGaussLobattoTensorProductGroupFactory as Lgl

from grudge.dof_desc import DISCR_TAG_BASE
order = degree
dtag_to_grp_fac = None
if tpe:
order = None
dtag_to_grp_fac = {
DISCR_TAG_BASE: Lgl(degree)
}
dcoll = DiscretizationCollection(actx, mesh, order=order,
discr_tag_to_group_factory=dtag_to_grp_fac)

from grudge.models.wave import WeakWaveOperator
wave_op = WeakWaveOperator(dcoll, c=1)
Expand Down

0 comments on commit a4dd3f0

Please sign in to comment.