YuCrazing / Taichi

Taichi demos
91 stars 6 forks source link

How to compute the stiffness matrix K? #1

Closed FantasyVR closed 3 years ago

FantasyVR commented 4 years ago

When computing dP(F:\delta F) , there are some differences between your implementation and the SIGGRAPH 2012 FEM Course https://github.com/YuCrazing/Taichi/blob/a8df2239e359550bd63ec3320a6a7a9b39524fa5/fem_3d_imp/fem-3d-implicit.py#L263

Why do you re-compute dF in the for-loop rather than using the already computed dF?

I tried to change some code according to algorithm 2 in SIGGRAPH 2012 FEM Course based on your code. The simulation still works.

            for n in range(4):
                for dim in range(self.dim):
                    for i in ti.static(range(self.dim)):
                        for j in ti.static(range(self.dim)):
                            dF = self.dF[e,n,dim]
                            dF_T = dF.transpose()
                            dTr = (F_1 @ dF).trace()
                            dP_dFij = self.mu * dF + (self.mu - self.la * ti.log(J)) * F_1_T @ dF_T @ F_1_T + self.la * dTr * F_1_T
                            self.dP[e, n, dim] += dP_dFij 
YuCrazing commented 4 years ago

self.dF means dF/dx, and the second dF means dF/dF_{ij}.

And the meaning of my code is

png latex-2

You can check whether it is equivalent to your code. 🙂