Exemple #1
0
os.makedirs(plot_dir, exist_ok=True)
heat_flow_dir = top_dir + "heat_flow/"

l_wire_list = [  #5,
    2.7
]  # in cm
exp_list = [14, 15, 16, 17]
T_cracker_list = [2400, 2200, 2000, 1800, 1000, 500, 300, 0]

f_arr_full = np.zeros(
    (len(l_wire_list), len(exp_list), len(T_cracker_list), 6))
for n_lw, l_wire in enumerate(l_wire_list):
    for n_phi, phi_exp in enumerate(exp_list):
        for n_T, T_cracker in enumerate(T_cracker_list):
            run_name = "lw_{}_phi_{}_Tc_{}".format(l_wire, phi_exp, T_cracker)
            wire = Wire()
            wire = wire.load(top_dir + "results\\" + run_name)
            wire.plot_heat_flow(top_dir + "plots\\" +
                                "heat_flow/log_{}".format(run_name),
                                log_y=True)
            i = wire.n_wire_elements // 2
            elem = [
                wire.f_el(i),
                wire.f_conduction(i),
                wire.f_rad(i),
                wire.f_beam(i),
                wire.f_beam_gas(i),
                wire.f_bb(i)
            ]
            f_arr_full[n_lw, n_phi, n_T] = elem
signal_arr_full = np.zeros(
    (len(l_beam_list), len(l_wire_list), len(exp_list), len(x_offset_list)))
for n_lb, l_beam in enumerate(l_beam_list):
    # Initialize Arrays
    U_arr = np.zeros((len(l_wire_list), len(exp_list), len(x_offset_list)))
    T_max_arr = np.zeros((len(l_wire_list), len(exp_list), len(x_offset_list)))
    T_avg_arr = np.zeros((len(l_wire_list), len(exp_list), len(x_offset_list)))
    signal_arr = np.zeros(
        (len(l_wire_list), len(exp_list), len(x_offset_list)))
    for n_lw, l_wire in enumerate(l_wire_list):
        for n_p, phi_exp in enumerate(exp_list):
            for n_x_off, x_off in enumerate(x_offset_list):
                run_name = "lb_{0}_lw_{1}_phi_{2}_xoff_{3:.1f}".format(
                    l_beam, l_wire, phi_exp, x_off)
                #TODO Include enumerates, output plots for every i_current
                wire = Wire()
                wire = wire.load(top_dir + "results\\" + run_name)
                #l_beam = wire.l_beam

                U_beam_off = wire.U_wire(0)
                U_beam_on = wire.U_wire(-1)

                U_delta = U_arr[n_lw, n_p, n_x_off] = U_beam_on - U_beam_off
                signal = signal_arr[n_lw, n_p, n_x_off] = U_delta / U_beam_off

                T_max = T_max_arr[n_lw, n_p, n_x_off] = np.amax(
                    wire.record_dict["T_distribution"][-1])
                T_avg = T_avg_arr[n_lw, n_p, n_x_off] = np.average(
                    wire.record_dict["T_distribution"][-1])
            phi_list = [10**exp for exp in exp_list]
        U_arr_full[n_lb] = U_arr

fig = plt.figure(0, figsize=(8,6.5))
ax1=plt.gca()
top_dir_list = ["20um_phi_beam_sweep_taylor/", "20um_phi_beam_sweep/"]
#top_dir_list = ["10um_phi_beam_sweep_taylor/", "10um_phi_beam_sweep/"]
#top_dir_list = ["5um_phi_beam_sweep_taylor/", "5um_phi_beam_sweep/"]
label_list = [r"$F_{rad}$ Taylored", r"$F_{rad} \propto T^4$"]
exp_list = np.linspace(15,20,num = 21)
# Initialize Arrays
U_arr = np.zeros((len(top_dir_list), len(exp_list)))
T_max_arr = np.zeros((len(top_dir_list), len(exp_list)))
signal_arr = np.zeros((len(top_dir_list), len(exp_list)))
for j, top_dir in enumerate(top_dir_list):
    for i, phi_exp in enumerate(exp_list):
        wire = Wire()
        wire = wire.load(top_dir + "phi_to_{}".format(phi_exp))

        U_beam_off = wire.U_wire(0)
        U_beam_on = wire.U_wire(-1)
        
        U_delta = U_arr[j, i] = U_beam_on - U_beam_off
        signal = signal_arr[j, i] = U_delta / U_beam_off

        T_max = T_max_arr[j, i] = np.amax(wire.record_dict["T_distribution"]
                                          [-1])

    phi_list = 10**exp_list

