Stand With Ukraine

Thursday, December 30, 2021

Phase speed of gravity waves in a shallow water layer

This is something I probably heard many times at many courses I was attending during my long years of studies. Nevertheless, I don't think I really understood what was going on physically, although I have never had problems understanding mathematics involved, i.e. equations were clear as well as transformations required to linearize them, for example to get a wave dispersion relation $\omega=\omega(k)$.

Currently, I am going (slowly) through the deformations section ("Deformations and Strains. Wave speed") in my favourite physics problem book (Savchenko et al 1981) and one problem is asking to derive an expression for the phase speed of gravity waves in a shallow water layer, assuming the wave lengths to be much larger than the depth of the water layer. Another implied condition is that the density of the fluid is constant so that we indeed focus only on gravity waves, because a fluid with varying density would allow for elastic waves (I hope this is the right term here...).

I was trying to think of perturbations and how they would be propagating and about trajectories of water parcels subjected to the above constraints (mostly mass conservation). But honestly I could not understand right away how to go about solving the problem without formally writing equations of motion and actually got some help and direction from "Essentials of Atmospheric and Oceanic Dynamics" by Geoffrey Vallis. When I finally clearly realized the path for this formal solution I wrote it down as follows.

Figure 1 shows the water layer and a perturbation propagating to the right at speed $c$.

Considering the problem to be one-dimensional with the $x$-axis pointing towards the direction of the propagation of waves, we can write the following linearized momentum and mass continuity equations.

