On 04/07/2014 03:10 PM, Robert Cimrman wrote:
Hi Phil,
On 04/07/2014 09:33 AM, seismo_phil wrote:
Hello,
I'm still working on the same thermal diffusion problem I referred to in the "thermal diffusion - Dirichlet vs. Neumann BCs" thread. The problem is attached file "flndrs2d.py" and *appears* to give a reasonable solution, but I still need to calculate heat flux out the top of the model. So, following Robert's suggestion i added a post_process hook that evaluates d_surface_flux:
def post_process(out, problem, state, extend=False):
"""
Calculate gradient of the solution.
"""
flux = problem.evaluate('d_surface_flux.2.Gamma_Top(coef.val, t)',
mode='eval', copy_materials=False, verbose=False)
print flux
When I call this using my rather complicated materials definition in the attached file, d_surface flux fails with the following error:
File "/Users/philcummins/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sfepy/discrete/functions.py",
line 114, in get_constants
nqp = qps.shape[ig][1]
KeyError: 1
(after a lengthy traceback). If I change the materials definition to a very
There is a bug in ConstantFunctionByRegion that occurs when evaluating a term in a region that is not listed in the material definition, although the region is a subset of the regions in the list (so that it should work).
I have created an issue for it: https://github.com/sfepy/sfepy/issues/263
<snip>
r.