The challenge now is to evaluate the diffusion operator in spherical coordinates, such that we can use it in our 2D EBM model. To do that, we will obtain a discrete version of the spatial derivatives that we can compute using the nodal values for the temperature and diffusion coefficients in our 2D latitude/longitude grid.
The finite difference method is one of the simplest numerical methods to discretize derivatives. There are many ways to derive finite difference formulas, but we will focus on the method of the Taylor expansion, as it will give us information about the approximation errors.
Taylor series: The Taylor series (or Taylor expansion) of a function is an infinite sum of polynomial terms that are expressed in terms of the function's derivatives at a point. For instance, the Taylor series of the function f(x) around the point x0 is defined as f(x)=f(x0)+dxdf(x0)(x−x0)+2!1dx2d2f(x0)(x−x0)2+3!1dx3d3f(x0)(x−x0)3+⋯=f(x0)+dxdf(x0)Δx+2!1dx2d2f(x0)Δx2+2!1dx3d3f(x0)Δx3+⋯=n=1∑∞n!f(n)(x0)Δx, where f(n)(x0) is a short-hand notation for the nth derivative of function f(x) at x0, and the distance between the evaluation point and the point x and x0 is Δx:=x−x0.
Let us consider a uniform one-dimensional grid containing temperature values.
Using (1), we can write Taylor expansion for Ti+1 around Ti:
where O(Δx) indicates that the largest term is of the order of Δx. Hence, if we truncated the Taylor series there,
dxdTi≈ΔxTi+1−Ti,
we would obtain an approximation of the derivative dTi/dx, which would converge to the exact value of the derivative with first-order accuracy (i.e., error∼Δx1) as the grid size is reduced, Δx→0.
It is also possible to write Taylor expansions of Ti−1 around Ti,
Using (2), (5), and (6), we can obtain the following approximations for the first derivative at xi:
Right-sided finite-difference scheme of first order (error∼Δx1):
dxdTi≈ΔxTi+1−Ti.
Left-sided finite-difference scheme of first order (error∼Δx1):
dxdTi≈ΔxTi−Ti−1.
Central finite-difference scheme of second order (error∼Δx2):
dxdTi≈2ΔxTi+1−Ti−1.
Right-sided finite-difference scheme of second order (error∼Δx2):
dxdTi≈2Δx−3Ti+4Ti+1−Ti+2.
And many other possibilities.
Remark: High-order approximations are desired as the higher the order, the faster we approach the exact value of the derivative as we refine the grid. However, high-order accuracy sometimes come with the price of more operations to compute.
Remark: Note that some finite difference approximations are central, and some are left-sided or right-sided. Depending on how the finite-difference formula is defined, it will have some bias as to how information travels in the domain.
Using (2), (5), and (6), we can also obtain approximations for the second derivative at xi:
Right-sided finite-difference scheme of first order (error∼Δx1):
dx2d2Ti≈Δx2Ti+2−2Ti+1+Ti.
Central finite-difference scheme of second order (error∼Δx2):
which can be discretized with the first-order derivative finite-difference approximations, and two terms (Terms 1 and 2) of the form
L2(T)=∂x∂(D∂x∂T),
which is slightly more involved.
One possibility to discretize L2(T) is to apply the chain rule of differentiation at the continuous level,
L2(T)=∂x∂(D∂x∂T)=∂x∂D∂x∂T+D∂x2∂2T,
such that it is expressed in terms of first and second-order derivatives.
Remark: Even though we are now dealing with partial derivatives, the finite difference formulas can be applied dimension by dimension.
We now have enough tools to obtain a discrete form for the diffusion term of the 2D EBM. Our goal is to obtain a finite difference scheme with the following properties:
The scheme must be central: To model the parabolic nature of the heat conduction term (see Milestone 2 - Conservation and Balance), we require the scheme to be symmetric.
The scheme must be compact: To avoid wide stencils, we require the scheme to only use the information from neighboring nodes.
The scheme must be as accurate as possible: We will select a scheme of the highest order possible, such that our approximation is as accurate as possible given our constraints.
Given these criteria, we select the central second-order accurate finite-difference approximations for the first-order (9) and second-order (12) derivatives, to obtain for the degree of freedom i
Garhering everything, and introducing h=Δθ=Δφ as the uniform mesh spacing, the central second-order finite-difference discretization of the different terms of the diffusion operator in spherical coordinates reads
Remark: We cannot use equations (20), (21), and (22) for the nodes at the pole becuse of the singularity of our grid. In fact, (20) and (22) are not well defined for θ~=0, and the evaluation of (21) is complicated because it requires a nodal value across the pole.
To deal with the pole problem, we use the techniques proposed in the following papers:
Bates, J. R., Semazzi, F. H. M., Higgins, R. W., & Barros, S. R. (1990). Integration of the shallow water equations on the sphere using a vector semi-Lagrangian scheme with a multigrid solver. Monthly Weather Review, 118(8), 1615-1627.
We will proceed to derive a discretization for the north pole. The discretization for the south pole can be derived in an analogous manner. Let us consider a control area of the size of the northern polar cell (green in the figure), which spans θ~∈[0,h/2], φ∈[0,2π].
To avoid the singularity at the pole, we will now consider an integral form of (23), which we obtain by integrating the equation over the polar cell,
Remark: As mentioned above, there is a singularity at θ~=0. As shown in (28), we can deal with the singularity using the integral form of the equation. As can be derived with standard calculus, the value of the integral is well defined.
Similarly, we can use the fundamental theorem of calculus to integrate the second term in the right-hand side of (24) over the colatitude:
As a next step, we make the assumption that L(θ~,φ) is a constant in the polar cell, such that we can approximate the integral on the left-hand side with a mid-point rule,
where L1,i is the nodal value of L(θ~,φ) at θ~j=0 (j=1) for any longitude position i. This is an approximation of the integral that assumes that the nodal value of the mid-point corresponds to the area-average of L(θ~,φ) in the polar cell. Recall that the first entry of the array area contains the total area of the polar cap normalized with the area of the sphere (see Milestone 3 - Averages).
Now, we approximate the derivative of temperature with respect to colatitude at each discrete longitude, φi, with a central finite-difference approximation of second-order accuracy,
[∂θ~∂T]θ~=2h,i≈hT2,i−T1,i,
and the diffusion coefficient at θ~=2h with a simple average,
[D(θ~,φ)]θ~=2h,i≈DiNP=21(D1,i+D2,i).
Remark: Another possibility is to compute an area-weighted average:
With the spatial discretization that we derived above, we can rewrite the PDE that describes our 2D EBM in spherical coordinates as an ODE for each degree of freedom (j,i):
where we have gathered the temperature-dependent terms under Rj,i(T) and the sources and sinks under Fj,i.
In equation (38), Cj,i is the point-wise heat capacity that depends on the geography (see Milestone 2 - Heat Capacity); Lj,i is the discrete point-wise heat transfer term computed with (19) for the interior nodes, with (35) for the north pole (j=1), and with (36) for the south pole (j=n_latitude); A and B are the outgoing longwave radiation parameters (see Milestone 2 - Radiation Modeling); and Ssol,j,i=(1−αj,i)Sj,i is the point-wise time-dependent solar forcing term that depends on the point-wise insolation Sj,i and the point-wise albedo αj,i.
where T∈Rn_latitude×n_longitude is a matrix that contains all point-wise values of temperature, R(T)∈Rn_latitude×n_longitude is a matrix operator applied on the temperature matrix, F(t)∈Rn_latitude×n_longitude is the time-dependent matrix containing the sources and sinks of the method, and we use the dot operator to denote the time derivative term.