Esempio n. 1
0
 def Run(self,MySettings):
     '''Function used to run the PyBoltz simulation. Note that the PBSettings dictionary needs to be set up.'''
     MBObject = Boltz()
     Status=self.ProcessInputs(MBObject,MySettings)
     if(Status):
         MBObject.Start()
     Outputs = self.ProcessOutputs(MBObject)
     return Outputs
Esempio n. 2
0
    def Run(self, InputSettings=None, JSONFileName=None, PrintSettings=False):
        MBObject = Boltz()

        if JSONFileName:
            with open(JSONFileName, 'r') as File:
                print("Reading {} ...".format(JSONFileName))
                JSONSettings = json.load(File)
                json.dumps(JSONSettings, indent=4)
            Status = self.ProcessInputs(MBObject, JSONSettings, PrintSettings)
        elif InputSettings:
            Status = self.ProcessInputs(MBObject, InputSettings, PrintSettings)
        else:
            print("Using stored inputs.")
            Status = self.ProcessInputs(MBObject, self.OdieSettings, PrintSettings)

        if Status:
            MBObject.Start()
        else:
            print("Error detected. Not running simulation.")

        return self.ProcessOutputs(MBObject)
Esempio n. 3
0
def test_type_two():

    D = TestData.getData()
    for ITest in range(1,D['NTests']+1):
        TN = 'T'+str(ITest)
        if D[TN + '/type'] == 2:

            Object = Boltz()
            # Set the number of gases
            Object.NumberOfGases = D[TN +'/Input/NumberOfGases']
            # Set the number of collisons
            Object.MaxNumberOfCollisions = D[TN +'/Input/MaxNumberOfCollisions']
            # Set penning
            Object.Enable_Penning =  D[TN +'/Input/Enable_Penning']
            # Calculate the electron energy
            Object.Enable_Thermal_Motion = D[TN +'/Input/Enable_Thermal_Motion']
            Object.Max_Electron_Energy =  D[TN +'/Input/Max_Electron_Energy']
            # Set the gas's with there given number
            Object.GasIDs =  D[TN +'/Input/GasIDs']
            # Set the gas fractions
            Object.GasFractions = D[TN +'/Input/GasFractions']
            # Set the tempature
            Object.TemperatureCentigrade = D[TN +'/Input/TemperatureCentigrade']
            # Set the pressure
            Object.Pressure_Torr = D[TN +'/Input/Pressure_Torr']
            # Set the eletric field
            Object.EField =  D[TN +'/Input/EField']
            # Set the magnetic field and angle
            Object.BField_Mag = 0.0 # first run...
            Object.BField_Angle = 0
            Object.Console_Output_Flag = D[TN +'/Input/Console_Output_Flag']
            Object.Steady_State_Threshold = D[TN +'/Input/Steady_State_Threshold']
            Object.Which_Angular_Model = D[TN +'/Input/Which_Angular_Model']
            Object.Start()

            Trans1 = Object.TransverseDiffusion

            Object = Boltz()
            # Set the number of gases
            Object.NumberOfGases = D[TN + '/Input/NumberOfGases']
            # Set the number of collisons
            Object.MaxNumberOfCollisions = D[TN + '/Input/MaxNumberOfCollisions']
            # Set penning
            Object.Enable_Penning = D[TN + '/Input/Enable_Penning']
            # Calculate the electron energy
            Object.Enable_Thermal_Motion = D[TN + '/Input/Enable_Thermal_Motion']
            Object.Max_Electron_Energy = D[TN + '/Input/Max_Electron_Energy']
            # Set the gas's with there given number
            Object.GasIDs = D[TN + '/Input/GasIDs']
            # Set the gas fractions
            Object.GasFractions = D[TN + '/Input/GasFractions']
            # Set the tempature
            Object.TemperatureCentigrade = D[TN + '/Input/TemperatureCentigrade']
            # Set the pressure
            Object.Pressure_Torr = D[TN + '/Input/Pressure_Torr']
            # Set the eletric field
            Object.EField = D[TN + '/Input/EField']
            # Set the magnetic field and angle
            Object.BField_Mag = D[TN + '/Input/BField_Mag']
            Object.BField_Angle = D[TN + '/Input/BField_Angle']
            Object.Console_Output_Flag = D[TN + '/Input/Console_Output_Flag']
            Object.Steady_State_Threshold = D[TN + '/Input/Steady_State_Threshold']
            Object.Which_Angular_Model = D[TN + '/Input/Which_Angular_Model']


            Object.Start()

            Trans = Object.TransverseDiffusion

            if D[TN + '/Comparisons'] == 1 or D[TN + '/Comparisons'] == 3:
                TransM = D[TN + '/Output/MBdtr']
                TransEM = D[TN + '/Output/MBdtrE']

                assert Trans1/Trans >= TransM - TransEM , "Test #: {}".format(ITest)
                assert Trans1/Trans <= TransM + TransEM, "Test #: {}".format(ITest)

            if D[TN + '/Comparisons'] == 2 or D[TN + '/Comparisons'] == 3:
                TransD = D[TN + '/Output/dtr']
                TransDE = D[TN + '/Output/dtrE']


                assert Trans1/Trans >= TransD - TransDE, "Test #: {}".format(ITest)
                assert Trans1/Trans <= TransD + TransDE, "Test #: {}".format(ITest)
