<p>From the code you provided, you used finite difference approximation to the differential expressions.  That is the root of the difference.  When you use finite difference schemes (here centered differencing), you have implicitly neglected the higher-order terms in Taylor series.</p>
<p>Generally, a differential term can be sometimes written in different forms.  These different forms give somewhat different results when they are discretized.  A well-known example is:
<span class="math-container">$$u\frac{du}{dx}=\frac{1}{2}\frac{du^2}{dx}$$</span>
However, if you using centered differencing, you cannot prove:
<span class="math-container">$$u_i\frac{u_{i+1}-u_{i-1}}{2\Delta x}=\frac{1}{2}\frac{u_{i+1}^2-u_{i-1}^2}{2\Delta x}$$</span></p>
<p>because higher-order terms are dropped out.  So you have to properly choose your expression for discretization.  For diagnostic purpose, such difference can generally be ignored, as it is due to your finite difference scheme.</p>

CC BY-SA 4.0
2022-11-22T17:33:54.567Z
Thanks, the static stability parameters diverge sometimes, so I guess that what we are facing is not a systematic error.
Kernel
CC BY-SA 4.0
2022-11-13T13:03:56.090Z
2022-11-13T13:03:56.090Z
MiniUFO
<p>All,
The static stability of the atmosphere is defined as:<br />
<span class="math-container">$\sigma =-\dfrac{T}{\theta} \dfrac{d\theta}{dp}= \dfrac{dT}{dp}-\dfrac{R}{c_p} \dfrac{T}{p}$</span></p>
<p>where:
<span class="math-container">$T$</span> is temperature,
<span class="math-container">$P$</span> is pressure,
<span class="math-container">$R$</span> is ideal gas constant,
<span class="math-container">$c_p$</span> is heat capacity at constant pressure,
<span class="math-container">$\theta$</span> is potential temperature, which is defined as <span class="math-container">$\theta=T \left(\dfrac{p_o}{p}\right)^{R/c_p}$</span>, <span class="math-container">$p_0$</span> is reference pressure.</p>
<p>The calculated statics stability using <span class="math-container">$\dfrac{dT}{dp}-\dfrac{R}{c_p} \dfrac{T}{p}$</span> or <span class="math-container">$-\dfrac{T}{\theta} \dfrac{d\theta}{dp}$</span> should be identical, yet they actually differ sometimes as shown below
<a href="https://i.sstatic.net/6vGTm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6vGTm.png" alt="enter image description here" /></a></p>
<p><a href="https://app.box.com/s/ryzrgd7txr16qizt3fandjp65sqamhg8" rel="nofollow noreferrer">(plz see attached Python code used to calculated statics stability )</a></p>
<p>I am wondering if there is analytical or numerical way to determine when both identical definition of static stability might diverge, though? Sometimes, the way that terms is calculated numerically can significantly change the results, for example, the physical properties of the Jacobian of the 2D advection equation was found to differ based on the numerical technique used in the calculation <a href="https://people.bath.ac.uk/ensdasr/PAPERS/arakawa_1966.pdf" rel="nofollow noreferrer">see Arakawa (1966)</a></p>

<meteorology><atmosphere><atmosphere-modelling><numerical-modelling><thermodynamics>
divergence of static stability identical parameters
Kernel
# divergence of static stability identical parameters

(Asked by: username_0 on 2022-06-14)

All,
The static stability of the atmosphere is defined as:  
$\sigma =-\dfrac{T}{\theta} \dfrac{d\theta}{dp}= \dfrac{dT}{dp}-\dfrac{R}{c\_p} \dfrac{T}{p}$

where:
$T$ is temperature,
$P$ is pressure,
$R$ is ideal gas constant,
$c\_p$ is heat capacity at constant pressure,
$\theta$ is potential temperature, which is defined as $\theta=T \left(\dfrac{p\_o}{p}\right)^{R/c\_p}$, $p\_0$ is reference pressure.

The calculated statics stability using $\dfrac{dT}{dp}-\dfrac{R}{c\_p} \dfrac{T}{p}$ or $-\dfrac{T}{\theta} \dfrac{d\theta}{dp}$ should be identical, yet they actually differ sometimes as shown below
[![enter image description here](https://i.sstatic.net/6vGTm.png)](https://i.sstatic.net/6vGTm.png)

[(plz see attached Python code used to calculated statics stability )](https://app.box.com/s/ryzrgd7txr16qizt3fandjp65sqamhg8)

I am wondering if there is analytical or numerical way to determine when both identical definition of static stability might diverge, though? Sometimes, the way that terms is calculated numerically can significantly change the results, for example, the physical properties of the Jacobian of the 2D advection equation was found to differ based on the numerical technique used in the calculation [see Arakawa (1966)](https://people.bath.ac.uk/ensdasr/PAPERS/arakawa_1966.pdf)

**Tags:** meteorology, atmosphere, atmosphere-modelling, numerical-modelling, thermodynamics


---

## 1 answers

### Answer by username_1 on 2022-11-13. Score: 1

From the code you provided, you used finite difference approximation to the differential expressions. That is the root of the difference. When you use finite difference schemes (here centered differencing), you have implicitly neglected the higher-order terms in Taylor series.

Generally, a differential term can be sometimes written in different forms. These different forms give somewhat different results when they are discretized. A well-known example is:
$$u\frac{du}{dx}=\frac{1}{2}\frac{du^2}{dx}$$
However, if you using centered differencing, you cannot prove:
$$u\_i\frac{u\_{i+1}-u\_{i-1}}{2\Delta x}=\frac{1}{2}\frac{u\_{i+1}^2-u\_{i-1}^2}{2\Delta x}$$

because higher-order terms are dropped out. So you have to properly choose your expression for discretization. For diagnostic purpose, such difference can generally be ignored, as it is due to your finite difference scheme.

> **Comments:**
> **username_0**: Thanks, the static stability parameters diverge sometimes, so I guess that what we are facing is not a systematic error.  

---

