diff --git a/examples/advection/var-velocity.py b/examples/advection/var-velocity.py index de1b45354..a917c38f4 100644 --- a/examples/advection/var-velocity.py +++ b/examples/advection/var-velocity.py @@ -215,12 +215,13 @@ def rhs(t, u): norm_u = actx.to_numpy(op.norm(dcoll, event.state_component, 2)) plot(event, "fld-var-velocity-%04d" % step) + logger.info("[%04d] t = %.5f |u| = %.5e", step, event.t, norm_u) + # NOTE: These are here to ensure the solution is bounded for the + # time interval specified + assert norm_u < 1 + step += 1 - logger.info("[%04d] t = %.5f |u| = %.5e", step, event.t, norm_u) - # NOTE: These are here to ensure the solution is bounded for the - # time interval specified - assert norm_u < 1 # }}} diff --git a/grudge/models/em.py b/grudge/models/em.py index 938e98e87..05859a3d6 100644 --- a/grudge/models/em.py +++ b/grudge/models/em.py @@ -246,6 +246,8 @@ def flux(self, wtpair): e, h = self.split_eh(wtpair) epsilon = self.epsilon mu = self.mu + else: + raise NotImplementedError("only fixed material spported for now") Z_int = (mu/epsilon)**0.5 # noqa: N806 Y_int = 1/Z_int # noqa: N806 @@ -348,6 +350,8 @@ def absorbing_bc(self, w): if self.fixed_material: epsilon = self.epsilon mu = self.mu + else: + raise NotImplementedError("only fixed material supported for now") absorb_Z = (mu/epsilon)**0.5 # noqa: N806 absorb_Y = 1/absorb_Z # noqa: N806 @@ -394,6 +398,8 @@ def operator(self, t, w): # need to check this material_divisor = ( [self.epsilon]*elec_components+[self.mu]*mag_components) + else: + raise NotImplementedError("only fixed material supported for now") tags_and_bcs = [ (self.pec_tag, self.pec_bc(w)), @@ -567,9 +573,6 @@ def get_rectangular_cavity_mode(actx, nodes, t, E_0, mode_indices): # noqa: N80 cx = actx.np.cos(kx*x) sy = actx.np.sin(ky*y) cy = actx.np.cos(ky*y) - if dims == 3: - sz = actx.np.sin(kz*z) - cz = actx.np.cos(kz*z) if dims == 2: tfac = t * omega @@ -584,7 +587,10 @@ def get_rectangular_cavity_mode(actx, nodes, t, E_0, mode_indices): # noqa: N80 * np.sin(tfac) / omega), # hy zeros, ) - else: + elif dims == 3: + sz = actx.np.sin(kz*z) + cz = actx.np.cos(kz*z) + tdep = np.exp(-1j * omega * t) gamma_squared = ky**2 + kx**2 @@ -596,6 +602,8 @@ def get_rectangular_cavity_mode(actx, nodes, t, E_0, mode_indices): # noqa: N80 1j * omega * kx*E_0*cx*sy*cz*tdep / gamma_squared, zeros, ) + else: + raise NotImplementedError("only 2D and 3D supported") return result diff --git a/test/test_grudge.py b/test/test_grudge.py index 022545ca5..3686e1d10 100644 --- a/test/test_grudge.py +++ b/test/test_grudge.py @@ -349,7 +349,7 @@ def test_face_normal_surface(actx_factory, mesh_name): dof_desc.FACE_RESTR_INTERIOR, dof_desc.VTAG_ALL) )(face_normal_i) - if mesh.ambient_dim == 3: + if ambient_dim == 3: from grudge.geometry import pseudoscalar, area_element # NOTE: there's only one face tangent in 3d face_tangent = (