-
Notifications
You must be signed in to change notification settings - Fork 217
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
Specialize ADK for linear or circular laser polarization #1541
Specialize ADK for linear or circular laser polarization #1541
Conversation
Compiles and runs. |
+1 |
Could you check
|
Sadly not all laser profiles are using this enum type, yet. Until then I thought it's better to have two independent realizations of ADK. |
you mix British and American english in |
my apologies 🙇 ... it's an internal conflict |
float_X dFromADK = math::pow(dBase,nEff); | ||
|
||
/* factor from averaging over one laser cycle with LINEAR polarization */ | ||
float_X polarizationFactor = math::sqrt(float_X(3.0) * util::cube(nEff) * eInAU / (pi * util::cube(protonNumber))); |
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.
since this line is the only difference between AlgorithmADKCircPol
and AlgorithmADKLinPol
, but the code for AlgorithmADKLinPol
takes about 120 additional lines, could you create a AlgorithmADKPol<...>
that takes a template argument to switch between both cases? That would reduce the code duplication dramatically.
bddcab1
to
ec81d7a
Compare
I now pass a boolean value as a template parameter that activates the calculation of the additional polarization factor for linear polarization or leaves it out for circular polarization. As we discussed offline before: we cannot just check for the polarization so easily because the laser could be initialized via an HDF5 input file. |
@@ -82,8 +85,21 @@ namespace ionization | |||
float_X dBase = float_X(4.0) * util::cube(protonNumber) / (eInAU * util::quad(nEff)) ; | |||
float_X dFromADK = math::pow(dBase,nEff); | |||
|
|||
float_X polarizationFactor; | |||
/* set up the polarization factor */ | |||
if(T_linPol) |
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.
This is still a run-time decision thus is not as efficient as possible.
Just use:
float_X polarizationFactor = TEMPLATE_PARAM::polarizationFactor;
with a struct containing the value not just a bool.
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.
The value is not const
so I cannot just calculate it during compile time (it depends on the ionization potential and the electric field strength). Nevertheless, it is known if the bool is true
or false
during compile time. Therefore the compiler should optimize the code in such a way that the unnecessary code vanishes.
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.
@psychocoderHPC
your verdict?
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.
@PrometheusPi Your suggestion is not possible because like @n01r said the factor is only known at runtime.
A possible solution would be to add a functor for the factor calculation but it is a little bit complicated because of the needed input values.
My suggestion: (small design change)
/* ionization rate */
float_X rateADK = polarizationFactor \
* eInAU * util::square(dFromADK) / (float_X(8.0) * pi * protonNumber) \
* math::exp(float_X(-2.0) * util::cube(protonNumber) / (float_X(3.0) * util::cube(nEff) * eInAU));
if(T_linPol)
{
/* factor from averaging over one laser cycle with LINEAR polarization */
const float_X polarizationFactor = math::sqrt(float_X(3.0) * util::cube(nEff) * eInAU / (pi * util::cube(protonNumber)));
rateADK *= polarizationFactor;
}
Then the code is better readable.
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.
👍 Yep, looks good to me. I think it's okay to stay away from overcomplicating things and not introduce a new functor for this.
ec81d7a
to
bf007af
Compare
@@ -82,11 +85,23 @@ namespace ionization | |||
float_X dBase = float_X(4.0) * util::cube(protonNumber) / (eInAU * util::quad(nEff)) ; | |||
float_X dFromADK = math::pow(dBase,nEff); | |||
|
|||
/* factor for CIRCULAR polarization */ | |||
float_X polarizationFactor = float_X(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.
please remove this line as discussed offline
physics looks OK to me 👍 |
bf007af
to
d2aae33
Compare
Added a boolean value that activates an additional polarization factor for linear polarization in `AlgorithmADK.hpp`.
d2aae33
to
71e3265
Compare
The ADK model has been updated so that now the user is given the choice between the linear and circular polarization case, according to Delone, Krainov 1998 Phys.-Usp. 41 469.