K Dependence of flux density with sddsfluxcurve

Moderators: cyao, michael_borland

Post Reply
Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

K Dependence of flux density with sddsfluxcurve

Post by Faissal » 05 Mar 2018, 14:26

Dear all,

I am using sddsfluxcurve to calculate the angular flux density of several harmonics of an undulator in a non-zero emittance case.

I type:

Code: Select all



sddsfluxcurve VMX.twi out.twi -mode=density -harmonics=7 -method=dejus -electronBeam=current=0.3,coupling=0.03 -undulator=Period=0.022,numberOfPeriods=91,kmin=1,kmax=1.93095,points=100


I do get outputs, but I am puzzled by two things :

1/ the command line to compute the desired output takes the whole lattice file. I would have though that the flux density would depend of the particular values of the twiss parameters, as it is done is some other software, such as SPECTRA.

2/ There is no possibility to give an information on the distance from the source for the "density" case, only for the "pinhole" case. Is that normal?


any insight would be appreciated

regards,

- Faissal

(PS: i don't find sddsfluxcurve in the Unix version of Elegant, only in the Windows version: is there a Unix version of it?)

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: K Dependence of flux density with sddsfluxcurve

Post by michael_borland » 05 Mar 2018, 15:43

Faissal,

In answer to your two questions
  • sddsfluxcurve doesn't require the lattice functions for the full lattice. It uses only the final row of the file. It also uses various parameters in the file, such as emittance and energy spread, which are typically obtained from a calculation of the full lattice (or a periodic cell).
  • Since the computed flux density is the angular flux density, the distance does not enter into it. If you need the spatial flux density, divide by the distance squared using sddsprocess.
I'm not sure why it isn't in the Linux distribution. We'll fix that.

--Michael

Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

Re: K Dependence of flux density with sddsfluxcurve

Post by Faissal » 05 Mar 2018, 15:46

Thanks Michael for your prompt reply. This was definitely helpful. Just a last question: if sddsfluxcurve uses only the last row, how would it work if we want to compute the flux density emitted at a particular location of the lattice? Do I have to "rotate" the lattice in the twiss file?

regards,

- Faissal

soliday
Posts: 391
Joined: 28 May 2008, 09:15

Re: K Dependence of flux density with sddsfluxcurve

Post by soliday » 05 Mar 2018, 15:52

It looks like sddsfluxcurve is in the Linux RPMs. It should be at /usr/bin/sddsfluxcurve, if it isn't, let me know which version of the RPM you downloaded and I will run some tests on our development system to insure that it gets installed.

Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

Re: K Dependence of flux density with sddsfluxcurve

Post by Faissal » 06 Mar 2018, 04:43

Hi soliday

In the Unix version (at least, the one installed here), it is not present in the /usr/bin directory, however there is a *.c file in:

/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/oag/apps/src/elegant/sddsbrightness/sddsfluxcurve.c


also, since sddsfluxcurve takes only the last row of the lattice, how to use it with the twiss parameters of a specific location of the lattice? I mean, usually, undulators are not necessarily at the end of the accelerator. The only option I can think of at the moment is to modify the source code but I just wonder if there is a quicker way...

regards,

- Faissal

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: K Dependence of flux density with sddsfluxcurve

Post by michael_borland » 06 Mar 2018, 08:53

Faissal,

If you want to select a different location for the source of the flux calculations, just use SDDS process to pick out that location.
E.g.,
  • sddsprocess fullLattice.twi sourcePoint.twi -match=column,ElementName=ID27
would pick out the lattice functions at the element named ID27. Other quantities you might want to use for filtering (with the -filter option) are s (position in beamline) and ElementOccurence (1, 2, 3, ... for identically-named elements in a beamline).

--Michael

Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

Re: K Dependence of flux density with sddsfluxcurve

Post by Faissal » 06 Mar 2018, 12:32

Dear Michael and Bob

Many thanks, using the sddsprocess does work indeed.

At this stage I can proceed with the work I was doing....on Windows, but I have a final question for "documentational purpose". Since the sddsfluxcurve executable is not present (or, does not seem) in my Unixdistribution, I have tried two approaches:



1/ compile an executable "by hand" starting from sddsfluxcurve.c, which is located in


/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/oag/apps/src/elegant/sddsbrightness/sddsfluxcurve.c

I type :

Code: Select all


gcc  sddsfluxcurve.c -o test.out -I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/include/ 
-I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/lzma/ 
-I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/include/ 
-lm -L /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/lib
 -L /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/lib 
 -I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/oag/apps/src/physics/ 
 -m64 -DzLib 
 -L/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/lib/linux-x86_64 
 -Wl,-rpath,/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/lib/linux-x86_64      
  -m64       -lmdbmth  -lSDDS1 -lmdblib -llzma  -lz -lpthread   -lreadline -lm -lrt -ldl -lgcc  
  -MMD -I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/lib/linux-x86_64/
   -L/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/lib/linux-x86_64 -Wl,-rpath,/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/lib/linux-x86_64       
   -m64            -lmdbcommon -lSDDS1 -lmdblib -llzma  -lz -lpthread   
   -lreadline -lm -lrt -ldl -lgcc 
   -I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/mdbmth 
   -I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/mdbmth/O.linux-x86_64/ 
   -lgfortran -I /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/fortran/ 
   -L /dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/fortran/

but somehow the "us" fortran module is not recognized, and I get the error message:

Code: Select all


/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/lib/linux-x86_64/libmdbcommon.a(scanargs.o): In function `processFilenames':
/dls_sw/prod/tools/RHEL6-x86_64/elegant/32-0-0/src/epics/extensions/src/SDDS/mdbcommon/O.linux-x86_64/../scanargs.c:557: warning: the use of `mktemp' is dangerous, better use `mkstemp'
/tmp/ccFOXJ28.o: In function `CalculateFlux':
sddsfluxcurve.c:(.text+0x3dcc): undefined reference to `us_'
sddsfluxcurve.c:(.text+0x4412): undefined reference to `us_'
sddsfluxcurve.c:(.text+0x4c55): undefined reference to `us_'


2/ I also tried another approach, by downloading the executable from the APS website. The executable is in the /usr/bin as you mentioned above. However when I run it, I get the error message:

Code: Select all


 $./sddsfluxcurve 
 
 $./sddsfluxcurve: error while loading shared libraries: libquadmath.so.0: cannot open shared object file: No such file or directory




and I was wondering if you had seen that kind of message before?

regards,

- Faissal

soliday
Posts: 391
Joined: 28 May 2008, 09:15

Re: K Dependence of flux density with sddsfluxcurve

Post by soliday » 06 Mar 2018, 12:52

It is not clear to me which operating system you are using. Our prebuilt version for RHEL6 does not have this dependency. If you are running RHEL7 and downloaded the elegant package for RHEL7 then you will need libquadmath. This is a RHEL system package. On a RHEL7 system you can install this with "yum install libquadmath.x86_64", it should have printed out a warning when installing the elegant RPM that this was missing.

Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

Re: K Dependence of flux density with sddsfluxcurve

Post by Faissal » 07 Mar 2018, 06:56

Hi Bob, you are absolutely right. I just fixed that and it now works !

thanks again to you both.

regards,

- Faissal

Post Reply