PolymerGuy / muDIC

Digital Image Correlation in Python
MIT License
160 stars 69 forks source link

Computing the Lagrangian strain #24

Closed ilyasst closed 4 years ago

ilyasst commented 4 years ago

Hello @PolymerGuy ,

First of all, thanks for the great work, this is the first global/FE DIC code that I ever found written in proper python !

I am interested in implementing the Lagrangian strain formulation to this code. I tried doing so, but I am a little bit confused by how I could do so. To determine how I could so, I have looked at the _green_strain_() static method from the Fields class (in /post/viz.py) to try to determine how you computed the Green strain but that's where I got a little bit confused. Could you please help me understand how the computation for the Green strain works ?

    @staticmethod
    def _green_strain_(F):
        """
        Calculate Green strain tensor from F as G = 0.5*(F^T + F -I)
        :param F: Deformation gradient tensor F_ij on the form [nEl,i,j,...]
        :return: Green Lagrange strain tensor E_ij on the form [nEl,i,j,...]
        """
        E11 = 0.5 * (F[:, 0, 0, :, :, :] ** 2. + F[:, 0, 1, :, :, :] ** 2. - 1.)

        E12 = 0.5 * (F[:, 0, 0, :, :, :] * F[:, 1, 0, :, :, :] + F[:, 0, 1, :, :, :] * F[:, 1, 1, :, :, :])

        E22 = 0.5 * (F[:, 1, 0, :, :, :] ** 2. + F[:, 1, 1, :, :, :] ** 2. - 1.)

        E = np.array([[E11, E12], [E12, E22]])

        E[E == np.nan] = 0.

        return np.moveaxis(E, 2, 0)

Thank you, ilyass

PolymerGuy commented 4 years ago

Hi @ilyasst ,

Thanks for your interest in this code! First of all, could you define the Lagrangian strain tensor? I see that there is a typo in the docstring above. It supposes to be G = 0.5*(F^T F -I).

So, if you look at G11, its G11 = 0.5(F11F11+F21F21-1)

What makes the above code look so strange is that all values are computed in one go. By that, i mean that all "points" and time-frames are evaluated in on function call. So:

F[i, 0, 1, j, k, l] is deformation gradient component F12 (remeber that things are zero indexed) for element i, at "point" j,k and frame l.

Since the shape of the arrays is the same in the code, every component is evaluated by itself in one go.

I hope this helps :)

diehlpk commented 4 years ago

Suppose it is G = 0.5*(F^T F -I). I have few questions for the following line of code?

E11 = 0.5 * (F[:, 0, 0, :, :, :] ** 2. + F[:, 0, 1, :, :, :] ** 2. - 1.)

  1. Why is there a power of two for F_00 and F_01? I can not see the power of two in the equation.
  2. Why is there a plus between the two F entries? From the equation it should be a multiplication and not a plus as in the code?

Maybe I miss see something and just be suspicious.

PolymerGuy commented 4 years ago

If you write it out component by component, eg. G11 = 0.5(F11F11+F21F21-1)

Note that the calculation is on components and not on the whole tensor.

I really appreciate all scepticism, as having all calculations correct is really important!

diehlpk commented 4 years ago

Ok, thanks makes sense. I think we are good to go and add the Lagrangian strain formulation to this code. We just want to let a new student work with this code and make sure that everything is understood by us.

PolymerGuy commented 4 years ago

Wonderfull! I can see that the code is not as readable as it should be. I will try to improve it a bit... But I looked at the tests for this part of the code, and I see that they are too weak. I will include a couple of test cases where any coordinate issues etc. are easy to identify, such as in simple shear.

I am a bit curious, what kind of projects are you working on?

diehlpk commented 4 years ago

We try to extract elastic constitutive parameters using the virtual field method. Next step would be to extract damage properties, but this is a long way to go.

PolymerGuy commented 4 years ago

Sounds really exciting!

ilyasst commented 4 years ago

Thank you very much for your help with this, I understand it better now

ilyasst commented 4 years ago

Given the information we have, it seems that Green Lagrange strain tensor is the same as the Lagrangian tensor. The only issue is the typo in the docstring.

PolymerGuy commented 4 years ago

In order to facilitate easy modification of the post processor, I'm working on some more documentation as well as a proposal for a more strict formulation. I would love to have your feedback on this!

I will first open a separate issue and provide a draft on the docs and then a branch containing a revised post-processor.

ilyasst commented 4 years ago

I would love to do so.

I would actually be interested in, if it is OK with you, discussing a bit more the future of muDIC and how we could help with it (some students are interested in working on this code as a summer project). Could we discuss this more by email ? ousted(dot)ilyass(at)gmail(dot)com Thank you