I want to simulate the drift of electrons in a cell constructed by 9 wires, but I found when electron was created inside wire it will give seg fault and simulation stopped.
DriftLineRKF::DriftLine:
Cannot retrieve drift velocity at initial position (-0.946065, 0.793843, 0.000000).
*** Break *** segmentation violation
Is there any way to skip these electrons? I need to manually skip them (geometrically) for now…
// Some gas
MediumMagboltz gas;
gas.LoadGasFile("ar_93_co2_7_3bar.gas");
gas.LoadIonMobility("IonMobility_Ar+_Ar.txt");
// Example component with thick wire
ComponentAnalyticField cmp;
cmp.SetMedium(&gas);
cmp.AddWire(0, 0, 2*0.1, 3000, "s"); //0.1 cm radius wire
cmp.AddTube(1, 0, 0, "t"); //1 cm radius tube
cmp.AddReadout("s");
Sensor sensor;
sensor.AddComponent(&cmp);
sensor.AddElectrode(&cmp, "s");
DriftLineRKF drift;
drift.SetSensor(&sensor);
// Make two points, one inside wire, one outside
std::vector<std::array<double,3>> points;
std::array good_point = {0.3,0.1,0.0};
std::array bad_point = {0.05,0.0,0.0};
points.push_back(good_point);
points.push_back(bad_point);
for(int i=0;i<points.size();i++){
double ex,ey,ez,v;
Medium* m;
int status;
double x=points[i][0];
double y=points[i][1];
double z=points[i][2];
// Check if electric field at point is defined
sensor.ElectricField(x,y,z,ex,ey,ez,v,m,status);
if(!status){
drift.DriftElectron(x,y,z,0.0);
std::cout<<"Successfully drifted ("<<x<<","<<y<<","<<z<<")"<<std::endl;
}else{
std::cout<<"No field at ("<<x<<","<<y<<","<<z<<")"<<std::endl;
}
}