MOM6
MOM6 copied to clipboard
Generalize tracer_vertdiff and triDiagTs
tridiagTS
is a slightly more optimized version of tracer_vertdiff
(used for passive tracers)under the assumption that temperature and salinity have the same diapycnal diffusivity. This however leads to two similar pieces of code that must be maintained. Additionally, it has been suggested that the ea
and eb
input fields to tracer_vertdiff
be replaced with Kd. For ALE cases, this change is simple since ea(k+1) = eb(k)
, however, this does not work for layered-configurations where in general ea(k+1) != eb(k)
(due to diapycnal mass transport).
For full generality, I suggest the following:
- Deprecate
triDiagTS
in favor oftracer_vertdiff
, trading efficiency for generality - Make
ea
,eb
, andKd
optional arguments totracer_vertdiff
and add two 3D arraysea_loc
,eb_loc
- Perform the following logical tests at the top of tracer_vertdiff
- if ea and eb are both present: copy them to ea_loc and eb_loc
- if
Kd
is present: use it to calculateea_loc
andeb_loc
- if none are present or
ea, eb, and Kd
are all provided, throw a fatal error
Any other suggestions or alternatives?
Thanks for these thoughts, @ashao.
I don't like the idea of adding additional 3-d arrays and copying into them, because that gets expensive. My preferred solution would be to exploit the fact that in ALE mode, ea(i,j,k) = 2*dt*Kd(i,j,K)/(h(i,j,k-1)+h(i,j,k))
is already essentially the second-order accurate time-integrated piston velocity that would be derived from Kd
. In other words, once you know Kd
, dt
, and h
, we can provide an interface that converts these three fields to ea
. eb
can be made into an optional argument to tracer_vertdiff
when in ALE mode, for which eb(i,j,k)=ea(i,j,k-1)
, with the only loss being that the tracers would not then be added with any net mass flux from below.
Note that ea(i,j,1)
incorporates net mass fluxes through the free surface, and that we do want the tracer fluxes to be consistent with net mass gain or loss through the free surface.