Esempio n. 4
0
def test_type_one():

    D = TestData.getData()
    for ITest in range(1, D['NTests'] + 1):
        TN = 'T' + str(ITest)
        if D[TN + '/type'] == 1:

            Object = Boltz()
            # Set the number of gases
            Object.NumberOfGases = D[TN + '/Input/NumberOfGases']
            # Set the number of collisons
            Object.MaxNumberOfCollisions = D[TN +
                                             '/Input/MaxNumberOfCollisions']
            # Set penning
            Object.Enable_Penning = D[TN + '/Input/Enable_Penning']
            # Calculate the electron energy
            Object.Enable_Thermal_Motion = D[TN +
                                             '/Input/Enable_Thermal_Motion']
            Object.Max_Electron_Energy = D[TN + '/Input/Max_Electron_Energy']
            # Set the gas's with there given number
            Object.GasIDs = D[TN + '/Input/GasIDs']
            # Set the gas fractions
            Object.GasFractions = D[TN + '/Input/GasFractions']
            # Set the tempature
            Object.TemperatureCentigrade = D[TN +
                                             '/Input/TemperatureCentigrade']
            # Set the pressure
            Object.Pressure_Torr = D[TN + '/Input/Pressure_Torr']
            # Set the eletric field
            Object.EField = D[TN + '/Input/EField']
            # Set the magnetic field and angle
            Object.BField_Mag = D[TN + '/Input/BField_Mag']
            Object.BField_Angle = D[TN + '/Input/BField_Angle']
            Object.Console_Output_Flag = D[TN + '/Input/Console_Output_Flag']
            Object.Steady_State_Threshold = D[TN +
                                              '/Input/Steady_State_Threshold']
            Object.Which_Angular_Model = D[TN + '/Input/Which_Angular_Model']

            Object.Start()

            if D[TN + '/Comparisons'] == 1 or D[TN + '/Comparisons'] == 3:
                DriftVelocityM = D[TN + '/Output/MBvel']
                DriftVelocityErrM = D[TN + '/Output/MBvelE']

                LongM = D[TN + '/Output/MBdl']
                LongEM = D[TN + '/Output/MBdlE']

                TransM = D[TN + '/Output/MBdt']
                TransEM = D[TN + '/Output/MBdtE']

                assert Object.VelocityZ >= DriftVelocityM - DriftVelocityErrM, "Test #: {}".format(
                    ITest)
                assert Object.VelocityZ <= DriftVelocityM + DriftVelocityErrM, "Test #: {}".format(
                    ITest)

                assert Object.LongitudinalDiffusion1 >= LongM - LongEM, "Test #: {}".format(
                    ITest)
                assert Object.LongitudinalDiffusion1 <= LongM + LongEM, "Test #: {}".format(
                    ITest)

                assert Object.TransverseDiffusion1 >= TransM - TransEM, "Test #: {}".format(
                    ITest)
                assert Object.TransverseDiffusion1 <= TransM + TransEM, "Test #: {}".format(
                    ITest)

            if D[TN + '/Comparisons'] == 2 or D[TN + '/Comparisons'] == 3:
                DriftVelocity = D[TN + '/Output/vel']
                DriftVelocityErr = D[TN + '/Output/velE']

                Long = D[TN + '/Output/dl']
                LongE = D[TN + '/Output/dlE']

                Trans = D[TN + '/Output/dt']
                TransE = D[TN + '/Output/dtE']

                assert Object.VelocityZ >= DriftVelocity - DriftVelocityErr, "Test #: {}".format(
                    ITest)
                assert Object.VelocityZ <= DriftVelocity + DriftVelocityErr, "Test #: {}".format(
                    ITest)

                assert Object.LongitudinalDiffusion1 >= Long - LongE, "Test #: {}".format(
                    ITest)
                assert Object.LongitudinalDiffusion1 <= Long + LongE, "Test #: {}".format(
                    ITest)

                assert Object.TransverseDiffusion1 >= Trans - TransE, "Test #: {}".format(
                    ITest)
                assert Object.TransverseDiffusion1 <= Trans + TransE, "Test #: {}".format(
                    ITest)
PROPANE = 10
ISOBUTANE = 11
CO2 = 12
H2O = 14
O2 = 15
N2 = 16
H2 = 21
DEUTERIUM = 22
DME = 24
C2F6 = 26

GASES = [np.nan, 'CF4', 'ARGON', 'HELIUM4', 'HELIUM3', 'NEON', 'KRYPTON', 'XENON', 'CH4', 'ETHANE', 'PROPANE'
         , 'ISOBUTANE', 'CO2', np.nan, 'H2O', 'OXYGEN', 'NITROGEN', np.nan, np.nan, np.nan, np.nan
         , 'HYDROGEN', 'DEUTERIUM', np.nan, 'DME','C2F6']

