-
Notifications
You must be signed in to change notification settings - Fork 17
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
Enable dt estimate for quads/hexes, extend tests for it #338
base: main
Are you sure you want to change the base?
Conversation
2f3a604
to
cc6bc8f
Compare
Co-authored-by: Andreas Kloeckner <[email protected]>
cc6bc8f
to
b3eff8b
Compare
Well... for some very innocuous-looking changes, this has some very exciting-looking failures. 😬 |
I forgot about these. At some point I had worked out a plan for how to fix these tests, but now have turned away too long to remember. I'll have another look. |
grudge/dt_utils.py
Outdated
@@ -256,11 +271,10 @@ def dt_geometric_factors( | |||
actx = dcoll._setup_actx | |||
volm_discr = dcoll.discr_from_dd(dd) | |||
|
|||
r_fac = dcoll.dim | |||
if any(not isinstance(grp, SimplexElementGroupBase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check for supported element types instead.
@MTCam Now all the remaining failures are numerical in nature, illustrating (I think) that this does not find a valid time step estimate for tensor product elements even for wave. |
If we adjust the sketchy fudge factor in the wave operator's rk4 estimate to 0.23 for TPE. I think it passes. That fudge factor is dependent on element type. I think I also added a skip for the dim=1 tests for TPEs as there is no 1D TPE. |
grudge/dt_utils.py
Outdated
For non-simplicial elements, we use the following formula for a mean | ||
cell size measure: | ||
|
||
.. math:: | ||
|
||
r_D = \frac{2~d~V}{\sum_{i=1}^{N_{faces}} F_i}, | ||
|
||
where :math:`d` is the topological dimension, :math:`V` is the cell volume, | ||
and :math:`F_i` are the areas of each face of the cell. Other valid choices | ||
here include the shortest, longest, average of the cell diagonals, or edges. | ||
The value returned by this routine (i.e. the cell volume divided by the | ||
average cell face area) is bounded by the extrema of the cell edge lengths, | ||
is straightforward to calculate regardless of element shape, and jibes well | ||
with the foregoing calculation for simplicial elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MTCam says this inaccurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed up now.
test/test_dt_utils.py
Outdated
@pytest.mark.parametrize("tpe", [False, True]) | ||
def test_wave_dt_estimate(actx_factory, dim, degree, tpe, visualize=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also try with anisotropic meshes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm attempting to add some gmsh-generated meshes to the tests, but both simplices and tensor product fail when I use those meshes. (3c4ebea)
test/test_dt_utils.py
Outdated
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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe go warped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect you won't be super impressed by what I've done in 7b8f37b to get passing warped mesh tests, but please take a look and we can discuss.
cc @MTCam
TensorProductElementGroupBase.bases_1d
meshmode#409