Modification to source code

Hello!

I am currently trying to use garfield++ to simulate electron drifting motion using class AvalancheMC:
AvalancheMC drift;
double x0 = …
double y0 = …
double z0 = …
double t0 = …
drift.DriftElectron(x0,y0,z0,t0)
I have loaded the field map exported from COMSOL and have also loaded gas table. The contour plot of the electric potential seems fine.
No errors were shown when I ran it, but no electron drift lines were drawn in the pop up window. It seems electrons didn’t drift at all no matter which position it starts from.
To understand what is going on, I tried to modify the source code “AvalancheMC.cc” in my source directory so that it can print out my customized error messages and print out the electric field for certain coordinates, but the modification I made to the source code doesn’t have any effect when I re-run the simulation code:
cmake .
make
./example
Could you help me find the right way to do it?
Are there any other ways to print out the electric field for a given position?
I can provide more information if needed. Thanks a lot for any help you may give.

I think @hschindl can help.

If you modify the source files you need to run make; make install in your Garfield++ build folder.

To probe the electric field at a given position you can do something like this:

Medium* medium = nullptr;
double ex = 0., ey = 0., ez = 0., v = 0.;
int status = 0;
fm.ElectricField(0, 0, 0, ex, ey, ez, v, medium, status);
std::printf("E = (%15.8f, %15.8f %15.8f), V = %15.8f, status = %d\n", ex, ey, ez, v, status);

where fm is your ComponentComsol object.

Thanks for your reply! These lines of code works. I will modify the source files and see whether I can figure out the issue. If I still cannot make the electron drift in the simulation and I want to ask some questions about it, should I add a new topic or just keep asking in this post?

As you prefer. Maybe it’s easier to keep the same thread?

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