$$ \left\{\begin{array}{l} \partial_t u &= -\frac{1}{\rho_0}\partial_x P = -g \partial_x \eta \\ \partial_t \eta &= -h \partial_x u \end{array}\right.\tag{1} $$

These $u$ ($x$-component of the current) and $\eta$ (elevation relative to the unperturbed depth $h$) are small perturbations around the base state of the shallow water layer at rest. The impact of Earth rotation is ignored here, you could checkout "Essentials of Atmospheric and Oceanic Dynamics" for more details about the Earth rotation effects (i.e. Coriolis force).

Then by applying $\partial_x$ and $\partial_t$ to the first and the second equations of the system (1) respectively we obtain the following equation for $\eta$:

$$ -\frac{1}{h} \partial_{t}^2 \eta = -g\partial_{x}^2\eta \Rightarrow \\ \boxed{\frac{1}{gh} \partial_{t}^2 \eta = \partial_{x}^2\eta} $$

Comparing the above to the canonical wave equation

$$ \frac{1}{c^2}\partial_t^2 \xi = \partial_{x}^2\xi + \partial_{y}^2\xi + \partial_{z}^2\xi = \Delta \xi $$

we can conclude that the wave speed in our case is $c=\sqrt{gh}$. Note how it does not depend on $k=2\pi/\lambda$, i.e. the same for all wavelengths, so that the initial perturbation won't be deforming and would maintain its shape with time. This is not the case for waves in deep water.

That would close the problem for me and I would move on, but somehow I decided to dig a bit around and learned a bit more about these waves in Feynman's physics lectures, although he was considering short waves in a very deep layer (even considering capillary effects). There he describes water parcel trajectories which are not that simple as one can think. In Feynman's book and at the back of the problem book itself I found hints to the following simpler solution of this problem.

This alternative approach is visualised in Figure 2.

Assuming that we have a limit between unperturbed and perturbed parts of the fluid propagating with speed $c$ (the one we are interested to compute). Let's denote the height difference between these parts of the fluid as $\Delta h$. If we accept that water from the perturbed region would pile onto the water from the unperturbed region, we could express the water flux as follows:

$$ u(h + \Delta h) = c \Delta h $$

We can simplify this expression using the assumption that $\Delta h \ll h$ and therefore:

$$ uh = c \Delta h \Rightarrow u = c \frac{\Delta h}{h} \tag{2} $$

Now we can use momentum equation to get more information about propagation of the perturbed region. During time $\Delta t$ a part of the unperturbed region will gain the same speed as in the perturbed region and we can write the momentum change as follows:

$$ \Delta p = \rho_0 c \Delta t h \Delta y \cdot u \Rightarrow \frac{\Delta p}{\Delta t} = \rho_0 c h \Delta y \cdot u $$

This momentum change is caused by the pressure of the perturbed region on the unperturbed region:

$$ F = \rho_0 g \Delta h \cdot \Delta y h = \rho_0 c h \Delta y \cdot u $$

Then simplifying we get

$$ g \Delta h = c \cdot u $$

And substituting $u$ from equation (2) we get the following:

$$ g \Delta h = c \cdot c \frac{\Delta h}{h} \Rightarrow c=\sqrt{gh} $$

Friday, November 5, 2021

Random freezes with AMD Ryzen fix for Manjaro

I was having these random freezes, when only hard reboot could revive the system, in Kubuntu and tried googling a lot reading system logs, updated BIOS... Decided to switch to Manjaro hoping that they will go away by itself, but I started haing freezes again especially when I lock screen...

I found these instructions and applied them: https://archived.forum.manjaro.org/t/amd-ryzen-problems-and-fixes/55533

The instructions are very easy to follow, except I could not find the BIOS option mentioned there...

So far, the system is stable and did not freeze yet. There was a minor hiccup on return from locked state, but this time tty2 (ctrl+alt+f2) worked and I ran reboot from there..

I will keep an eye on it though and will update the post.

Updates
  • Had a freeze today (same day after I posted this) but not in the lock screen, when working with chrome. (05/11/2021)
  • 07/11/2021: Another freeze, I was watching a youtube video.
  • 24/11/2021: I finally found C-states and the idle option in BIOS, and after this I have not had any freezes yet...

Thursday, November 4, 2021

Bootstraping using python: resample package

This is just a note about a Python package for calculating confidence intervals using bias correction accelerated method (BCA). It is very convenient as it directly gives me a method/function to calculate confidence intervals. I have discovered it recently, but any time I want to get a link to send it to a collegue, google is having hard time finding it, therefore I am noting a link to the project in here: https://github.com/resample-project/resample.

Monday, November 1, 2021

Autocomplete ssh destinations in Manjaro/bash and other things I had to adjust to migrate from Kubuntu to Manjaro

Recently I decided to switch my Linux distribution from Kubuntu/KDE to Manjaro/KDE. Before installing Manjaro I resized my disk into 2 partitions: one for the system (ext4) and one for home (btrfs). This way I could reinstall the OS without touching my home folder. And then I replaced Kubuntu with Manjaro in the system partition. It went mostly smoothly, except few things:
  • When I was typing ssh+TAB in Kubuntu I had my servers from .ssh/config autocompleted for me, but not in Manjaro. To activate that feature I had to install bash-completion package from offcial repositories (extra).
  • I had to remove my ~/.kde directory to have the kde from Manjaro work. Using tty by pressing ctrl+alt+F2 from the login window.
  • For some servers I had to add the following option in .ssh/config: HostKeyAlgorithms=+ssh-rsa, this was not necessary in Kubuntu. Otherwize, I was getting the following error message
    Unable to negotiate with $ip port $port: no matching host key type found. Their offer: ssh-dss,ssh-rsa

Notes
  • I used GParted from within a live usb to repartition my disk (followed steps from here). Had to move around some stuff and fix ownership of files, but it worked out great. I am happy I did it as it allowed me to painlessly switch from Kubuntu to Manjaro.

Wednesday, September 1, 2021

Remapping keys on kubuntu (Apple aluminum keyboard, Canadian Multilingual/French layout)

I like Apple keyboards, they are very comfortable to work with. But I prefer Linux to Mac, so I just attach my Apple keyboard to my Linux machine and try to make it work.

This time It worked almost out of the box on Kubuntu 21.04, but I had the following two keys swapped: 'ù' and '/'. First, I tried to remap them using xmodmap and xev, and it worked but that messed up my Yakuake shortcut and it continued to reset it after each reboot... I tried to figure out why, but in the process I found this post, which pointed me to this utility Key Mapper (just download and double-click the .deb to install it). From there it is easy to remap the keys (IFF you have sudo rights on your computer):

The only downside of this approach is that you have to have sudo rights to use the program. You could try installing it in an alternative location with
dpkg -x key-mapper*.deb dest/directory/of/your/choice
But, I think it requires root privileges to apply the mapping, which is a bummer. Not sure if this is easy to fix or if it is on the developer's radar.

Wednesday, August 25, 2021

Physics problem: ocean compressibility

This problem is not complicated, but it is particularly interesting to me as it is related to my work: modelling of the ocean, especially dynamics and everything impacting water level. I took it from the book by Savchenko et al., in the section on deformations.

Problem statement

Assuming that compressibility of water is $\alpha=5\times 10^{-10}\; {\rm Pa^{-1}}$ and the mean ocean depth is around 3.5 km, answer the following questions:

  1. Estimate the change in water level if water becomes incompressible.
  2. At some places the ocean is 10 km deep. Estimate the change of water density between the 10 km depth and the surface.
  3. What is the deformation energy stored in 1 ${\rm m^3}$ of water at the 10 km depth?

Solution

It is probably easy to show that the weight of atmosphere is negligible in comparison with the weight of water pushing and compressing the ocean. Therefore I will neglect the impacts of atmospheric pressure for this problem and will assume that the only cause for the compression of the ocean is its weight.

First, let's remember the definition of the compressibility coefficient, i.e. relative change of volume per unit change of pressure:

\begin{align} \frac{dV}{V} = -\alpha \cdot dP \end{align}

where $V, P$ are the volume and pressure respectively.

To answer the above questions we would need to know how the density of water changes with depth, i.e. $\rho(z)$. We select a layer at depth $z$, and if we push it down by $dz$, the pressure would increase by $dP = \rho(z)\cdot g dz$, since we would have additional amount of water pushing down on our layer. This same pressure increase can be expressed using the definition of compressibility coefficient:

$$ dP = \rho(z)\cdot g dz = \frac{dV}{\alpha V} $$

Then using the relation $V(z) = \frac{m}{\rho(z)}$ and the fact that the mass does not vary during compression, we can express the relative volume change as:

$$ \frac{dV}{V} = \frac{d(m/\rho(z))}{m/\rho(z)} = \frac{d(1/\rho(z))}{1/\rho(z)} \Rightarrow \\ dP = \rho(z)\cdot g dz = -\frac{d(1/\rho(z))}{1/\rho(z) \cdot \alpha} = -\frac{\rho(z)}{\alpha}d\left( \frac{1}{\rho(z)} \right) $$

Then simplifying we get the following equation for the function $\rho(z)$:

$$ d\left( \frac{1}{\rho(z)} \right) = -\alpha g dz $$

Integrating and denoting surface water density as $\rho_0$:

$$ \frac{1}{\rho(z)} = -\alpha g z + \frac{1}{\rho_0} \Rightarrow \\ \rho(z) = \frac{1}{-\alpha g z + \frac{1}{\rho_0}} \Rightarrow \\ \rho(z) = \frac{\rho_0}{1 - \alpha \rho_0 g z} $$

It is easy to estimate that the product in the denominator is at most

$$ \alpha \rho_0 g z \lesssim 10^{-10} \cdot 10^3 \cdot 10^4=10^{-3} \ll 1 $$

Therefore we can further simplify the expression for $\rho(z)$:

\begin{align} \rho(z) \approx \rho_0 \left(1 + \alpha \rho_0 g z \right) \end{align}
Q1: Estimate change in water level if water becomes incompressible.

To figure out the change of the water level we divide the ocean into horizontal layers of width $dz$ and then we calculate compression of each layer due to the weight of water above it. Finally, we can find the water level rise by summing the compressions for all layers.

Following the above plan, we can express mass per unit area of the water layer $dz$ as below:

$$ d\mu = \rho(z)dz = \rho_0 (dz + dh) $$

where $dh$ is the increase of the water layer width due to decreased pressure at the surface (i.e. $P(z=0)=0$).

By reorganizing the terms in the equation above we get:

$$ (\rho(z) - \rho_0) dz = \rho_0 dh $$

Now we substitute the expression we obtained previously for $\rho(z)$ :

$$ \frac{\rho(z) - \rho_0}{\rho_0} dz = dh \Rightarrow \\ \alpha\cdot \rho_0 g z dz = dh $$

Then by integrating from the surface ($z=0$) down to the mean water depth ($z=\overline{H}$), we find the total compression of the water layers, if there was no weight pushing on them, which is equivalent to the problem statement condition imposing water incompressibily:

$$ \Delta h = \int\limits_{0}^{\Delta h} dh = \int\limits_{0}^{\overline{H}}\alpha\cdot \rho_0 g z dz = \alpha\cdot \rho_0 g \frac{\overline{H}^2}{2} \Rightarrow \\ \boxed{ \Delta h \approx 5 \cdot 10^{-10} \cdot 10^3 \cdot 10 \cdot \frac{3.5^2\cdot 10^6}{2} \approx 30.6 \;({\rm m})} $$

Finally, we obtain that if water in the ocean becomes incompressible, the water level will rise by about 30 meters.

Q2: At some places the ocean is 10 km deep. Estimate the difference of water density between the 10 km depth and the surface.

The answer to this question directly follows from the expression we derived for $\rho(z)$ in the beginning of the post:

$$ \Delta\rho (z) = \rho(z) - \rho_0 = \alpha \rho_0^2 g z $$

where $\Delta\rho (z)$ is the difference of water density between the depth $z$ and the surface.

If we substitute 10 km depth (i.e. $z_1 = 10^4 \; {\rm m}$):

$$ \boxed{ \Delta\rho (z_1) = \alpha \rho_0^2 g z = 5 \cdot 10^{-10} \cdot 10^6 \cdot 10 \cdot 10^4 = 50\;({\rm kg/m^3}) } $$
Q3: What is the deformation energy stored in 1 ${\rm m^3}$ of water at the 10 km depth?

The deformation energy stored in comressed water can be computed using work needed to compress a water parcel (let's say a unit cube) from its density at the surface to its density at the 10 km depth. It is easy to show that the compression work $dW$ can be expressed as follows:

$$ dW = PdV \Rightarrow W = \int\limits_{V_0}^{V_H} PdV $$

Using the expression for the compression coefficient we can find pressure as a function of volume $P(V)$:

$$ \int \frac{dV}{V} = -\alpha dP \Rightarrow \ln V = -\alpha P + C $$

Using that at the surface $P(z=0) = 0$ (actually it is equal to the atmospheric pressure, but we neglect it compared to the weight of water) and denoting the volume of the water parcel at the surface as $V_0$ we get:

$$ P = -\frac{1}{\alpha} \ln\frac{V}{V_0} $$

Now we plug it into the expression for work $W$:

\begin{align*} W =& \int\limits_{V_0}^{V_H} -\frac{1}{\alpha} \ln\frac{V}{V_0} dV \\ =& -\frac{V_0}{\alpha} \int\limits_{1}^{V_H/V_0} \ln y \cdot dy \\ =& -\frac{V_0}{\alpha} \left( \left. \ln y \right\rvert_{1}^{V_H/V_0} - \frac{V_H}{V_0} + 1 \right) \\ =& -\frac{V_0}{\alpha} \left( \ln \left( \frac{V_H}{V_0}\right) - \frac{V_H}{V_0} + 1 \right) \\ \end{align*}

Using the relation between densities and volumes of the same parcel of water and expressing the density difference calculated in Q2 we get:

$$ \frac{V_H}{V_0} = \frac{\rho_0}{\rho_H} = \frac{\rho_0}{\rho_0 + \alpha \rho_0^2 g H} = \frac{1}{1 + \alpha \rho_0 g H} $$

Then we can plug the volume ratio into the expression for the energy and get the density as follows:

\begin{align*} \omega & = \frac{W}{V_H} \\ & = -\frac{V_0}{\alpha V_H} \left( \ln \left( \frac{V_H}{V_0}\right) - \frac{V_H}{V_0} + 1 \right) \\ & = -\frac{1 + \alpha \rho_0 g H}{\alpha} \left( -\ln \left( 1 + \alpha \rho_0 g H\right) - \frac{1}{1 + \alpha \rho_0 g H} + 1 \right) \\ \end{align*}

Then using that the $\alpha \rho_0 g H$ is much smaller than 1 as was shown above, we can do the following approximations to the second order of $\alpha \rho_0 g H$:

\begin{align*} \omega & \approx -\frac{1 + \alpha \rho_0 g H}{\alpha} \left( -\alpha \rho_0 g H +\frac{\left(\alpha \rho_0 g H\right)^2}{2} - (1 - \alpha \rho_0 g H + \left(\alpha \rho_0 g H\right)^2) + 1 \right) \\ & = -\frac{1 + \alpha \rho_0 g H}{\alpha} \left( -\frac{\left(\alpha \rho_0 g H\right)^2}{2}\right)\\ & \approx \frac{\alpha}{2}\left( \rho_0 g H\right)^2 \end{align*}

Therefore, the deformation energy density of water at the depth $H$ can be approximated as follows:

$$ \boxed{ \omega = \frac{\alpha}{2}\left( \rho_0 g H\right)^2 } $$

Now, substituting values we get that at the depth $H=10 {\rm km}$:

$$ \omega \approx 0.5 \cdot 5 \cdot 10^{-10}\cdot 10^6 \cdot 10^2 \cdot 10^8=\underline{2.5\times10^6\;({\rm J/m^3})} $$

Saturday, July 24, 2021

Minimum work required to bend a metal rod

This problem is from the section on deformations obbeying the linear relation between reaction force and deformation length. This one requires knowledge of Young modulus which allows to express reaction force as a function of relative deformation. In one-dimensional case the law looks as follows:

$$ \sigma = E\varepsilon $$

where $\sigma=F/A$ is the reaction tension (${\rm N/m^2}$) of the material in response to the relative deformation $\varepsilon=\Delta L / L$.

This problem is taken from the book Savchenko et al and it took me some time to understand to my satisfaction, therefore it is written up here.

Problem statement

Determine the minimum amount of work required to bend a rod of length $l$ with square cross section ($a \times a$) into a ring. Young modulus of the material is $E$ and $l \gg a$.

Solution

The approach to take here was hinted to me by the previous problem which asked for the expression of the energy density for a deformed material. It is relatively easy to derive using the above expression for the deformation tension that the energy density per unit volume ($\omega$) can be expressed as follows:

$$ \omega = \frac{dW}{dV} = \frac{E\varepsilon^2}{2} $$

So the problem now is reduced to finding the ring configuration that would minimize the energy (work) due to deformation of the rod:

$$ W = \int\omega dV \Rightarrow W_{\rm min} = \min_{V_{\rm ring}}\left( \int \omega dV \right) $$

In the bent state we can divide the ring into multiple strips of width $dr$ with the smallest having the radius $R$. We assume that the length of the longest (outer) strip would be $R+a$, i.e. here we neglect radial deformations and assume that the width of the rod as well as its height won't change. Then the deformation energy $dW$ stored in each strip would be:

$$ dW = \omega dV = \frac{E\varepsilon^2}{2}dV =\frac{E\varepsilon^2}{2}a\cdot 2\pi r dr $$

Therefore the total energy of the deformed rod would be a sum of energy of each of the strips:

$$ W = \int\limits_{R}^{R+a}\frac{E\varepsilon^2}{2}a\cdot 2\pi r dr $$

Then noting that for each strip the relative deformation $\varepsilon$ is $(2 \pi r -l )/l $, we get: $$ W(R) = \int\limits_{R}^{R+a}\frac{E(2 \pi r - l)^2}{2l^2}a\cdot 2\pi r dr $$

Now we need to find the radius of the shortest strip $R$ (which would also define the radii of all the longer strips) that minimizes $W(R)$, i.e.:

$$ W_{\min} = \min_{R} W(R) = \min_{R}\left( \int\limits_{R}^{R+a}\frac{E(2 \pi r - l)^2}{2l^2}a\cdot 2\pi r dr \right) $$

Intuitively, I figured that the minimizing configuration would include the undeformed strip (i.e. the one in bent state having the same length $l$ as before). To minimize the deviations of the other strips, the undeformed strip would have to be in the middle, so that leaves us with $R = \frac{l}{2\pi} - \frac{a}{2}$ and once we have this the solution is straightforward. But I still would like to find the minimizing $R$ in a more rigorous way.

If one accepts the above arguments then (If not please see another way of determining $R$ in the note section at the end of the post) the expression for $W_{\min}$ becomes:

$$ W_{\min}=W\left(R=\frac{l}{2\pi} - \frac{a}{2}\right)=\int\limits_{\frac{l}{2\pi} - \frac{a}{2}}^{\frac{l}{2\pi} + \frac{a}{2}}\frac{E(2 \pi r - l)^2}{2l^2}a\cdot 2\pi r dr $$

Making a substitution $y = 2 \pi r$: $$ W_{\min} = \frac{Ea}{4\pi l^2}\int\limits_{l - \pi a}^{l + \pi a}(y - l)^2\cdot y dy $$

Then simplifying: $$ W_{\min} = \frac{Ea}{4\pi l^2}\left(\int\limits_{\:l - \pi a}^{l + \pi a}(y - l)^3 dy + l\cdot\int\limits_{l - \pi a}^{l + \pi a}(y - l)^2 dy \right) $$

And another substitution for convenience $z=y-l$: $$ W_{\min} = \frac{Ea}{4\pi l^2}\left(\int\limits_{\: - \pi a}^{\pi a}z^3 dz + l\cdot\int\limits_{- \pi a}^{\pi a}z^2 dz \right) $$

Noticing that the first integral above is from an odd function over a symmetric interval with respect to 0, therefore it is 0 (or you could simply integrate to convince yourself) and we get: $$ W_{\min} = \frac{Ea}{4\pi l^2}l\cdot\int\limits_{- \pi a}^{\pi a}z^2 dz = \frac{Ea}{4\pi l^2}l\cdot \frac{2 \pi^3 a^3}{3} $$

Then simplifying we get the final expression for the minimum amount of work needed to bend the rod:

$$ \boxed{W_{\min} = \frac{E\pi^2 a^4}{6 l}} $$

Note on finding the minimum radius of the minimizing configuration of bent strips

The general expression for the deformation energy (work) of the bent rod is:

$$ \min_{R} W(R) = \min_{R}\left( \int\limits_{R}^{R+a}\frac{E(2 \pi r - l)^2}{2l^2}a\cdot 2\pi r dr \right) $$

We need to find the $R_0$ for which $W(R)$ is minimized. The minimizing configuration should contain the undeformed strip and therefore we can limit our search for $R_0$ to the closed interval $\left[ \frac{l}{2\pi} - a, \frac{l}{2\pi} \right ]$.

Reorganizing the terms

$$ W(R) = \min_{R}\left( \frac{Ea}{8\pi l^2} \int\limits_{2\pi R - l}^{2\pi R+ 2\pi a - l}z^2\cdot (z + l) dz \right) $$

Let's change the independent variable from $R$ to $Z = 2\pi R - l$ (where $Z \in [-2\pi a\,,\: 0]$), for convenience:

$$ W(Z) = \min_{Z}\left( \frac{Ea}{8\pi l^2} \int\limits_{Z}^{Z+ 2\pi a}z^2\cdot (z + l) dz \right) $$

Equivalently, we need to determine $Z$, which will minimize the following function:

$$ I(Z) = \int\limits_{Z}^{Z+ 2\pi a}z^2\cdot (z + l) dz $$

To find the extrema of $I(Z)$ we solve for roots of $\frac{dI(Z)}{dZ}=0$.

By differentiation of the integral with variable limits we get the following expression for the derivative:

$$ \frac{dI(Z)}{dZ}=(Z+2\pi a)^2 \cdot (Z+2\pi a + l) - Z^2 \cdot (Z + l)=0 $$

Simplifying we get the following equation for the extrema of $I(Z)$:

$$ Z^2 2 \pi a + 4\pi a Z^2 + 4\pi a Z (2\pi a + l) + 4\pi^2 a^2 Z + 4\pi^2 a^2 (2\pi a + l) = 0 $$

Simplifying further, we get the following quadratic equation with respect to $Z$:

$$ 3Z^2 + 2 Z (3\pi a + l) + 2\pi a (2\pi a + l) = 0 $$

The exact solution is then:

$$ Z_{1,2} = \frac{-(3\pi a + l) \pm \sqrt{l^2 - 3 \pi^2a^2}}{3} $$

then using the condition $l \gg a$ we neglect second order term $3\pi^2(a/l)^2$:

$$ \left [ \begin{array}{l} Z_1 = -\pi a \\ Z_2 = -\pi a - 2l/3 \\ \end{array}\right. $$

Since $\frac{dI(Z)}{dZ}$ is quadratic, and $Z_2 < Z_1$, it is easy to see that

$$ \left\{ \begin{array}{l} \frac{dI(Z)}{dZ} \geq 0\,,\; Z\leq Z_2 \\ \frac{dI(Z)}{dZ} \leq 0\,,\; Z_2 < Z \leq Z_1 \\ \frac{dI(Z)}{dZ} > 0\,,\; Z > Z_1 \\ \end{array}\right. $$

Therefore we can conclude that $Z_1$ is a local mininmum, and $Z_2$ is a local maxinmum of $I(Z)$. Hence $Z_1 = -\pi a$ is a candidate for a minimum of $I(Z), Z\in [-2 \pi a\,,\: 0]$. To make sure that $Z_1$ is the minimum we need to check that $I(Z_1) < I(-2 \pi a)$.

Let's compute directly these values:

$$ I(Z_1) = \int\limits_{-\pi a}^{\pi a}z^2\cdot (z + l) dz = \frac{2}{3}l \pi^3 a^3 $$$$ I(-2 \pi a) = \int\limits_{-2\pi a}^{0}z^2\cdot (z + l) dz = 4 \pi^4 a^4 + \frac{8}{3}l \pi^3 a^3 $$

From the two above expressions it is obvious that $Z=-\pi a$ minimizes $I(Z), Z \in [-2\pi\,,\: 0]$.

Finally, we can find the $R_0$ which minimizes energy of deformation:

$$ Z_0 = -\pi a = 2 \pi R_0 - l \Rightarrow \boxed{R_0 = \frac{l}{2\pi} - \frac{a}{2}} $$

Which is the same as we guessed before.