Dear Robert Cimrman,
I have two new questions, could you please give me some tips:
1)I have been using C_11, C_12 and C_44 to define stiffness tensor of cubic crystal, then repeat to all elements, basically as shown below,
self.stiffness_gene[i] = np.array([[self.C_11[i], self.C_12[i], 0.],
[self.C_12[i], self.C_11[i], 0.],
[0., 0., self.C_44[i]]])
self.m = Material('m', function=self.D_function)
def D_function(self, ts, coors, mode, term=None, **kwargs):
if mode != 'qp': return
_, weights = term.integral.get_qp('2_4')
self.n_qp = weights.shape[0]
self.val_D = np.repeat(self.stiffness_gene, self.n_qp, axis=0)
return {'function' : self.val_D}
However, what if I have a full stiffness tensor as below. I want to prescribe each component then use this full stiffness tensor. It seems the stiffness tensor in sfepy only supports 3*3 shape or 9 components. So, the question is how can I implement a full stiffness tensor?
\begin{bmatrix}
C_{11} & C_{12} & C_{13} & C_{14} & C_{15} & C_{16} \\
C_{12} & C_{22} & C_{23} & C_{24} & C_{25} & C_{26} \\
C_{13} & C_{23} & C_{33} & C_{34} & C_{35} & C_{36} \\
C_{14} & C_{24} & C_{34} & C_{44} & C_{45} & C_{46} \\
C_{15} & C_{25} & C_{35} & C_{45} & C_{55} & C_{56} \\
C_{16} & C_{26} & C_{36} & C_{46} & C_{56} & C_{66}
\end{bmatrix}
2) if I have a 'for' loop and at each iteration of the 'for' loop, I use sfepy solve a static-linear-elastic mechanical equilibrium equation, basically as below,
for self.t_step in range(self.nt):
self.prestress = Material('prestress', function=self.prestress_function) self.m = Material('m', function=self.D_function)
.............
self.pb.time_update(ebcs=Conditions())
self.pb.update_materials()
self.vec = self.pb.solve()
However, I find that as the loop goes on, the computer Mem is increasing, after the Mem if full, then Swp is increasing, after several hours more, Swp is also full and computer crashes.
I guess sfepy is stalling something big at each loop, so Mem accumulates constantly, but I cannot figure out what's exactly wrong. Do you have any idea about this? Thanks.
Regard
Ronghai
在 2015年4月17日星期五 UTC+2上午10:35:33,Robert Cimrman写道:Hi Ronghai,
you just need to define a function like in the example [1]:
def traction_function(ts, coor, mode=None, **kwargs):
if mode == 'qp':
val = np.tile([[1.], [0.], [0.]], (coor.shape[0], 1, 1))
return {'val' : val}
traction_rig = Material('traction_rig', function=traction_function)
Just replace the 'tile' command with a function of the coordinates coor.
r.
[1]
http://sfepy.org/doc-devel/examples/linear_elasticity/linear_elastic_tractions.html
On 04/16/2015 12:39 PM, Ronghai Wu wrote:
> Dear Robert Cimrman,
>
> I have a simple question about the gradient traction boundary as shown in
> attached picture. I know a constant traction can be implemented in the
> following way:
>
> rig = domain.create_region('Rig', 'vertices in x > %f' % (max_x - eps),
> 'facet')
> traction_rig = Material('traction_rig', val=[[rig_trac], [0.], [0.]]) #
> sigma11, sigma22, sigma12.
> t4 = Term.new('dw_surface_ltr(traction_rig.val, v)', integral, rig,
> traction_rig=traction_rig, v=v)
>
> Could you show how to implement if traction is function of coordinate?
> Thanks.
>
> Regards
> Ronghai
>
>
> 在 2015年3月18日星期三 UTC+1下午1:03:37,Robert Cimrman写道:
>>
>> On 03/18/2015 10:04 AM, Ronghai Wu wrote:
>>> Thanks, after adding the code before solving, it works.
>>> I do not exactly understand what you mean by "time-stepping solvers".
>> This
>>> problem exists only in sfepy2015.1 or also in sfepy-2014.4? Do you mean
>> a
>>> interactive building problem with codes like "pb.time_update,
>>> pb.update_materials" does not not work well currently? I am worrying
>> about
>>> the influence of this "time-stepping solvers". Where can I find the fix?
>>> also in sfepy-devel?
>>
>> This means that it was not possible to use the time stepping solvers from
>> sfepy
>> (i.e. those in sfepy/solvers/ts_solvers.py) interactively. But you were
>> free to
>> write your own time stepping for time-dependent problems, of course,
>> pb.time_update(), pb.update_materials() etc. work ok.
>>
>> Anyway, now it is possible, as I have just updated the time stepping code
>> in
>> sfepy, see my next e-mail.
>>
>> r.
>>
>>> 在 2015年3月13日星期五 UTC+1下午1:42:26,Robert Cimrman写道:
>>>>
>>>> The linear option works in connection with time-stepping solvers. I
>> have
>>>> found
>>>> recently, that the time stepping solvers do not play well in
>> interactive
>>>> building of the problem. The fix should be available soon.
>>>>
>>>> The singular matrix warning is caused by the fact, that in the linear
>> case
>>>> the
>>>> non-linear solver assumes that the matrix is already assembled (which
>> is
>>>> the
>>>> case, if called from the time-stepping solvers in sfepy). In your
>> script,
>>>> try
>>>> calling the following before solving the problem:
>>>>
>>>> # pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls)
>>>> from sfepy.solvers.ts_solvers import prepare_matrix
>>>> prepare_matrix(pb, pb.create_state())
>>>>
>>>> r.
>>
>>
>