# Plot delta U vs Phi in atoms/s
fig = plt.figure(0, figsize=(8,6.5))
    2.7
]  # in cm

U_arr_full = np.zeros((len(l_wire_list), len(i_current_list)))
signal_arr_full = np.zeros((len(l_wire_list), len(i_current_list)))
for n_lw, l_wire in enumerate(l_wire_list):
    # Initialize Arrays
    U_arr = np.zeros((len(i_current_list)))
    T_max_arr = np.zeros((len(i_current_list)))
    T_avg_arr = np.zeros((len(i_current_list)))
    signal_arr = np.zeros((len(i_current_list)))
    R_arr = np.zeros((len(i_current_list)))
    for n_i, i_current in enumerate(i_current_list):
        run_name = "lw_{}_i_{}".format(l_wire, i_current)
        #TODO Include enumerates, output plots for every i_current
        wire = Wire()
        #wire = wire.load(top_dir + "0.02mbar_air\\" + "results\\" + run_name)
        wire = wire.load(top_dir + "0.02mbar_air_em_{}\\".format(emissivity) +
                         "results\\" + run_name)
        #l_beam = wire.l_beam

        U_beam_off = wire.U_wire(0)
        U_beam_on = wire.U_wire(-1)

        U_delta = U_arr[n_i] = U_beam_on - U_beam_off
        signal = signal_arr[n_i] = U_delta / U_beam_off

        T_max = T_max_arr[n_i] = np.amax(
            wire.record_dict["T_distribution"][-1])
        T_avg = T_avg_arr[n_i] = np.average(
            wire.record_dict["T_distribution"][-1])
Exemple #5
0
    if n_max > 100:
        n_wire_elements = 100
    else:
        if round(n_max,-1) == 0:
            n_wire_elements = 10
        else:
            n_wire_elements = int(round(n_max,-1))
    # simulate wire base temperature with beam off

    for T_cracker in T_cracker_list:
        time_before = time()
        wire_no_beam = Wire(
            n_wire_elements = n_wire_elements,
            i_current = (d/5)**2 * i_current * 10**-3, d_wire = d * 10**-6,
            emissivity = 0.3, l_wire=l_wire*10**-2,
            T_cracker = T_cracker, T_atoms = T_cracker,
            ###
            phi_beam=0, T_base=None
            ###
            ) 

        # Run the Simulation
        mod = 4

        n_steps_no_beam = 30000 * mod
        n_steps = 10000 * mod
        record_steps = 1000
        time_step = 0.001 / mod
        wire_no_beam.simulate(n_steps=n_steps_no_beam, 
                              record_steps=record_steps, time_step=time_step)
Exemple #6
0
                2.7
               ] # in cm

U_arr_full = np.zeros((len(l_wire_list), len(i_current_list) ))
signal_arr_full = np.zeros((len(l_wire_list), len(i_current_list)))
for n_lw, l_wire in enumerate(l_wire_list):
    # Initialize Arrays
    U_arr = np.zeros(( len(i_current_list)))
    T_max_arr = np.zeros(( len(i_current_list)))
    T_avg_arr = np.zeros(( len(i_current_list)))
    signal_arr = np.zeros(( len(i_current_list)))
    R_arr = np.zeros(( len(i_current_list)))
    for n_i, i_current in enumerate(i_current_list):
        run_name = "lw_{}_i_{}".format(l_wire,i_current)
        #TODO Include enumerates, output plots for every i_current
        wire = Wire()
        wire = wire.load(top_dir + "results\\" + run_name)
        #l_beam = wire.l_beam

        U_beam_off = wire.U_wire(0)
        U_beam_on = wire.U_wire(-1)
        
        U_delta = U_arr[n_i] = U_beam_on - U_beam_off
        signal = signal_arr[n_i] = U_delta / U_beam_off

        T_max = T_max_arr[n_i] = np.amax(
            wire.record_dict["T_distribution"][-1])
        T_avg = T_avg_arr[n_i] = np.average(
            wire.record_dict["T_distribution"][-1])

        R_arr[n_i] = wire.resistance_total()
Exemple #7
0
            n_wire_elements = 100
        else:
            if round(n_max,-1) == 0:
                n_wire_elements = 10
            else:
                n_wire_elements = int(round(n_max,-1))
        # simulate wire base temperature with beam off

        for i_current in i_current_list:
            time_before = time()
            wire_no_beam = Wire(
                n_wire_elements = n_wire_elements,
                i_current = (d/5)**2 * i_current * 10**-3, d_wire = d * 10**-6,
                emissivity = emissivity, l_wire=l_wire*10**-2, 
                rho_specific_resistance=0.054 * 10**-6,
                pressure=0.0005*10**-3*10**5, m_molecular_gas= 29 * 1.674 * 10**-27,
                T_cracker = 300,
                T_background=298.25,
                ###
                phi_beam=0, T_base=None
                ###
                ) 

            # Run the Simulation
            mod = 4

            n_steps_no_beam = 30000 * mod
            n_steps = 10000 * mod
            record_steps = 1000
            time_step = 0.001 / mod
            wire_no_beam.simulate(n_steps=n_steps_no_beam,
                                record_steps=record_steps,
# Add location of Wire_detector.py to path
import sys
import os

# top_dir = os.path.dirname(os.path.abspath(__file__)) + os.sep
# sys.path.append(top_dir + ".." + os.sep)
# import Wire class from Wire_detector.py
from Wire_detector import Wire

import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatches

file_directory = "example/results/"
filename = "example_1"
wire = Wire().load(file_directory + filename)
os.makedirs("plots/", exist_ok=True)
#wire.plot_signal()

# wire.plot_signal() used as an example plot below
# Plot Temperature over Wire for start and end of simulation
# Plot Temperature over Wire
plt.figure(0, figsize=(8, 6.5))
ax1 = plt.gca()
ax1.set_aspect(0.1)

x_lst = [
    1000 * ((i + 0.5) * wire.l_segment - (wire.l_wire / 2))
    for i in range(wire.n_wire_elements)
]
T_beam_off = wire.record_dict["T_distribution"][0]
    2.7
]  # in cm

U_arr_full = np.zeros((len(l_wire_list), len(i_current_list)))
signal_arr_full = np.zeros((len(l_wire_list), len(i_current_list)))
for n_lw, l_wire in enumerate(l_wire_list):
    # Initialize Arrays
    U_arr = np.zeros((len(i_current_list)))
    T_max_arr = np.zeros((len(i_current_list)))
    T_avg_arr = np.zeros((len(i_current_list)))
    signal_arr = np.zeros((len(i_current_list)))
    R_arr = np.zeros((len(i_current_list)))
    for n_i, i_current in enumerate(i_current_list):
        run_name = "lw_{}_i_{}".format(l_wire, i_current)
        #TODO Include enumerates, output plots for every i_current
        wire = Wire()
        wire = wire.load(top_dir + "results\\" + run_name)
        #l_beam = wire.l_beam

        U_beam_off = wire.U_wire(0)
        U_beam_on = wire.U_wire(-1)

        U_delta = U_arr[n_i] = U_beam_on - U_beam_off
        signal = signal_arr[n_i] = U_delta / U_beam_off

        T_max = T_max_arr[n_i] = np.amax(
            wire.record_dict["T_distribution"][-1])
        T_avg = T_avg_arr[n_i] = np.average(
            wire.record_dict["T_distribution"][-1])

        R_arr[n_i] = wire.resistance_total()
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import matplotlib.patches as mpatches
import os
import dill
from Wire_detector import Wire

