Skip to content

Conversation

@mnlevy1981
Copy link
Contributor

CESM is running into some divide-by-zeros in the StokesMOST code -- this PR will add a seventh test to reg_tests/kpp that turns on StokesMOST and will also fix any float-point errors caught by that test.

Changed ifx -> ifort; also needed to change order of $(EXE) dependencies in
src/Makefile (maybe a make 4.1 vs make 3.81 difference?)
Now use -O0 -g -fpe0 to capture floating point exceptions. Also updated the
Makefile because the netCDF pkgconfig/netcdf-fortran.pc file changed format
Added external statements to cvmix_driver.F90 to avoid build issue with intel
compiler; also added a seventh test to reg_tests/kpp and modified cvmix_kpp.F90
to fix a segmentation fault in this new test.
Found one more possible divide-by-zero, and fixed it as well
The argument kSL needs to be an integer between 1 and nlev7; it was using kt in
previous commit, which is a bad choice because kt is computed in an earlier
test... so if Test 7 is the only one being run, kt won't be defined and if the
previous test has more columns than Test 7 than kt might be larger than nlev7

Using (nlev7+1)/2, which should always be between 1 and nlev7 using integer
division
Split surf_fric**3 / (surf_buoy(k+1) * (cvmix_one-Xi(k+1))) into storing
numerator and denominator separately, and intentionally compute surf_fric**3
outside the k loop but surf_buoy(k+1) * (cvmix_one-Xi(k+1)) needs to be inside
it
1. index of zw_iface should be (k+1) instead of (k)
cvmix_kpp_compute_OBL_depth_low()
2. there are some checks for OBL_depth (is it bigger than minOBLdepth? is it
smaller than maxOBLdepth?) that should be called regardless of value of
lStokesMOST, but they were only in the lStokesMOST = .false. branch of a
conditional

Also, I removed a "if BLdepth > 0" check in cvmix_kpp_compute_StokesXi()
because BLdepth should always be positive given the fixes above.
@mnlevy1981 mnlevy1981 marked this pull request as ready for review January 24, 2025 20:29
@mnlevy1981 mnlevy1981 merged commit 65ef5c7 into CVMix:master Jan 24, 2025
1 check passed
@mnlevy1981 mnlevy1981 deleted the test_StokesMOST_edgecases branch March 6, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant