z-dependent core radius#99
Conversation
|
I believe this will almost already work for modal fields too. I think the only addition required is to make For the mode average, I think we should switch to propagating the flux rather than the field (as we do for modal problems). This will also remove some code as the But as a hack this looks OK. |
|
Now much less hacky with the switch to propagating the flux also for the mode average. This is implemented by still applying a scaling factor to the field before calculating the nonlinearity and changing the norm to include the inverse of this scaling factor. |
|
Now with analytical calculations for Aeff and N - execution time down from ~100-200 μs to <100 ns. Question: why do we limit TE/TM modes to m=1? As far as I can see, higher-order modes just have different |
|
What's the status of this? Is it no longer "hacky". |
|
I think there were a couple of small issues and the tests aren't quite comprehensive enough yet. Also all the examples need to be changed. And I guess we can unify |
| end | ||
| return energyfun | ||
| end | ||
| _energy_modal(t, Et::Array{T, N}) where T <: Real where N = _energy_modal(t, Maths.hilbert(Et)) |
There was a problem hiding this comment.
I'm not sure about this. It makes everything very neat but relies on envelope fields actually being complex--which they are not necessarily, at least at the beginning of the propagation. Hence the fixtype function in Luna. What do you think?
There was a problem hiding this comment.
I think it is OK, but see my comment below
|
We now have analytical Another quick review would be good, but then I think this is actually ready to go |
|
One thing I haven't done is actually implement the z-dependent dimensions for |
|
Not immediately, but it would be useful. I'd be happy for this to be merged and an issue opened to track that. What actually needs to be done here? |
OK, I'll leave that to be fixed in #99
| aeff(z) = Modes.Aeff(m, z=z) | ||
|
|
||
| energyfun = NonlinearRHS.energy_mode_avg(m) | ||
| energyfun = NonlinearRHS.energy_modal() |
There was a problem hiding this comment.
Should we not just call this function energy given that it is now universal?
There was a problem hiding this comment.
it's not universal though, given that #85 is nearly ready too. I have to double check but we can probably call it energy anyway (this is a good idea) and just return the correct function depending on the arguments. I will probably change the energy calculation a bit anyway, for fast statistics and possibly for more universal inputs as well
jtravs
left a comment
There was a problem hiding this comment.
I've read through it again and this looks good. Moved on considerably from the "hacky" first attempt!
|
The gradient tests still fail for me even after merging this. |
|
I've tracked it down to the change in |
|
Test passes if, instead of doing this, function make_const_linop(grid::Grid.RealGrid, βfun!, αfun!, β1)
β = similar(grid.ω)
βfun!(β, grid.ω, 0)
α = similar(grid.ω)
αfun!(α, grid.ω, 0)
αlim!(α)
linop = @. -im*(β-β1*grid.ω) - α/2
linop[1] = 0
return linop
endSome weird floating-point error caused by dividing and dividing again, maybe. |
|
OK. |
Implements a slightly hacky version of varying the core radius in capillary modes. For the dispersion this works correctly (I think) and uses the same mechanism as I implemented for gradients. For the nonlinearity, at the moment I'm multiplying by a factor in
TransModeAvgto take into account the changing effective area. This means that the output field will also have to be rescaled after the propagation (I haven't implemented this).I have nothing to verify this with, but constant core radius reproduces the results in
test_main.jland a reducing radius does something plausible (RDW at shorter wavelength, shorter fission length)