Exemplo n.º 1
0
Ndays         = 5.  # Total length of run (days)

kwargs={}
kwargs['lat']            = ['1.','2.']
kwargs['solin']            = ['300.','310.']
kwargs['dt']              = 60.*10.
#kwargs['RestartFile']     = 'two_column.nc'
kwargs['OutputFile']      = 'two_column.nc'
kwargs['OutputFreq']      = 60*10.
#kwargs['MonitorFields']   = ['U','T','q']
#kwargs['MonitorFreq']     = 60 *60.*4.

# Set up federation
dyn  = climt.dynamics(scheme='two_column')
tur  = climt.turbulence()
rad  = climt.radiation(scheme='cam3')
con  = climt.convection(scheme='hard')
oce  = climt.ocean()
fed  = climt.federation(dyn,tur,rad,con,oce, **kwargs)

# Run
fed.step(Ndays*86400.)

try:
    from matplotlib.pylab import *
    show()
except:
    pass

Exemplo n.º 2
0
Ndays = 5.0  # Total length of run (days)

kwargs = {}
kwargs["lat"] = ["1.", "2."]
kwargs["solin"] = ["300.", "310."]
kwargs["dt"] = 60.0 * 10.0
# kwargs['RestartFile']     = 'two_column.nc'
kwargs["OutputFile"] = "two_column.nc"
kwargs["OutputFreq"] = 60 * 10.0
# kwargs['MonitorFields']   = ['U','T','q']
# kwargs['MonitorFreq']     = 60 *60.*4.

# Set up federation
dyn = climt.dynamics(scheme="two_column")
tur = climt.turbulence()
rad = climt.radiation(scheme="cam3")
con = climt.convection(scheme="hard")
oce = climt.ocean()
fed = climt.federation(dyn, tur, rad, con, oce, **kwargs)

# Run
fed.step(Ndays * 86400.0)

try:
    from matplotlib.pylab import *

    show()
except:
    pass
Exemplo n.º 3
0
## Automatically adapted for numpy.oldnumeric Feb 01, 2008 by -c

#!/usr/bin/env python

import climt, numpy.oldnumeric as Numeric

# instantiate convection module
x = climt.convection(scheme='emanuel')

# initial condition taken from cold pool, year 80 of stp run Tc=14.05.nc
levs = 30
ps = 1020.  # surface pressure
p = (Numeric.arange(levs, typecode='d') + 0.5) * ps / levs
T = Numeric.zeros(levs, typecode='d')
q = Numeric.zeros(levs, typecode='d')

T[0], q[0] = 229.48622, 0.00974
T[1], q[1] = 208.02373, 0.00973
T[2], q[2] = 198.75464, 0.00973
T[3], q[3] = 201.19379, 0.01010
T[4], q[4] = 211.52014, 0.02950
T[5], q[5] = 221.65689, 0.08010
T[6], q[6] = 230.88527, 0.17872
T[7], q[7] = 238.23030, 0.38702
T[8], q[8] = 244.83342, 0.55836
T[9], q[9] = 250.61952, 0.71973
T[10], q[10] = 255.49783, 0.94264
T[11], q[11] = 259.61646, 1.23721
T[12], q[12] = 263.15134, 1.62335
T[13], q[13] = 266.24539, 2.10185
T[14], q[14] = 269.05978, 2.66333
Exemplo n.º 4
0
## Automatically adapted for numpy.oldnumeric Feb 01, 2008 by -c

import climt, numpy.oldnumeric as Numeric

# instantiate radiation module
r = climt.convection(scheme='ccm3')

# initialise T,q to moist adiabat with 70% RH
ps = 1020.  # surface pressure
q0 = 15.  # surface moisture
T0 = 300.  # surface temp
the0 = climt.thetae(T0, ps, q0)
p = (Numeric.arange(r.levs, typecode='d') + 0.5) * ps / r.levs
T = Numeric.zeros(r.levs, typecode='d')
q = Numeric.zeros(r.levs, typecode='d')
for k in range(r.levs):
    T[k] = climt.tmoistadiab(the0, p[k])
    if (T[k] < 273.15 - 80.): T[k] = 273.15 - 80.
    q[k] = climt.qsflatau(T[k], p[k], 1) * 0.7
    if (p[k] < 100.): q[k] = 1.e-9

# compute radiative fluxes and heating rates
r(p, ps, T, q)

