[ . . . ]
If I understand your response correctly, it is possible to get the vertical velocity using the continuity equation by smoothing 'w' appreciably.
That's not quite what I meant. I meant:
1. Use exactly the same discrete continuity equation that the model uses. Different discretization will often result in large error.
2. If you cannot use the exact discrete continuity equation, then you would need to heavily smooth the w field calculated with an ad-hoc discrete continuity equation.
In case 2, you don't know how much smoothing is appropriate because you don't know the true w field.
I would like to try it out because my earlier attempt without non-smoothing did not yield any reasonable structure for w.
However, I have a question because you say that because your numerical code uses B-grid and the Cartesian coordinates, u[x=@DDC] + v[y=@DDC] is the right calculation.
On the B-grid, both velocity components, u and v, are located at the same gridpoint. So, both central-difference derivatives u[x=@DDC] and v[y=@DDC] are located at the same velocity points. In the C-grid, the u and v components are located at different grid points and there u[x=@DDC] and v[y=@DDC] are located at different gridpoints. For this reason, to sum the discrete ∂u/∂x and ∂v/∂y, you need to map them to a common grid by interpolation.
With SODA, you use the spherical coordinate. Then,
div(u, v) = (∂u/∂λ)/(r cos ϕ) + [∂(v cos ϕ)/∂ϕ] / (r cos ϕ) . . . (A)
(∂v/∂ϕ) / r . . . (B)
because dy = r dϕ . This gradient is, however, not the derivative we want: compare (B) with (A). Normally, this error is minor unless you go to high latitudes, but, as I demonstrated in my previous message, a small error in horizontal divergence translates to large error in w . . . I don't know whether this error would be cured by smoothing . . .
The GCM of course uses a discrete version of (A), which isn't hard to program if you know how to do it . . .
Mercator coordinate horizontal grid
Oops! I'm not familiar with that coordinate system.
Perhaps the best way may be to ask the creators of SODA.
Ryo