Message: Re: Variable Local Magnetic Field Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Variable Local Magnetic Field 

Forum: Fields: Magnetic and Otherwise
Re: Question Variable Local Magnetic Field (Jim Streuli)
Date: 01 May, 2017
From: Gumplinger Peter <Gumplinger Peter>

> My code is
> essentially modeled verbatim after to field03, however whenever I issue
> a command and the field strength changes, it turns into a global field.

Well, the fixed code reads:

 79   fMagneticField = new G4UniformMagField(G4ThreeVector(3.3*tesla,
 80                                                        0.0, // 0.5*tesla,
 81                                                        0.0));
 82   fLocalMagneticField = new G4UniformMagField(G4ThreeVector(3.3*tesla,
 83                                                             0.0, // 0.5*tesla,
 84                                                             0.0));
 85 
 86   fFieldMessenger = new F03FieldMessenger(this);
 87  
 88   fEquation = new G4Mag_UsualEqRhs(fMagneticField);
 89   fLocalEquation = new G4Mag_UsualEqRhs(fLocalMagneticField);
 90  
 91   fMinStep     = 0.25*mm ; // minimal step of 1 mm is default
 92   fStepperType = 4 ;       // ClassicalRK4 is default stepper
 93 
 94   fFieldManager = GetGlobalFieldManager();
 95   fLocalFieldManager = new G4FieldManager();

117 fFieldManager->SetDetectorField(fMagneticField);

118 fLocalFieldManager->SetDetectorField(fLocalMagneticField);

You have to write your FieldMessenger to operate on fLocalMagneticField

And in DetectorConstruction:

450 // Set local field manager and local field in radiator and its daughters:

451 G4bool allLocal = true;

452 fLogicRadiator->SetFieldManager(fEmFieldSetup.Get()->GetLocalFieldManager(),

453 allLocal );

 Add Message Add Message
to: "Re: Variable Local Magnetic Field"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]