velocity = True # print current time in simulation to command line print("+++ t = " + str(round(t / day, 2)) + " days +++") print('T: ', round(temperature_world.max() - 273.15, 1), ' - ', round(temperature_world.min() - 273.15, 1), ' C') print('U: ', round(u.max(), 2), ' - ', round(u.min(), 2), ' V: ', round(v.max(), 2), ' - ', round(v.min(), 2), ' W: ', round(w.max(), 2), ' - ', round(w.min(), 2)) # before_radiation = time.time() temperature_world, temperature_atmos = top_level.radiation_calculation( temperature_world, temperature_atmos, air_pressure, air_density, 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)
velocity = True # print current time in simulation to command line print("+++ t = " + str(round(t / day, 2)) + " days +++") print('T: ', round(temperature_world.max() - 273.15, 1), ' - ', round(temperature_world.min() - 273.15, 1), ' C') print('U: ', round(u.max(), 2), ' - ', round(u.min(), 2), ' V: ', round(v.max(), 2), ' - ', round(v.min(), 2), ' W: ', round(w.max(), 2), ' - ', round(w.min(), 4)) before_radiation = time.time() temperature_world, potential_temperature = top_level.radiation_calculation( temperature_world, potential_temperature, pressure_levels, heat_capacity_earth, albedo, insolation, lat, lon, t, dt, day, year, axial_tilt) potential_temperature = top_level.smoothing_3D(potential_temperature, 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,
velocity = False else: dt = dt_main velocity = True # print current time in simulation to command line print("+++ t = " + str(round(t/day,2)) + " days +++") print('T: ',round(temperature_world.max()-273.15,1),' - ',round(temperature_world.min()-273.15,1),' C') print('U: ',round(u[:,:,:sponge_index-1].max(),2),' - ',round(u[:,:,:sponge_index-1].min(),2),' V: ',round(v[:,:,:sponge_index-1].max(),2),' - ',round(v[:,:,:sponge_index-1].min(),2),' W: ',round(w[:,:,:sponge_index-1].max(),2),' - ',round(w[:,:,:sponge_index-1].min(),4)) tracer[40,50,sample_level] = 1 tracer[20,50,sample_level] = 1 if verbose: before_radiation = time.time() temperature_world, potential_temperature = top_level.radiation_calculation(temperature_world, potential_temperature, pressure_levels, heat_capacity_earth, albedo, insolation, lat, lon, t, dt, day, year, axial_tilt) if smoothing: potential_temperature = top_level.smoothing_3D(potential_temperature,smoothing_parameter_t) if verbose: time_taken = float(round(time.time() - before_radiation,3)) 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:
# print current time in simulation to command line print("+++ t = " + str(round(t / day, 2)) + " days +++") print('T: ', round(temperature_world.max() - 273.15, 1), ' - ', round(temperature_world.min() - 273.15, 1), ' C') print('U: ', round(u.max(), 2), ' - ', round(u.min(), 2), ' V: ', round(v.max(), 2), ' - ', round(v.min(), 2), ' W: ', round(w.max(), 2), ' - ', round(w.min(), 4)) before_radiation = time.time() temperature_world, potential_temperature = top_level.radiation_calculation( temperature_world, potential_temperature, pressure_levels, heat_capacity_earth, albedo, insolation, lat, lon, t, dt, day, year, axial_tilt) if smoothing: potential_temperature = top_level.smoothing_3D(potential_temperature, smoothing_parameter_t) time_taken = float(round(time.time() - before_radiation, 3)) if verbose: 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,
velocity = True # print current time in simulation to command line print("+++ t = " + str(round(t / day, 2)) + " days +++") print('T: ', round(temperature_world.max() - 273.15, 1), ' - ', round(temperature_world.min() - 273.15, 1), ' C') print('U: ', round(u.max(), 2), ' - ', round(u.min(), 2), ' V: ', round(v.max(), 2), ' - ', round(v.min(), 2), ' W: ', round(w.max(), 2), ' - ', round(w.min(), 2)) # before_radiation = time.time() temperature_world, temperature_atmos = top_level.radiation_calculation( temperature_world, temperature_atmos, air_pressure, air_density, 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)