In economic applications, we often deal with the following boundary problem of a nonlinear parabolic equation:
where is the infinitesimal generator operator; represents the interior of the hyper-rectangular domain; denotes the boundary of the domain; are evaluable functions; and Neumann boundary conditions are assumed, which align with the majority of our economic applications. In the previous blog post, we discussed the monotonicity of the numerical scheme, with a focus on the interior points of the domain. However, special attention must be paid when handling boundary points to ensure monotonicity, consistency and stability in the numerical solution.
Conventionally, we denote the discretized node space of finite points as , where is the number of supporting nodes, and thus the boundary of such node space as . Usually, there are two strategies to handle the boundary in the finite difference framework by discretizing the nodes in :
True boundary: Assuming all are exactly on the boudary such that boundary conditions hold for all these nodes.
Ghost boundary: Assuming all are slightly inward away from the boundary. Assuming there exist a "thin" suface just outside where the boundary conditions hold on points in rather than on points in .
We discuss each of them while considering the quasi-implicit scheme on uniform/dense grid.
True boundary
Let be a node that we are about to discretize, where is a multi-index of dimensions. We use to denote the value of the -th dimension of . Before moving to the "corner" (intersection of two boundaries) or "vertex" (intersection of three or more boundaries), let's first discuss the "edge" case. Suppose is on the boundary of only one dimension, say . For all , are interior.
Edge
In the case of true boundary, if the boundary condition is Dirichlet, then we simply evaluate . However, for Neumann boundary conditions, we still need to discretize the boundary condition at . Recall the boundary condition along dimension :
The quasi-implicit method requires discretizing Eq () on the layer of . In this case, if is the left boundary along dimension i.e. , then we do forward difference and rearrange the terms to make all coefficients positive:
where the prime mark denotes the time layer of . This scheme is unconditional monotonic. Similarly, in the case of right boundary, there is:
Equation () are the equations for updating the guess of . One should NOT use the parabolic equation () which holds on interior points.
Corner and vertex
In the case of the intersection of two boundaries, say and , let lie on the boundary along dimensions and simultaneously. A node like this is often referred to as a corner node. If three or more dimensions intersect simultaneously, we call such a node a vertex node. Note that the literature often does not distinguish between the two, which is fine.
The challenge in discretization here is to ensure that simultaneously satisfies both boundary conditions. If we use Dirichlet conditions for both and , we can always assign a consistent value to . However, if two Neumann conditions meet, a problem arises: we have two equations but only one unknown, . This indeterminacy persists even if there is no mixed partial derivative involved.
One possible solution is to average the two Neumann conditions such that (assuming both boundaries are left boundaries):
The monotonicity still holds. This can trivially extends to three-dimension vertex nodes even nodes of higher dimensionality. However, one issue here is that the case of simultaneous-holding is certainly a solution to Eq. (), but it is obviously not the unique solution. Numerical non-monotonicity, instability and other violations may still exist. Therefore, it is critical to ensure that the implied value function derived from the two Neumann boundary conditions is continuous at the corner node. In the context of a household problem, for example, consider the reflection boundary condition (Neumann) for liquid assets, which implies consuming all flow income, alongside the reflection boundary condition for illiquid housing wealth, which implies purchasing as much housing wealth as possible. These two conditions must determine an allocation at the “lowest consumption and lowest housing wealth” point: how should the flow income be allocated between consumption and housing wealth investment? Furthermore, is the manually assigned allocation consistent with the policy functions for consumption and housing wealth investment? Answering these questions requires a deep understanding of the behavior of the quantitative model before attempting computational implementation. In such cases, solving a discrete-time version of the problem on a coarse grid can provide valuable intuition. The discrete-time version and its continuous-time counterpart must exhibit consistency, while the discrete-time model typically does not require explicitly specified boundary conditions, instead relying on numerical optimization to determine solutions.
The idea of re-introducing some numerical optimization reminds us that, instead of manually specifying the allocation at such corner nodes, one can solve the optimization problem at numerically. This approach preserves the convenience of analytical policy solutions for continuous-time models, as the number of corner/vertex nodes is very small relative to the total number of nodes. An example of such an optimization step looks like:
where is a vector of control variables. Here, we are searching for a control that satisfies the maximum principle while respecting the multiple boundary conditions as much as possible.
It is important to note that, in economic applications, we typically do not impose "hard" boundary conditions that require strict equalities. Instead, we often work with "soft" boundary conditions, which are expressed as inequalities. The nature of the free boundary problem we are addressing validates the optimization framework outlined above without compromising adherence to the boundary conditions.
Example: optimization at corner nodes
Let's consider a simple human capital problem which has two states: physical capital, and human capital.
in which households choose consumption and the time allocation between working and education. We use soft reflection boundaries for such that for , for , for , and for . Readers may notice that we use all "soft" boundary conditions rather than standard Neumann conditions because, by definition, this is a free-boundary problem.
Now, let's define the optimization problem. We define the generalized Hamiltonian , which is discounted to the current moment rather than to as in the standard statement of maximum principle.
Notes: The solved policy function of and , which are denoted as functions of partial derivetives of , are:
They will be discretized in Eq (). We list them here for reference.
For the "bottom-left" corner in which and , we discretize the Hamiltonian using forward difference along both dimensions (recall that we are handling the case of true boundary). Assume the values of neighbor nodes are known such that they become parameters of the Hamiltonian. The function value becomes a control that we want to solve:
where for convenience; and are the two neighbor nodes used in the finite difference approximation. This discretized Hamiltonian, which serves as the objective function, is subject to:
where the two monotonicity constraints are imposed by the non-negativity constraint of consumption and our domain knowledge, respectively. Meanwhile, we require policy functions of and still hold in order to smooth the policy function surface, while make the optimal bounded.
In this way, by knowing the two neighboring nodes and , one can solve the above optimization problem efficiently using fmincon() or other nonlinear optimizer routines. This approach focuses solely on one point, , of the value function, allowing the problem to be modeled as a closure. Consequently, there is no need to interpolate the entire . Similarly, one can define such an optimization problem for all four corners in this human capital example. Furthermore, the problem can be trivially generalized to higher dimensions.
Remark: explicit? or implicit?
The optimization solution for corner/vertex nodes described above requires knowing the values of and , i.e., the value function in the neighborhood of the corner nodes. This approach works perfectly with an explicit scheme as Eq () since these values are guesses from the previous iteration. However, with the implicit method, these neighboring node values are on the time layer , meaning they are unknown when solving for . Equivalently, this results in nonlinear equation(s) that must be solved to update the corner nodes. Consequently, one needs to solve these nonlinear corner equations simultaneously with the interior equations. This process breaks the linearity of the quasi-implicit scheme that is commonly used.
However, one may have noticed that the above optimization problems are computationally very cheap to solve, making them suitable to be wrapped as a callable object. The corner/vertex equations can then be expressed as:
The monotonicity of this nonlinear scheme is always satisfied due to the monotonicity constraint embedded within the optimization routine. Meanwhile, the monotonicity of the scheme for interior nodes can be ensured by the regular quasi-implicit upwind scheme.
In general, either the implicit form as Eq () or the explicit form as Eq () works, regardless of which form is applied to interior nodes. Mixing implicit and explicit methods for different parts of the domain is feasible and is often referred to as a locally defined difference scheme.
In practice, the explicit form is usually preferred due to its computational simplicity. However, if the implicit form is chosen, the entire numerical scheme (incorporating both interior and boundary nodes) remains implicit. To solve the entire system of updates, one may consider employing iterative algorithms such as the Newton method.
Hint: Always check CFL condition carefully when working with any explicit scheme.
Ghost boundary
The ghost boundary method is more frequently used due to its smoothness in the neighborhood of , especially when we are not particularly interested in the boundary behavior of the PDE but merely use the boundary to pin down the solution.
Remark: In Benjamin Moll's illustrative examples, the partial derivatives from backward difference at a left boundary node are manually specified (e.g., using the reflection of zero savings). This approach effectively embeds a backward difference operation with a ghost outside node.
The idea of discretizing ghost boundaries is similar to the true boundary case. However, in this approach, we require the PDE to hold on while the boundary conditions are enforced on ghost nodes, e.g., on .
Edge
Let's illustrate this using an edge node which is the left boundary of dimension . Let's consider Neumann boundary condition on ghost node . Because it is a left boundary, we use forward difference to approximate , rearrange terms and get the following formula for :
Suppose the PDE for interior points bas the following simple form:
Discretizing it and apply quasi-implcit upwind scheme:
It is easy to realize Eq () is unconditionally monotonic.
Corner and vertex
When using ghost boundaries, a notable advantage is that we usually do not need to solve for the very corner ghost node unless we are approximating specific partial derivatives. To illustrate, consider , a "bottom-left" corner node. The following table provides the spatial locations of and its neighboring ghost nodes:
, ghost edge
, actual node
, ghost corner
, ghost edge
The ghost corner, , is only required when approximating the off-diagonal element of the Hessian matrix, such as , particularly using backward difference. This type of approximation typically arises, at least in the context of economic research, in portfolio selection models with systemic risks. The same concept can be trivially generalized to vertex nodes.
However, if someone really wants to solve , they may simply use the optimization idea introduced in the last section. Notably, this optimization does not contribute to updating the guess in this example.