Exemple #1
0
def main():

    plate1 = [((0.0, 0.0), (1.0, 0.0))]
    ref_point = (0.5, -0.5)
    surf_temp1 = 300.0

    plate2 = [((0.0, 1.0), (1.0, 1.0))]
    ref_point2 = (0.5, 1.5)
    surf_temp2 = 300.0
    # creating surface
    surf_group = SurfaceGroup()
    surf_group.add_new_group(plate1, ref_point, surf_temp1)
    surf_group.add_new_group(plate2, ref_point2, surf_temp2)

    inlet = [((0.0, 0.0), (0.0, 1.0))]
    outlet = [((1.0, 0.0), (1.0, 1.0))]
    zero_grad = [((0.0, 0.0), (1.0, 0.0)), ((0.0, 1.0), (1.0, 1.0))]
    center = (0.5, 0.5)
    length = 1.0
    width = 1.0
    volume = 1.0
    domain = Domain(volume, inlet, zero_grad, outlet)

    #    ensemble_sample = 10
    time_av_sample = 10000
    dof = 3.0
    mass = 66.3e-27
    viscosity_coeff = 2.117
    viscosity_index = 0.81
    mole_fraction = [0.5, 0.5]
    dia = 4.17e-10
    mach = [3.0, 0.0, 0.0]
    temperature = 300.0
    ref_temperature = 273.0
    number_density = 1.699e20
    gamma = 5.0 / 3.0
    n_particles_in_cell = 8
    ref_point = (0.1, 0.5)
    argon = Molecules(
        dia, viscosity_index, mass, viscosity_coeff, dof, 0, ref_temperature, gamma, volume, number_density
    )
    argon1 = Molecules(
        dia, viscosity_index, mass, viscosity_coeff, dof, 1, ref_temperature, gamma, volume, number_density
    )
    gas = Gas([argon, argon1], mole_fraction, mach, temperature)
    gas.setup()
    #    dl = min(gas.mean_f_path)
    #    dt = min(gas.mean_col_time)
    dt = 1.0e-7
    #    print dt
    #    cell_x, cell_y = np.ceil(length / dl), np.ceil(width / dl)
    cell_x, cell_y = 200, 200
    cells = RectCells(cell_x, cell_y, length, width, center, 2)

    start_time = time()
    solver = DsmcSolver(
        cells,
        gas,
        domain,
        surf_group,
        n_particles_in_cell,
        dt,
        time_av_sample,
        CollisionDetector,
        VhsCollider,
        Diffuse,
        ignore_frac=0.5,
    )
    solver.run()
    end_time = time()

    simulation_time = end_time - start_time
    print "simulation time in mins (upper bound) = ", int(round(simulation_time / 60))
    print "simulation time in sec = ", simulation_time
    number_density_0 = solver.get_2d_num_den(cell_x, cell_y, 0)
    number_density_1 = solver.get_2d_num_den(cell_x, cell_y, 1)
    temperature = solver.get_2d_temperature(cell_x, cell_y)
    speed = solver.get_2d_speed(cell_x, cell_y)
    u = solver.get_2d_u(cell_x, cell_y)
    v = solver.get_2d_v(cell_x, cell_y)
    w = solver.get_2d_w(cell_x, cell_y)
    pressure = (number_density_0 + number_density_1) * 1.3806488e-23 * temperature

    f = open("poise_super_temperature.txt", "w")
    np.savetxt(f, temperature)
    f.close()

    f = open("poise_super_number_density_0.txt", "w")
    np.savetxt(f, number_density_0)
    f.close()

    f = open("poise_super_number_density_1.txt", "w")
    np.savetxt(f, number_density_1)
    f.close()

    f = open("poise_super_speed.txt", "w")
    np.savetxt(f, speed)
    f.close()

    f = open("poise_super_u.txt", "w")
    np.savetxt(f, u)
    f.close()
    f.close()

    f = open("poise_super_v.txt", "w")
    np.savetxt(f, v)
    f.close()

    f = open("poise_super_w.txt", "w")
    np.savetxt(f, w)
    f.close()

    f = open("poise_super_pressure.txt", "w")
    np.savetxt(f, pressure)
    f.close()
