igfuw / UWLCM

University of Warsaw Lagrangian Cloud Model
GNU General Public License v3.0
6 stars 13 forks source link

add precipitation flux output for blk2m #155

Closed claresinger closed 1 year ago

claresinger commented 1 year ago

@pdziekan is there a reason that this diagnostic is commented out with a TODO? What needs to be done to make it work? Would love to have this output for a simulation I'm running. I can open a PR with changes mirroring the blk1m code if that sounds good to you. Thanks!

https://github.com/igfuw/UWLCM/blob/ba14a1fc657bde8af3bfe54d3804e3517bf06824/src/solvers/blk_2m/slvr_blk_2m_common.hpp#L42-L43

Looking to the blk1m code as an example it seems like it should be initialized: https://github.com/igfuw/UWLCM/blob/0fc77ec68053936e36eea4b49f11b3dd2cb1a827/src/solvers/blk_1m/update_rhs_blk_1m_common.hpp#L17-L19 And then some lines in the update_rhs needs to be modified to calculate it: https://github.com/igfuw/UWLCM/blob/0fc77ec68053936e36eea4b49f11b3dd2cb1a827/src/solvers/slvr_blk_1m.hpp#L43-L53

pdziekan commented 1 year ago

@claresinger the diagnostic is commented out, because precipitation_rate is currently not calculated with blk_2m microphysics. It would be great if you were willing to fix this. Like you said, the implementation will be very similar to blk_1m (so similar it might be better to create one common base class, but that can be left for later). In addition to the parts of code you mentioned, you will also need to define the precipitation_rate variable

https://github.com/igfuw/UWLCM/blob/0fc77ec68053936e36eea4b49f11b3dd2cb1a827/src/solvers/blk_1m/slvr_blk_1m_common.hpp#L22-L23

to reserve memory for it by increasing by 1 the third argument of alloc_tmp_sclr

https://github.com/igfuw/UWLCM/blob/0fc77ec68053936e36eea4b49f11b3dd2cb1a827/src/solvers/blk_1m/slvr_blk_1m_common.hpp#L173

and to make the precipitation_rate variable reference this memory:

https://github.com/igfuw/UWLCM/blob/0fc77ec68053936e36eea4b49f11b3dd2cb1a827/src/solvers/blk_1m/slvr_blk_1m_common.hpp#L191

claresinger commented 1 year ago

Thanks @pdziekan! I have started a branch here to do this. There's some problem going on right now because everything becomes NaN as soon as the spin-up ends. I think I know how to fix it, so as soon as it's not giving NaN I'll open a PR :)