Open dmitrySorokin opened 8 years ago
This is a class diagram for the field propagation project. The new class G4ReviseChordFinder can apply different algorithms for drivers with interpolation (Bulirsch-Stoer, Bogacki-Shampine45) and without it.
For drivers with interpolation I have decided to use the following algorithm:
For testing purposes I have created a test called SimplePropatation. This test simulates movement of 1 MeV proton in uniform magnetic field directed along Y axe. Initial momentum direction is (sqrt(2)/2, sqrt(2)/2, 0). In this test it is possible to compare position and intersection points with analytical solution. The only one used process is transportation.
Using this test I have tested ClassicalRK, CashKarp and Bulirsch-Stoer algorithms. All of them are producing exactly the same output:
Step# | X(mm) | Y(mm) | Z(mm) | KinE(MeV) | dE(MeV) | StepLeng | TrackLeng | NextVolume | ProcName |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | -742 | -102 | 1 | 0 | 0 | 0 | World | initStep |
1 | -0.171 | -100 | -102 | 1 | 0 | 908 | 908 | Cube | Transportation |
2 | 94.7 | 100 | 38.3 | 1 | 0 | 283 | 1.19e+03 | World | Transportation |
3 | -71.2 | 300 | 73.3 | 1 | 0 | 283 | 1.47e+03 | Cube2 | Transportation |
4 | -41.1 | 500 | -93.6 | 1 | 0 | 283 | 1.76e+03 | World | Transportation |
5 | -99.4 | 1e+03 | 23.7 | 1 | 0 | 707 | 2.46e+03 | OutOfWorld | Transportation |
Number of field evaluations is shown in the table below.
Algorithm | Number of field evaluatons | error |
---|---|---|
ClassicalRK | 4307 | 2.06e-06 |
CashKarp | 1457 | 2.00e-05 |
Bulirsch-Stoer (dense) | 1195 | 6.54e-05 |
Bulirsch-Stoer (non-dense) | 2182 | 1.83e-06 |
The error has been calculated using difference between analytical and numerical solutions:
In this test I used the following parameters: DeltaOneStep: 0.0001 DeltaIntersection: 1e-05. It is clearly seen from the table that for each algorithm misplacement error doesn't exceed the DeltaOneStep value.
Running testNTST I've got the following results. run2a.mac
UPD1: Add results of Bogacki-Shampine45 (non-dese) UPD2: Add results of Bogacki-Shampine45 (dense)
Algorithm | Number of field evaluations |
---|---|
ClassicalRK | 258'202'511 |
CashKarp | 197'812'070 |
Bogacki-Shampine45 (non-dense) | 196'841'663 |
Bulirsch-Stoer (non-dense) | 165'822'246 |
Bulirsch-Stoer (dense) | 70'629'309 |
Bogacki-Shampine45 (dense) | 33'267'828 |
run2b.mac
Algorithm | Number of field evaluations |
---|---|
ClassicalRK | 1'310'095'739 |
CashKarp | 637'558'303 |
Bogacki-Shampine45 (non-dense) | 584'907'614 |
Bulirsch-Stoer (non-dense) | 881'546'608 |
Bulirsch-Stoer (dense) | 325'747'133 |
Bogacki-Shampine45 (dense) | 203'119'876 |
run2c.mac
Algorithm | Number of field evaluations |
---|---|
ClassicalRK | 4'359'099'222 |
CashKarp | 1'996'530'125 |
Bogacki-Shampine45 (non-dense) | 1'763'054'970 |
Bulirsch-Stoer (non-dense) | 2'705'914'123 |
Bulirsch-Stoer (dense) | 1'731'185'999 |
Bogacki-Shampine45 (dense) | 1'250'251'457 |
Results are very promising indeed !! Great to see.
G4RevisedChordFinder class should be able to provide different strategies for finding the next chord and location of the intersection point for drivers with and without interpolation.