Add FEL simulation#555
Conversation
…o, extended tests to include multiple particles.
…cted simulation config parameters.
…el/, fix default config path
|
Please add @s-mayani as reviewer |
| /* Type of the bunch which is one of the manual, ellipsoid, cylinder, cube, and 3D-crystal. If | ||
| * it is manual the charge at points of the position vector will be produced. | ||
| */ | ||
| // std::string bunchType_; |
There was a problem hiding this comment.
why is this commented? remove if not used
| FieldVector<scalar> initialDirection_; | ||
|
|
||
| /* Position of the center of the bunch in the unit of length scale. */ | ||
| // std::vector<FieldVector<scalar> > position_; |
| FieldVector<scalar> betaVector_; | ||
|
|
||
| /* Initialize the parameters for the bunch initialization to some first values. */ | ||
| // BunchInitialize (); |
| */ | ||
| Double e; | ||
|
|
||
| // Charge(); |
| // printmessage(std::string(__FILE__), __LINE__, std::string("Warning: The number of | ||
| // particles in the bunch is not a multiple of four. ") + | ||
| // std::string("It is corrected to ") + std::to_string(bunchInit.numberOfParticles_) ); |
There was a problem hiding this comment.
you could also print this in an IPPL inform message, and uncomment it
| // printmessage(std::string(__FILE__), __LINE__, std::string("The bunching factor can not be | ||
| // larger than one or a negative value !!!") ); exit(1); |
There was a problem hiding this comment.
can uncomment this and turn it into an IpplException
| // if ( bunchInit.generator_ == "random" ) | ||
| return (randomNumbers.at(n * 2 * Np / ng + m)); | ||
| // else | ||
| // return ( randomNumbers[ n * 2 * Np/ng + m ] ); | ||
| // TODO: Return halton properly | ||
| // return ( halton(n,m) ); |
There was a problem hiding this comment.
remove all the commented code here (do we really need halton rng? )
| } | ||
|
|
||
| /* If the longitudinal type of the bunch is uniform a tapered part needs to be added to remove | ||
| * the CSE from the tail of the bunch. |
There was a problem hiding this comment.
change the CSE to full form of the acronym
s-mayani
left a comment
There was a problem hiding this comment.
Left some minor comments to be addressed
|
cscs-ci run cscs-ci-gh200, cscs-ci-mi300, cscs-ci-openmp |
The deposition kernel applies a half-cell shift before computing CIC weights:
gp = (mid - origin) / h - 0.5
This was introduced so current deposition uses the same centering convention as
the field gather on the cell-centered UniformCartesian grid. With that shift,
a particle segment whose midpoint is at the geometric cell center no longer
splits uniformly over the surrounding 2^Dim nodes. Instead, it lands exactly on
the shifted node location.
The exact-value unit test still used the older unshifted convention:
gp = (mid - origin) / h
This made the test expect, for example, a 2D x-directed segment from 0.25 to
0.75 at y=0.5 to deposit
Jx = 0.125
on each of four neighboring nodes. The current kernel correctly deposits the
full
Jx = 0.5
on the shifted node and zero on the other three nodes. This mismatch caused
TestCurrentDeposition to fail for all 2D and 3D typed exact-value cases.
This change updates the expected tables and comments in
TestCurrentDeposition.cpp for the half-cell-shifted convention:
Verification:
- Built TestCurrentDeposition
- Ran TestCurrentDeposition via CTest: passed
- Ran full OpenMP unit_tests CTest tree: 35/35 passed
|
cscs-ci run cscs-ci-gh200, cscs-ci-mi300, cscs-ci-openmp |
|
cscs-ci run cscs-ci-gh200, cscs-ci-mi300, cscs-ci-openmp |
1 similar comment
|
cscs-ci run cscs-ci-gh200, cscs-ci-mi300, cscs-ci-openmp |
|
This test was failing at CSCS and local on my laptop. Lets see if I can find earlier tests at CSCS that passed. |
|
At cscs #555 did never pass all tests (https://my.cdash.org/queryTests.php?project=IPPL&date=2026-06-30&filtercount=2&showfilters=1&filtercombine=and&field1=status&compare1=62&value1=passed&field2=buildname&compare2=63&value2=555) Bit still it could be a side effect of an other commit. |
Okay I see, but I am still confused since the current projection was merged in a separate PR which did pass tests. |
|
Pushed the cleanup from @s-mayani comments. Thank you very much for fixing the tests numbers @aaadelmann! Looks all correct to me. A bit of explanation: At the time when the current deposition was merged previously, I was still thinking that the solver was using a staggered grid, so I wrote the deposition for that. Then it turned out that this was not the case, so I had to change to the colocated grid. When I later fixed a half-cell off bug, I forgot to update the tests accordingly. Do we want to keep the staggered version for future use (If yes I will re-add it and its tests), or keep only the colocated one which is what the Maxwell solver uses? |
|
Yes push the other test too! |
Summary
fel/, built with-DIPPL_ENABLE_FEL=ON.It runs an FDTD/PIC simulation of a relativistic electron bunch through an
undulator in a co-moving Lorentz frame and writes the forward radiated power to CSV
(with an optional Poynting-flux video).
Build & run
Notes
MITHRA (A. Fallahi, GPL).
fel/README.md.