diff --git a/examples/wave/var-propagation-speed.py b/examples/wave/var-propagation-speed.py index f392b420d4e06c6fb547c6461c0290726388cf29..858e72549413b8120962a8052ebd7174622fff18 100644 --- a/examples/wave/var-propagation-speed.py +++ b/examples/wave/var-propagation-speed.py @@ -56,7 +56,7 @@ def main(write_output=True, order=4): sym_t = sym.ScalarVariable("t") c = sym.If(sym.Comparison( np.dot(sym_x, sym_x), "<", 0.15), - np.float32(-0.1), np.float32(-0.2)) + np.float32(0.1), np.float32(0.2)) from grudge.models.wave import VariableCoefficientWeakWaveOperator from meshmode.mesh import BTAG_ALL, BTAG_NONE diff --git a/grudge/models/wave.py b/grudge/models/wave.py index 09a954e873573df374402c28762668573ae71882..1be9abe2a7339870941fcbc8e973a7eea7137c3e 100644 --- a/grudge/models/wave.py +++ b/grudge/models/wave.py @@ -370,18 +370,18 @@ class VariableCoefficientWeakWaveOperator(HyperbolicOperator): v = w[2:] normal = sym.normal(w.dd, self.ambient_dim) + flux_central_weak = -0.5 * flat_obj_array( + np.dot(v.int*c.int + v.ext*c.ext, normal), + (u.int * c.int + u.ext*c.ext) * normal) + if self.flux_type == "central": - return -0.5 * flat_obj_array( - np.dot(v.int*c.int + v.ext*c.ext, normal), - (u.int * c.int + u.ext*c.ext) * normal) + return flux_central_weak elif self.flux_type == "upwind": - return -0.5 * flat_obj_array( - np.dot(normal, c.ext * v.ext + c.int * v.int) - + c.ext*u.ext - c.int * u.int, + return flux_central_weak - 0.5 * flat_obj_array( + c.ext*u.ext - c.int * u.int, - normal * (np.dot(normal, c.ext * v.ext - c.int * v.int) - + c.ext*u.ext + c.int * u.int)) + normal * (np.dot(normal, c.ext * v.ext - c.int * v.int))) else: raise ValueError("invalid flux type '%s'" % self.flux_type) @@ -443,7 +443,6 @@ class VariableCoefficientWeakWaveOperator(HyperbolicOperator): -self.c*(sym.stiffness_t(self.ambient_dim)*u) ) - - sym.FaceMassOperator()(flux(sym.int_tpair(flux_w)) + flux(sym.bv_tpair(self.dirichlet_tag, flux_w, dir_bc)) + flux(sym.bv_tpair(self.neumann_tag, flux_w, neu_bc))