Exemple #2
0
def main():

    surface = [((0.0, 1.0), (0.0, 0.0)), ((0.0, 0.0), (1.0, 0.0)),
            ((1.0, 0.0), (1.0, 1.0)), ((1.0, 1.0), (0.0, 1.0))]
    
    center = (0.5, 0.5)
    length = 1.0
    width = 1.0
    volume = 1.0
    
    domain = Domain(volume)
    surf_group = SurfaceGroup()
    surf_group.add_new_group(surface, center)
    
    time_av_sample = 10000
    dof = 3.0
    mass = 66.3e-27
    viscosity_coeff = 2.117
    viscosity_index = 0.81
    mole_fraction = [0.5, 0.5]
    dia = 4.17e-10
    mach = [0.0, 0.0, 0.0]
    temperature = 300.0
    ref_temperature = 273.0
    number_density = 5e18
    gamma = 5.0 / 3.0
    n_particles_in_cell = 8
    argon = Molecules(dia, viscosity_index, mass, viscosity_coeff, dof, 0,
                ref_temperature, gamma, volume, number_density)
    argon1 = Molecules(dia, viscosity_index, mass, viscosity_coeff, dof, 1,
                ref_temperature, gamma, volume, number_density)
    gas = Gas([argon, argon1], mole_fraction, mach, temperature)
    gas.setup()
#    dl = min(gas.mean_f_path)
#    dt = min(gas.mean_col_time)
    dt = 1.0e-5
#    print dt
#    cell_x, cell_y = np.ceil(length / dl), np.ceil(width / dl)
    cell_x, cell_y = 200, 200
    cells = RectCells(cell_x, cell_y, length, width, center, 2)
    
    start_time = time()
    solver = DsmcSolver(cells, gas, domain, surf_group, n_particles_in_cell,
                         dt, time_av_sample, CollisionDetector,
                        VhsCollider, Specular, ignore_frac=0.1)
    solver.run()
    end_time = time()
    
    simulation_time = end_time - start_time
    print "simulation time in mins (upper bound) = ", round(simulation_time / 60)
    print "simulation time in sec = ", simulation_time
    number_density_0 = solver.get_2d_num_den(cell_x, cell_y, 0)
    number_density_1 = solver.get_2d_num_den(cell_x, cell_y, 1)
    temperature = solver.get_2d_temperature(cell_x, cell_y)
    mach = solver.get_2d_mach(cell_x, cell_y)
    pressure = (number_density_0 + number_density_1) * 1.3806488e-23 * temperature
    
    f = open('box_temperature.txt', 'w')
    np.savetxt(f, temperature)
    f.close()
    
    f = open('box_number_density_0.txt', 'w')
    np.savetxt(f, number_density_0)
    f.close()
    
    f = open('box_number_density_1.txt', 'w')
    np.savetxt(f, number_density_1)
    f.close()
    
    f = open('box_mach.txt', 'w')
    np.savetxt(f, mach)
    f.close()
    
    f = open('box_pressure.txt', 'w')
    np.savetxt(f, pressure)
    f.close()
Exemple #3
0
def main():
    
    wedge = [((0.39, 0.0), (1.0, 0.3464))]
    ref_point = (1.0, 0.0)
    surf_temp1 = 1000.0
    
    wedge2 = [((0.39, 1.0), (1.0, 0.6536))]
    ref_point2 = (1.0, 1.0)
    surf_temp2 = 1000.0
    # creating surface
    surf_group = SurfaceGroup()
    surf_group.add_new_group(wedge, ref_point, surf_temp1)
    surf_group.add_new_group(wedge2, ref_point2, surf_temp2)
    
    inlet = [((0.0, 0.0), (0.0, 1.0))]
    outlet = [((1.0, 0.3464), (1.0, 0.6536))]
    zero_grad  = [((0.0, 0.0), (0.39, 0.0)), ((0.39, 0.0), (1.0, 0.3464)),
                  ((0.0, 1.0), (0.39, 1.0)), ((0.39, 1.0), (1.0, 0.6536))]
    center = (0.5, 0.5)
    length = 1.0
    width = 1.0
    volume = 0.36
    domain = Domain(volume, inlet, zero_grad, outlet)
    
    
    sample_size = 10
    dof = 3.0
    mass = 66.3e-27
    viscosity_coeff = 2.117
    viscosity_index = 0.81
    mole_fraction = [0.5, 0.5]
    dia = 4.17e-10
    mach = [5.0, 0.0, 0.0]
    temperature = 300.0
    ref_temperature = 273.0
    number_density = 1.699e19
    gamma = 5.0 / 3.0
    n_particles_in_cell = 10
    ref_point = (0.1, 0.5)
    argon = Molecules(dia, viscosity_index, mass, viscosity_coeff, dof, 0,
                ref_temperature, gamma, volume, number_density)
    argon1 = Molecules(dia, viscosity_index, mass, viscosity_coeff, dof, 1,
                ref_temperature, gamma, volume, number_density)
    gas = Gas([argon, argon1], mole_fraction, mach, temperature)
    gas.setup()