# output
td = r.tdot * 86400.
qd = r.qdot * 86400.
print "lev    p     T       q        tdot   qdot"
for i in range(r.levs):
    print "%3i %6.1f %6.1f %6.3f %10.2f %6.2f" % (i, p[i], T[i], q[i], td[i],
                                                  qd[i])
Exemplo n.º 5
0
## Automatically adapted for numpy.oldnumeric Feb 01, 2008 by -c

#!/usr/bin/env python

import climt, numpy.oldnumeric as Numeric

# instantiate convection module
x = climt.convection(scheme="emanuel")

# initial condition taken from cold pool, year 80 of stp run Tc=14.05.nc
levs = 30
ps = 1020.0  # surface pressure
p = (Numeric.arange(levs, typecode="d") + 0.5) * ps / levs
T = Numeric.zeros(levs, typecode="d")
q = Numeric.zeros(levs, typecode="d")

T[0], q[0] = 229.48622, 0.00974
T[1], q[1] = 208.02373, 0.00973
T[2], q[2] = 198.75464, 0.00973
T[3], q[3] = 201.19379, 0.01010
T[4], q[4] = 211.52014, 0.02950
T[5], q[5] = 221.65689, 0.08010
T[6], q[6] = 230.88527, 0.17872
T[7], q[7] = 238.23030, 0.38702
T[8], q[8] = 244.83342, 0.55836
T[9], q[9] = 250.61952, 0.71973
T[10], q[10] = 255.49783, 0.94264
T[11], q[11] = 259.61646, 1.23721
T[12], q[12] = 263.15134, 1.62335
T[13], q[13] = 266.24539, 2.10185
T[14], q[14] = 269.05978, 2.66333
Exemplo n.º 6
0
# 1) by specifying a restart file, whose format is identical to
#    that of an output file. If the file contains a time series,
#    the model will initialize from the last time step in the file.
#    If RestartFile and OutputFile are the same, then output will be
#    appended to the restart file (ie. a continuation run).
#kwargs['RestartFile']     = 'radconv.nc'
# 2) If RestartFile is not given, then initial values for prognostic
#    fields must be explicitly given, e.g.
nlev = climt.get_nlev()
kwargs['q'] = zeros(nlev) + 1.e-9
kwargs['T'] = zeros(nlev) + 250. #(kwargs['solin']/2./climt.parameters.Parameters()['stebol'])**0.25
kwargs['Ts'] = 250.

# -- Instantiate components and federation
rad = climt.radiation(UpdateFreq=kwargs['dt']*50)
con = climt.convection(scheme='emanuel')
dif = climt.turbulence()
ice = climt.seaice()
ins = climt.insolation(lat=85.,avg='daily')

kwargs['Hslab']=50.
kwargs['Pr']=100.
#kwargs['do_srf_lat_flx']=0
#kwargs['do_srf_sen_flx']=0

T0,q0 = climt.thermodyn.moistadiabat(rad['p'],273.,273.-90,.1)
kwargs['T'],kwargs['q'] = T0,q0

fed = climt.federation(dif, rad, ice, con, ins, **kwargs)

# Main timestepping loop
Exemplo n.º 7
0
# Initial fields
kwargs['T'] = zeros((nlev,nlat)) + 100.
kwargs['q'] = zeros((nlev,nlat)) + 1.e-9

# Run length (days)
Ndays  = 3000  
########################## End user adjustble

kwargs['lat']  = (arange(nlat)+0.5)*(MaxLat-MinLat)/nlat + MinLat
kwargs['lev']  = (arange(nlev)+0.5)*(MaxLev-MinLev)/nlev + MinLev

# Set up federation
tur = climt.turbulence()
dyn = climt.dynamics()
ocn = climt.ocean()
con = climt.convection()
fed  = climt.federation(dyn, tur, ocn, con, **kwargs)

# Run
Nsteps = int(Ndays*86400./kwargs['dt'])
ins = climt.insolation(lat=kwargs['lat'], avg='annual')
CoolingRate = 0./86400.

for l in range(Nsteps):
    fed.State['SrfRadFlx'] = ins.State['solin']*0.5 - fed['stebol']*fed.State['Ts']**4
    fed.step()
    fed.State['T'][4:nlev,:,:] -= CoolingRate*kwargs['dt']*ones((nlev-4,nlat,1))

try:
    from matplotlib.pylab import *
    show()