#Hydrostatic equilibrium work_field['g'] = T1['g'] work_field.antidifferentiate('z', ('right', 0), out=p) #hydrostatic equilibrium #Adjust magnitude of noise due to cos envelope & estimated magnitude of FT temperature fluctuations. A0 /= np.cos(np.pi * (-0.5 + 2 * d_BL)) A0 /= Nu_estimate else: logger.info( "WARNING: Smart ICS not implemented for boundary condition choice." ) #Add noise kick noise = global_noise(domain, int(args['--seed'])) T1['g'] += A0 * P * np.cos(np.pi * z_de) * noise['g'] T1.differentiate('z', out=T1_z) dt = None mode = 'overwrite' elif TT_to_FT is not None: logger.info("restarting from {} and swapping BCs".format(TT_to_FT)) dt = checkpoint.restart(TT_to_FT, solver) mode = 'overwrite' Nu = float(args['--TT_to_FT_Nu']) true_t_ff = np.sqrt(Nu) T1 = solver.state['T1'] u = solver.state['u']
#ts = de.timesteppers.SBDF2 ts = de.timesteppers.RK443 cfl_safety = float(args['--safety']) solver = problem.build_solver(ts) logger.info('Solver built') ### 6. Set initial conditions: noise or loaded checkpoint checkpoint = Checkpoint(data_dir) checkpoint_min = 30 restart = args['--restart'] if restart is None: T1 = solver.state['T1'] T1_z = solver.state['T1_z'] T1.set_scales(domain.dealias) noise = global_noise(domain, int(args['--seed']), n_modes=args['--noise_modes']) z_de = domain.grid(-1, scales=domain.dealias) T1['g'] = (1e-6 * np.cos(np.pi * z_de) * noise['g']) / np.sqrt(Ra) T1.differentiate('z', out=T1_z) dt = None mode = 'overwrite' else: logger.info("restarting from {}".format(restart)) dt = checkpoint.restart(restart, solver) mode = 'append' checkpoint.set_checkpoint(solver, wall_dt=checkpoint_min * 60, mode=mode) ### 7. Set simulation stop parameters, output, and CFL if run_time_buoy is not None: solver.stop_sim_time = run_time_buoy