Skip to content

Commit 0b4bdc8

Browse files
committed
prepare for test wih ecloud in bologna
1 parent db9a031 commit 0b4bdc8

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

test_ring_with_objects/Simulation_with_eclouds.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import communication_helpers as ch
22
import numpy as np
3-
from scipy.constants import c
3+
from scipy.constants import c, e
44

55

66
class Simulation(object):
77
def __init__(self):
8-
self.N_turns = 128
8+
self.N_turns = 2
99

1010
def init_all(self):
1111
n_slices = 100
@@ -14,7 +14,7 @@ def init_all(self):
1414
self.n_slices = n_slices
1515
self.z_cut = z_cut
1616

17-
n_segments=70
17+
n_segments=3
1818

1919
from LHC import LHC
2020
self.machine = LHC(machine_configuration='Injection', n_segments=n_segments, D_x=0.,
@@ -52,16 +52,16 @@ def init_all(self):
5252
init_unif_edens = 9.000000e+11
5353
N_MP_ele_init = 100000
5454
N_mp_max = N_MP_ele_init*4.
55-
Dh_sc = .2e-3
55+
Dh_sc = 1e-3
5656
nel_mp_ref_0 = init_unif_edens*4*x_aper*y_aper/N_MP_ele_init
5757

5858
import PyECLOUD.PyEC4PyHT as PyEC4PyHT
5959
my_new_part = []
6060
self.my_list_eclouds = []
61-
for ele in mypart:
61+
for ele in self.mypart:
6262
my_new_part.append(ele)
63-
if ele in machine.transverse_map:
64-
ecloud_new = PyEC4PyHT.Ecloud(L_ecloud=machine.circumference/n_segments, slicer=None ,
63+
if ele in self.machine.transverse_map:
64+
ecloud_new = PyEC4PyHT.Ecloud(L_ecloud=self.machine.circumference/n_segments, slicer=None,
6565
Dt_ref=10e-12, pyecl_input_folder='../pyecloud_config',
6666
chamb_type = chamb_type,
6767
x_aper=x_aper, y_aper=y_aper,
@@ -70,11 +70,11 @@ def init_all(self):
7070
init_unif_edens=init_unif_edens,
7171
N_mp_max=N_mp_max,
7272
nel_mp_ref_0=nel_mp_ref_0,
73-
B_multip=B_multip_per_eV*machine.p0/e*c,
73+
B_multip=B_multip_per_eV*self.machine.p0/e*c,
7474
slice_by_slice_mode=True)
7575
my_new_part.append(ecloud_new)
7676
self.my_list_eclouds.append(ecloud_new)
77-
mypart = my_new_part
77+
self.mypart = my_new_part
7878

7979
def init_master(self):
8080

test_ring_with_objects/ring_of_CPUs.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ def __init__(self, sim_content):
5252

5353
def run(self):
5454
if self.I_am_the_master:
55-
55+
import time
56+
t_last_turn = time.mktime(time.localtime())
5657
while True: #(it will be stopped with a break)
5758
orders_from_master = []
5859
# pop a piece
5960
try:
60-
piece_to_send = self.pieces_to_be_treated.pop() #pop starts for the last slices
61-
#(it is what we want, for the HEADTAIL
62-
#slice order convention, z = -beta*c*t)
61+
piece_to_send = self.pieces_to_be_treated.pop() # pop starts for the last slices
62+
# (it is what we want, for the HEADTAIL
63+
# slice order convention, z = -beta*c*t)
6364
except IndexError:
6465
piece_to_send = None
6566

@@ -78,14 +79,17 @@ def run(self):
7879

7980
# end of turn
8081
if len(self.pieces_treated)==self.N_pieces:
81-
print 'Turn', self.i_turn
8282

8383
self.pieces_treated = self.pieces_treated[::-1] #restore the original order
8484

8585
# perform global operations and reslice
8686
orders_to_pass, new_pieces_to_be_treated = \
8787
self.sim_content.finalize_turn_on_master(self.pieces_treated)
8888
orders_from_master += orders_to_pass
89+
90+
t_now = time.mktime(time.localtime())
91+
print 'Turn %d, %d s'%(self.i_turn,t_now-t_last_turn)
92+
t_last_turn = t_now
8993

9094
# prepare next turn
9195
self.pieces_to_be_treated = new_pieces_to_be_treated

0 commit comments

Comments
 (0)