# yade-users team mailing list archive

## Re: Elastic energy

```Hi Janek, thanks for your anwer.

hmm. I remember calculating internal work, and in fact I remember
> that we stumbled upon this problem.
>
> (I hope that your UTF-8 works good, because I'm using UTF below)
>
> What is the work of a typical spring?
>
>  W=∫F*dx
>
>  F=k*x
>
>  W=∫k*x*dx = k*x²/2
>
> , see that squared distance factor?
>
> But we need to integrate that in a little different manner, because
> we are summing from one iteration to another. Let us make a plot of
> force versus displacement and calculate the surface area below the
> force. To make it simple we are integrating using the Trapezoidal Rule:
>
>  Wᵢ = (Fᵢ+Fᵢ₋₁)*Δxᵢ⁄2
>
Not sure to understand the point. Using trapezoidal rule, hence working out
the net work done by the spring in an incremental way, or either taking the
value of the integral should give you the same result.

>
> , where ᵢ is the iteration, Fᵢ₋₁ is previous force, Fᵢ is
> current force, Δxᵢ=xᵢ-xᵢ₋₁ is the displacement that happened from
> iteration ᵢ₋₁ to ᵢ. Now if we perform summation over all
> iterations, like that:
>
>  W += Wᵢ
>
> we would get:
>
>     i="now"
>  W =   ∑ (Fᵢ+Fᵢ₋₁)*(xᵢ-xᵢ₋₁)⁄2
>       i=1
>
> In the end we were using that formula for all DOFs, to get a total
> work, as a sum of normal, shearing and rotational displacements over
> respective forces (and moment).
>
>  W=Wn+Ws+Wr
>
>  Wn =∑ (Fnᵢ+Fnᵢ₋₁)*(xᵢ-xᵢ₋₁)⁄2
>  Ws =∑ (Fsᵢ+Fsᵢ₋₁)*(sᵢ-sᵢ₋₁)⁄2
>

Actually in Law2_ScGeom_FrictPhys_Basic we do not have the rotational
spring. That would be an additional contribution to account for if using the
MT law. The components of energy that we need in this example are simply:

- linear and rotational kinetic energy -> kineticEnergy()
- normal and tangential elastic potential energy -> elasticEnergy()
- dissipated energy due to sliding -> plasticDissipation()

Actually, without friction, everything seems working fine (again more or
less since our velocities are shifted of half time step).

>
> I don't have the implementation at hand right now, I'll find it
> tomorrow. I might have made some mistake above, but you should get
> the general idea.
>
No mistake in your writing, though I believe that as long as we can compute
the integral of the work analytically then there is no need to make the
summation out incrementally.
Perhaps the mistake is in the computation of the plastic dissipation. But I

>
> If I find a mistake I'll let you know :)
>
> best regards
> --
> Janek Kozicki                               http://janek.kozicki.pl/  |
>
> _______________________________________________