Minimizing the potential energy in a hyperelasticity problem I am currently using the FEniCS/DOLFINx package to simulate deformations on a mesh volume.
Following this tutorial, I am using the following equation to find $u$ such as $L(u)=0$:
$$L = \vec{\nabla} \vec{v} \cdot P ~\vec{dx} - \vec{T} \cdot \vec{v} ~\vec{ds}$$ (I may have forgotten integrals here)
with

*

*$P$ the first Piola Kirchhoff stress $P = \dfrac{\partial \psi}{\partial F}$ with $F$ the deformation gradient.

*$\vec{dx}$ and $\vec{ds}$ the volume and surface element

*$\vec{T}$ a traction force applied on the surface.

Originally, the goal would be to minimize the potential energy, which writes itself as:
$$\Pi = \int_{\Omega} \psi (u) \,dx - \int_{\partial \Omega} T\cdot u \,ds$$
with $\psi$ the energy density function.
My question is: what is the link between these two equations ? How to get to the first one starting from the second one ? I know that the Gateaux derivative is used in that case but I don't know how to apply it to $\Pi$.
 A: I got an answer on the FEniCS forum from @kamensky, so I will paste the answer given here to close the subject:
If you’ve studied calculus of variations before, it may help to use the
notation $\partial u$ for the test function instead of $v$, then think
about the Gateaux derivative of $\Pi$ with respect to $u$ in the direction
$\delta u$ to zero (by analogy to seeking the minimum of a univariate
function by looking for an argument such that its ordinary derivative is
zero):
$$d\Pi(\boldsymbol{u} ; \delta\boldsymbol{u}) = \delta \Pi = \int_\Omega 
 \frac{\partial \psi}{\partial F} : \delta \boldsymbol F d \Omega - 
 \int_{\partial\Omega} T \cdot \delta \boldsymbol u d \partial\Omega = 0,$$
where the variation $\delta \boldsymbol F$ is also a Gateaux derivative
with respect to the displacement of $\boldsymbol F = \nabla \boldsymbol u + 
 \boldsymbol I$, i.e.
$$\delta \boldsymbol F = d\boldsymbol{F}(\boldsymbol u\,; 
 \delta\boldsymbol{u}) = \nabla (\delta \boldsymbol u).$$
Making the substitutions
$$\partial \psi / \partial \boldsymbol F \rightarrow \boldsymbol P, \delta 
 \boldsymbol F \rightarrow \nabla (\delta \boldsymbol u), \delta \boldsymbol 
 u \rightarrow \boldsymbol v,$$
You recover the weak form
$$\int_\Omega \nabla \boldsymbol v : \boldsymbol P ~d\Omega - \int_{\partial 
 \Omega} \boldsymbol T \cdot \boldsymbol v ~d\partial\Omega
 = 0 ~~\forall v.$$
