| Message: Re: simultaneous B and E fields | Not Logged In (login) |
|
Let's assume you have a global field: gbl_Bfield_x = 3.3*tesla; gbl_Bfield_y = 0.0*tesla; gbl_Bfield_z = 0.0*tesla; fieldVector = G4ThreeVector(gbl_Bfield_x,gbl_Bfield_y,gbl_Bfield_z); fMagneticField = new G4UniformMagField(fieldVector); GetGlobalFieldManager()->SetDetectorField(fMagneticField); Now you want in addition an electric field inside a subvolume: lcl_Efield_x = 0.0*volt/m; lcl_Efield_y = -5000.0*volt/m lcl_EField_z = 0.0*volt/m;
fLocalField =
new G4ElectroMagneticField(gbl_Bfield_x, gbl_Bfield_y, gbl_Bfield_z,
lcl_Efield_x, lcl_Efield_y, lcl_Efield_z);
fLocalFieldManager = new G4FieldManager(); fLocalFieldManager->SetDetectorField(fLocalField ); and assign this to the local LogicalVolume as usual.
> ps. In reality I would prefer to apply both a local electric field
> and a local magnetic field to different subsets of my geometry.
> Is this really not possible in Geant4? There must be a misunderstanding. You can define as many local fields as you need and assign each to its respective logical volume. If there is no field in the space between them, then don't assign a field to the global field manager. You have to take care that in each subset of your geometry you define a field that is already the superposition of all fields in that space. What you must not do is overlap positioned logical volumes each assigned their respective field then hope that G4 somehow adds the fields in the overlap region. |
| Inline Depth: | Outline Depth: | Add message: |
|
to: |