## z* visualization

Visualize the work of _Adcroft and Campin (2004)_. They incorporated a z* depth in the MITgcm which is defined as

$$z=\eta + s^* z^*$$ 
where $s^* = 1 + \eta/H$ and $z=-H$ at the bottom of the ocean and $\eta$ is at the top of the ocean.


```python
from numpy import linspace
```


```python
H=3000.0 # meters (m)
eta=30.0  # meters (m)
numPts=50
waterColumn=linspace(0,0,num=numPts)
z=linspace(eta, -H, num=numPts)
```


```python
sStar=1+eta/H
zStar= (z-eta) / sStar
```

#### Plotting z* next to z to show the difference


```python
import matplotlib.pyplot as plt
%matplotlib inline
```


```python
plt.figure(figsize=(2,20))
plt.plot(waterColumn, z,
         'k_', ms=40, label='z')
plt.plot(waterColumn, zStar,
         'co', ms=10, alpha=0.6, label='z*')
plt.legend()
plt.show()

plt.figure(figsize=(10,2.5))
plt.plot(abs(z-zStar))
plt.show()
```

### Math proof

Let $z \in [-H, \eta]$, we want to show that $z^*$ contains only non-positive numbers. We do so by rearranging the relation
$$z=\eta + s^* z^*$$ 
to 
$$z^*=\frac{z-\eta}{s^*}.$$ 

At $z=-H$

\begin{align}
    z^* &= \frac{-H-\eta}{s^*} \\
        &= \frac{-H-\eta}{1+\frac{\eta}{H}}\\
    (1+\frac{\eta}{H})z^* &= -H-\eta \\
    (H+\eta)z^* &= -H(H+\eta)\\
    z^* &= -H.
\end{align}

At $z=\eta$
\begin{align}
    z^* &= \frac{\eta-\eta}{s^*} \\
    z^* &= 0.
\end{align}

Therefore, $z^* \in [-H, 0]$, which is a non-positive range for all values of $H$ and $\eta$.


```python

```

6386154a337de88f80f159cf2a305b54dad74507
ipynb
Jupyter Notebook
sandbox/gcm-methods/zStarTutorial.ipynb
IvanaEscobar/sandbox
71d62af2c112686c5ce26def35593247cf6a0ccc
MIT
sandbox/gcm-methods/zStarTutorial.ipynb
IvanaEscobar/sandbox
71d62af2c112686c5ce26def35593247cf6a0ccc
MIT
2022-02-15T23:32:52.000Z
2022-03-28T21:35:12.000Z
sandbox/gcm-methods/zStarTutorial.ipynb
IvanaEscobar/sandbox
71d62af2c112686c5ce26def35593247cf6a0ccc
MIT
Qwen/Qwen-72B
1. YES
2. YES