gavin971 / cvmix

Automatically exported from code.google.com/p/cvmix
0 stars 0 forks source link

kOBL_depth > max number of vertical levels #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. running cvmix kip
2. bulk Ri == 0, Bf == 0
3. neutral stratification

What is the expected output? What do you see instead?
With nVertLevels=40, I see kOBL_depth=40.75 even though OBL_depth is less than 
ocean bottom depth.

Please use labels and text to provide additional information.

calling cvmix_kpp_compute_OBL_depth
return cvmix_kpp_compute_OBL_depth
OBL_depth, kOBL_depth   2378.23899909065        40.7500000000000     
OBL_depth   2378.23899909065  

Original issue reported on code.google.com by todd.rin...@mac.com on 20 Aug 2013 at 4:00

GoogleCodeExporter commented 9 years ago
Hi Todd,

I think this is the expected behavior, the fact that 40.75 > 40 is just an 
artifact of the bookkeeping method we employ. There are two integers we are 
interested in:

ktup = the kt (cell center) index such that zt(ktup-1) < OBL_depth <= zt(ktup)
kwup = the kw (cell interface) index such that zw(kwup-1) < OBL_depth <= 
zw(kwup), which is another way to say that the OBL_depth is in cell kwup

These are defined by

ktup = nint(kOBL_depth) - 1
kwup = floor(kOBL_depth)

So kOBL_depth = 40.75 means that ktup = 40 (the OBL is somewhere between the 
middle of cell 39 and the middle of cell 40, inclusive on the bottom) and kwup 
= 40 (the OBL_depth is somewhere in cell number 40).

I should add that one of the assumptions made in the computation is that the 
OBL depth can never be lower than the center of the bottom cell, even if the 
bulk Richardson number is less than the critical Richardson number everywhere.

Original comment by mike.lev...@gmail.com on 23 Aug 2013 at 5:45