Dear sfepy users and developers,
I am using sfepy for solving an 2D inclusion elastic problem. So, I
implemented based on "linear_elasticity/prestress_fibres" example in
interactive way. However, the prestress in my problem is not constant, so I
manually assign values.
I have two questions:
1. why when the integral order is 3, the array shape of prestress.datas[(
'Omega', 'i')][0]['val'] is (nx*ny,4,3,1), so when I assign by
prestress_value, I have to make it the same shape. If change integral order
to 1, the shape changes to (nx*ny,8,3,1), why?
2. When I use mesh smaller than 70*70, no problem. When 90*90 very slow.
When 120*120 "MemoryError" comes out.
Thanks a lot.
My codes and errors are as follow:
field = Field.from_args('displacement', np.float64, 'vector', omega, 1)
u = FieldVariable('u', 'unknown', field)
v = FieldVariable('v', 'test', field, primary_var_name='u')
prestress_value = np.zeros((nx*ny,3,1))
m = Material('m', lam=lambda_, mu=mu)
prestress = Material('prestress', val=prestress_value)
integral = Integral('i', order=3)
t1 = Term.new('dw_lin_elastic_iso(m.lam, m.mu, v, u )', integral, omega, m=m
, v=v, u=u)
t2 = Term.new('dw_lin_prestress(prestress.val, v )',integral, omega,
prestress=prestress, v=v)
eq = Equation('balance', t1-t2 )
eqs = Equations([eq])
ls = ScipyDirect({})
nls_status = IndexedStruct()
nls = Newton({'i_max' : 1,'eps_a' : 1e-6,'problem' : 'nonlinear'},
lin_solver=ls, status=nls_status)
pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls)
pb.update_materials()
prestress_value = np.zeros((nx*ny,4,3,1))
#######################################################################
this is how I assign values to prestress, eta is a known scalar field.
#######################################################################
for i in range(nx*ny):
for j in range(4):
prestress_value[i][j] = np.array([[stress00_11], [stress00_22], [
stress00_12]]) * eta.value[i]
prestress.datas[('Omega', 'i')][0]['val'] = prestress_value
pb.update_materials()
########################################################################
following is error:
sfepy: updating materials...
sfepy: m
sfepy: prestress
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py"
, line 580, in runfile
execfile(filename, namespace)
File "/home/ronghaiwu/temporary/test.py", line 304, in <module>
main()
File "/home/ronghaiwu/temporary/test.py", line 179, in main
pb.update_materials()
File
"/home/ronghaiwu/mypylibs/lib/python2.7/site-packages/sfepy/discrete/problem.py"
, line 522, in update_materials
problem=self, verbose=verbose)
File
"/home/ronghaiwu/mypylibs/lib/python2.7/site-packages/sfepy/discrete/equations.py"
, line 313, in time_update_materials
verbose=verbose)
File
"/home/ronghaiwu/mypylibs/lib/python2.7/site-packages/sfepy/discrete/materials.py"
, line 70, in time_update
mat.time_update(ts, equations, mode=mode, problem=problem)
File
"/home/ronghaiwu/mypylibs/lib/python2.7/site-packages/sfepy/discrete/materials.py"
, line 339, in time_update
self.update_data(key, ts, equations, term, problem=problem)
File
"/home/ronghaiwu/mypylibs/lib/python2.7/site-packages/sfepy/discrete/materials.py"
, line 251, in update_data
**self.extra_args)
File
"/home/ronghaiwu/mypylibs/lib/python2.7/site-packages/sfepy/discrete/functions.py"
, line 34, in __call__
return self.function(*args, **_kwargs)
File
"/home/ronghaiwu/mypylibs/lib/python2.7/site-packages/sfepy/discrete/functions.py"
, line 66, in get_constants
out[key] = nm.tile(val, (coors.shape[0], 1, 1))
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/shape_base.py",
line 860, in tile
c = c.reshape(-1, n).repeat(nrep, 0)
MemoryError
Regards
Ronghai