Generalized Conservative Regridding¶
Regridding problem is the problem of transforming a vector \(\vec{f^A}\) in vector space \(\cal{A}\) into an “equivalent” vector \(\vec{f^B}\) in vector space \(\cal{B}\). Because \(\cal{A}\) is a vector spaces, it has dimensionality \(|\cal{A}|\) and basis functions, denoted as \(a_i(\vec{x})\) for \(1 \leq x \leq |\cal{A}|\).
Note
- Regridding transformations are almost always linear, and therefore representable by a matrix. All regridding operations we consider here will be linear.
- Practitioners typically think about regridding in terms of grids. Grids can be more formally represented by the more general notion of a vector space, where each “grid cell” is represented by a basis function.
The notion of “equivalence” may be formalized by insisting that \(\cal{N}^A(\vec{f^A}) = \cal{N}^B(\vec{f^B})\) where \(\cal{N}^A\) and \(\cal{N}^B\) are norms on the vector spaces. We can define the vector of weigths for the basis functions:
Using this, we can define a norm that corresponds to our idea of “conservative”, i.e. it measures the amount of “stuff” represented by a vector (assuming \(\vec{f^A}\) uses intrusive units).
Note
Intrusive units are units, such as kg/m^2, express the amount of a substance in a grid cell by the quantity of substance, divided by the area/volume. Climate models typically use intrusive units for all quantities.
Overlap Matrix¶
We define an overlap matrix \(\matrix{O}^{BA}\), or unscaled regridding matrix to be:
We define weight vectors for vector spaces \(\cal{A}\) and \(\cal{B}\) as:
\(\vec{w^B}\) can be interpreted as the area of grid cells in \(\cal{B}\) that overlap \(\cal{A}\). If the entire grid \(\cal{B}\) overlaps \(\cal{A}\), then \(\vec{w^B} = \vec{b}\). However, this is often not the case: for example, an ice sheet may be define on only a portion of a grid, with the other grid cells unused. The effective grid consists of only ice sheet-covered cells, and \(\vec{w^B}\) must be used instead of \(\vec{b}\) in evaluating conservation properties on this grid.
Scaled Regridding Matrix¶
We define scale vectors as the inverse of weight vectors \(s^A_i = 1 / w^A_i\). A conservative (or “scaled”) regridding matrix may be computed as:
It can be used to regrid:
with the property:
It is important to note that all conservative regridding matrices published in the literature follow this pattern. The only “interesting part” is the computation of the inner products \(\int_A b_j(\vec{x}) a_i(\vec{x}) dA\).
Regridding Areas vs. Quantities¶
The above formulas work if \(\vec{f^A}\) uses intrusive units; eg kg/m^2; and they can also be trivially adapted to the case where \(\vec{f^A}\) is not scaled by area, eg. in units of kg. If \(\vec{f^A}\) is in units of area (m^2), then the following formula applies instead:
Symmetries and Identities¶
Regridding matrices have a fundamental symmetry based on the fact that
Thus, \(\matrix{M}^{BA}\) and \(\matrix{M}^{AB}\) may both be computed from \(\matrix{O}^{BA}\) and its weight vectors \(w^B\) and \(w^A\). This suggests a layered system to compute scaled regridding matrices: core subroutines that compute \(\matrix{O}^{BA}\), and then outer subroutines that scale and (possible) transpose depending on whether \(\matrix{M}^{BA}\) or \(\matrix{M}^{AB}\) is required.
ASCII Notation¶
The following notation is used for variables in IceBin code:
BvAorBvA.M= \(\matrix{O}^{BA}\) or \(\matrix{M}^{BA}\), depending on context.wB= \(\vec{w^B}\)sB= \(\vec{s^B}\)wBvAorBvA.wM= \(\vec{w^B}\) computed from the matrix \(\matrix{O}^{BA}\).sBvA= \(\vec{s^B}\) computed from the matrix \(\matrix{O}^{BA}\).BvAworBvA.Mw= \(\vec{w^A}\) computed from the matrix \(\matrix{O}^{BA}\).BvAs= \(\vec{s^A}\) computed from the matrix \(\matrix{O}^{BA}\).
In the code, final regridding matrices are typically assembled by computing lower-level matrices and then multiplying them together. The multiplication is done with the Eigen package, thereby elucidating the core mathematical nature of what is being multiplied.
Regridding Chains¶
In some cases, a desired regridding matrix is not available directly between two vector spaces. Consider the following example, with grids \(\cal{A}\), \(\cal{B}\) and \(\cal{C}\). In this case, we know how to compute \(\matrix{O}^{BA}\) and \(\matrix{O}^{CB}\):
![digraph {
rankdir=RL;
A -> B[label="BvA"]
B -> C[label="CvB"]
}](_images/graphviz-97c8bc5d64ab26ac364706060704a400b6eea802.png)
Linearity of these transformations allows us to compute the scaled regrid matrix:
The equivalent unscaled version can be obtained by omitting the last term on the left:
Regridding matrices can therefore be assembled based on graph diagrams, like the one above, showing the vector spaces and the available base-level regridding matrices we know how to compute.