earth-system-radiation / rte-rrtmgp

RTE+RRTMGP is a set of codes for computing radiative fluxes in planetary atmospheres.
BSD 3-Clause "New" or "Revised" License
74 stars 67 forks source link

Feature-numerics #222

Closed RobertPincus closed 1 year ago

RobertPincus commented 1 year ago

This is mostly a first implementation of single precision (finally addressing #156) following #39. The stand-alone tests are heavily revised - solutions to equivalent problems (e.g reversed vertical orientation) are tested with respect to numerical precision. Single precision fluxes differ from double precision in sample problems by as much as .13 W/m2.

RobertPincus commented 1 year ago

Note that @MennoVeerman's comment is not addressed

charleskawczynski commented 1 year ago

Hi @RobertPincus, this looks great! I'm curious what sort of solution tolerance you're achieving with single precision. We're testing RRTMGP.jl with Float32, but the errors are quite large at the moment. cc @sriharshakandala

RobertPincus commented 1 year ago

@charleskawczynski Feel free to review the PR :-).

In the test problems in our suite we see difference in single precision with respect to double precision of up to .13 W/m2. (See the steps labeled "Relax failure thresholds for single precision" in the updated CI workflow files.) @peterukk has a different formulation for the minimum value of k that reduces errors further. I may implement that and/or other alternatives now that automated testing of single precision is in place.