Milestone 5 - Stability and Jacobian Matrices

In this chapter, we are interested in analyzing the stability properties of our semi-discrete 2D2D EBM.

Mapping from a 2D2D Operator to a 1D1D Vector

As a first step, we will first rewrite our system of ODEs in matrix form as a system of ODEs in vector form, as that will facilitate the stability analysis of the system.

In particular, we want to concatenate the columns of our operators that are defined in matrix form (with n_latitude×n_longitude\texttt{n\_latitude} \times \texttt{n\_longitude}), such that we create a one-dimensional vector with NDOF=n_latitude×n_longitude\texttt{NDOF} = \texttt{n\_latitude} \times \texttt{n\_longitude} entries, where NDOF\texttt{NDOF} stands for number of degrees of freedom (see figure).

Applying this mapping to our system of ODEs in matrix form, we obtain

T˙=R(T)+F(t), \dot{\mathbf{T}} = \mathbf{R}(\mathbf{T}) + \mathbf{F}(t),

where T,R(T),F(t)RNDOF\mathbf{T}, \mathbf{R}(\mathbf{T}), \mathbf{F}(t) \in \mathbb R^{\texttt{NDOF}}.

Remark: To map a matrix (2D2D) variable to a 1D1D vector, you can use the command vec in Julia, and the command .flatten() in numpy (Python).

RR \underline{\mathbf{ R}} \rightarrow \mathbf{R}

Stability Theory for Linear Systems of Equations

As we saw in Milestone 3, the maximum allowable time-step size depends on the choice of the time discretization method for scalar ODEs. In this section, we will apply the stability theory presented in Milestone 3 to systems of ODEs that result from spatial discretizations to study the stability properties of our 2D2D EBM model.

As a first step for our analysis, we will take advantage of the linearity of the term R(T)\mathbf{R}(\mathbf{T}) to rewrite our system of ODEs (1) as

T˙=ATR(T)+F(t), \dot{\mathbf{T}} = \underbrace{ \underline{\mathbf{ A}} \mathbf{T} }_{\mathbf{R}(\mathbf{T})} + \mathbf{F}(t),

where A\underline{\mathbf{ A}} is the so-called Jacobian matrix of the system.

Note that (3) differs from the linear scalar homogeneous ODE that we analyzed in Milestone 3. As a matter of fact, (3) is nonhomogeneous and the different ODEs are coupled through matrix A\underline{\mathbf{ A}}.

Assuming that our Jacobian matrix is invertible, we can rewrite it as

A=V Λ V1, \underline{\mathbf{ A}} = \underline{\mathbf{ V}} \, \underline{\mathbf{ \Lambda}} \, \underline{\mathbf{ V}}^{-1},

where the dense matrix V=[v1,v2,,vNDOF]\underline{\mathbf{ V}} = [\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_{\texttt{NDOF}}] contains the eigenvectors of A\underline{\mathbf{ A}} in its columns, and Λ=diag(λ1,λ2,,λNDOF)\underline{\mathbf{ \Lambda}} = \text{diag} (\lambda_1, \lambda_2, \ldots, \lambda_{\texttt{NDOF}}) is a diagonal matrix that contains the (possibly complex) eigenvalues of A\underline{\mathbf{ A}}. Hence, (3) is equivalent to the system of ODEs,

Z˙=ΛZ+F(t), \dot{\mathbf{Z}} = \underline{\mathbf{ \Lambda}} \mathbf{Z} + \pmb{\mathcal{F}}(t),

where Z=V1T\mathbf{Z} = \underline{\mathbf{ V}}^{-1}\mathbf{T} and F(t)V1F(t) \pmb{\mathcal{F}}(t) \coloneqq \underline{\mathbf{ V}}^{-1} \mathbf{F}(t).

Note that the individual variables in (5) are decoupled due to the diagonal matrix Λ\underline{\mathbf{ \Lambda}}. As a result, (5) resembles the linear scalar homogeneous ODE and the solutions have the form

Zi(t)=aieλit+Zip(t), Z_i(t) = a_i e^{\lambda_i t} + Z^p_{i}(t),

where ZipZ^p_{i} is a so-called particular solution (also particular integral) for the ithi^{\text{th}} nonhomogeneous problem that depends on Fi(t)\mathcal{F}_i(t) and λi\lambda_i, and aia_i is a constant that is adjusted to match the initial condition,

ai=Zi(t=0)Zip(t=0). a_i = Z_i(t=0) - Z^p_{i}(t=0).

In the case that

Re(λi)<0,for i=1,2,,NDOF, \text{Re}(\lambda_i) < 0, \qquad \text{for}~ i=1, 2, \ldots, \texttt{NDOF},

we expect that Z(t)\mathbf{Z}(t) converges to the particular solution Zp(t)\mathbf{Z}^p(t) as tt \rightarrow \infty. In such a case, we call the particular solution equilibrium solution.

Remark: The stability properties of our system of ODEs (3) are inherited from the linearized system (5). As a matter of fact, we can compute the solutions of (3) from (6) as

T(t)=VZ(t)=i=1NDOFaieλitvi+VZp(t)Tp(t), \mathbf{T}(t) = \underline{\mathbf{ V}} \mathbf{Z}(t) = \sum_{i=1}^{\texttt{NDOF}} a_i e^{\lambda_i t} \mathbf{v}_i + \underbrace{\underline{\mathbf{ V}}\mathbf{Z}^p(t)}_{\mathbf{T}^{p}(t)},

where Tp\mathbf{T}_{p} is now the particular solution of the original nonhomogeneous problem. If conditions (8) are valid, Tp\mathbf{T}_{p} is the equilibrium temperature field.

