Project

General

Profile

Bug #344

Enge derivatives slow to calculate

Added by Rogers, Chris over 12 years ago. Updated over 12 years ago.

Status:
Open
Priority:
Normal
Assignee:
Category:
Fields
Target version:
Start date:
23 February 2011
Due date:
% Done:

0%

Estimated time:
Workflow:

Description

You will need g4mice version 2-4-1 to do this.

So there are two pieces of code that talk to each other:

In $MICESRC/Interface/include/MathUtils.hh there is a class called Enge

In $MICESRC/BeamTools/include/BTMultipole.hh there is a class called BTMultipole

The code in Enge calculates something called Enge function plus analytical derivatives. The code in BTMultipole uses the analytical derivatives to calculate a field. There is a recursion relation that derives from Maxwell's equations allowing one to use the field profile on-axis to generate field profiles off-axis. At the moment this is rather slow, and could certainly be optimised. The slowness is likely to be caused by too many calls to exp(x)... see what you think.

One solution might be to add a function that calculates not just Enge nth derivative but all derivatives of Enge from n through to 0 all at once. Can probably reuse the exp(x) call better that way. One interesting thing to play with is gprof which allows to do code profiling...

Essentially though, have a play and see what you come up with.

There are existing unit tests in $MICETESTS/gUnit that should not be broken by whatever you are doing. Also an application test in $MICETEST/Integration/Simulation/Multipoles/

I attach to help a cards file and a geometry file that can be used to run the simulation. If you have g4mice-2-4-1 running, just put the cards and geometry file into some directory. Do

source ~/setupmice.csh
mkdir some_directory
cd some_directory

Copy the attached Multipole.dat and cards into some_directory, then
$MICESRC/Applications/Simulation/Simulation cards

This should get the simulation going, fire a whole load of neutral particles (neutrons) on a rectangular grid and write out the particle data at a few points - with position, momentum and field values in the output.

Let me know, there's probably some stuff that needs clarifying here.


Files

cards (230 Bytes) cards cards file Rogers, Chris, 23 February 2011 17:14
Multipole.dat (1.96 KB) Multipole.dat geometry/configuration file Rogers, Chris, 23 February 2011 17:14
#1

Updated by Rogers, Chris over 12 years ago

  • Assignee changed from Blot, Summer to Rogers, Chris
#2

Updated by Rogers, Chris over 12 years ago

  • Project changed from G4MICE to MAUS
  • Category deleted (BeamTools)
#3

Updated by Rogers, Chris over 12 years ago

  • Category set to Fields
  • Target version set to Future MAUS release

Also available in: Atom PDF