Skip to content

Commit

Permalink
Update TPE tests - esp for wave rk4 estimate
Browse files Browse the repository at this point in the history
  • Loading branch information
MTCam committed May 1, 2024
1 parent e7af8e8 commit 4c72f9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion grudge/models/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,13 @@ def max_characteristic_velocity(self, actx, t=None, fields=None):

def estimate_rk4_timestep(self, actx, dcoll, **kwargs):
# FIXME: Sketchy, empirically determined fudge factor
return 0.38 * super().estimate_rk4_timestep(actx, dcoll, **kwargs)
from meshmode.discretization.poly_element import SimplexElementGroupBase
from grudge.dof_desc import DD_VOLUME_ALL
volm_discr = dcoll.discr_from_dd(DD_VOLUME_ALL)
tpe = any(not isinstance(grp, SimplexElementGroupBase)
for grp in volm_discr.groups)
fudge_fac = 0.38 if not tpe else 0.23
return fudge_fac * super().estimate_rk4_timestep(actx, dcoll, **kwargs)

# }}}

Expand Down
9 changes: 5 additions & 4 deletions test/test_dt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ def test_geometric_factors_regular_refinement(actx_factory, name, tpe):
assert np.all(np.isclose(ratios, 2))

# Make sure it works with empty meshes
mesh = builder.get_mesh(0, builder.mesh_order)
dcoll = make_discretization_collection(actx, mesh, order=order,
discr_tag_to_group_factory=dtag_to_grp_fac)
factors = actx.thaw(dt_geometric_factors(dcoll)) # noqa: F841
if not tpe:
mesh = builder.get_mesh(0, builder.mesh_order)
dcoll = make_discretization_collection(actx, mesh, order=order,
discr_tag_to_group_factory=dtag_to_grp_fac)
factors = actx.thaw(dt_geometric_factors(dcoll)) # noqa: F841


@pytest.mark.parametrize("name", ["interval", "box2d", "box3d"])
Expand Down

0 comments on commit 4c72f9c

Please sign in to comment.