gotm-model / code

Source code for the General Ocean Turbulence Model
https://gotm.net
GNU General Public License v2.0
53 stars 44 forks source link

Fix two bugs in the Stokes drift module #10

Closed qingli411 closed 3 years ago

qingli411 commented 3 years ago

This PR fixes two bugs in the Stokes drift module that in some cases the Langmuir numbers may be invalid values:

  1. An invalid value of 0 could happen when the surface wind forcing is zero but the Stokes drift is not. This is now fixed by checking both the surface friction velocity u_taus and the surface magnitude of Stokes drift us_srf when computing the Langmuir numbers. A valid big number for Langmuir numbers is assigned when either u_taus or us_srf is very small (smaller than 1e-4).
  2. An invalid value of NaN (taking the square root of a negative number) could happen for the surface layer averaged Langmuir number when the surface layer Stokes drift magnitude is smaller than that near the base of the boundary layer (could happen when a swell component exists that is to the opposite direction of the wind and cancels the wind wave component near the surface). This is fixed by taking the absolute value of the difference before taking the square root.