FDTD Solver / Free Electron Laser for ALPINE#289
FDTD Solver / Free Electron Laser for ALPINE#289manuel5975p wants to merge 34 commits intoIPPL-framework:masterfrom
Conversation
|
Update: Now everything is in the /fel directory |
|
There are still a few open comments from Sonali to be addressed. |
| /* 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.
See previous comment: "why is this commented? not needed?"
| // std::vector<FieldVector<scalar> > position_; | ||
| FieldVector<scalar> position_; | ||
|
|
||
| /* Number of macroparticles in each direction for 3Dcrystal type. */ |
There was a problem hiding this comment.
see previous comment: this 3D crystal type thing is inherited from mithra I assume? is it actually supported here? if so I would add some explanation of what it means
| // 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.
why is this commented? if not necessary, please remove
| /* Check the bunching factor. */ | ||
| if (bunchInit.bF_ > 2.0 || bunchInit.bF_ < 0.0) { | ||
| // 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.
this if is not doing anything
| // else | ||
| // return ( randomNumbers[ n * 2 * Np/ng + m ] ); | ||
| // TODO: Return halton properly | ||
| // return ( halton(n,m) ); |
There was a problem hiding this comment.
why commented? if not needed, remove
fel/FreeElectronLaser.cpp
Outdated
| if (std::isnan(iterQ->rnp[2])) { | ||
| std::cerr << iterQ->gb[2] << ", " << g << ", " << iterQ->rnp[2] << ", " << bunch_.zu_ | ||
| << ", " << frame_beta << "\n"; | ||
| std::cerr << __FILE__ << ": " << __LINE__ << " OOOOOF\n"; |
There was a problem hiding this comment.
this error message should be more informative
| for (auto iterQ = chargeVectorn_.begin(); iterQ != chargeVectorn_.end(); iterQ++) { | ||
| Double g = std::sqrt(1.0 + iterQ->gb.squaredNorm()); | ||
| if (std::isinf(g)) { | ||
| std::cerr << __FILE__ << ": " << __LINE__ << " inf gb: " << iterQ->gb << ", g = " << g |
There was a problem hiding this comment.
this error message should be more informative, unless it's just there for debug purposes
There was a problem hiding this comment.
Where is this Matrix type used? Is this a replacement of the ippl::Vector<ippl::Vector<T,3>,3> type normally used as Matrix_t in the solvers?
There was a problem hiding this comment.
Used in the struct LorenzFrame, which is not used anywhere in the code in fel.
Do we want this struct and this type in ippl?
There was a problem hiding this comment.
still needs to be divided into .h and .hpp, if we have decided to still go with that structure
There was a problem hiding this comment.
Devided in to FDTDSolverBase, StandardFDTDSolver and NonStandardFDTDSolver, all with .h and .hpp file
fel/NSFDSolverWithParticles.h
Outdated
| // return pear<ippl::Vector<int, 3>, ippl::Vector<T, 3>>{ippl::Vector<int, 3>{5,5,5}, | ||
| // ippl::Vector<T, 3>{0,0,0}}; printf("%.10e, %.10e, %.10e\n", (inverse_spacing * | ||
| // spacing)[0], (inverse_spacing * spacing)[1], (inverse_spacing * spacing)[2]); |
There was a problem hiding this comment.
commented stuff is just for debug purposes or necessary to keep?
fel/NSFDSolverWithParticles.h
Outdated
| for (unsigned k = 0; k < 3; k++) { | ||
| fracpos[k] = gridpos[k] - (int)ipos[k]; | ||
| } | ||
| // TODO: NGHOST!!!!!!! |
There was a problem hiding this comment.
please make this TODO more informative
fel/NSFDSolverWithParticles.h
Outdated
| // printf("Scatterdest: %.4e, %.4e, %.4e\n", from_grid.second[0], from_grid.second[1], | ||
| // from_grid.second[2]); | ||
| for (int d = 0; d < 3; d++) { | ||
| // if(abs(from_grid.first[d] - to_grid.first[d]) > 1){ | ||
| // std::cout <<abs(from_grid.first[d] - to_grid.first[d]) << " violation " << | ||
| // from_grid.first << " " << to_grid.first << std::endl; | ||
| // } | ||
| // assert(abs(from_grid.first[d] - to_grid.first[d]) <= 1); | ||
| } | ||
| // const uint32_t nghost = g.nghost(); | ||
| // from_ipos += ippl::Vector<int, 3>(nghost); | ||
| // to_ipos += ippl::Vector<int, 3>(nghost); |
There was a problem hiding this comment.
what is this doing? remove if not necessary anymore
There was a problem hiding this comment.
add more comments in general
| FourField A_n; | ||
| FourField A_np1; | ||
| FourField A_nm1; | ||
| scalar dt; |
There was a problem hiding this comment.
Previous review comment still applies: Are these attributes supposed to be public?
It would also make the code more readable to have them at the end of the code block (like in the first public block you have the attributes at the end before the private).
There was a problem hiding this comment.
These are protected variables in FDTDSolverBase now.
| * @tparam FourField | ||
| */ | ||
| template <typename EMField, typename FourField, fdtd_bc boundary_conditions = periodic> | ||
| class NonStandardFDTDSolver : Maxwell<EMField, FourField> { |
There was a problem hiding this comment.
add more comments to this class / documentation
| return ret; | ||
| } | ||
| template <typename view_type, typename scalar> | ||
| KOKKOS_FUNCTION void scatterToGrid(const ippl::NDIndex<3>& ldom, view_type& view, |
There was a problem hiding this comment.
comment from previous review still applies: the scatter is repeated here and also in the FreeElectronLaser.cpp, would be nice to avoid this by putting it in some common file maybe.
|
I am done with my comments. But it seems this branch may still have some conflicts that need to be resolved. |
Open questions
Design