kBT = 0.5 # Move max 0.75 mu in any direction delta = M #int(0.75 / delta_x) nr_tries = 1000 # to avoid confusion vol_frac_goal = np.double(vol_frac_goal) L = np.double(L) M = np.int(M) mc_steps = np.int(mc_steps) kBT = np.double(kBT) nr_tries = np.int(nr_tries) trunc_triangles = ccb.prepare_triangles(1.0, L) # Using 1.0 instead of vol_frac_goal in order to obtain enough inputs. #ccb.optimize_midpoints(L, trunc_triangles) with open('trunc_triangles_0.data', 'wb') as f: pickle.dump(L, f, pickle.HIGHEST_PROTOCOL) pickle.dump(trunc_triangles, f, pickle.HIGHEST_PROTOCOL) grain_ids_0, overlaps_0, voxel_indices_0 = ccb_c.populate_voxels(M, L, trunc_triangles, nr_tries, delta, vol_frac_goal) phases_0, good_voxels_0, euler_angles_0, phase_volumes_0, grain_volumes_0 = ccb_c.calc_grain_prop(M, grain_ids_0, trunc_triangles) surface_voxels_0, gb_voxels_0, interface_voxels_0 = ccb_c.calc_surface_prop(M, grain_ids_0) vol_frac_WC_0 = phase_volumes_0[1]/np.float(np.sum(phase_volumes_0)) vol_frac_Co_0 = 1 - vol_frac_WC_0 mass_frac_WC_0 = ccb.mass_fraction(vol_frac_WC_0) d_eq_0 = ccb.volume_to_eq_d(grain_volumes_0*delta_x**3)
#fname = 'testfile_{}_Sayers'.format(L) #fname = 'testfile_{}_Mari'.format(L) #fname = 'testfile_{}_Cheng'.format(L) #fname = 'testfile_{}_Touloukian'.format(L) #fname = 'testfile_{}_Johansson_lowK'.format(L) #fname = 'testfile_{}_Lee'.format(L) #fname = 'testfile_{}_Golovchan'.format(L) #fname = 'testfile_{}_Johansson'.format(L) #fname = 'testfile_{}_Suetin'.format(L) #fname = 'testfile_{}_Li'.format(L) #fname = 'testfile_{}_Cheng_klow'.format(L) #fname = 'testfile' ######### Start of simulation ############# trunc_triangles = ccb.prepare_triangles(vol_frac_goal, L, r, k, d_eq) # Sort triangles w.r.t. volume, so that large triangles are added to the box first (better packing) trunc_triangles.sort(key=lambda m: m.volume, reverse=True) if use_potential: ccb.optimize_midpoints(L, trunc_triangles) print('Prepared', len(trunc_triangles), 'triangles') with open('trunc_triangles_0.data', 'wb') as f: pickle.dump(L, f, pickle.HIGHEST_PROTOCOL) pickle.dump(trunc_triangles, f, pickle.HIGHEST_PROTOCOL) if m_coarse == m: grain_ids_0, overlaps_0, voxel_indices_0 = ccb_c.populate_voxels(M, L, trunc_triangles, nr_tries, M, 1.0) else: