コード例 #1
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)
コード例 #2
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
コード例 #3
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()
コード例 #4
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,
コード例 #5
0
# 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]
コード例 #6
0
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
l_beam = 10 * 10**-2
A_beam = np.pi * (l_beam / 2)**2

for i_current in i_current_list:
    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 * 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 = 20000
        record_steps = 1000
        time_step = 0.001
        wire_no_beam.simulate(n_steps=n_steps,
                              record_steps=record_steps,
                              time_step=time_step)
        for phi_exp in exp_list:
コード例 #7
0
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()
コード例 #8
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
コード例 #9
0
# 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)