crossingWires.C 1.12 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

#include <TApplication.h>

#include "Garfield/SolidWire.hh" 
#include "Garfield/GeometrySimple.hh"
#include "Garfield/MediumMagboltz.hh"
#include "Garfield/MediumConductor.hh"
#include "Garfield/ComponentNeBem3d.hh"
#include "Garfield/ViewField.hh"

using namespace Garfield;

int main(int argc, char * argv[]) {

  TApplication app("app", &argc, argv);

18
  MediumMagboltz gas("ar");
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  MediumConductor metal;

  // Geometry.
  GeometrySimple geo;
  const double radius = 0.01;
  const double halflength = 1.; 
  SolidWire wire1(0, 0, -0.05, radius, halflength, 1, 0, 0);
  SolidWire wire2(0, 0, +0.05, radius, halflength, 0, 1, 0);
  wire1.SetBoundaryPotential(-1.);
  wire2.SetBoundaryPotential(+1.);
  geo.AddSolid(&wire1, &metal);
  geo.AddSolid(&wire2, &metal);
  geo.SetMedium(&gas);

  ComponentNeBem3d nebem;
  nebem.SetGeometry(&geo);
  nebem.SetTargetElementSize(0.01);
  nebem.UseSVDInversion();
  nebem.Initialise();
 
  ViewField fieldView;
  fieldView.SetComponent(&nebem);
  fieldView.SetArea(-0.25, -0.25, -0.25, 0.25, 0.25, 0.25);
  fieldView.SetPlaneXY();
  fieldView.PlotContour("e");

  app.Run(true);
}