Closed Hector-Mauricio-Castaneda-Cortes closed 7 years ago
Dear Hector,
Thank you very much for helping us to make ocelot great! (again) =) At the moment the development of the Ocelot adaptor is focused in iagapov/ocelot/dev_gen branch. The code discussed looks like this:
if out('dgrid') == 0:
rbeam = sqrt(out('rxbeam')**2 + out('rybeam')**2)
ray = sqrt(out('zrayl') * out('xlamds') / np.pi * (1 + (out('zwaist') / out('zrayl')))**2)
out.leng = out('rmax0') * (rbeam + ray)
else:
out.leng = 2 * out('dgrid')
out.ncar = int(out('ncar')) # number of mesh points
#universal solution?
out.leng=out('meshsize')*(out.ncar-1)
We have also found this bug only recently (I always use dgrid!=0) and decided to go for the most universal solution possible, that is to use the explicit mesh size value, provided in genesis *.out:
flags for output parameter 1 1 1 1 1 0 1 1 1 1 1 0 0 1 0 0 0 0 0 342 entries per record 762 history records 0.1831E-08 wavelength 0.1831E-07 seperation of output slices 101 number of gridpoints 0.1000E-04 meshsize 8192 number of particles 0 particle: records in z 0 particle: records in t
so that out.leng=out('meshsize')*(out.ncar-1)
Thanks again for letting us know, I'll fix the Rayleigh length calculation for the future!
Svitozar
Dear all:
I have found a bug in the function readGenesisOutput (/ocelot/adaptors/genesis.py), lines 890 and 891. If the input parameter dgrid is set to be 0, GENESIS uses the Rayleigh length and the waist of the beam to calculate the grid length. Currently, it is implemented as follows if out('dgrid')==0: rbeam=sqrt(out('rxbeam')2+out('rybeam')2) ray=sqrt(out('zrayl')out('xlamds')/np.pi(1+(out('zwaist')/out('zrayl')))2); out.leng=2out('rmax0')(rbeam+ray) However, if you compare the current implementation in OCELOT with the original implementation in GENESIS if ((dgrid.le.small).and.(zrayl.gt.0.)) then !grid size determined by beam size? rw0 = dsqrt((zraylxlamds/pi)(1.0d0+(zwaist/zrayl)2)) dgrid = rmax0*(rw0+dsqrt(rxbeam2+rybeam2))/2.d0 endif
You can see that there is a bug in the definition of the ray variable (it should be 1+((out ('zwaist')/out('zray'))2), instead of ( 1+(out ('zwaist')/out('zray')))2. The term that is squared is the ratio between the waist and the position of the source, not (1+(out ('zwaist')/out('zray')) Moreover, the out.leng attribute is taken as 2out(rmax0)(rbeam+ray). This definition implies that the grid is 4 times dgrid. According to the GENESIS documentation, the whole grid has a length of 2 dgrid ( it is defined between (-dgrid,dgrid)). Therefore, outl.leng should be out.leng = out('rmax0')*(rbeam+ray) In order to have the right size of the grid. This bug has an impact on the plotting of the dfl files, as the results show a larger grid compared to what was obtained in GENESIS (the size of the projection of the file distribution appears larger than it is due to the bug in the readOutputFile routine)
With best regards,
Hector Mauricio Castaneda Cortes STFC Daresbury Laboratory