Open GoogleCodeExporter opened 9 years ago
Hi Robert,
Thanks for your input! I attempted to fix the poisson_parametric_study.py per
your
suggestions. Please find the updated file attached.
However, now I am encountering what I believe to be a separate issue with the
poisson_parametric_study.py input file. I'm getting the following output:
logan@phoenix:~/projects/sfepy$ ./simple.py
input/poisson_parametric_study_20090930.py
sfepy: left over: ['select_circ', 'vary_omega1_size', '__builtins__',
'__file__',
'output', '__name__', 'pause', 'nm', '_filename', 'default_diameter', 'debug',
'os',
'__doc__']
sfepy: reading mesh (database/square_circ.vtk)...
sfepy: ...done in 0.01 s
sfepy: setting up domain edges...
sfepy: ...done in 0.00 s
sfepy: creating regions...
sfepy: leaf Omega region_Omega__2
sfepy: leaf Omega_1 region_Omega_1__1
sfepy: leaf Gamma_1 region_Gamma_1__0
sfepy: leaf Gamma_2 region_Gamma_2__3
sfepy: ...done in 0.03 s
Traceback (most recent call last):
File "./simple.py", line 100, in <module>
main()
File "./simple.py", line 93, in main
app = SimpleApp( conf, options, output_prefix )
File "/home/logan/projects/sfepy/sfepy/applications/simple_app.py", line 48, in
__init__
**kwargs )
File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 83, in from_conf
obj.set_regions(conf.regions, conf.materials, obj.functions)
File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 126, in set_regions
materials = Materials.from_conf(conf_materials, functions)
File "/home/logan/projects/sfepy/sfepy/fem/materials.py", line 27, in from_conf
fun = functions[fun]
File "/home/logan/projects/sfepy/sfepy/base/base.py", line 241, in __getitem__
raise IndexError
IndexError
It seems like the problem is that sfepy is erroneously looking for a function
to set
the material parameters. Are the material parameters in
poisson_parametric_study.py
the correct format?
Also, the from_conf method in sfepy/fem/materials.py beginning on line 9 may
have an
error:
def from_conf(conf, functions, wanted=None):
"""Construct Materials instance from configuration."""
if wanted is None:
wanted = conf.keys()
objs = OneTypeList(Material)
for key, mc in conf.iteritems():
if key not in wanted: continue
fun = get_default_attr(mc, 'function', None)
vals = get_default_attr(mc, 'values', None)
if (fun is not None) and (vals is not None):
msg = 'material can have function or values but not both! (%s)' \
% mc
raise ValueError(msg)
elif vals is not None: # => fun is None
fun = ConstantFunction(vals, functions = functions)
else: # => vals is None
fun = functions[fun]
if (fun is None):
msg = 'material has no values! (%s)' % mc
raise ValueError(msg)
For some reason, with this input file, fun == None and val == None, so an
IndexError
exception is raised in the else clause for fun = functions[fun].
I'll have another look later on, but I wanted to give an update of the progress.
Thanks!
Logan
Original comment by logan.so...@gmail.com
on 30 Sep 2009 at 8:09
Attachments:
Closing this issue. The problem should be fixed from commit id
7b310b6c5e5097b40f990afc890334d481431489 onwards.
Logan
Original comment by logan.so...@gmail.com
on 5 Oct 2009 at 2:09
Migrated to http://github.com/sfepy/sfepy/issues/100
Original comment by robert.c...@gmail.com
on 30 Jan 2012 at 10:26
Original issue reported on code.google.com by
logan.so...@gmail.com
on 30 Sep 2009 at 6:15