diff --git a/examples/advection/var-velocity.py b/examples/advection/var-velocity.py index de1b45354..cd9f1c867 100644 --- a/examples/advection/var-velocity.py +++ b/examples/advection/var-velocity.py @@ -215,12 +215,12 @@ def rhs(t, u): norm_u = actx.to_numpy(op.norm(dcoll, event.state_component, 2)) plot(event, "fld-var-velocity-%04d" % step) - step += 1 - logger.info("[%04d] t = %.5f |u| = %.5e", step, event.t, norm_u) + 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 - # NOTE: These are here to ensure the solution is bounded for the - # time interval specified - assert norm_u < 1 + step += 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..e7bb7bdb0 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 = ( @@ -884,6 +884,8 @@ def rhs(t, w): logger.info("dt %.5e nsteps %5d", dt, nsteps) + esc = None + step = 0 for event in dt_stepper.run(t_end=final_t): if isinstance(event, dt_stepper.StateComputed): @@ -1045,6 +1047,8 @@ def test_norm_real(actx_factory, p): ref_norm = (1/3)**0.5 elif p == np.inf: ref_norm = 1 + else: + raise AssertionError("unsupported p") logger.info("norm: %.5e %.5e", norm, ref_norm) assert abs(norm-ref_norm) / abs(ref_norm) < 1e-13 @@ -1066,6 +1070,8 @@ def test_norm_complex(actx_factory, p): ref_norm = (2/3)**0.5 elif p == np.inf: ref_norm = 2**0.5 + else: + raise AssertionError("unsupported p") logger.info("norm: %.5e %.5e", norm, ref_norm) assert abs(norm-ref_norm) / abs(ref_norm) < 1e-13 @@ -1088,6 +1094,8 @@ def test_norm_obj_array(actx_factory, p): ref_norm = (dim/3)**0.5 elif p == np.inf: ref_norm = 1 + else: + raise AssertionError("unsupported p") logger.info("norm: %.5e %.5e", norm, ref_norm) assert abs(norm-ref_norm) / abs(ref_norm) < 1e-14