Closed dennisYatunin closed 7 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
1dc23bb
) 93.04% compared to head (c8575c2
) 92.98%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
In order to enable automatic differentiation in
ClimaAtmos.jl
, we need to get rid of dispatch onFT
. For example, consider the definitionThis does not work when
ts
containsDual
numbers ande_pot
is a regularFloat32
orFloat64
, which occurs whents
depends on the prognostic state whilee_pot
is a constant. In general, it is hard to anticipate which of the values that come fromClimaAtmos.jl
will beDual
numbers, since the same value can be either prescribed or inferred from the prognostic state, depending on the model configuration. This is particularly significant for surface conditions, where the chain of computations can vary a lot between different surface parameterizations.In order to make this change easier to review, I'll split it up into several PRs. This PR removes all dispatch on
FT
fromrelations.jl
. In places whereFT
is necessary for type-stability (i.e., when we need to returnFT(0)
orFT(1)
from a conditional statement) or for obtaining machine epsilon (eps(FT)
), it is now inferred from the parameter set. As long as the parameter set does not contain anyDual
numbers, this ensures that "constant" values will always be represented asFloat32
s orFloat64
s.