3 < rx1 (Haney) < 7
0 < rx0 (Beckman and Haidvogel) < 0.4
come from.
in Robert Miller's "Numerical modeling of Ocean Circulation" 2007 Cambridge University Press, one can read regarding the pressure gradient error in sigma coordinates (page 136 after some analysis) that (please use LaTeX to read below expression):
We therefore obtain the expected behavior of the error decreasing as $\delta \sigma$ decreases as long as $\left| \frac {\sigma_j D_x} {D} \right| \Delta x \leq \Delta \sigma $ . This condition is often referred to as hydrostatic consistency
Also in page 141 after discussing Haney's and Beckman and Haidvogel's work, Miller states specifically about Beckman and Haidvogel's r factor:
My point is that pressure gradient errors depend also on the vertical resolution. I would like to test a new vertical discretization for hydrostatic consistency before I interpolate a year worth of daily boundary conditions only to find I have a fictitious pressure gradient spicing up my dynamics.If we recast (hydrostatic consistency expression) as $ r \leq 2 \Delta \sigma / \sigma_j$ we can see that this choice will result in violation of hydrostatic consistency unless r is chosen << 0.2 or the resolution in $\sigma$ is very coarse
In conclusion I have a couple of questions:
1) Why is only smoothing of the bathymetry (to reduce D_x) mentioned (in the forum or wiki roms) as a solution to avoid this problem when the vertical resolution is also a factor and the same smoothed bathymetry may work for one vertical discretization and fail for another one? ... Am I missing something?
2) I wrote a few lines of matlab code to check for hydrostatic consistency given a roms_grd.nc but I am not sure I am understanding hydrostatic consistency criterion correctly, it seems the way I calculated it might be a little to restrictive or perhaps I should be using Cs_w: can someone take a look and comment? Ideally if this ends up being a useful check then others can benefit from this code:
Code: Select all
function count2=check_hydro_consistency(grd)
% count=check_hydro_consistency(grd)
% Uses roms_get_grid.m
% grd=roms_get_grid(roms_grd.nc);
% $Id: roms_get_grid.m 393 2010-07-20 15:11:52Z wilkin $
h=grd.h;
dx=1./grd.pm;
dy=1./grd.pn;
Cs_r=grd.Cs_r;
dsigma=diff(grd.z_r,1);
% I use 1 in diff command because in my case depth is the first dimension
% in the z_r array, if depth is the third dimension in your array change 1
% for 3; Notice this also would affect dsigma(:,k,kk) below
[dhdx dhdy]=gradient(h,dx(:,1),dy(:,1)); %this is D_x and D_y
%in my case I only need a column because spacing in Xi and Eta directions
%depends only on latitude [i.e. Eta direction - note the dimensions for my
%2D arrays are (dim(Eta),dim(Xi)) ]
% check for hydrostatic consistency from Miller 2007:
% I think that this would be
% max(abs(Cs_r*dhdx(k,kk)/h(k,kk))*dx(k,kk)) <= min(dsigma(:,k,kk))
% so if
% max(abs(Cs_r*dhdx(k,kk)/h(k,kk))*dx(k,kk)) > min(dsigma(:,k,kk))
% the test fails
count=0;
count2=zeros(size(h));
disp('Starting checkout -----------------')
for k=1:size(h,1)
for kk=1:size(h,2)
a= max(abs(Cs_r*dhdx(k,kk)/h(k,kk))*dx(k,kk));
b= min(dsigma(:,k,kk));
c= max(abs(Cs_r*dhdy(k,kk)/h(k,kk))*dy(k,kk));
%test for failure in Xi direction
if a > b
count=count+1;
count2(k,kk)=1;
end
%test for failure in Eta direction
if c > b
count=count+1;
count2(k,kk)=1;
end
end
end
disp(['Consistency not met ', num2str(count),' times'])
disp('Finished checkout -----------------')
figure
pcolor(count2), shading flat
colorbar
title('One values are where consistency is not met','Fontsize',14)
end