Skip to content

srwl_wfr_emit_prop_multi_e useTermin issues #55

@maltissimo

Description

@maltissimo

The issue I have is with the srwl_wfr_emit_prop_multi_e method inside srwlib.py.

This the function that Oasys calls when a multi-electro propagation script is generated[ (see attached file as an example].

test5e-.yp.py

The issue is that, when I try to simulate either radiation from a bending magnet, or from an arbitrary Mag Field for that matter, I get this error:


WarningWarning: Computation of terminating terms of radiation integrals WAS NOT PERFORMED for some values of input parameters
because asymptotic expansion validity criterion was not satisfied. This may influence the accuracy of the computation.
One can try to fix the problem by modifying Magnetic Field definition range and/or Integration limits.

And this is regardless of whether I checked or not the corresponding box in Oasys.
This happens when the call

srwl.CalcElecFieldSR(wfr, 0, _mag, arPrecParSR)

Is executed inside the multi-electron propagation function ( line 9322 of swrlib.py). At first, I though that the arPrecParSR array was wrongly defined in Oasys, but upon digging, it seems that it is defined as:

arPrecParSR = [_sr_meth, _sr_rel_prec, 0, 0, 50000, 1, _sr_samp_fact] #to add npTraj, useTermin ([4], [5]) terms as input parameters ( line 8878)

So regardless of what I ask from Oasys, the array is set in stone and cannot be changed at call time.

Here’s the question: would it be possible to add those numbers (i.e. npTraj and useTermin) as user-definable parameters in the main call of srw_wfr_emit_propp_multi_e ? I was thinking something along the lines of :

def srwl_wfr_emit_prop_multi_e(_e_beam, _mag, _mesh, _sr_meth, _sr_rel_prec, _n_part_tot, _n_part_avg_proc=1, _n_save_per=100,
_file_path=None, _sr_samp_fact=-1, _opt_bl=None, _pres_ang=0, _char=0, _x0=0, _y0=0, _e_ph_integ=0,
npTraj = 50000, useTermin = 1……..)

This would allow to run multi electron simulations with bending magnets and arbitrary, 3D fields. At the same time, it would preserve the defaults of line 8878. Not too sure whether this is correct, and definitely not too sure about the full implications of this

Happy to help anyway I can.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions