def add_sigma_epsilonr_mur(name, f_name): if isinstance(f_name, NativeCoefficientGenBase): pass elif isinstance(f_name, str): add_expression(v, name, suffix, ind_vars, f_name, [], domains=self._sel_index, gdomain=self._global_ns) else: add_constant(v, name, suffix, f_name, domains=self._sel_index, gdomain=self._global_ns)
def do_add_scalar_expr(self, v, suffix, ind_vars, name, f_name, add_diag=False): from petram.helper.variables import add_expression, add_constant from petram.helper.variables import NativeCoefficientGenBase kywds = {} if isinstance(self, Domain): kywds['domains'] = self._sel_index kywds['gdomain'] = self._global_ns elif isinstance(self, Bdry): kywds['bdrs'] = self._sel_index kywds['gbdr'] = self._global_ns if isinstance(f_name, NativeCoefficientGenBase): pass elif isinstance(f_name, str): add_expression(v, name, suffix, ind_vars, f_name, [], **kywds) else: add_constant(v, name, suffix, f_name, **kywds) if add_diag: ''' convension: scalar parameters should be s+name ex) in RF epsilonr is (3,3) sepsilonr : scarlar version epsilonr : matrix ''' size = int(add_diag) add_expression(v, name[1:], suffix, ind_vars, 'diag([1]*' + str(size) + ')*' + name, [name], **kywds)
def add_domain_variables(self, v, n, suffix, ind_vars, solr, soli=None): from petram.helper.variables import add_expression, add_constant if len(self._sel_index) == 0: return var, f_name = self.eval_phys_expr(self.epsilonr, 'epsilonr') if callable(var): add_expression(v, 'epsilonr', suffix, ind_vars, f_name, [], domains=self._sel_index, gdomain=self._global_ns) else: add_constant(v, 'epsilonr', suffix, var, domains=self._sel_index, gdomain=self._global_ns) var, f_name = self.eval_phys_expr(self.mur, 'mur') if callable(var): add_expression(v, 'mur', suffix, ind_vars, f_name, [], domains=self._sel_index, gdomain=self._global_ns) else: add_constant(v, 'mur', suffix, var, domains=self._sel_index, gdomain=self._global_ns) var, f_name = self.eval_phys_expr(self.sigma, 'sigma') if callable(var): add_expression(v, 'sigma', suffix, ind_vars, f_name, [], domains=self._sel_index, gdomain=self._global_ns) else: add_constant(v, 'sigma', suffix, var, domains=self._sel_index, gdomain=self._global_ns)