Optimisation of scored quantity in geometry

Hi all:

I am trying to optimise fluence in my geometry based on example RE02 via the following approach:

How it all works

Input parameters
These are defined in a Constants.hh header which I inherit into the main RE02.cc file to have global variables on geometries, particle energies and filenames

I have 1, 5x5cm water phantom of 0.5cm depth, at 50cm away from a bremsstrahlung target that produces photons from electrons. I make the phantom as a G4MultiFunctionalDetector*.

I implement runManager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores());

Primary Generator Action
I produce a flat MeV electron beam with 1e6 particles. The seed is taken in as a parameter at the beginning. Here main bits of the code are:

(**where CLHEP::RandGauss gaussianDist;, gaussianDist(anEngine,beam_energy,beam_energy_std_dev)**
**CLHEP::RanecuEngine anEngine;**)
G4double angle = (G4UniformRand())*2*M_PI;
  G4double r = (G4UniformRand())*(beam_diameter/2);
  G4double dx = r*cos(angle);
  G4double dy = r*sin(angle); 

Target Design
The target has two logical volumes that occupy the same space. In each logical volume are parameterised physical volumes which do not overlap. They also can be used as multifunctional detectors to score energy deposition etc on them.

I was unsure of the stepsize to use in the target given in optimisation the geometry can change quite drastically ~0.1cm to 10cm. There are also individual elements which can be as small as thin as 20 microns. I implement

(**where G4double step = 0.01;**)

I implement RegisterPhysics (new G4EmStandardPhysics_option3()); I have nominally added splitting by putting, but have put the factor to 1 for now. This is done in MyPhysics constructor via:

G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
      std::vector< G4String > processToBias;
      biasingPhysics->PhysicsBias("e-", processToBias);
      biasingPhysics->PhysicsBias("e+", processToBias);

The scoring is based on the example RE02: with RE02PSFlatSurfaceFlux used for the phantom and with the filter for gamma.

** RunAction**
I get the values from G4THitsMap* gammaSurfFlux= re02Run-

>GetHitsMap("PhantomSD/gammaSurfFlux"); and put them into a result file.


What I am trying to do:
I am trying to maximise the fluence output using optimisation algorithms which change my target geometries

How its gone so far

  • I have achieved very noisy results which take around 15s each to achieve although the times started to vary up to 45 minutes to run 1e6 particles
  • I have had to implement derivative free optimisation algorithms in python and matlab and use these to change the Constants.hh file and get an output from reading in a result file - these algorithms have struggled to converge at all

What I am unsure about

  • I am unsure whether the parameterisation and overlap of logical volumes is ok and which takes precedence - the same question applies to physical volumes
  • I am unsure about what to put as the step size or whether to leave this as default
  • I am unsure as the best cost evaluation to use for number of particles to simulate vs time vs noise
  • I am unsure if the random engine I chose is contributing to the noise and if I can just keep putting the iteration number as my seed i.e. 1,2,3…500 etc
  • I am unsure whether its worth adding in fast simulation implementations to help with time cost

What I am looking for advice with
I am hoping to gain some advice with how would be best for me to
a) troubleshoot this problem
b) any advice for best practise in the situation I now find myself in

Any help would be gratefully appreciated.

1 Like

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