top_dir = os.path.dirname(os.path.abspath(__file__)) + "\\"

wire = Wire()
wire = wire.load("10um_phi_beam_sweep/" + "phi_to_17.0")
wire.taylor_f_rad = False
animate_dir = top_dir + "animate\\"
os.makedirs(animate_dir, exist_ok=True)

n_steps = 15000
record_steps = 150
time_step = 0.001
# ####### reproduce ohmic heating procedure
# wire_no_beam = wire
# wire_no_beam.T_base = None
# wire_no_beam.phi_beam = 0
# wire_no_beam.taylor_f_rad = False

# wire_no_beam.simulate(n_steps=n_steps, record_steps=record_steps,
#                      time_step=time_step)
# wire_no_beam.save(animate_dir + "base_heating")
# #######
wire_no_beam = Wire()
d_wire_list = [5, 10, 20]
i_current_list = [0.1, 1]
exp_list = np.linspace(14, 20, num=25)  # later normalized to per cm**2

for i_current in i_current_list:
    # Initialize Arrays
    U_arr = np.zeros((len(d_wire_list), len(exp_list)))
    T_max_arr = np.zeros((len(d_wire_list), len(exp_list)))
    T_avg_arr = np.zeros((len(d_wire_list), len(exp_list)))
    signal_arr = np.zeros((len(d_wire_list), len(exp_list)))
    for n_d, d in enumerate(d_wire_list):
        for n_p, phi_exp in enumerate(exp_list):
            run_name = "d_{}_i_{}_phi_{}".format(d, i_current, phi_exp)
            #TODO Include enumerates, output plots for every i_current
            wire = Wire()
            wire = wire.load(top_dir + "results\\" + run_name)
            l_beam = wire.l_beam

            U_beam_off = wire.U_wire(0)
            U_beam_on = wire.U_wire(-1)

            U_delta = U_arr[n_d, n_p] = U_beam_on - U_beam_off
            signal = signal_arr[n_d, n_p] = U_delta / U_beam_off

            T_max = T_max_arr[n_d, n_p] = np.amax(
                wire.record_dict["T_distribution"][-1])
            T_avg = T_avg_arr[n_d, n_p] = np.average(
                wire.record_dict["T_distribution"][-1])

            if True:
Exemple #12
0
os.makedirs(results_dir, exist_ok=True)
os.makedirs(plot_dir, exist_ok=True)
d = 5
i_current = 1
exp_list = np.linspace(14, 18, num=9)  # later normalized to per cm**2
l_beam = 10 * 10**-2
A_beam = np.pi * (l_beam / 2)**2

# simulate wire base temperature with beam off
wire_no_beam = Wire(
    n_wire_elements=100,
    k_heat_conductivity=174,
    i_current=(d / 5)**2 * i_current * 10**-3,
    d_wire=d * 10**-6,
    emissivity=0.3,
    l_wire=5.45 * 10**-2,
    beam_shape="Flat",
    l_beam=l_beam,
    ###
    phi_beam=0,
    T_base=None
    ###
)

# Run the Simulation
n_steps_no_beam = 60000
n_steps = 20000
record_steps = 1000
time_step = 0.001
wire_no_beam.simulate(n_steps=n_steps_no_beam,
                      record_steps=record_steps,
                      time_step=time_step)
#pressure = 0.0005
pressure = 0.02

