A collection of methods for the BPhO 2022 Computational Challenge.
This solves the following set of ODEs in a variety of ways:
$$
\begin{align}
\frac{dT}{dh} & = -L(r,T_K) \\
\frac{dP}{dh} & = -\frac{34.171}{ T_K} \left ( P - 0.37776 U E_S(T) \right )
\end{align}
$$
Given
$$
\begin{align}
L(r,T_K) & = 9.7734 \frac{1 + 5420.3 \frac{r}{T_K}}{1 + 8400955.5 \frac{r}{ T_K^2}} \\
r(P,T) & = \frac{UE_S(T)}{P-UE_S(T)} \\
E_S(T) & = 6.1121e^{ \left (18.678 - \frac{T}{234.5} \right ) \left (\frac{T}{T+257.14} \right ) }
\end{align}
$$
where $T_K = T + 273.15$ - i.e the Kelvin conversion - and for some parameter $U \in [0,1]$, given the initial conditions $h_0 = 0$ km, $P_0=1013.25$ mbar and $T_0 = 15^\circ$ C, with step size $\Delta h=0.01$, up to $h_1 = 11$ km.
- C++ and python implementations uf euler's method and runge-kutta's 4th order method (rk4)
- euler's method: recommended (read: mandated) by BPhO
- rk4 method: approx 40% faster than euler' method
- 'py_ref.py' contains roughly equivalent python code to the c++ code used for euler and rk4