ClimaLand.jl icon indicating copy to clipboard operation
ClimaLand.jl copied to clipboard

Reduce allocations in divf2c

Open kmdeck opened this issue 7 months ago • 0 comments

In our tendency functions and Jacobians, we have

top_bc = p.top_bc # scalar field
bottom_bc = p.bottom_bc # scalar field
divf2c =  Operators.DivergenceF2C(
            top = Operators.SetValue(Geometry.WVector.(top_bc)),
            bottom = Operators.SetValue(Geometry.WVector.(bottom_bc)),)

This is allocationg. We need to either make p.top_bc a field of WVectors, or else cache two fields of WVectors. This appears now in the soil implicit tendency (2x), soil jacobian (2x), and soil CO2 tendency (1x). so it may be worth doing something about.

kmdeck avatar Jul 02 '24 19:07 kmdeck