在 2015年6月2日星期二 UTC+2上午11:11:52,Robert Cimrman写道:
On 06/02/2015 10:58 AM, Ronghai Wu wrote:
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}
So you are solving a 2D problem, right?
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
stiffness tensor in sfepy only supports 3*3 shape or 9 components. So,
the 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}
This is supported in the same way as the 3x3 above, but you have to use a 3D mesh/problem. Use it with the dw_lin_elastic term (see e.g. examples/linear_elasticity/prestress_fibres.py)
I soon realized my stupidness. My full stiffness tensor is : \begin{bmatrix} C_{11} & C_{12} & C_{13} & 0 & 0 & C_{16} \\ C_{12} & C_{22} & C_{23} & 0 & 0 & C_{26} \\ C_{13} & C_{23} & C_{33} & 0 & 0 & 0 \\ 0 & 0 & 0 & C_{44} & 0 & 0 \\ 0 & 0 & 0 & 0 & C_{55} & 0 \\ C_{16} & C_{26} & 0 & 0 & 0 & C_{66} \end{bmatrix}
Since I work on 2D problem, it can be reduced to: \begin{bmatrix} C_{11} & C_{12} & C_{16} \\ C_{12} & C_{22} & C_{26} \\ C_{16} & C_{26} & C_{66} \end{bmatrix}
- 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.
What sfepy version are you using? Could you retry it with the latest release (2015.2), if you have not had it already? If the problem persists, it seems like a bug. Then you can try using [1] (see expecially "Executing external scripts" section) to locate the memory leak.
I ran different simulations(script1 and script2) in different systems(ubuntu and fedora, total Mem is around 7500MB) with different sfepy versions(2015.1 and 2015.2). Memory_profiler was tracking the used memory, as shown in attached figures. We can basically say that the memory accumulation problem results from, not the specific system or script, but a bug in 2015.1(also 2014.4 according to my experience), although I do not know what the bug exactly is. Anyway, thanks for constantly improving sfepy and helping me.
Regards Ronghai
Thanks, r.