def bind(self, discr): """Return a :class:`BoundPoissonOperator`.""" assert self.dimensions == discr.dimensions from grudge.mesh import check_bc_coverage check_bc_coverage(discr.mesh, [self.dirichlet_tag, self.neumann_tag]) return BoundDiffusionOperator(self, discr)
def bind(self, discr, sensor=None, sensor_scaling=None, viscosity_only=False): if (sensor is None and self.artificial_viscosity_mode is not None): raise ValueError("must specify a sensor if using " "artificial viscosity") bound_op = discr.compile( self.sym_operator(sensor_scaling=sensor_scaling, viscosity_only=False)) from grudge.mesh import check_bc_coverage check_bc_coverage(discr.mesh, [ self.inflow_tag, self.outflow_tag, self.noslip_tag, self.wall_tag, self.supersonic_inflow_tag, self.supersonic_outflow_tag, ]) if self.mu == 0 and not discr.get_boundary(self.noslip_tag).is_empty(): raise RuntimeError("no-slip BCs only make sense for " "viscous problems") def rhs(t, q): extra_kwargs = {} if self.source is not None: extra_kwargs["source_vect"] = self.source.volume_interpolant( t, q, discr) if sensor is not None: extra_kwargs["sensor"] = sensor(q) opt_result = bound_op( q=q, bc_q_in=self.bc_inflow.boundary_interpolant( t, discr, self.inflow_tag), bc_q_out=self.bc_outflow.boundary_interpolant( t, discr, self.outflow_tag), bc_q_noslip=self.bc_noslip.boundary_interpolant( t, discr, self.noslip_tag), bc_q_supersonic_in=self.bc_supersonic_inflow. boundary_interpolant(t, discr, self.supersonic_inflow_tag), **extra_kwargs) max_speed = opt_result[-1] ode_rhs = opt_result[:-1] return ode_rhs, discr.nodewise_max(max_speed) return rhs
def bind(self, discr, u0=1, sensor=None): compiled_sym_operator = discr.compile( self.sym_operator(with_sensor=sensor is not None)) from grudge.mesh import check_bc_coverage check_bc_coverage(discr.mesh, []) def rhs(t, u): kwargs = {} if sensor is not None: kwargs["sensor"] = sensor(u) return compiled_sym_operator(u=u, u0=u0, **kwargs) return rhs