Calculating salinity budget

26 views
Skip to first unread message

Jay

unread,
Jul 8, 2025, 4:48:18 AMJul 8
to GETM-users
Dear GETM users, 

We have output data from a two-dimensional cross-sectional slice model under the assumptions of a rigid-lid condition, sinusoidal tidal velocity, and a constant longitudinal salinity gradient. We are trying to calculate each term of the salinity budget equation:

1.png

Current Approach: The output data is in sigma coordinates, and we have obtained the z-coordinates of the grid points based on the total water depth. Using MATLAB, we wrote functions to compute partial derivatives with respect to y and z. For the y-derivative between adjacent grid columns, we first interpolate the data to the same vertical grid coordinates before taking the difference and dividing by “dy” to compute the horizontal gradient. For the z-derivative, we directly use adjacent row data. Both velocity and salinity are calculated at the same grid coordinates (cell centers), and these gradient functions are used to compute each term in the equation.

Current Issue: We encountered an issue where the time derivative term does not match the negative sum of the other terms. The discrepancy becomes larger when the longitudinal velocity is smaller. The attached figure shows a comparison between the time derivative term at slack tide and the negative sum of the other terms.

2.png


Request for Assistance: We would like to ask for your help in understanding how the model source code computes gradients in the y and z directions—whether it first performs a coordinate transformation before calculating gradients or computes them directly in the curvilinear grid and then transforms them? Could this be the reason for our current errors? How should we adjust our approach? Additionally, are there any other potential mistakes in our calculation method that might be causing this issue?

Thank you very much for your assistance!

Best regards,
Jian

Hans Burchard

unread,
Jul 16, 2025, 1:27:23 AMJul 16
to getm-...@googlegroups.com, Jay, Hans Burchard
Dear Jian,

thanks a lot for your interesting question. You are trying to tackle a
very difficult problem. I guess that the reason for your descrepencies
is that you numerical scheme to calculate the terms differs from the
numerical scheme used inside the code. This would be specifically
evident with the advection terms which are generally calculated by means
of non-linear TVD schemes while your reconstruction probably is direct
in the sense that dz(wS) is approximated by ([wS]_k+1 - [wS]_k)/dz with
some spatial averaging of the salinity. Another source of error is of
course the transformation to z-coordinates that you use, instead of
calculating the terms in the sigma-type coordinates. The horizontal
diffusion terms could alos be a source of error. GETM calculates them
along the coordinates while you probably do it in horizontal direction,
after interpolation to z-coordinates.

As a first step, I would try to minimise the horizontal diffusivities.

Then try to calculate all terms in sigma-coordinates and instead of
z-coordinates.

Then GETM offers the possibility to output the interfacial values of
salinity at the cell interfaces as used in the advection schemes. Knut
will inform you about that possibility. You should also try to minimise
the time step in order to ahve small difference between temporally
implicit and explicit schemes.

Anyway, altogether, I think that it will be very challenging to get the
residual error down to machine or output accuracy. Given that your
method leave a lot of room for improvement, the error doesn't seem to be
that surprisingly big.

Hope this helps.

Best regards, Hans.




Am 2025-07-08 10:48, schrieb Jay:
> Dear GETM users,
>
> We have output data from a two-dimensional cross-sectional slice model
> under the assumptions of a rigid-lid condition, sinusoidal tidal
> velocity, and a constant longitudinal salinity gradient. We are trying
> to calculate each term of the salinity budget equation:
>
> Current Approach: The output data is in sigma coordinates, and we have
> obtained the z-coordinates of the grid points based on the total water
> depth. Using MATLAB, we wrote functions to compute partial derivatives
> with respect to y and z. For the y-derivative between adjacent grid
> columns, we first interpolate the data to the same vertical grid
> coordinates before taking the difference and dividing by “dy” to
> compute the horizontal gradient. For the z-derivative, we directly use
> adjacent row data. Both velocity and salinity are calculated at the
> same grid coordinates (cell centers), and these gradient functions are
> used to compute each term in the equation.
>
> Current Issue: We encountered an issue where the time derivative term
> does not match the negative sum of the other terms. The discrepancy
> becomes larger when the longitudinal velocity is smaller. The attached
> figure shows a comparison between the time derivative term at slack
> tide and the negative sum of the other terms.
>
> Request for Assistance: We would like to ask for your help in
> understanding how the model source code computes gradients in the y
> and z directions—whether it first performs a coordinate
> transformation before calculating gradients or computes them directly
> in the curvilinear grid and then transforms them? Could this be the
> reason for our current errors? How should we adjust our approach?
> Additionally, are there any other potential mistakes in our
> calculation method that might be causing this issue?
>
> Thank you very much for your assistance!
>
> Best regards,
> Jian
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "GETM-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to getm-users+...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/getm-users/7a28e23c-a708-44dc-b99a-0f23aef50169n%40googlegroups.com
> [1].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/getm-users/7a28e23c-a708-44dc-b99a-0f23aef50169n%40googlegroups.com?utm_medium=email&utm_source=footer

--
Hans Burchard, Prof. Dr.

fon: +49-381-5197-140
fax: +49-381-5197-114
e-mail: hans.b...@io-warnemuende.de
website: https://www.io-warnemuende.de/hans-burchard-en.html

Leibniz Institute for Baltic Sea Research Warnemünde
Physical Oceanography and Instrumentation
Seestraße 15
D-18119 Rostock
Germany
Reply all
Reply to author
Forward
0 new messages