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
import climt from Numeric import * d=climt.turbulence(scheme='simple') V =arange(d.nlev,typecode='d')+1 T =d['T'] Ts=d['Ts']+1 q =V/10. d(Ts=Ts, V=V, q=q, do_srf_heat_flx=1, do_srf_mom_flx=1, nuv=.01, u0=10., Pr=1.) print '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++' print 'Testing simple turbulence module ...' print d['SrfLatFlx'] print ' ' print 'Success!' print '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
kwargs['dt'] = 60.*5. #kwargs['RestartFile'] = 'held_hou.nc' kwargs['OutputFile'] = 'held_hou.nc' kwargs['OutputFreq'] = 86400. * 5. kwargs['MonitorFields'] = ['psi','U','T','q'] kwargs['MonitorFreq'] = 60 *60.*4. kwargs['do_srf_lat_flx'] = 0 kwargs['do_srf_sen_flx'] = 0 # Grid kwargs['lat'] = (arange(nlat)+0.5)*(MaxLat-MinLat)/nlat + MinLat kwargs['lev'] = (arange(nlev)+0.5)*(MaxLev-MinLev)/nlev + MinLev kwargs['q'] = zeros((nlev,nlat,1)) + 1.e-9 kwargs['q'][nlev*4/5,:] =1. # Set up federation dyn = climt.dynamics(scheme='axisymmetric') tur = climt.turbulence() fed = climt.federation(dyn,tur, **kwargs) # Run fed.step(Ndays*86400.) try: from matplotlib.pylab import * show() except: pass
# 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'] = 'restart.nc' # 2) If RestartFile is not given, then initial values for prognostic # fields must be explicitly given, e.g. nlev = climt.get_nlev() stebol = climt.Parameters()['stebol'] kwargs['q'] = zeros(nlev) + 1.e-9 kwargs['T'] = zeros(nlev) + (kwargs['solin'] / 2. / stebol)**0.25 # -- Instantiate components and federation rad = climt.radiation(UpdateFreq=kwargs['dt'] * 50, scheme='cam3') con = climt.convection(scheme='emanuel') dif = climt.turbulence() oce = climt.ocean() fed = climt.federation(dif, rad, oce, con, **kwargs) # Main timestepping loop RunLength = 2000. # Total length of run (days) NSteps = int(RunLength * 86400. / fed['dt']) for i in range(NSteps): # With a line like the following, it is possible to manipulate # field values each time step (the example here resets humidity # to an almost dry value everywhere at each timestep) #fed.State['q']=zeros(rad.nlev)+1.e-9 # The following code adds a uniform 1 K/day cooling rate to # the internally-computed tendencies dT = array([[-1. / 86400. * kwargs['dt'] * 2. * ones(rad.nlev)] ]).transpose()
# 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 RunLength = 2000. # Total length of run (days)
import climt from Numeric import * d = climt.turbulence(scheme='simple') V = arange(d.nlev, typecode='d') + 1 T = d['T'] Ts = d['Ts'] + 1 q = V / 10. d(Ts=Ts, V=V, q=q, do_srf_heat_flx=1, do_srf_mom_flx=1, nuv=.01, u0=10., Pr=1.) print '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++' print 'Testing simple turbulence module ...' print d['SrfLatFlx'] print ' ' print 'Success!' print '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'