def tlm_validation(eta, dt, tlm): ndim = np.shape(eta)[0] err = 0.1 * np.random.randn(ndim) eta_new = integrator.step(eta, 0, dt) eta_new_p = integrator.step(eta + err, 0, dt) out = np.linalg.norm(eta_new - eta_new_p) / np.linalg.norm(tlm * err) return out
def compute_tlm(eta, dt, tensor): ndim = np.shape(eta)[0] n = 1 eta1 = eta j1 = jacobi_mat(eta1, tensor) eta2 = integrator.step(eta1, 0, dt) j2 = jacobi_mat(eta2, tensor) tlm = np.identity(ndim) + (j1 + j2) * 0.5 * dt + np.dot(j2, j1) * 0.5 * dt**2 return tlm
def compute_adm(eta, dt, tensor): # Notice, the input dt is a positive number ndim = np.shape(eta)[0] n = 1 dt_adm = dt / n eta_old = eta adm_old = np.identity(ndim) for i in range(1, n + 1): j_mat = jacobi_mat(eta_old, tensor) adm = np.dot(np.identity(ndim) + dt_adm * j_mat.transpose(), adm_old) eta_new = integrator.step(eta_old, 0, -dt_adm) eta_old = eta_new adm_old = adm return adm
BOLD = '\033[1m' UNDERLINE = '\033[4m' print (bcolors.OKBLUE + "Model MAOOAM v1.2" + bcolors.ENDC) print (bcolors.OKBLUE + "Initialization ..." + bcolors.ENDC) ic_def.load_IC() X = ic.X0 print (bcolors.OKBLUE + "Starting the transient time evolution ..." + bcolors.ENDC) t = 0. T = time.clock() t_up = dt/t_trans*100 while t < t_trans: X = integrator.step(X, t, dt) t += dt if t/t_trans*100 % 0.1 < t_up: print_progress(t/t_trans) print (bcolors.OKBLUE + "Starting the time evolution ..." + bcolors.ENDC) fichier = open("evol_field.dat", "w") t = 0. t_up = dt/t_run*100 while t < t_run: X = integrator.step(X, t, dt) t += dt if t % (tw) < dt: fichier.write(str(t)+" ") for i in range(0, ndim):