We can now apply the stability theory presented in Milestone 3 to each scalar ODE of our diagonalized system (5). For systems of ODEs, we require that all values λiΔt\lambda_i \Delta t, for i=1,2,,NDOFi=1, 2, \ldots, \texttt{NDOF}, lie in the stability region of the time-integration method used.

Remark: The maximum allowable time-step size to solve a system of ODEs that results from a spatial discretization of a PDE depends on the spatial discretization method. For instance, note that the eigenvalues λi\lambda_i of matrix A\underline{\mathbf{ A}} depend on the spatial discretization method and grid size.

Computing Jacobian Matrices (Numerical Jacobian)

It is possible to expand a general nonlinear operator, R(T)\mathcal{R}(\mathbf{T}), with a multi-dimensional Taylor series to obtain,

R(T)=R(T0)+A(T0)ΔT+O((ΔT)2), \mathcal{R}(\mathbf{T}) =\mathcal{R}(\mathbf{T}_0) + \underline{\mathbf{ A(\mathbf{T}_0)}} \Delta \mathbf{T} + \mathcal{O} ((\Delta \mathbf{T})^2),

where the Jacobian matrix is defined as

RNDOF×NDOFA(T0)R(T)TT0. \mathbb R^{\texttt{NDOF}\times\texttt{NDOF}}\ni\underline{\mathbf{ A}} (\mathbf{T}_0) \coloneqq \left. \frac{\partial { \mathcal{R} (\mathbf{T})}}{\partial { \mathbf{T}} } \right|_{\mathbf{T}_0}.

This Taylor expansion can also be used to approximate the Jacobian matrix. For instance, one can assume that T\mathbf{T} differs from T0\mathbf{T}_0 only in one degree of freedom by a small quantity ϵ\epsilon,

T=T0+ϵK^j, \mathbf{T} = \mathbf{T}_0 + \epsilon \hat{\mathbf{K}}^j,

where K^j=(k^1j,k^2j,,k^NDOFj)T\hat{\mathbf{K}}^j = (\hat{k}^j_1, \hat{k}^j_2, \ldots, \hat{k}^j_{\texttt{NDOF}})^T is a vector whose entries are defined as

k^ij={1,if i=j,0,otherwise. \hat{k}^j_i = \begin{cases} 1, & \mathrm{if} \ i = j, \\ 0, & \mathrm{otherwise}. \end{cases}

Equation (10) can then be rearranged as

RNDOFAK^j=R(T0+ϵK^j)R(T0)ϵ+O(ϵ). \mathbb R^{\texttt{NDOF}}\ni\underline{\mathbf{ A}} \hat{\mathbf{K}}^j = \frac{\mathcal{R}(\mathbf{T}_0+\epsilon \hat{\mathbf{K}}^j)-\mathcal{R}(\mathbf{T}_0)}{\epsilon} + \mathcal{O}(\epsilon).

For general nonlinear operators, the quantity AK^j\underline{\mathbf{ A}} \hat{\mathbf{K}}^j is a good approximation for the jthj^{\mathrm{th}} column of the Jacobian matrix if ϵ\epsilon is small enough. One has to be careful in choosing the size of ϵ\epsilon, as very small values (close to machine precision) suffer from cancelation errors, when adding up. Hence, there is some discussion in the literature available about the optimal choice of ϵ\epsilon. As a starting point, it is good to consider only the square root of the currently used machine precision ϵm\epsilon_m, i.e., ϵϵm\epsilon\sim\sqrt{\epsilon_m} to have a good balance of accuracy and machine error cancellation issues. For a typical double precision calculation with ϵm1016\epsilon_m\sim 10^{-16} we then have about single precision accuracy, ϵ108\epsilon\sim 10^{-8}.

Since the right-hand-side term of our 2D2D EBM is a linear operator, (14) is exact for any ϵ\epsilon and any linearization temperature T0\mathbf{T}_0, and the second and higher-order terms vanish. As a consequence, we can choose ϵ=1\epsilon = 1 and T0=0\mathbf{T}_0 = \mathbf{0} to get a column of the Jacobian of our 2D2D EBM

AEBMK^j=R(K^j)R(0). \underline{\mathbf{ A}}_{\text{EBM}} \hat{\mathbf{K}}^j = \mathbf{R}(\hat{\mathbf{K}}^j)-\mathbf{R}(\mathbf{0}).

The whole Jacobian matrix can be recovered by computing (15) NDOF\texttt{NDOF} times (i.e., NDOF+1\texttt{NDOF} + 1 computations of the right-hand-side operator R(T)\mathbf{R}(\mathbf{T})):

RNDOF×NDOFAEBM=[AEBMK^1,AEBMK^2,,AEBMK^NDOF]. \mathbb R^{\texttt{NDOF}\times\texttt{NDOF}}\ni \underline{\mathbf{ A}}_{\text{EBM}} = \left[ \underline{\mathbf{ A}}_{\text{EBM}} \hat{\mathbf{K}}^{1}, \underline{\mathbf{ A}}_{\text{EBM}} \hat{\mathbf{K}}^{2}, \ldots, \underline{\mathbf{ A}}_{\text{EBM}} \hat{\mathbf{K}}^{\texttt{NDOF}} \right].

Created by Gregor Gassner and Andrés Rueda-Ramírez with contributions by Simone Chiocchetti, Daniel Bach, Sophia Horak, Philipp Baasch, Benjamin Bolm, Erik Faulhaber, and Luca Sommer. Last modified: April 02, 2026. Website built with Franklin.jl and the Julia programming language.