heat_capacity_earth, albedo, insolation, lat, lon, heights, dz, t, dt, day, year, axial_tilt) temperature_atmos = top_level.smoothing_3D(temperature_atmos, smoothing_parameter_t) # time_taken = float(round(time.time() - before_radiation,3)) # print('Radiation: ',str(time_taken),'s') # update air pressure old_pressure = np.copy(air_pressure) air_pressure = air_density * specific_gas * temperature_atmos if velocity: before_velocity = time.time() u, v, w = top_level.velocity_calculation(u, v, air_pressure, old_pressure, air_density, coriolis, gravity, dx, dy, dt) u = top_level.smoothing_3D(u, smoothing_parameter_u) v = top_level.smoothing_3D(v, smoothing_parameter_v) w = top_level.smoothing_3D(w, smoothing_parameter_w, 0.3) u[(advection_boundary, -advection_boundary - 1), :, :] *= 0.5 v[(advection_boundary, -advection_boundary - 1), :, :] *= 0.5 w[(advection_boundary, -advection_boundary - 1), :, :] *= 0.5 u[:advection_boundary, :, :] = 0 v[:advection_boundary, :, :] = 0 w[:advection_boundary, :, :] = 0 u[-advection_boundary:, :, :] = 0 v[-advection_boundary:, :, :] = 0
print('Radiation: ',str(time_taken),'s') diffusion = top_level.laplacian_2d(temperature_world,dx,dy) diffusion[0,:] = np.mean(diffusion[1,:],axis=0) diffusion[-1,:] = np.mean(diffusion[-2,:],axis=0) temperature_world -= dt*1E-5*diffusion # update geopotential field geopotential = np.zeros_like(potential_temperature) for k in np.arange(1,nlevels): geopotential[:,:,k] = geopotential[:,:,k-1] - potential_temperature[:,:,k]*(sigma[k]-sigma[k-1]) if velocity: if verbose: before_velocity = time.time() u_add,v_add = top_level.velocity_calculation(u,v,w,pressure_levels,geopotential,potential_temperature,coriolis,gravity,dx,dy,dt,sponge_index) if verbose: time_taken = float(round(time.time() - before_velocity,3)) print('Velocity: ',str(time_taken),'s') if verbose: before_projection = time.time() grid_velocities = (x_dot_N,y_dot_N,x_dot_S,y_dot_S) u_add,v_add,x_dot_N,y_dot_N,x_dot_S,y_dot_S = top_level.polar_planes(u,v,u_add,v_add,potential_temperature,geopotential,grid_velocities,indices,grids,coords,coriolis_plane_N,coriolis_plane_S,grid_side_length,pressure_levels,lat,lon,dt,polar_grid_resolution,gravity,sponge_index) u += u_add v += v_add if smoothing: u = top_level.smoothing_3D(u,smoothing_parameter_u)
smoothing_parameter_t) time_taken = float(round(time.time() - before_radiation, 3)) print('Radiation: ', str(time_taken), 's') # update geopotential field for k in np.arange(1, nlevels): geopotential[:, :, k] = geopotential[:, :, k - 1] - potential_temperature[:, :, k] * ( sigma[k] - sigma[k - 1]) if velocity: before_velocity = time.time() u, v = top_level.velocity_calculation(u, v, w, pressure_levels, geopotential, potential_temperature, coriolis, gravity, dx, dy, dt) u = top_level.smoothing_3D(u, smoothing_parameter_u) v = top_level.smoothing_3D(v, smoothing_parameter_v) w = top_level.w_calculation(u, v, w, pressure_levels, geopotential, potential_temperature, coriolis, gravity, dx, dy, dt) w = top_level.smoothing_3D(w, smoothing_parameter_w, 0.25) u[:, :, -1] *= 0.1 v[:, :, -1] *= 0.1 for k in range(nlevels): w[:, :, k] *= pressure_levels[k] / pressure_levels[0]
heat_capacity_earth, albedo, insolation, lat, lon, heights, dz, t, dt, day, year, axial_tilt) temperature_atmos = top_level.smoothing_3D(temperature_atmos, smoothing_parameter_t) # time_taken = float(round(time.time() - before_radiation,3)) # print('Radiation: ',str(time_taken),'s') # update air pressure old_pressure = np.copy(air_pressure) air_pressure = air_density * specific_gas * temperature_atmos if velocity: before_velocity = time.time() u, v, w = top_level.velocity_calculation(u, v, w, air_pressure, ref_pressure_profile, air_density, coriolis, gravity, dx, dy, dz, dt) u = top_level.smoothing_3D(u, smoothing_parameter_u) v = top_level.smoothing_3D(v, smoothing_parameter_v) w = top_level.smoothing_3D(w, smoothing_parameter_w, 0.1) u[(advection_boundary, -advection_boundary - 1), :, :] *= 0.5 v[(advection_boundary, -advection_boundary - 1), :, :] *= 0.5 w[(advection_boundary, -advection_boundary - 1), :, :] *= 0.5 u[:advection_boundary, :, :] = 0 v[:advection_boundary, :, :] = 0 w[:advection_boundary, :, :] = 0 u[-advection_boundary:, :, :] = 0 v[-advection_boundary:, :, :] = 0