I just updated sfepy to the latest master (previous version was about 1 year old) and I'm having trouble evaluating an FEM model that was working with the old version. The full script is pretty long so I will try to summarize here. It seems that a region of facet type is no longer able to evaluate it's material properties where the material properties were defined on other related regions of cell type.
Robert, do you know off hand of any changes to Region or Material that may have broken this? Otherwise, I can try to reproduce it in a simpler use case, for debugging.. anyway here is a description of whats happening:
A material is defined as follows:
self.matP = Material('elecProps', kind='stationary', values={'sigma' : { 'BloodPool' : sigma_blood, 'Tissue' : sigma_tissue}})
One of the terms is as follows:
probeFlux = Term.new('dw_surface_integrate(elecProps.sigma, s)', self.integral, self.probeSurf, elecProps=self.matP, s=self.s)
where self.probeSurf is defined as follows (it contains no cells, only facets):
self.probeSurf = self.domain.create_region('ProbeSurf', 'r.Probe *f r.Tissue', kind='facet', parent='Tissue')
When I run the full script I get the following backtrace:
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/problem.pyc in solve(self, state0, nls_status, ls_conf, nls_conf, force_values, var_data) 1012 self.equations.set_data(var_data, ignore_unknown=True) 1013 -> 1014 self.update_materials() 1015 state0.apply_ebc(force_values=force_values) 1016
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/problem.pyc in update_materials(self, ts, mode, verbose) 528 self.update_time_stepper(ts) 529 self.equations.time_update_materials(self.ts, mode=mode, --> 530 problem=self, verbose=verbose) 531 532
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/equations.pyc in time_update_materials(self, ts, mode, problem, verbose) 318 """ 319 self.materials.time_update(ts, self, mode=mode, problem=problem, --> 320 verbose=verbose) 321 322 def setup_initial_conditions(self, ics, functions=None):
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/materials.pyc in time_update(self, ts, equations, mode, problem, verbose) 55 for mat in self: 56 if verbose: output(' ', mat.name) ---> 57 mat.time_update(ts, equations, mode=mode, problem=problem) 58 if verbose: output('...done in %.2f s' % (time.clock() - tt)) 59
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/materials.pyc in time_update(self, ts, equations, mode, problem) 304 305 for key, term in self.iter_terms(equations): --> 306 self.update_data(key, ts, equations, term, problem=problem) 307 308 self.update_special_data(ts, equations, problem=problem)
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/materials.pyc in update_data(self, key, ts, equations, term, problem) 220 data = self.function(ts, coors, mode='qp', 221 equations=equations, term=term, problem=problem, --> 222 **self.extra_args) 223 224 self.set_data(key, qps, data)
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/functions.pyc in __call__(self, *args, **kwargs) 32 _kwargs = dict(kwargs) 33 _kwargs.update(self.extra_args) ---> 34 return self.function(*args, **_kwargs) 35 36 def set_function(self, function, is_constant=False):
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/functions.pyc in get_constants(ts, coors, mode, term, problem, **kwargs) 112 region = problem.domain.regions[rkey] 113 rval = nm.array(rval, dtype=nm.float64, ndmin=3) --> 114 ii = term.region.get_cell_indices(region.cells) 115 matdata[ii] = rval 116
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/common/region.pyc in get_cell_indices(self, cells, true_cells_only) 600 to facets are returned if the region itself contains no cells. 601 """ --> 602 fcells = self.get_cells(true_cells_only=true_cells_only) 603 604 ii = nm.searchsorted(fcells, cells)
/usr/local/lib/python2.7/dist-packages/sfepy/discrete/common/region.pyc in
get_cells(self, true_cells_only)
579 msg = 'region %s has not true cells! (has kind:
%s)'
580 % (self.name, self.kind)
--> 581 raise ValueError(msg)
582
583 else:
ValueError: region ProbeSurf has not true cells! (has kind: facet)