Open QJohn2017 opened 6 years ago
Hi @QJohn2017, this error warns you that the retarded time of one of your particles with regard to a specific observation direction does not increase between two iteration-/time-steps. This can have two reasons:
While the first case is a real error in the initial simulation code creating the trajectory data, the second is a common warning that you reached the limit of numerical precision of either your input data or of Clara2 (double precision floats). Since you are using the well tested Vorpal code and since the warning states no decrease in time, this looks like the second case to me and can be safely ignored. Clara2 just does not perform an interpolation between these two iterations because numerically they appear to be equal.
@QJohn2017 Please excuse that I had no time to further investigate the factor~2 discrepancy between expected radiation frequency and output. Could you find a reason for this discrepancy?
Hi @PrometheusPi , You said that the errors occurred in my spectrum calculation are look like the second case above and can be ignored. But I have tried many times and the errors always existed and the output file "my_spectrum_data000*.dat" related to the "wrong" trajectories can not be created. The attachments are two sample trajectories of mine. The "data_1.txt" is a "wrong" trajectory that had errors when running, the other trajectory "data_66.txt" is normal for running and can create the output file "my_spectrum_data00066.dat". So, can you help me to check it ? The propagation is x direction.** data_1.txt data_66.txt
@PrometheusPi , sorry, i could not find the reason for this ~2 discrepancy.
Hi @PrometheusPi , Recently, I have tested the clara2 code again and I founded that this code is right and there is no ~2 times discrepancy. I tested a head-on inverse Compton scatter, in which the a0 = 1.0, wavelength= 0.8um, and the gamma = 600. Therefore, the undulator_wavelength=0.4um , and K = a0 = 1.0. the scatter frequency= 2.26e21 Hz. When I calculated this spectrum by clara2 code, the result is right and there is no ~2 times discrepancy. So, I think your code is right and the ~2 times discrepancy before may came from my own claculation fault. Thank you for focusing this question.
@QJohn2017 Great you found the time to validate the code with a test case. I am very sorry - I could not find the time to further test clara2 - I was occupied with other projects.
Would you be willing to upload your test case (the code that generated your test trajectories) as a pull request to this repository so that other users have can generate an example to start from?
Were you able to determine the cause of the factor 2 error in your trajectories? (I hope so.)
@PrometheusPi , Sorry that I was busy in recent days. The attachment file is the code that generated my trajectory, you can check it and test it, if there are any errors or problem, you can contact me at any time.
The namelist.example
is my input file, you can set the laser intensity and the undulator intensity. The *.txt
is my initial particles' distribution, you can modify the output format in interaction.cpp
file, the element.cpp
file is the electromagnetic field and undulator field.
modu_trajectory.zip
@QJohn2017 Thank you for providing your code for computing the trajectories. I already had a brief look at the source code. It looks very sophisticated and advanced. I have seen you include some header files that I also found online. Which license does your source code (including the Bessel functions) have and will this conflict with the GNU3 license we use for Clara2?
@QJohn2017 No reason to apologize - you always react very quickly. I am the one who needs weeks to answer questions and find a solution. Thanks again for your feedback and support.
@PrometheusPi , I don't know whether the GNU3 license conflict with the Clara2, but i think it is ok ! Actually, the codes I provided are downloaded from the Github, I just made some modifications and improvements. I am anxious for your advice and improvement. Thank you !
@QJohn2017 Please excuse my imprecise question: Clara2 is under the GNU3 license. Under which license are your code and the code you found on GitHub?
@PrometheusPi , sorry, i don't have any license for my code, but the license of the code i found on GitHub is located at https://github.com/archman/felscripts/tree/master/felsim/scripts/src
@QJohn2017 Thank you for the link. The code seems to be under GNU2 license, so that should be fine. Would you agree, if I add your code changes to this public Clara2 repository?
@steindev are you by accident familiar with the FEL code the trajectory generator is based on?
@ax3l are there any license issues when using GNU2 code in a GNU3 project?
I don't know it. And it is not an FEL Code.
@PrometheusPi , I am very glad that you can add the code I provided to Clara2.
are there any license issues when using GNU2 code in a GNU3 project?
As long as it's GPLv2+ and not GPLv2-only there should be no problem. The repo you link is a bit wildly structured, but looks like overall using the usual GPLv2+ license text.
@ax3l Thanks for your expertise :+1:
Hi @PrometheusPi , when I use the clara2 code to calculate the radiation spectrum from some electron trajectories which tracked by Vorpal code. I have 141 number particles, when I calculate the spectrum by clara2 code, some errors were raised at some electron trajectories, but the other trajectories had no errors. The errors are recorded by the file "my_error.txt-...". the error is as follows:
So, I don't know how to avoid this error, could you help me? Thank you very much!