Moist GCM with a convective parameterisation


Here, CliMT is configured as a simple moist GCM with a grey radiation scheme and the simple physics package (Reed and Jablonowski (2012)) to provide surface fluxes, a boundary layer, and the Emanuel convection scheme.

The GCM generates a weak circulation, but the vertical profiles of moisture and temperature adjust quickly due to the presence of convection. The weak circulation is a consequence of no water vapour sensitivity in the radiation scheme.


In [1]:
%matplotlib notebook

from climt.dynamics import dynamics
from climt.simple_physics_custom import simple_physics_custom
from climt.federation import federation
import climt

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_style('whitegrid',rc={'grid.linestyle':'dotted', 'grid.color':'0.0'})
# Dynamical core parameters

global_time_step = 1200.

kwargs = {}
kwargs['dt'] = global_time_step
kwargs['nlon'] = 128
kwargs['nlat'] = 62

#Init the dynamics Component
dycore = dynamics(scheme='gfs', **kwargs)

#Get the pressure and lat/lon values
pressure = dycore['p']
ps = dycore['ps']

full_latitudes = dycore.Extension.latitudes
full_longitudes = dycore.Extension.longitudes

dycore_grid = dycore.Grid


Using netCDF4 interface for IO
Lats, lons, levs, trunc, dims, tracers 62 128 28 40 861 1

In [2]:
#Setup simple physics

kwargs['grid'] = dycore_grid
kwargs['dt'] = global_time_step
kwargs['p'] = pressure
kwargs['pint'] = dycore['pint']
kwargs['use_ext_ts'] = True
#kwargs['lsc'] = False
#set surface temperatures
eq_pole_temp_gradient = 40.
max_temp = 300.

delta = eq_pole_temp_gradient/max_temp

Ts = max_temp*(1 - delta*np.sin(full_latitudes)**2)

kwargs['Ts'] = Ts

phys = simple_physics_custom(**kwargs)

#Initialise radiation
kwargs = {}
#kwargs['UpdateFreq'] = 3600.
kwargs['grid'] = dycore_grid

rad = climt.radiation(scheme='newgreygas', **kwargs)

#Initialise convection
kwargs = {}
kwargs['grid'] = dycore_grid
kwargs['dt'] = global_time_step

conv = climt.convection(scheme='emanuelnew', **kwargs)


Finished initialising emanuel convection scheme

In [3]:
#Setup federation
kwargs = {}
kwargs['Ts'] = Ts
kwargs['MonitorFields'] = ['U','q','V','cape'] # Display zonal velocity during simulation
kwargs['MonitorFreq'] = 3600. #hourly update
kwargs['OutputFile'] = 'moistGcm_lowAlpha.nc'
kwargs['OutputFreq'] = 86400.*4
kwargs['grid'] = dycore_grid
kwargs['dt'] = global_time_step
kwargs['OutputFields'] = ['U','V','q','T','ps','precc']

fed = federation(dycore, rad, phys, conv, **kwargs)
#Run the code for 10 days. each time step is 1200 seconds = 1/3 hour
num_steps = 1000*24*12
for i in range(num_steps):
    #Integrate one time step
    fed.step()


gfs_dynamics  can integrate  ['U', 'V', 'T', 'q', 'ps']
All fields integrated by federation members:  ['U', 'V', 'T', 'q', 'ps']
All fields returned by federation members:  ['U', 'V', 'T', 'q', 'ps', 'p', 'pint']
 Wrote to file moistGcm_lowAlpha.nc, time=   0.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=   4.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=   8.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  12.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  16.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  20.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  24.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  28.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  32.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  36.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  40.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  44.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  48.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  52.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  56.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  60.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  64.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  68.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  72.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  76.00000 days
 Wrote to file moistGcm_lowAlpha.nc, time=  80.00000 days
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-3-7a6f7e27bbd1> in <module>()
     15 for i in range(num_steps):
     16     #Integrate one time step
---> 17     fed.step()

/home/joymm/github/joyClimt/lib/python2.7/site-packages/climt/component.pyc in step(self, RunLength, Inc)
    196 
    197             # Bring diagnostics and increments up to date
--> 198             self.compute()
    199 
    200             # Bring calendar up to date

/home/joymm/github/joyClimt/lib/python2.7/site-packages/climt/federation.pyc in compute(self, ForcedCompute)
    206         for component in self.components:
    207             # bring component's diagnostics and increments up to date
--> 208             component.compute(ForcedCompute=ForcedCompute)
    209             # accumulate increments
    210             for key in component.Inc:

/home/joymm/github/joyClimt/lib/python2.7/site-packages/climt/component.pyc in compute(self, ForcedCompute)
    116 
    117         # Call extension and build dictionary of outputs
--> 118         OutputValues = self.driver(*args)
    119         if len(self.FromExtension) == 1: Output = {self.FromExtension[0]: OutputValues}
    120         else:                            Output = dict( zip(self.FromExtension, OutputValues ) )

uel/_emanuel_convection.pyx in _emanuel_convection_new.driver (_emanuel_convection.c:4806)()

/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.pyc in asfortranarray(a, dtype)
    603 
    604     """
--> 605     return array(a, dtype, copy=False, order='F', ndmin=1)
    606 
    607 def require(a, dtype=None, requirements=None):

KeyboardInterrupt: 

In [ ]:
del(dycore)
del(fed)

In [ ]:
conv.State.Grid['lev']