U_arr_full = np.zeros((len(l_wire_list), len(i_current_list)))
signal_arr_full = np.zeros((len(l_wire_list), len(i_current_list)))
for n_lw, l_wire in enumerate(l_wire_list):
    # Initialize Arrays
    U_arr = np.zeros((len(i_current_list)))
    T_max_arr = np.zeros((len(i_current_list)))
    T_avg_arr = np.zeros((len(i_current_list)))
    signal_arr = np.zeros((len(i_current_list)))
    R_arr = np.zeros((len(i_current_list)))
    for n_i, i_current in enumerate(i_current_list):
        run_name = "lw_{}_i_{}".format(l_wire, i_current)
        #TODO Include enumerates, output plots for every i_current
        wire = Wire()
        #wire = wire.load(top_dir + "0.02mbar_air\\" + "results\\" + run_name)
        wire = wire.load(top_dir +
                         "{}mbar_air_em_{}\\".format(pressure, emissivity) +
                         "results\\" + run_name)
        wire.gen_k_heat_cond_function()
        #l_beam = wire.l_beam

        U_beam_off = wire.U_wire(0)
        U_beam_on = wire.U_wire(-1)

        U_delta = U_arr[n_i] = U_beam_on - U_beam_off
        signal = signal_arr[n_i] = U_delta / U_beam_off

        T_max = T_max_arr[n_i] = np.amax(
            wire.record_dict["T_distribution"][-1])
Exemple #14
0
l_beam_list = [
    0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6,
    2.8
]  # in cm

# Implement comparison of integrated heat flows over beam spot size
# Generate array:
func_list = [
    "f_el", "f_rad", "f_conduction", "f_beam", "f_beam_gas", "f_bb",
    "f_background_gas", "f_laser"
]

power_arr_full = np.zeros((len(func_list), len(l_beam_list)))
for n_lb, l_beam in enumerate(l_beam_list):
    run_name = "lb_{}".format(l_beam)
    wire = Wire().load(top_dir + "results\\" + run_name)
    for n_func, func in enumerate(func_list):
        power = wire.integrate_f(getattr(wire, func))
        power_arr_full[n_func, n_lb] = power

if True:
    fig = plt.figure(0, figsize=(8, 6.5))
    ax1 = plt.gca()
    label_list = [
        r"$P_{el}$", r"$P_{conduction}$", r"$P_{rad}$", r"$P_{beam}$",
        r"$P_{beam gas}$", r"$P_{bb cracker}$", r"$P_{background gas}$",
        r"$P_{laser}$"
    ]
    # color_list = ["C0", "C1", "C2", "C3", "C4", "C5"]
    for n_func, func in enumerate(func_list):
        x_lst = l_beam_list
Exemple #15
0
# Add location of Wire_detector.py to path
import sys
sys.path.append("..")

# import Wire class from Wire_detector.py 
from Wire_detector import Wire

import os

print("This should take about 3 minutes to run")
# initialize wire with selected parameters
wire_no_beam = Wire(
            n_wire_elements = 100,
            i_current = 1 * 10**-3, d_wire = 5 * 10**-6,
            emissivity = 0.3, l_wire= 2.7 *10**-2,
            ### Without beam and with default stating temperature distribution
            phi_beam=0, T_base=None
            ###
            )

# Run Simulation to heat wire to starting temperature distribution
# adjust mod for shorter time steps if simulation crashes due to overflows
mod = 2
n_steps_no_beam = 20000 * mod
n_steps = 10000 * mod
record_steps = 1000
time_step = 0.001 / mod
wire_no_beam.simulate(n_steps=n_steps_no_beam, 
                        record_steps=record_steps, time_step=time_step)

# clone wire object
# Try matching 5um signa with 20um wire by increasing current
top_dir = "low_current_matching/"
os.makedirs(top_dir, exist_ok=True)
os.makedirs(top_dir + "plots/", exist_ok=True)
d_wire_list = [5, 10, 20]
i_current = 0.1 * 10**-3
for d in d_wire_list:
    # simulate wire base temperature with beam off
    wire_no_beam = Wire(
        n_wire_elements=100,
        k_heat_conductivity=174,
        i_current=(d / 5)**2 * i_current,
        d_wire=d * 10**-6,
        emissivity=0.3,
        l_wire=5.45 * 10**-2,
        beam_shape="Gaussian",
        sigma_beam=1.1 * 10**-3,
        ###
        phi_beam=0,
        T_base=None
        ###
    )

    # Run the Simulation
    n_steps = 20000
    record_steps = 1000
    time_step = 0.001
    wire_no_beam.simulate(n_steps=n_steps,
                          record_steps=record_steps,
                          time_step=time_step)