Closed huixingjian closed 1 month ago
With the input of
lasers.names = gaussian parser ff
lasers.lambda0 = 800e-9
lasers.solver_type = multigrid
lasers.MG_tolerance_rel = 1e-5
gaussian.a0 = 1.9
gaussian.position_mean = 0. 15e-6 0
gaussian.w0 = 20e-6
gaussian.L0 = 10e-6
parser.init_type = parser
gaussian.init_type = gaussian
ff.init_type = from_file
parser.laser_real(x,y,z)="2*exp(-(x^2+y^2)/W0^2-z^2/(2*clight^2*tau^2))*cos(-(6.28*z/800e-9))*
if(abs(z)<5e-7 and y >0,
if(y<(2.25*sqrt(abs(-(abs(z*1e6)-0.5)*(abs(z*1e6)+0.5))/(-(abs(z*1e6)-0.5)*(abs(z*1e6)+0.5))))/1e6,0,1),1)*
if(abs(z)>5e-7 and abs(z)<7.5e-7 and y >0,
if(y<(3*abs(z*1e6)+0.75*sqrt(abs(-(abs(z*1e6)-0.5)*(abs(z*1e6)-0.75))/(-(abs(1e6*z)-0.5)*(abs(z*1e6)-0.75))))/1e6,0,1),1)*
if(abs(z)>7.5e-7 and abs(z)< 1e-6 and y >0,
if(y<(9*sqrt(abs(-(abs(z*1e6)-1)*(abs(z*1e6)-0.75))/(-(abs(1e6*z)-1)*(abs(z*1e6)-0.75)))-8*abs(z*1e6))/1e6,0,1),1)*
if(abs(z)>1e-6 and abs(z)< 3e-6 and y >0,
if(y<(6*sqrt(10)/7+(1.5-0.5*abs(z*1e6))*sqrt(abs(abs(z*1e6)-1)/(abs(z*1e6)-1))-6*sqrt(10)*sqrt(4-(abs(1e6*z)-1)**2)/14)/1e6,0,1),1)*
if(abs(z)>3e-6 and abs(z) < 7e-6 and y>0,
if(y <(3*sqrt(1-(z*1e6/7)**2)*sqrt(abs(abs(z*1e6)-3)/(abs(z*1e6)-3)))/1e6,0,1),1)*
if(abs(z)>4e-6 and abs(z)<7e-6 and y<0,
if(y >(-3*sqrt(1-(z*1e6/7)**2)*sqrt(abs(abs(z*1e6)-4)/(abs(z*1e6)-4)))/1e6,0,1),1)*
if(abs(z)< 4e-6 and y <0,
if(y > (abs(z*1e6/2)-(3*sqrt(33)-7)*(z*1e6)**2/122-3.1+sqrt(1-(abs(abs(z*1e6)-2)-1)**2))/1e6,0,1),1)"
parser.laser_imag(x,y,z)="2*exp(-(x^2+y^2)/W0^2-z^2/(2*clight^2*tau^2))*sin(-(6.28*z/800e-9))*
if(abs(z)<5e-7 and y >0,
if(y<(2.25*sqrt(abs(-(abs(z*1e6)-0.5)*(abs(z*1e6)+0.5))/(-(abs(z*1e6)-0.5)*(abs(z*1e6)+0.5))))/1e6,0,1),1)*
if(abs(z)>5e-7 and abs(z)<7.5e-7 and y >0,
if(y<(3*abs(z*1e6)+0.75*sqrt(abs(-(abs(z*1e6)-0.5)*(abs(z*1e6)-0.75))/(-(abs(1e6*z)-0.5)*(abs(z*1e6)-0.75))))/1e6,0,1),1)*
if(abs(z)>7.5e-7 and abs(z)< 1e-6 and y >0,
if(y<(9*sqrt(abs(-(abs(z*1e6)-1)*(abs(z*1e6)-0.75))/(-(abs(1e6*z)-1)*(abs(z*1e6)-0.75)))-8*abs(z*1e6))/1e6,0,1),1)*
if(abs(z)>1e-6 and abs(z)< 3e-6 and y >0,
if(y<(6*sqrt(10)/7+(1.5-0.5*abs(z*1e6))*sqrt(abs(abs(z*1e6)-1)/(abs(z*1e6)-1))-6*sqrt(10)*sqrt(4-(abs(1e6*z)-1)**2)/14)/1e6,0,1),1)*
if(abs(z)>3e-6 and abs(z) < 7e-6 and y>0,
if(y <(3*sqrt(1-(z*1e6/7)**2)*sqrt(abs(abs(z*1e6)-3)/(abs(z*1e6)-3)))/1e6,0,1),1)*
if(abs(z)>4e-6 and abs(z)<7e-6 and y<0,
if(y >(-3*sqrt(1-(z*1e6/7)**2)*sqrt(abs(abs(z*1e6)-4)/(abs(z*1e6)-4)))/1e6,0,1),1)*
if(abs(z)< 4e-6 and y <0,
if(y > (abs(z*1e6/2)-(3*sqrt(33)-7)*(z*1e6)**2/122-3.1+sqrt(1-(abs(abs(z*1e6)-2)-1)**2))/1e6,0,1),1)"
ff.input_file=/p/scratch/plasmadiy/janhui/read_file_test/from_file/diags/hdf5/openpmd_000000.h5
ff.iteration = 0
three lasers could be generated
This PR intends to fix the confliction that no user-defined laser could be generated when reading laser from file.
Combining with PR #1122 and PR #866, the code can now initialise multiple lasers by parser\gaussian\from_file.
-The default option of
<laser name>. init_type
would begaussian
. And another two options areparser
from_file
.Note that the central wavelength of all the lasers ought to be identical on current setting. An error will be raised if the value of
lasers.lambda0
doesn't equal to the wavelength loaded from file.