Dear experts,
I try to import the field map from COMSOL and I have checked that the voltage of different place has been import successfully. But the electric field isn’t defined. I also checked that the electric filed could be plotted normally.
ComponentComsol fm;
fm.Initialise("mesh.mphtxt", "dielectrics.dat", "field.txt", "cm");
fm.EnableMirrorPeriodicityX();
fm.EnableMirrorPeriodicityY();
fm.PrintRange();
fm.SetMedium(0,&gas);
fm.SetMedium(1,&metal);
fm.PrintMaterials();
Sensor sensor;
sensor.AddComponent(&fm);
sensor.SetArea(
-1, -1, 0,
1, 1, 30
);
std::vector<std::array<double,3>> points;
std::array good_point = {0.3,0.1,15.0};
std::array bad_point = {0.8,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;
}
}
The output is
No field at (0.3,0.1,15)
No field at (0.8,0,0)
The status # is -5
I would appreciate it very much if you could help me to figure it out.