#    dl = min(gas.mean_f_path)
#    dt = min(gas.mean_col_time)
    dt = 1.0e-5
#    print dt
#    cell_x, cell_y = np.ceil(length / dl), np.ceil(width / dl)
    cell_x, cell_y = 10, 10
    cells = RectCells(cell_x, cell_y, length, width, center, 2)
    
    start_time = time()
    solver = DsmcSolver(cells, gas, domain, surf_group, n_particles_in_cell,
                        ref_point, dt, sample_size, CollisionDetector,
                        VhsCollider, Diffuse)
    solver.run()
    end_time = time()
    
    simulation_time = end_time - start_time
    print "simulation time in mins (upper bound) = ", int(simulation_time / 60) + 1
    print "simulation time in sec = ", simulation_time
    number_density = solver.get_2d_num_den(cell_x, cell_y)
    temperature = solver.get_2d_temperature(cell_x, cell_y)
    
    f = open('nozzle_temperature.txt', 'w')
    np.savetxt(f, temperature)
    f.close()
    
    f = open('nozzle_number_density.txt', 'w')
    np.savetxt(f, number_density)
    f.close()
Exemple #4
0
def main():

    surface1 = [((0.0, 1.0), (0.0, 0.0)), ((0.0, 0.0), (1.0, 0.0)), ((1.0, 0.0), (1.0, 1.0))]
    surface1_temp = 300.0
    
    surface2 = [((1.0, 1.0), (0.0, 1.0))]
    surface2_temp = 500.0
    
    center = (0.5, 0.5)
    length = 1.0
    width = 1.0
    volume = 1.0
    
#    ensemble_sample = 10
    sample_size = 10
    dof = 3.0
    mass = 66.3e-27
    viscosity_coeff = 2.117
    viscosity_index = 0.81
    mole_fraction = [0.5, 0.5]
    dia = 4.17e-10
    mach = [0.0, 0.0, 0.0]
    temperature = 500.0
    ref_temperature = 273.0
    number_density = 1.699e19
    gamma = 5.0 / 3.0
    n_particles_in_cell = 10
    ref_point = (0.1, 0.5)
    
    argon = Molecules(dia, viscosity_index, mass, viscosity_coeff, dof, 0,
                ref_temperature, gamma, volume, number_density)
    argon1 = Molecules(dia, viscosity_index, mass, viscosity_coeff, dof, 1,
                ref_temperature, gamma, volume, number_density)
    gas = Gas([argon, argon1], mole_fraction, mach, temperature)
    gas.setup()
    
    domain = Domain(volume)
    surf_group = SurfaceGroup()
    surf_group.add_new_group(surface1, center, surface1_temp)
    surf_group.add_new_group(surface2, center, surface2_temp)
    dt = 1.0e-5
    cell_x, cell_y = 5, 5
    cells = RectCells(cell_x, cell_y, length, width, center, 2)
    
    start_time = time()
    solver = DsmcSolver(cells, gas, domain, surf_group, n_particles_in_cell,
                        ref_point, dt, sample_size, CollisionDetector,
                        VhsCollider, Diffuse)
    solver.run()
    end_time = time()
    
    simulation_time = end_time - start_time
    print "simulation time in mins (upper bound) = ", int(simulation_time / 60) + 1
    print "simulation time in sec = ", simulation_time
    number_density = solver.get_2d_num_den(10, 10)
    print "number_density = ", number_density
    temperature = solver.get_2d_temperature(10, 10)
    print "temperature = ", temperature
    
    f = open('box_temp_grad_temperature.txt', 'w')
    np.savetxt(f, temperature)
    f.close()
    
    f = open('box_temp_grad_number_density.txt', 'w')
    np.savetxt(f, number_density)
    f.close()