Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make from_file and other laser init compatible #1144

Closed
wants to merge 33 commits into from

Conversation

huixingjian
Copy link
Contributor

@huixingjian huixingjian commented Aug 2, 2024

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 be gaussian. And another two options are parser 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.

@huixingjian huixingjian changed the title Make from_file and other laser init compatible [WIP]Make from_file and other laser init compatible Aug 2, 2024
@huixingjian huixingjian changed the title [WIP]Make from_file and other laser init compatible Make from_file and other laser init compatible Aug 2, 2024
@huixingjian
Copy link
Contributor Author

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
Screenshot 2024-08-05 at 19 27 08

@AlexanderSinn AlexanderSinn added the component: laser envelope About the laser envelope solver label Aug 7, 2024
@MaxThevenet MaxThevenet self-requested a review September 4, 2024 13:55
@huixingjian huixingjian closed this Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: laser envelope About the laser envelope solver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants