How the calculation of drift velocity for ions worked?

Hi, all
I tried to simulate the induced charge for drifting ions. The field map was calculated by COMSOL. But I found that the calculation of ion drift velocity is a bit larger than the estimation with uniform electric field. So I want to debug what happened.

I want to get the value of electric field which was used for velocity calculation, but I didn’t find a function which could be called. Is there an example?

Besides, is there any mechanism such as diffusion, attachment, electric field could affect the calculation result of drift velocity and cause the difference with uniform electric field? Is it possible to fix?

Hi! Maybe @hschindl can help with this question?

Hi @dm-leo

You only load the drift velocity for ions, no other swarm parameters (like e.g. attachment, multiplication, diffusion), so these effects are not implemented for the simulation of ions.

You can obtain the value of the electric field at any point (x,y,z) using the component.ElectricField function:

double ex = 0., ey = 0., ez = 0.;
Medium* medium = nullptr;
int status = 0;
cmp.ElectricField(x, y, z, ex, ey, ez, medium, status);

Or, if you don’t need the medium:

std::array<double, 3> f = cmp.ElectricField(x, y, z);
std::cout << "E = (" << f[0] << ", " << f[1] << ", " << f[2] << ")\n";