Radiative Equilibrium with Simple Physics


This demo steps the grey radiation code forward in time to get a radiative equilibrium profile. In addition, the Simple Physics module is available to add a boundary layer and large scale condensation.

This notebook shows how to configure Simple Physics to only provide those tendency terms that are needed for the simulation. In the first example below, large scale condensation is switched off, and in the second it is switched on. This makes a difference in the final profiles obtained: with large scale condensation, the boundary layer temperatures are warmer, and the vapour profile is significantly changed.


In [1]:
%matplotlib notebook
import numpy as np
import climt

#Initialise convection
kwargs = {}
kwargs['MonitorFields'] = ['T','U','q']


kwargs['dt'] = 1200.
conv = climt.convection(scheme='emanuelnew', **kwargs)

U = 0.*np.ones((1,1,conv.nlev))

T = ((1+np.arange(conv.nlev,dtype=np.double))[::-1]/conv.nlev)*290.
q = climt.thermodyn.qs(T, conv['p']/100.)
conv['T'] = T
conv['U'] = U
conv['q'] = q


Using netCDF4 interface for IO
Finished initialising emanuel convection scheme
T
[[[ 283.15  283.15  283.15  283.15  283.15  283.15  283.15  283.15  283.15
    283.15  283.15  283.15  283.15  283.15  283.15  283.15  283.15  283.15
    283.15  283.15  283.15  283.15  283.15  283.15  283.15  283.15  283.15
    283.15]]]
U
[[[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.
    0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]]]
q
[[[  1.00000000e-05   1.00000000e-05   1.00000000e-05   1.00000000e-05
     1.00000000e-05   1.00000000e-05   1.00000000e-05   1.00000000e-05
     1.00000000e-05   1.00000000e-05   1.00000000e-05   1.00000000e-05
     1.00000000e-05   1.00000000e-05   1.00000000e-05   1.00000000e-05
     1.00000000e-05   1.00000000e-05   1.00000000e-05   1.00000000e-05
     1.00000000e-05   1.00000000e-05   1.00000000e-05   1.00000000e-05
     1.00000000e-05   1.00000000e-05   1.00000000e-05   1.00000000e-05]]]

In [2]:
for i in range(10000):
    conv.step()


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-2-b908c5f96286> in <module>()
      1 for i in range(10000):
----> 2     conv.step()

/home/joymm/github/joyClimt/lib/python2.7/site-packages/climt/component.pyc in step(self, RunLength, Inc)
    214                 freq = self.Monitor.MonitorFreq
    215                 if int(time/freq) != int((time-dt)/freq):
--> 216                     self.Monitor.refresh(self)
    217 
    218     def __call__(self,**kwargs):

/home/joymm/github/joyClimt/lib/python2.7/site-packages/climt/plot.pyc in refresh(self, Component)
    174 
    175         # Redraw figure
--> 176         self.manager.canvas.draw()
    177 
    178 class Panel:

/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_webagg_core.pyc in draw(self)
    180             backend_agg.RendererAgg.lock.release()
    181             # Swap the frames
--> 182             self.manager.refresh_all()
    183 
    184     def draw_idle(self):

/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_webagg_core.pyc in refresh_all(self)
    471     def refresh_all(self):
    472         if self.web_sockets:
--> 473             diff = self.canvas.get_diff_image()
    474             for s in self.web_sockets:
    475                 s.send_binary(diff)

/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_webagg_core.pyc in get_diff_image(self)
    237             _png.write_png(
    238                 output.view(dtype=np.uint8).reshape(output.shape + (4,)),
--> 239                 self._png_buffer)
    240 
    241             # Swap the renderer frames

KeyboardInterrupt: 

In [6]:
climt.thermodyn.es(273.16)


Out[6]:
array(6.1144380358594)