Hello,
I wrote a macro to set a magnetic Field in a parallelepiped and do interpolation. I take the values of the magnetic field from a txt file. So, it is convenient to use the ComponentVoxel of garfield. The macro read well the values.
After I wanted to view the magnetic field but it prints the error message “ComponentVoxel::ElectricField : Field is not available for interpolation” many times and I don’t understand why. So, I cannot view the MagneticField.
Here is my code :
const unsigned int nx=13;
const unsigned int ny=13;
const unsigned int nz=251;
const double xmin=-240;
const double xmax=240;
const double ymin=-240;
const double ymax=240;
const double zmin=-5000;
const double zmax=5000;
const std::string filename = "data_test.txt";
const std::string format= "XYZ";
ComponentVoxel *mesh=new ComponentVoxel();
mesh->SetMesh(nx,ny,nz,xmin,xmax,ymin,ymax,zmin,zmax);
mesh->LoadMagneticField(filename,format,1,1);
mesh->EnableInterpolation(true);
/*** Viewing the magnetic volume ***/
TCanvas* c = new TCanvas()
ViewField* meshView = new ViewField();
meshView->SetCanvas(c);
meshView->SetComponent(mesh);
meshView->SetPlane(0,0,1,0,0,0);
meshView->SetArea(xmin, ymin, xmax, ymax);
meshView->Plot();
And attached, you are the data_test.dat file.
data_test.tar.gz (1.1 MB)
Thank you in advance,
Kali95