def __init__(self, x, y, anchor_point, polarity, body_length, wing_chord, wing_span, stabilizer_chord, stabilizer_span, fluid, box2dWorld, density=10.0): self.polarity = polarity self.body_length = body_length self.anchor_point = anchor_point # Make a body to Box2D for this foil bodyDef = b2BodyDef() bodyDef.position.Set(x, y) #bodyDef.linearDamping = 10.0 #bodyDef.angularDamping = 1.0 body = box2dWorld.CreateBody(bodyDef) shapeDef = b2PolygonDef() body_center = b2Vec2(-0.5 * body_length, 0.0) shapeDef.SetAsBox(body_length * 0.5, 0.05, body_center, 0) shapeDef.density = 0.0 # kg/m^3, from wikipedia for styrofoam density shapeDef.friction = 0.0 body.CreateShape(shapeDef) print "Made body" self.wing = Foil(wing_chord, wing_span, fluid, body, b2Vec2(0.0, 0.15 * polarity), angle=radians(5) * polarity, density=density) print "Made wing" self.stabilizer = Foil(stabilizer_chord, stabilizer_span, fluid, body, b2Vec2(-body_length + stabilizer_chord, 0.15 * polarity), angle=0.0, density=density) print "Made stabilizer" body.SetMassFromShapes() self.body = body
def initialize_dictionary(): foils = {} # import list of foil keys and store in dictionary with open('foil_ids.txt', 'r') as F: foil_keys = F.read().splitlines() for key in foil_keys: foils[key] = Foil(key) return foils, foil_keys
def __init__(self, xmin, xmax, ymin, ymax, thick, name="foil no name"): """ Constructor. Creates the Foil TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.foil = Foil(xmin, xmax, ymin, ymax, thick) self.setType("foil teapot") self.setLength(0.0) # The user choice of scattering routine. Defualt (0) is full scatter self.scatterChoice = 0
# storing the data from the wisconsin mpfd irradiation from foil import Foil data = {} data['al1'] = Foil(60036, 317, 2.20E-02, 6.61E-03, -1) data['al2'] = Foil(15467, 155, 3.47E-02, 5.48E-03, -1) data['al3'] = Foil(17094, 171, 3.86E-02, 6.10E-03, -1) data['al4'] = Foil(18031, 180, 3.08E-02, 4.87E-03, -1) data['mo_cd1'] = Foil(15271, 150, 0.439, 4.58E-02, -1) data['mo_cd2'] = Foil(28709, 213, 0.541, 9.57E-02, -1) data['mo_cd3'] = Foil(14523, 148, 0.758, 7.90E-02, -1) data['mo_cd4'] = Foil(32746, 230, 0.559, 9.88E-02, -1) data['dum'] = Foil(0, 0, 0, 0, -1) data['mo1'] = Foil(117208, 444, 0.365, 6.45E-02, -1) data['mo2'] = Foil(15617, 156, 0.692, 7.21E-02, -1) data['mo3'] = Foil(14896, 142, 0.805, 8.38E-02, -1) data['mo4'] = Foil(30133, 224, 0.629, 0.111, -1)
def __init__(self, json_boat_file, **kwargs): # Choix des options self.current_location = np.zeros(2) # 0 :Longitude, 1: Latitude self.destination_location = np.zeros(2) # 0 :Longitude, 1: Latitude self.twa_array = [] self.tws_array = [] self.hull = 1 self.boat_name = "none" self.Jib_option = True self.Spi_option = True self.sail_speed = [] self.Staysail_option = False self.LightJib_option = False self.Code0_option = False self.HeavyGnk_option = False self.LightGnk_option = False self.Foil_option = False self.Polish_option = False self.WinchPro_option = False self.utc = get_utctime() print("heure actuelle UTC", self.utc) if kwargs.__len__() != 0: if 'LightSail' in kwargs: if kwargs['LightSail']: self.LightJib_option = True self.LightGnk_option = True if 'HeavySail' in kwargs: if kwargs['HeavySail']: self.Staysail_option = True self.HeavyGnk_option = True if 'Code0' in kwargs: if kwargs['Code0']: self.Code0_option = True if 'Foil' in kwargs: if kwargs['Foil']: self.Foil_option = True if 'Polish' in kwargs: if kwargs['Polish']: self.Polish_option = True if 'WinchPro' in kwargs: if kwargs['WinchPro']: self.WinchPro_option = True if 'FullPack' in kwargs: if kwargs['FullPack']: self.Staysail_option = True self.LightJib_option = True self.Code0_option = True self.HeavyGnk_option = True self.LightGnk_option = True self.Foil_option = True self.Hull_option = True self.WinchPro_option = True if self.Foil_option: self.foil = Foil() self.read(json_boat_file)
# storing the data from the 6_25_18 mpfd irradiation from foil import Foil data = {} data['al1'] = Foil(115.3, 14.62, 3.2033E-002, 12.68, 3600) data['al2'] = Foil(150.9, 16.86, 4.1906E-002, 11.17, 3600) data['al3'] = Foil(-1, -1, -1, -1, -1) data['al4'] = Foil(-1, -1, -1, -1, -1) data['au1'] = Foil(137326.1, 382.43, 1.318e+000, 7.382e-003, 60) data['au2'] = Foil(175561.4, 433.84, 1.685E+000, 9.186E-003, 60) data['au3'] = Foil(185317.2, 447.60, 1.518E+001, 5.480E-001, 60) data['au4'] = Foil(113048.9, 505.68, 2.938E-001, 3.235E-002, 60) data['au_cd1'] = Foil(847634.3, 955.40, 1.388E+001, 5.004E-001, 300) data['au_cd2'] = Foil(1202112.1, 1101.06, 2.308E+000, 1.142E-002, 300) data['au_cd3'] = Foil(905406.3, 952.34, 1.739E+000, 8.645E-003, 300) data['au_cd4'] = Foil(836461.0, 4653.72, 2.1532E+002, 6.48, 300) data['in1'] = Foil(16385.8, 137.96, 9.897E-001, 2.669e-002, 60) data['in2'] = Foil(18046.7, 144.63, 1.090E+000, 2.926E-002, 60) data['in3'] = Foil(14003.7, 126.65, 8.458E-001, 2.298E-002, 60) data['in4'] = Foil(13549.7, 125.62, 8.184E-001, 2.230E-002, 60) data['in_cd1'] = Foil(40613.9, 219.35, -1, -1, 300) data['in_cd2'] = Foil(-1, -1, -1, -1, -1) data['in_cd3'] = Foil(3993.0, 67.70, 4.823E-002, 1.482E-003, 300) data['in_cd4'] = Foil(-1, -1, -1, -1, -1)
import math import sys from bunch import Bunch from foil import Foil from injection import InjectParts print "Start." xmin = -0.050 xmax = 0.050 ymin = -0.050 ymax = 0.050 # Below is 1000 times the width of normal foil but will do only one turn. thick = 400 foil = Foil(xmin, xmax, ymin, ymax, thick) #------------------------------ #Main Bunch init #------------------------------ b = Bunch() print "Read Bunch." runName = "Benchmark_Collimator" b.mass(0.93827231) b.macroSize(1.0e+1) energy = 1.0 #Gev b.readBunch("parts.dat") b.getSyncParticle().kinEnergy(energy) #=====track bunch through Foil============