diff options
author | Simon Rochester <simon.rochester@gmail.com> | 2012-09-21 20:22:53 +0100 |
---|---|---|
committer | Simon Rochester <simon.rochester@gmail.com> | 2012-09-21 20:22:53 +0100 |
commit | 1b04b4b4aa3469f08dfc566f7d00a9dadb5acc8c (patch) | |
tree | c27a1a67d0442ab8516a42570ae111d81572d9cb | |
parent | 67e33c25f224850e32abfcfc20069fa35a50d241 (diff) | |
parent | ad5ea419a1b91c42cbcb316ed2b33760e4b1ec4e (diff) | |
download | Nresonances-1b04b4b4aa3469f08dfc566f7d00a9dadb5acc8c.tar.gz Nresonances-1b04b4b4aa3469f08dfc566f7d00a9dadb5acc8c.zip |
Merge branch 'master' of qo.physics.wm.edu:Nresonances
-rw-r--r-- | xmds2/realistic_Rb/Makefile.par | 15 | ||||
-rw-r--r-- | xmds2/realistic_Rb/Makefile.pp | 29 | ||||
-rw-r--r-- | xmds2/realistic_Rb/OptimizationNotes.txt | 17 | ||||
-rw-r--r-- | xmds2/realistic_Rb/pp_I2.m | 99 | ||||
-rw-r--r-- | xmds2/realistic_Rb/realistic_Rb.xmds | 8 |
5 files changed, 139 insertions, 29 deletions
diff --git a/xmds2/realistic_Rb/Makefile.par b/xmds2/realistic_Rb/Makefile.par index cc21c7b..5fddce1 100644 --- a/xmds2/realistic_Rb/Makefile.par +++ b/xmds2/realistic_Rb/Makefile.par @@ -7,15 +7,24 @@ ### This makefile can be used to build and run the XMDS examples +XMDS_FILES = $(wildcard *.xmds) +BASE_NAME = $(patsubst %.xmds,%,$(XMDS_FILES)) +RUN_FILES = $(patsubst %.xmds,%.run,$(XMDS_FILES)) +XSIL_FILES = $(patsubst %.xmds,%.xsil,$(XMDS_FILES)) PARAMS_FILES = $(wildcard *.params) PP_DIR = $(PARAMS_FILES:%.params=%) -CALC_XSIL_FILES = $(PARAMS_FILES:%.params=%/data.xsil) +CALC_XSIL_FILES = $(PARAMS_FILES:%.params=%/$(BASE_NAME).xsil) default: $(CALC_XSIL_FILES) -$(CALC_XSIL_FILES): %/data.xsil : % %.params +$(CALC_XSIL_FILES): %/$(BASE_NAME).xsil : % %.params echo processing $$(dirname $(@)) dir - $(MAKE) -C $$(dirname $(@)) -f ../Makefile.pp SCRIPTS_DIR=../ PARAMS_FILE=../$<.params + $(MAKE) -C $$(dirname $(@)) \ + -f ../Makefile.pp \ + SCRIPTS_DIR=../ \ + PARAMS_FILE=../$<.params \ + XSIL_FILES=$(XSIL_FILES) \ + RUN_FILES=$(RUN_FILES) $(PP_DIR): % : %.params echo need to make dir diff --git a/xmds2/realistic_Rb/Makefile.pp b/xmds2/realistic_Rb/Makefile.pp index 83e5bec..e24107e 100644 --- a/xmds2/realistic_Rb/Makefile.pp +++ b/xmds2/realistic_Rb/Makefile.pp @@ -2,35 +2,20 @@ ### This makefile can be used to build and run the XMDS examples -XSIL_FILES = Nlevels_with_doppler_with_z_4wm.xsil -M_FILES = $(patsubst %.xsil,%.m,$(XSIL_FILES)) GNUPLOT_FILES = $(wildcard *.gp) +XSIL_FILES = $(wildcard *.xsil) +RUN_FILES = $(patsubst %.xsil,%.run,$(XSIL_FILES)) +M_FILES = $(patsubst %.xsil,%.m,$(XSIL_FILES)) -SCRIPTS_DIR = . +SCRIPTS_DIR = .. XSIL2GRAPHICS = xsil2graphics -# fast light -#PARAMS = --delta1=0 --delta2=0 --delta3=0 --E1o=1.9e7 --E2o=3.1e5 --E3o=3.8e7 --E4o=1e1 -#PARAMS = --delta1=0 --delta2=0 --delta3=0 --E1o=0.1e7 --E2o=1e4 --E3o=.3e7 --E4o=0 --Lcell=1.5e-2 --Temperature=.0001 -PARAMS = \ - --Ndens=1e15 \ - --Lcell=10.0e-2 \ - --Temperature=5 \ - --Pwidth=0.4e-6 \ - --delta1=0 --delta2=0 --delta3=0 \ - --E1o=2e7 --E2o=1e2 --E3o=4e7 --E4o=1e0 - - include $(PARAMS_FILE) +all: $(XSIL_FILES) $(M_FILES) plot fig -# slow light EIT -#PARAMS = --delta1=0 --delta2=0 --delta3=0 --E1o=1.9e7 --E2o=3.1e5 --E3o=0 --E4o=0 - -all: $(XSIL_FILES) Nlevels_with_doppler_with_z_4wm.xsil $(M_FILES) plot fig - -Nlevels_with_doppler_with_z_4wm.xsil: ../Nlevels_with_doppler_with_z_4wm.run $(PARAMS_FILE) +$(XSIL_FILES): ../$(RUN_FILES) $(PARAMS_FILE) $< $(PARAMS) | grep "Time elapsed for simulation is:" > exact_analysis_execution_time.txt %.m: %.xsil @@ -50,11 +35,11 @@ pp_I2.stamp: $(XSIL_FILES) $(M_FILES) octave -q $(SCRIPTS_DIR)/pp_I2.m clean: - rm -f $(M_FILES) $(XSIL_FILES) *.dat octave-core rm -f pp_I2.stamp $(MAKE) -f $(SCRIPTS_DIR)/Makefile.fig $@ real_clean: clean + rm -f $(M_FILES) $(XSIL_FILES) *.dat octave-core $(MAKE) -f $(SCRIPTS_DIR)/Makefile.fig $@ rm -f exact_analysis_execution_time.txt diff --git a/xmds2/realistic_Rb/OptimizationNotes.txt b/xmds2/realistic_Rb/OptimizationNotes.txt new file mode 100644 index 0000000..4aea670 --- /dev/null +++ b/xmds2/realistic_Rb/OptimizationNotes.txt @@ -0,0 +1,17 @@ +I use gcc 4.7.1 + +Enabling OpenMP option makes my 6 core CPU busy on all 6 of them. +Surprisingly on Time x Velocity = 10000 x 10 grid it takes longer them with +disabled OpenMp option and only single core working. I have got 230 seconds +vs 160 seconds. Besides optimizing wisdom of FFT takes forever with OpenMP. + + +on a grid Time x Velocity = 10000 x 100 +with OpenMP execution time = 988 seconds +without = 1708 seconds + +with 4 thread +on a grid Time x Velocity = 10000 x 100 +with OpenMP execution time = 1036 seconds +without = 1603 seconds + diff --git a/xmds2/realistic_Rb/pp_I2.m b/xmds2/realistic_Rb/pp_I2.m new file mode 100644 index 0000000..47b5f48 --- /dev/null +++ b/xmds2/realistic_Rb/pp_I2.m @@ -0,0 +1,99 @@ +% suppress output of plots on display +set (0, "defaultfigurevisible", "off") + +realistic_Rb + +%% field I2 propagation +z_1=z_1*100; % z in cm +t_1=t_1*1e6; % time now measured in uS +figure(1) +%set(gca,'fontsize',20); +imagesc(z_1, t_1, I2_out_1); colorbar +tmin=-0.4; +tmax= 0.4; +ylim([tmin,tmax],'manual'); +xlabel('z (cm)') +ylabel('t (uS)') +zlabel('I_2') +title('I_2') +print('-color','-depsc2', '-tight', '-S200,120', 'fields_propagation_I2.eps') + +desired_x_size=200; +desired_y_size=200; +xskip=ceil(length(z_1)/desired_x_size); +yskip=ceil(length(t_1)/desired_y_size); +map2dat('I2.dat',z_1,t_1, I2_out_1, xskip, yskip); + + +%% field I4 propagation +figure(2) + +imagesc(z_1, t_1, I4_out_1); colorbar +tmin=-0.4; +tmax= 0.4; +ylim([tmin,tmax],'manual'); +xlabel('z (cm)') +ylabel('t (uS)') +zlabel('I_4') +title('I_4') +print('-color','-depsc2', '-tight', '-S200,120', 'fields_propagation_I4.eps') +map2dat('I4.dat',z_1,t_1, I4_out_1, xskip, yskip); + + + + + +%% fields before and after the cell +figure(3) +%set(gca,'fontsize',30); +plot( ... + t_1,I2_out_1(:,1),'.-;I_2 before;', "linewidth", 4 ... + ,t_1,I2_out_1(:,end), '-;I_2 after;', "linewidth", 4 ... + ,t_1,I4_out_1(:,end), '-;I_4 after;', "linewidth", 4 ... + ) +xlabel('t (uS)') +ylabel('I (1/s)^2') +title('Fields before and after cell') +legend('location', 'northeast'); + +[b, a]=butter(3, 0.05); +I2_out_after=I2_out_1(:,end); +I2_out_after_filtered=filtfilt(b,a,I2_out_after); +settling_time=0.01; %uS +t_good_indx=t_1> min(t_1 + settling_time); +[m,max_pos_before]=max(I2_out_1(t_good_indx,1) ); [m,max_pos_after]=max(I2_out_after_filtered(t_good_indx)); +delay_time=t_1(max_pos_after)-t_1(max_pos_before); +printf('Second field delay time = %f uS\n',delay_time); + +%set(gca,'fontsize',40); +%set (gcf,'paperposition',[0.5 0 2.5,1.5]); % IMPORTANT to shrink eps size for readable fonts +%print('-color','-depsc2', '-tight','-S200,120', 'fields_before_after_cell.eps') +print('-color','-depsc2', 'fields_before_after_cell.eps') + +figure(4) +I2_max_in=max(I2_out_1(t_good_indx,1)); +I2_max_out=max(I2_out_1(t_good_indx,end)); +I4_max_out=max(I4_out_1(t_good_indx,end)); +I2_in_norm=(I2_out_1(:,1))/I2_max_in; +I2_out_norm=(I2_out_1(:,end))/I2_max_out; +I4_out_norm=(I4_out_1(:,end))/I4_max_out; +tmin=-.05; +tmax=.05; +indx=(t_1>=tmin & t_1<=tmax); % soom in in time to this region +plot( ... + t_1(indx),I2_in_norm(indx),'.-;I_2 before;', "linewidth", 4, ... + t_1(indx),I2_out_norm(indx), '-;I_2 after;', "linewidth", 4 ... + ,t_1(indx),I4_out_norm(indx), '-;I_4 after;', "linewidth", 4 ... + ) +legend('location', 'southeast'); +xlim([tmin,tmax],'manual'); +ylim([0.5,1],'manual'); +xlabel('t (uS)') +ylabel('I normalized') +title('Fields before and after cell normalized') +%set (gcf,'paperposition',[0.5 0 2.5,1.5]); % IMPORTANT to shrink eps size for readable fonts +%print('-color','-depsc2', '-tight','-S200,120', 'fields_before_after_cell_normalized.eps') +print('-color','-depsc2', 'fields_before_after_cell_normalized.eps') + +fid_stamp=fopen ("pp_I2.stamp", "a+"); +fclose (fid_stamp); diff --git a/xmds2/realistic_Rb/realistic_Rb.xmds b/xmds2/realistic_Rb/realistic_Rb.xmds index 598715f..3f558bb 100644 --- a/xmds2/realistic_Rb/realistic_Rb.xmds +++ b/xmds2/realistic_Rb/realistic_Rb.xmds @@ -521,10 +521,10 @@ <integration_vectors>E_field</integration_vectors> <dependencies>density_matrix</dependencies> <![CDATA[ - dE1_dz = 0.16666666666666666*eta1*(2.449489742783178*r0309 + 4.242640687119286*r0410 + 6.*r0511) - Lt[E1]; - dE2_dz = -0.8164965809277261*eta1*(r0709 + r0810) - Lt[E2]; - dE3_dz = -1.*eta2*(1.7320508075688772*r0614 + 3.*r0715 + 4.242640687119286*r0816) - Lt[E3]; - dE4_dz = (4*eta2*(2.449489742783178*r0113 + 3*r0214 + 3*r0315 + 2.449489742783178*r0416))/3. - Lt[E4]; + dE1_dz = i*0.16666666666666666*eta1*(2.449489742783178*r0309 + 4.242640687119286*r0410 + 6.*r0511) - Lt[E1]; + dE2_dz = -i*0.8164965809277261*eta1*(r0709 + r0810) - Lt[E2]; + dE3_dz = -i*1.*eta2*(1.7320508075688772*r0614 + 3.*r0715 + 4.242640687119286*r0816) - Lt[E3]; + dE4_dz = i*(4*eta2*(2.449489742783178*r0113 + 3*r0214 + 3*r0315 + 2.449489742783178*r0416))/3. - Lt[E4]; ]]> </operators> </integrate> |