Object = Boltz()

import time
t1 =time.time()

# Set the number of gases
Object.NumberOfGases =2
# Set the number of collisons
Object.MaxNumberOfCollisions =1*40000000.0
# Set penning
Object.Enable_Penning = 0
# Calculate the electron energy
Object.Enable_Thermal_Motion=1
Object.Max_Electron_Energy = 10
# Set the gas's with there given number
Object.GasIDs=[2,25,0,0,0,0]
Esempio n. 6
0
PROPANE = 10
ISOBUTANE = 11
CO2 = 12
H2O = 14
O2 = 15
N2 = 16
H2 = 21
DEUTERIUM = 22
DME = 24
C2F6 = 29

GASES = [np.nan, 'CF4', 'ARGON', 'HELIUM4', 'HELIUM3', 'NEON', 'KRYPTON', 'XENON', 'CH4', 'ETHANE', 'PROPANE'
         , 'ISOBUTANE', 'CO2', np.nan, 'H2O', 'OXYGEN', 'NITROGEN', np.nan, np.nan, np.nan, np.nan
         , 'HYDROGEN', 'DEUTERIUM', np.nan, np.nan, 'DME', np.nan, np.nan, np.nan, 'C2F6']

Object = Boltz()

import time
t1 =time.time()

Args = sys.argv

this_Gas   = int(Args[1])
this_Gas_frac   = float(Args[2])
that_Gas   = int(Args[3])
that_Gas_frac = float(Args[4])
efield     = int(Args[5])

a = str(that_Gas)+"-"
b = '{0:.7f}'.format(that_Gas_frac)+"-"
c = str(efield)+".npy"
Esempio n. 7
0
PROPANE = 10
ISOBUTANE = 11
CO2 = 12
H2O = 14
O2 = 15
N2 = 16
H2 = 21
DEUTERIUM = 22
DME = 24
C2F6 = 29

GASES = [np.nan, 'CF4', 'ARGON', 'HELIUM4', 'HELIUM3', 'NEON', 'KRYPTON', 'XENON', 'CH4', 'ETHANE', 'PROPANE'
         , 'ISOBUTANE', 'CO2', np.nan, 'H2O', 'OXYGEN', 'NITROGEN', np.nan, np.nan, np.nan, np.nan
         , 'HYDROGEN', 'DEUTERIUM', np.nan, np.nan, 'DME',np.nan, np.nan, np.nan, 'C2F6']

Object = Boltz()

import time
t1 =time.time()

# Set the number of gases
Object.NumberOfGases =2
# Set the number of collisons
Object.MaxNumberOfCollisions =40000000.0
# Set penning
Object.Enable_Penning = 0
# Calculate the electron energy
Object.Enable_Thermal_Motion=1
Object.Max_Electron_Energy = 0.0
# Set the gas's with there given number
Object.GasIDs=[2, 29, 0, 0, 0, 0]
Esempio n. 8
0
def test_ArCH4_90_10():

    ap = APA.getAPA()

    DriftVelocity = ap.root.CH4["10.0"].Drift_Velocity[5]
    DriftVelocityErr = ap.root.CH4["10.0"].Drift_Velocity_Error[5] * DriftVelocity

    Long = ap.root.CH4["10.0"].Long[5]
    LongE = ap.root.CH4["10.0"].LongE[5] * Long

    Trans = ap.root.CH4["10.0"].Trans[5]
    TransE = ap.root.CH4["10.0"].TransE[5] * Trans
    Object = Boltz()
    # Set the number of gases
    Object.NumberOfGases = 2
    # Set the number of collisons
    Object.MaxNumberOfCollisions = 1 * 40000000.0
    # Set penning
    Object.Enable_Penning = 0
    # Calculate the electron energy
    Object.Enable_Thermal_Motion = 1
    Object.Max_Electron_Energy = 0.0
    # Set the gas's with there given number
    Object.GasIDs = [2, 8, 0, 0, 0, 0]
    # Set the gas fractions
    Object.GasFractions = [90, 10, 0, 0, 0, 0]
    # Set the tempature
    Object.TemperatureCentigrade = float(23)
    # Set the pressure
    Object.Pressure_Torr = 750.062
    # Set the eletric field
    Object.EField = ap.root.CH4["10.0"].Reduced_Field[5]
    # Set the magnetic field and angle
    Object.BField_Mag = 0
    Object.BField_Angle = 0
    Object.Console_Output_Flag = 0
    Object.Steady_State_Threshold = 40
    Object.Which_Angular_Model = 2

    Object.Start()

    assert Object.VelocityZ >= DriftVelocity - DriftVelocityErr
    assert Object.VelocityZ <= DriftVelocity + DriftVelocityErr

    assert Object.LongitudinalDiffusion1 >= Long - LongE
    assert Object.LongitudinalDiffusion1 <= Long + LongE

    assert Object.TransverseDiffusion1 >= Trans - TransE
    assert Object.TransverseDiffusion1 <= Trans + TransE