From 1a4d368e84b29195b1de4fd3f15de924b48c3eb2 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl <alexfikl@gmail.com> Date: Fri, 19 Jun 2020 18:50:21 -0500 Subject: [PATCH] add a h_min value as well --- grudge/symbolic/operators.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/grudge/symbolic/operators.py b/grudge/symbolic/operators.py index c4afc0ec..77f735b9 100644 --- a/grudge/symbolic/operators.py +++ b/grudge/symbolic/operators.py @@ -742,6 +742,26 @@ def h_max_from_volume(ambient_dim, dim=None, dd=None): ) )**(1.0/dim) +def h_min_from_volume(ambient_dim, dim=None, dd=None): + """Defines a characteristic length based on the volume of the elements. + This length may not be representative if the elements have very high + aspect ratios. + """ + + import grudge.symbolic.primitives as prim + if dd is None: + dd = prim.DD_VOLUME + dd = prim.as_dofdesc(dd) + + if dim is None: + dim = ambient_dim + + return NodalMin(dd_in=dd)( + ElementwiseSumOperator(dd)( + MassOperator(dd_in=dd)(prim.Ones(dd)) + ) + )**(1.0/dim) + # }}} # vim: foldmethod=marker -- GitLab