atmtools / konrad

Implementation of a radiative-convective equilibrium model.
MIT License
19 stars 18 forks source link

Force cloud type to match rrtmg input #73

Closed SallyDa closed 5 years ago

lkluft commented 5 years ago

I also thought about that after my issue yesterday.

Could we simply set the RRTMG input in the radiation class depending on the cloud class that is used? pseudo-code:

if isinstance(cloud, DirectInputCloud):
    rrtmg_input = 'direct_input_cloud'
SallyDa commented 5 years ago

Yes, we could also do something like that. I figured that we (or at least I) will still be playing around with the cloud classes / making new ones etc and then it is maybe easier to just add the extra property each time I design a new cloud class rather than having to change things in the core...

SallyDa commented 5 years ago

Ah, we could do a combination of both! So the rrtmg input is set based on a property specified in each cloud class. What do you think?

lkluft commented 5 years ago

Ah, we could do a combination of both! So the rrtmg input is set based on a property specified in each cloud class. What do you think?

I like that approach! It should not be possible for the user (us) to use a cloud the wrong way. An attribute in the cloud class seems to be a perfect solution, as the RRTMG input should be constant for a given cloud class 👍

SallyDa commented 5 years ago

Okay, I'm just in the middle of implementing something else, but I'll do this as soon as I'm done :)

SallyDa commented 5 years ago

Update: I set the RRTMG input in the RRTMG class, not in the init, but when the first call is made to calculate radiative fluxes. This call requires a cloud to be passed (which was already the case anyway) and the update of properties still occurs before the climt RRTMGLongwave and RRTMGShortwave objects are initialised.