SmileiPIC / Smilei

Particle-in-cell code for plasma simulation
https://smileipic.github.io/Smilei
344 stars 120 forks source link

Reorganising of Mironov's for merge pull request into templates #741

Open GianlucaOberreit opened 2 months ago

GianlucaOberreit commented 2 months ago

This pull request combines the ionization models proposed in the for merge pull request by Arseny Mironov into a single template. This branch is a work in progress that needs to be tested and polished.

The template is give by template <int Model> class IonizationTunnel where Model=0 gives the original Smilei behaviour, Model=1 gives the new IonizationTunnelFullPPT model and so forth.

The main changes are that the monte carlo routine in the () operator overload method is pulled out into its own template method which is common to all the ionization models. This is template <int RateId> monteCarloRoutine. in this method, the class' Model template parameter is used to determine what ionization rate will be used, the ionization rate being the only difference within the routine between all the models. The RateId template parameter is needed to tell the monteCarloRoutine what rate to use in the case of the BSI model, which uses different rates depending on some values.

It is important to note that in the original implementation of the BSI model in the for merge branch in the src/Ionization/IonizationTunnelBSI.cpp file, at lines 146 (bsi-linear) and 235 (bsi-quadratic), there is i <= k_times+1 as opposed to the i < k_times+1 found in all the other ionization rates (including the tunnel in the same file, line 325). This change is not currently implemented, although it should be trivial. Neither Mironov nor I know why this is the case.

beck-llr commented 2 months ago

A .tex file and a .pdf files have been added to the repo in this branch. I think an important work is to rewrite the information contained in this document into the standard SMilei manual (in the understand section as well as in the namelist section).

beck-llr commented 2 months ago

The case tstAM_14_envelope_ionization_linear_polarization.py fails on error

[ERROR](0) src/Ionization/IonizationFactory.h:34 (create) The ionization model for species interacting with envelope is tunnel_envelope_averaged

There seems to be a problem with the handling of ionization in the presence of a laser envelope.

beck-llr commented 2 months ago

With the latest fix, all ionization tests of the CI passed.

beck-llr commented 2 months ago

All 1D and 2D standard CI tests passed as well. I will run some final performance tests and I think it is going to be ok for me.

beck-llr commented 2 months ago

I have tried a case where nitrogen 5+ is ionized. It has a laser intensity a0 = 3. WhenI switch from tunnel to tunnel_BSI there are no electrons created at all. This is extremely suspicious and needs to be investigated. This test case is available in /sps3/beck/smilei/benchmark_ionization.

beck-llr commented 2 months ago

I confirmed with an old executable that, even with tunnel_BSI there should be some electrons created by ionization. Therefore there is a problem with this templated version.

beck-llr commented 1 month ago

With these correction some electrons are ionized as expected. Differences are observed with the previous implementation though. This still needs to be clarified.