# CLimate Analysis using Digital Estimations (CLAuDE)
importnumpyasnp
importmatplotlib.pyplotasplt
importtime,sys
# define temporal parameters, including the length of time between calculation of fields and the length of a day on the planet (used for calculating Coriolis as well)
# how many degrees between latitude and longitude gridpoints
resolution=3
# define coordinate arrays
lat=np.arange(-90,91,resolution)
lon=np.arange(0,360,resolution)
nlat=len(lat)
nlon=len(lon)
lon_plot,lat_plot=np.meshgrid(lon,lat)
# initialise arrays for various physical fields
temperature_planet=np.zeros((nlat,nlon))+270
temperature_atmosp=np.zeros((nlat,nlon))+270
albedo=np.zeros((nlat,nlon))+0.5
heat_capacity_earth=np.zeros((nlat,nlon))+1E5
air_pressure=np.zeros((nlat,nlon))
u=np.zeros((nlat,nlon))
v=np.zeros((nlat,nlon))
air_density=np.zeros_like(air_pressure)+1.3
# if including an ocean, uncomment the below
# albedo[5:55,9:20] = 0.2
# albedo[23:50,45:70] = 0.2
# albedo[2:30,85:110] = 0.2
# heat_capacity_earth[5:55,9:20] = 1E6
# heat_capacity_earth[23:50,45:70] = 1E6
# heat_capacity_earth[2:30,85:110] = 1E6
# define physical constants
epsilon=0.75
heat_capacity_atmos=1E3
specific_gas=287
thermal_diffusivity_air=20E-6
thermal_diffusivity_roc=1.5E-6
insolation=1370
sigma=5.67E-8
# define planet size and various geometric constants
planet_radius=6.4E6
circumference=2*np.pi*planet_radius
circle=np.pi*planet_radius**2
sphere=4*np.pi*planet_radius**2
# define how far apart the gridpoints are: note that we use central difference derivatives, and so these distances are actually twice the distance between gridboxes
dy=circumference/nlat
dx=np.zeros(nlat)
coriolis=np.zeros(nlat)# also define the coriolis parameter here
angular_speed=2*np.pi/day
foriinrange(nlat):
dx[i]=dy*np.cos(lat[i]*np.pi/180)
coriolis[i]=day*np.cos(lat[i]*np.pi/180)
# define various useful differential functions:
# gradient of scalar field a in the local x direction at point i,j