Questions about DriftNegativeIon

Hello
I would like to confirm whether DriftLineRKF and AvalancheMC consider diffusion when simulating negative ion drift.

AvalancheMC does, DriftLineRKF does not.

When I use AvalancheMC DriftNegativeIon ( xe1, ye1, ze1, te1); the program will report an error " AvalancheMC: :Avalanche:Neither electron nor hole/ion component requested." However, when DriftLineRKF DriftNegativeIon ( xe1, ye1, ze1, te1 ) is used, the program can run.
Here are the key code.

   AvalancheMC *avalMC = new AvalancheMC();
    avalMC->SetSensor(&sensor);
    avalMC->EnableSignalCalculation(true);
    avalMC->UseWeightingPotential(true);
    avalMC->DisableAvalancheSizeLimit();


    DriftLineRKF *drift = new DriftLineRKF();
    drift->SetSensor(&sensor);
    drift->EnableNegativeIonTail(true);
    drift->EnableSignalCalculation(true);
    drift->SetMaximumStepSize(10e-4);

   for (unsigned int i = 0; i < nTracks; i++)
    {
        unsigned int netot = 0;
        tr->NewTrack(0, 0.8 * Ymax, 0, 0., 0., -1., 0.);
        for (const auto &cluster : tr->GetClusters())
        {
            netot += cluster.n;
            avalMC->SetElectronSignalScalingFactor(cluster.n);
            avalMC->DriftElectron(cluster.x, cluster.y, cluster.z, cluster.t);
            avalMC->GetElectronEndpoint(0, xe0, ye0, ze0, te0, xe1, ye1, ze1, te1, status);
            avalMC->SetIonSignalScalingFactor(cluster.n);
            avalMC->DriftNegativeIon(xe1, ye1, ze1, te1);

            // if (status == -7)
            // {
            //     drift->SetIonSignalScalingFactor(cluster.n);
            //     drift->DriftNegativeIon(xe1, ye1, ze1, te1);
            //     drift->GetEndPoint(xi1, yi1, zi1, ti1, statusi);
            //     // cout << "ion position: " << xi1 << "," << yi1 << "," << zi1 << endl;
            //     // cout << "=======statusi======" << statusi << endl;
            // }
            
        }
    }

Is it because AvalancheMC does not have the EnableNegativeIonTail (true) function in DriftLineRKF ? This is just my guess, look forward to your explanation of this error.Thanks!

That may be a bug. Will take a look…

Should be fixed now:

Thanks a lot, the error ‘AvalancheMC: :Avalanche : Nether electron nor hole/ion component requested.’ disappeared .But there was a new error, use AvalancheMC to simulate the drift of negative ions was very slow, and the computer memory overflowed, and the program was killed. But I would like to use AvalancheMC because it takes into account the diffusion of ions.
So if I want to consider diffusion and will not make computer memory overflow, do you have any suggestions?

Here are the key code

 for (unsigned int i = 0; i < nTracks; i++)
    {
        unsigned int netot = 0;
        tr->NewTrack(5, 0.8 * Ymax, 5, 0., 0., -1., 0.);
        for (const auto &cluster : tr->GetClusters())
        {
            netot += cluster.n;
            avalMC->SetElectronSignalScalingFactor(cluster.n);
            avalMC->DriftElectron(cluster.x, cluster.y, cluster.z, cluster.t);
            avalMC->GetElectronEndpoint(0, xe0, ye0, ze0, te0, xe1, ye1, ze1, te1, statuse);
            cout << "=======statuse======" << statuse << endl;
            avalMC->SetIonSignalScalingFactor(cluster.n);
            avalMC->DriftNegativeIon(xe1, ye1, ze1, te1);
        }
    }

Try to set the step size explicitly. For instance, to set 100 um steps:

avalMC->SetDistanceSteps(0.01);

Thank you very much! avalMC->SetDistanceSteps(0.01); make sense

I still have two small questions:

  1. Is avalMC->SetIonSignalScalingFactor(cluster.n) applicable to both negative ions and positive ions?"

2.The status obtained using drift->DriftElectron() is -1. ( Notice: I did not open drift->EnableNegativeIonTail(true); . However, when using avalMC->DriftElectron(), the obtained status is -7. Could you explain it briefly?

Therefore, if using DriftLineRKF, I get a driftline without using drift->DriftNegativeIon(xe1, ye1, ze1, te1);

drift->SetElectronSignalScalingFactor(cluster.n);
drift->DriftElectron(cluster.x, cluster.y, cluster.z, cluster.t);
drift->GetEndPoint(xe1, ye1, ze1, te1, statuse);
cout << "eletron position: " << xe1 << "," << ye1 << "," << ze1 << endl;
cout << "=======status======" << statuse << endl;
  1. Yes, it’s applied to both. But if needed, we could add a separate scaling factor for negative ions.

  2. DriftLineRKF first calculates the average drift path of an electron (or ion), essentially following the electric field lines until the particle leaves the active region, without any random element, and subsequently calculates the multiplication and attachment along this average drift path. If enabled, it then simulates (positive and negative) ion drift lines with starting points according to the multiplication and attachment profile along the drift line.
    AvalancheMC simulates individual electrons (or ions). It does include a random component, if you call AvalancheMC::DriftElectron multiple times, you will get (slightly) different results, some might be lost due to attachment, some might make it to the electrode, etc.

I understand,thanks a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.