def setBounds(self, **bounds): """Set the lower and upper bounds on the solution. The argument list should consist of keyword/value pairs, with component names as keywords and (lower_bound, upper_bound) tuples as the values. The keyword *default* may be used to specify default bounds for all unspecified components. The keyword *Y* can be used to stand for all species mass fractions in flow domains. >>> d.setBounds(default=(0, 1), ... Y=(-1.0e-5, 2.0)) """ d = {} if bounds.has_key('default'): for n in range(self.nComponents()): d[self.componentName(n)] = bounds['default'] del bounds['default'] for b in bounds.keys(): if b == 'Y': if self.type >= 50: nc = self.nComponents() for n in range(4, nc): d[self.componentName(n)] = bounds[b] else: raise CanteraError( 'Y can only be specified in flow domains.') else: d[b] = bounds[b] for b in d.keys(): n = self.componentIndex(b) _cantera.domain_setBounds(self._hndl, n, d[b][0], d[b][1])
def setBounds(self, **bounds): """Set the lower and upper bounds on the solution. The argument list should consist of keyword/value pairs, with component names as keywords and (lower_bound, upper_bound) tuples as the values. The keyword *default* may be used to specify default bounds for all unspecified components. The keyword *Y* can be used to stand for all species mass fractions in flow domains. >>> d.setBounds(default=(0, 1), ... Y=(-1.0e-5, 2.0)) """ d = {} if bounds.has_key('default'): for n in range(self.nComponents()): d[self.componentName(n)] = bounds['default'] del bounds['default'] for b in bounds.keys(): if b == 'Y': if self.type >= 50: nc = self.nComponents() for n in range(4, nc): d[self.componentName(n)] = bounds[b] else: raise CanteraError('Y can only be specified in flow domains.') else: d[b] = bounds[b] for b in d.keys(): n = self.componentIndex(b) _cantera.domain_setBounds(self._hndl, n, d[b][0], d[b][1])