From 2791af5826d6584dba7115ca57a08da07c9525e6 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Wed, 26 May 2021 16:21:27 -0500 Subject: [PATCH] mv_normal: Improve check on when it's valid to copute normals --- grudge/geometry/metrics.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grudge/geometry/metrics.py b/grudge/geometry/metrics.py index 3090cd56..40eb0306 100644 --- a/grudge/geometry/metrics.py +++ b/grudge/geometry/metrics.py @@ -552,12 +552,15 @@ def mv_normal( import grudge.dof_desc as dof_desc dd = dof_desc.as_dofdesc(dd) - if not dd.is_trace(): - raise ValueError("may only request normals on boundaries") dim = dcoll.discr_from_dd(dd).dim ambient_dim = dcoll.ambient_dim + if dim == ambient_dim: + raise ValueError("may only request normals on domains whose topological " + f"dimension ({dim}) differs from " + f"their ambient dimension ({ambient_dim})") + if dim == ambient_dim - 1: return rel_mv_normal(actx, dcoll, dd=dd) -- GitLab