HenryDane / climlab

Python package for process-oriented climate modeling
MIT License
1 stars 0 forks source link

Cloud Stuff #13

Open HenryDane opened 1 year ago

HenryDane commented 1 year ago

Try reading https://gmd.copernicus.org/articles/14/2801/2021/gmd-14-2801-2021.pdf

and then figure out outline for impl.

Also look at setup of model (1D) to use as base. And figure out plots to use to test.

Try just using python w/o Process objects to get test stuff working.

HenryDane commented 1 year ago

Also check out PyRADS and correlated-K?

HenryDane commented 1 year ago

Really funny bit:

state = climlab.column_state(num_lev=10)
state['q'] = climlab.radiation.water_vapor.ManabeWaterVapor(state=state).q
model = climlab.TimeDependentProcess(state=state)
model.add_subprocess('RRTMG', climlab.radiation.RRTMG(state=state))
model.add_subprocess('EC', climlab.convection.EmanuelConvection(state=state))
# the fact that DailyInsolation and AnnualMeanInsolation will not work here is wierd and should be fixed
model.add_subprocess('Sun', climlab.radiation.insolation.FixedInsolation(state=state, 
                                                                         domains=state.Ts.domain))

model.compute_diagnostics()
plt.plot(model.relative_humidity, model.lev)
plt.yscale('log'); plt.gca().invert_yaxis(); plt.xlabel('RH'); plt.ylabel('P'); plt.show()

model.integrate_years(1)

plt.plot(model.relative_humidity, model.lev)
plt.yscale('log'); plt.gca().invert_yaxis(); plt.xlabel('RH'); plt.ylabel('P'); plt.show()

its just that easy????

HenryDane commented 1 year ago

When reading the simcloud paper, I saw this snippet:

However, it is hard for a global model to capture the exact position of the inversion layer due to the limitation of vertical resolution (Kawai et al., 2019). Care thus needs to be taken to diagnose the marine stratocumulus clouds. First we find the most stable layer below 750 hPa, which is determined by the most negative dθ/dp (Slingo, 1987). Then within the most stable layer, if the lapse rate and vertical velocity satisfy dθ/dp < −0.08 K hPa−1 and ω > 0 Pa s−1, respectively, then we diagnose stratocu mulus clouds at that location. Note that the dθ/dp threshold is tuneable in our scheme, and it is −0.125 K hPa−1, as in Collins et al. (2004).

This is a problem -- calculating zinv is going to be hard because we do not have vertical velocity!

HenryDane commented 1 year ago

Convection schema they use is Betts-Miller from Frierson (2007).

HenryDane commented 1 year ago

Does changing CO2 change clouds?

Why does this crash when 2D?

Make process name: LargeScaleCloudParam

HenryDane commented 1 year ago

Need to figure out some way of getting access to relative_humidity from inside the LargeScaleCloud process.

HenryDane commented 1 year ago

I'm starting to think that the input system just does not work. Using 889bbd7, try the following code:

state = climlab.column_state(num_lev=15, num_lat=15)
state['q'] = climlab.radiation.water_vapor.ManabeWaterVapor(state=state).q
model = climlab.TimeDependentProcess(state=state, timestep=climlab.utils.constants.seconds_per_day)
model.add_subprocess('cloud', climlab.convection.LargeScaleCloud(state=state))
model.add_subprocess('RRTMG', climlab.radiation.RRTMG(state=state))
model.add_subprocess('EC', climlab.convection.EmanuelConvection(state=state))
model.add_subprocess('Sun', climlab.radiation.insolation.FixedInsolation(state=state, 
                                                                         domains=state.Ts.domain))

model.compute_diagnostics()

print(model.relative_humidity)

Notice how the two relative_humidity variables are different. I'm not sure if this is intended or not.

HenryDane commented 1 year ago

I can not get the inputs system to work correctly -- I may be misunderstanding something but I can not get LargeScaleCloud to read relative_humidity from EmanuelConvection and I can not get any RRTMG process to read clwp (or any LSC diagnostics) from LargeScaleCloud whatsoever. I'm utterly at a loss and I think I should open an issue and ask for help.