6.1. Lagrangian coordinates
When equations for the mesh position are formulated, the positions of the mesh nodes become part of the equations, i.e. they become dependent variables. The corresponding interpolated field can be obtained by the variable var("mesh") (vectorial) or var("mesh_x"), var("mesh_y") and var("mesh_z") for the individual components. However, since these are now dependent variables, it is beneficial to also have a fixed coordinate system, i.e. independent variables. These are the so-called Lagrangian coordinates, accessible with var("lagrangian") and var("lagrangian_x"), var("lagrangian_y"), var("lagrangian_z"), respectively (see var() for more details). These coordinates are initialized by default with the initial mesh positions, but they do not change when the mesh moves. A mesh node at a coordinate \(\vec{x}_0\) may move to another position, e.g. \(\vec{x}_1\), but it will still have the same Lagrangian coordinate afterwards. In that sense, the Lagrangian coordinates move along with the mesh motion - they are attached to the mesh. Let us denote the Lagrangian coordinates with \(\vec{\xi}\), then the Eulerian mesh coordinates \(\vec{x}\) can be described as a function of \(\vec{\xi}\) and time \(t\), i.e.
We can hence formulate equations for the mesh coordinates by describing them by Lagrangian coordinates. To that end, we can also calculate spatial derivatives, e.g. grad() and div(), with respect to the Lagrangian coordinates instead the Eulerian ones. This is done by adding the keyword argument lagrangian=True to the calls of grad() and div(). Likewise, when assembling weak forms, we can also integrate over the Lagrangian domain instead of the Eulerian one by adding the keyword argument lagrangian=True to the calls of weak().