CliMA / Cloudy.jl

:cloud_with_rain: Multi-moment cloud microphysics toy model
Apache License 2.0
15 stars 3 forks source link

Switch to Clima-compatible data structures #152

Open edejong-caltech opened 2 months ago

edejong-caltech commented 2 months ago

It seems like we need to take a several steps to make Cloudy compatible with ClimaAtmos...

Next steps will include:

charleskawczynski commented 2 months ago

Some notes from todays discussion:

Compatibility todos

Top items

function foo(a)
    b = zeros(size(a))
    for i = 1:length(a)
        b[i]+=rand()
    end
    return b
end

# non-allocating, but still mutating
function foo!(a, b)
    for i = 1:length(a)
        b[i]+=rand()
    end
    return b
end

# stack-allocated, much better
foo(a) = map(a_i->rand(), a)

Additional + details

edejong-caltech commented 2 months ago

Re: making Coalescence.jl GPU compatible...

  1. update_coal_ints should return an SVector

    • Perhaps we don't need to store Q, R, S
    • Remove update_moments!, maybe pass the current moments in instead
    • We should store finite_2d_integrals as a local map, rather than updating coal_data
    • As a first pass, try (Q, R, S) = get_coalescence_integral_qrs...
    • Expand out the arguments so we don't have coal_data, and keep local and global variables separate
  2. Get rid of intialize_coalescence_data