Beispiel #1
0
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)
Beispiel #2
0
    for sample in range(samples):
        np.random.seed(sample)

        # to avoid confusion
        vol_frac_goal = np.double(vol_frac_goal)
        L = np.double(L)
        kBT = np.double(kBT)
        nr_tries = np.int(nr_tries)
        delta_x = float(d_0)/float(m)
        M = np.int(m * L / d_0)

        print("Running vol fraction", vol_frac_goal, "with M", M)
        fname = 'mstat_{:.1f}_{}'.format(vol_frac_goal, sample)

        trunc_triangles = ccb.prepare_triangles(vol_frac_goal, L, r, k, d_eq)
        trunc_triangles.sort(key=lambda m: m.volume, reverse=True)
        print("Prepared", len(trunc_triangles), "triangles")
        if use_potential:
            ccb.optimize_midpoints(L, trunc_triangles)
            grain_ids_0, overlaps_0, voxel_indices_0 = ccb_c.populate_voxels(M, L, trunc_triangles, 1, 0, 1.0)
        else:
            grain_ids_0, overlaps_0, voxel_indices_0 = ccb_c.populate_voxels(M, L, trunc_triangles, nr_tries, M, 1.0)
        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.append( 1 - vol_frac_WC_0 )

        sum_gb_voxels_0 = np.sum(gb_voxels_0)
        contiguity_0.append( sum_gb_voxels_0 / np.float(sum_gb_voxels_0 + np.sum(interface_voxels_0)) )
Beispiel #3
0
#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:
Beispiel #4
0
    for sample in range(samples):
        np.random.seed(sample)

        print("Running vol fraction", vol_frac_goal)
        fname = 'volstat_{:.1f}_{}'.format(vol_frac_goal, sample)

        # to avoid confusion
        vol_frac_goal = np.double(vol_frac_goal)
        L = np.double(L)
        kBT = np.double(kBT)
        nr_tries = np.int(nr_tries)
        delta_x = float(d_0)/float(m)
        M = np.int(m * L / d_0)
        M_coarse = np.int(m_coarse * L / d_0)

        trunc_triangles = ccb.prepare_triangles(vol_frac_goal, L, r, k, d_eq)
        trunc_triangles.sort(key=lambda m: m.volume, reverse=True)
        print("Prepared", len(trunc_triangles), "triangles")
        if use_potential:
            ccb.optimize_midpoints(L, trunc_triangles)
        if nr_tries > 1:
            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.)
        grain_ids_0, overlaps_0, voxel_indices_0 = ccb_c.populate_voxels(M, L, trunc_triangles, 1, 0, 1.)

        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.append( 1 - vol_frac_WC_0 )

        sum_gb_voxels_0 = np.sum(gb_voxels_0)