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
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
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
# 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() fed.step(Inc={'T': dT}) printout(fed)
# -- 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) NSteps = int( RunLength*86400./fed['dt'] ) TdotDyn = 2./86400. 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']= q0[:,None,None] # Inject heating here fed.State['T'][14:23] += TdotDyn*fed['dt'] # Also put in a cloud; we could reset the moisture here, too #fed.State['cldf'][14:25] = 1. #fed.State['clwp'][14:25] = 30.
# 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() fed.step(Inc={'T':dT}) printout(fed)
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() except: