-
Notifications
You must be signed in to change notification settings - Fork 70
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
Momentum Diffusion #444
Momentum Diffusion #444
Conversation
src/module/MomentumDiffusion.cpp
Outdated
return; // Only charged particles | ||
} | ||
|
||
double p = c->current.getEnergy()/c_light; // Note we use E=p/c (relativistic limit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces:
getEnergy() / c_light
src/module/MomentumDiffusion.cpp
Outdated
double BScal = calculateBScalar(); | ||
|
||
double dp = AScal * dt + BScal * domega; | ||
c->current.setEnergy((p + dp)*c_light); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add spaces between parenthesis and c_light.
src/module/MomentumDiffusion.cpp
Outdated
} | ||
|
||
double ConstantMomentumDiffusion::calculateAScalar(double p) const { | ||
double a = + 2./p * Dpp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow CRPropa convention and add white spaces around /
src/module/MomentumDiffusion.cpp
Outdated
std::string ConstantMomentumDiffusion::getDescription() const { | ||
std::stringstream s; | ||
s << "limit: " << limit << "\n"; | ||
s << "Dpp: " << Dpp / (meter*meter/second) << " m^2/s"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add white spaces, following CRPropa's convention.
using namespace crpropa; | ||
|
||
ConstantMomentumDiffusion::ConstantMomentumDiffusion(double Dpp) { | ||
setLimit(0.1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make sense to allow the user to control the limit, as done in the other modules?
Hi @lukasmerten |
…limit in ConstantMomentumDiffusion
@rafaelab I adressed all your style convention comments and added a new constructor that allows for direct setting of the limit parameter. Let me know if there is anything else that needs to be done. |
This is a rewrite of the content of PR #279, which will be closed.
The module introduces a momentum diffusion module, that allows to treat 2nd order Fermi acceleration in the ensemble averaged picture. It is meant to be used together with the DiffusionSDE module. In the future the module can be extended to include more complicated dependencies of the momentum diffusion scalar.
Unit tests and documentation / example code are included.