-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow tracking of subset of particles filtered by energy range #16
base: master
Are you sure you want to change the base?
Conversation
These were inadvertently removed in commit bcc5e0a
@@ -21,7 +24,7 @@ module Rangerclass | |||
!> find the range (minimum and maxium of a single bunch) and the centroid | |||
!> of a single beam bunch. | |||
!-------------------------------------------------------------------------------------- | |||
subroutine singlerange(partcls,nplc,nptot,range,center) | |||
subroutine singlerange_standard(partcls,nplc,nptot,range,center) |
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 singlerange
subroutine has not been modified apart from being renamed.
The new functionality is all in the new singlerange_filtered
subroutine.
!> of a single beam bunch, filtering for a certain momentum range. | ||
!-------------------------------------------------------------------------------------- | ||
subroutine singlerange_filtered(partcls,nplc,nptot,range,center,& | ||
fmin, fmax, frange, fcenter, fnptot) |
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 new subroutine contains all the same code as the original subroutine, but with additional ranges and particle counts calculated for the particles filtered by energy range.
The results for singlerange_filtered(partcls,nplc,nptot,range,center,…)
should match exactly the results for singlerange_standard(partcls,nplc,nptot,range,center)
, but also return the additional values fmin, fmax, frange, fcenter, fnptot
.
src/Contrl/AccSimulator.f90
Outdated
FlagEnergyRange = 1 | ||
filter_min = 95.0e6 ! eV | ||
filter_max = 105.0e6 ! eV | ||
|
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 reading of values from input file is in the next commit.
ptrange,sgcenter) | ||
if(FlagEnergyRange == 1) then | ||
fmin = sqrt((1.0d0 + filter_min/Ebunch(ib)%mass)**2 - 1.0d0) | ||
fmax = sqrt((1.0d0 + filter_max/Ebunch(ib)%mass)**2 - 1.0d0) |
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 converts the energy range to a momentum range.
distance = zcent*Scxlt | ||
dzz = sqrt(1.0d0-1.0d0/gammazavg**2)*Clight*dtless*Dt | ||
if(FlagEnergyRange == 1) then | ||
call globalrange(frange, fgrange, fgammaz, fzcent, fnp, ibunch) |
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.
Main values grange, gammazavg, zcent
are not modified, here we use globalrange()
to calculate new filtered values just for the purpose of setting distance
and zzz
@@ -386,7 +390,7 @@ subroutine in2_Input(onblem,oblength,obnseg,obmpstp,& | |||
|
|||
end subroutine in2_Input | |||
|
|||
!> Input all parameters except beam line element parameters. | |||
!> Input parameters for subsequent bunches. |
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.
Not related to energy filtering, just clarifying the different subroutines in this module.
not sure about this modification. It looks like that the energy filter range was hard-wired in the code. |
It was, but it no longer is. I worked on this feature in two stages, so in commit a572779 the range was hard-coded, but in commit 4781d70 this hard-coded range is removed and the range is read from the input file. If you squash the two commits, the hard-coded range will not be there any more. Perhaps I should have done this before submitting the pull request. |
For beamlines with wide energy spread, such as laser-driven accelerators, it is helpful to be able to base output on a smaller energy range.
This pull request adds extra options to the input file to set a flag to switch on the filtering and define the lower and upper bounds of the target energy range.
Then the distance travelled by the bunch is calculated based on the filtered range rather than the full range of particles.