Closed nickgoldring closed 1 year ago
@nickgoldring -- you've requested 6 reviewers for this PR Please reduce this down to the 1 or 2 people that you expect to review it
@nickgoldring -- you've requested 6 reviewers for this PR Please reduce this down to the 1 or 2 people that you expect to review it
I reduced it to @k-wolfinger and @gurhar1133. We weren't clear on the distinction between Reviewers and Assignees. We did want to follow @gurhar1133's request to alert folks when the API is changing.
@gurhar1133 The tests aren't passing, specifically: rslaser/tests/element_test.py/crystal_slice_prop_test("default")
gives TypeError: propagate() takes from 2 to 3 positional arguments but 4 were given
.
I'm not sure on the fix, can you take a look?
@gurhar1133 The tests aren't passing, specifically:
rslaser/tests/element_test.py/crystal_slice_prop_test("default")
givesTypeError: propagate() takes from 2 to 3 positional arguments but 4 were given
.I'm not sure on the fix, can you take a look?
Working on it 👍
Looks good to me also. I think we can merge now.
@bnash and I implemented the nonlinear kick functionality into the rslaser API. Each of the propagators contains a flag for
nl_kick
which enables the user to toggle on and off the nonlinear kick effect for a given propagation. The nonlinear kick is applied following the specified linear propagation for each crystal slice. Specifically, thenl_kick()
function in crystal.py takes a $\delta n$ array, interpolates it onto the incoming wavefront mesh and then multiplies it by the wavefront. Thus, the input $\delta n$ array mesh can be different from the wavefront mesh, similarly to what is done in the gain propagator.With help from @gurhar1133, we edited the crystal object parameters in order to allow for a 3D $\delta n$ array (2D distribution for each slice) as required by the nonlinear kick algorithm.
A demonstration of the nonlinear kick effect using the rslaser API may be found here: https://github.com/radiasoft/rslaser_scratch/blob/main/notebooks/wavefront/nonlinear_kick06_benchmark.ipynb
The corresponding thermal simulation that produces the 3D $\delta n$ array may be found here: https://github.com/radiasoft/rslaser_scratch/blob/main/notebooks/thermal/rslaser_fenics_nonlinear_delta_n04.ipynb
@bnash, @gurhar1133, @dtabell, @k-wolfinger, @bruhwiler: Please note that significant changes have been made to crystal.py and these may need to be reconciled with recent changes made by others.