#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: if nr_tries > 0: # Optimization: Use coarser grid for packing, then insert packed grains into fine grid grain_ids_coarse_0, overlaps_coarse_0, voxel_indices_coarse_0 = ccb_c.populate_voxels(M_coarse, L, trunc_triangles, nr_tries, M_coarse, 1.0) grain_ids_0, overlaps_0, voxel_indices_0 = ccb_c.populate_voxels(M, L, trunc_triangles, 1, 0, 1.0)