# Re: [ferret_users] meridional overturning streamfunction

```Hi David,

| I calculated the meridional overturning streamfunction from the
| meridional velocity field of an ipcc4 model using the simple syntax as:
|
| vo[x=@din,z=@iin] ! vo is the variable for the meridional velocity

I think of at least three parameters to consider: Vertical coordinates,
horizontal grid configuration, sea surface, horizontal boundary
condition, and land values.

If the model uses z-coordinates, C-grid, a rigid lid, and no slip
boundaries with land values suitably masked, then your
formula "vo[x=@din,z=@iin]" should give you a correct streamfunction,
I think.  (One thing I'm concerned about is at which depths the @IIN
is defined.  I forgot how Ferret defines it.  A correct streamfunction
should be defined at vertical levels between neighboring v points.)

Then, if some of the parameters I list above are different,
"vo[x=@din,z=@iin]" will result in some error.  For example, if the
model uses the B-grid, you have to average v in the x-direction
to get the value of v defined at the midpoint between the two
neighboring v points.  If the model uses a free surface, the sea
surface elevation should be included in the vertical integration
(that is integration should start from z = SSH, instead of z = 0).
I'm not sure how volume fluxes are (or should be) defined when a
"half-slip" condition is used for a C-grid model.  And so on and
so forth.

I think the very basic principle is, derive your streamfunction
from the continuity equation.  If you know the finite-difference
form of the continuity equation used in the model, you can derive
a discrete version of streamfunction, which does not have any
"leakage" of water.

| Another related question: I also want to calculate the meridional
| overturning streamfunction for the Pacific Ocean. I have a basin
| mask file to mask out all the other basins. But I'm very confused by
| how to handle the Indonesian Throughflow (of a nontrivial transport)
| when computing the meridional overturning streamfunction.

It depends on what you want to look at, but I think an integration
from the bottom, instead of the sea surface, would give you a
"correct" streamfunction.  A streamfunction can be defined only
when the zonally integrated (v,w) is non-divergent. And it is
non-divergent except in the depth and latitudinal range of the
Throughflow.  That means that integration of v from the bottom
at each latitude gives you a correct and continuous streamfunction
except in the Throughflow opening because the integration avoids
the "bad" region until it reaches it.

Ryo

```