Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TsitourasRK45.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4TsitourasRK45
27//
28// Class description:
29//
30// Tsitouras - 5(4) RK stepper (non-FSAL version)
31// Implements RK tableau from 'Table 1' of:
32// C. Tsitouras, "Runge-Kutta pairs of order 5(4) satisfying only
33// the first column simplifying assumption"
34// Computers & Mathematics with Applications,
35// vol. 62, no. 2, pp. 770-775, 2011.
36
37// Author: Somnath Banerjee (CERN, Google Summer of Code 2015), 11.06.2015
38// Supervision: John Apostolakis (CERN)
39// --------------------------------------------------------------------
40#ifndef TSITOURAS_RK45_HH
41#define TSITOURAS_RK45_HH
42
44
45/**
46 * @brief G4TsitourasRK45 is an implementation of the 5(4) Runge-Kutta
47 * stepper (non-FSAL version).
48 */
49
51{
52 public:
53
54 /**
55 * Constructor for G4TsitourasRK45.
56 * @param[in] EqRhs Pointer to the provided equation of motion.
57 * @param[in] numberOfVariables The number of integration variables.
58 * @param[in] primary Flag for initialisation of the auxiliary stepper.
59 */
61 G4int numberOfVariables = 6,
62 G4bool primary = true);
63 /**
64 * Destructor.
65 */
66 ~G4TsitourasRK45() override;
67
68 /**
69 * Copy constructor and assignment operator not allowed.
70 */
73
74 /**
75 * The stepper for the Runge Kutta integration.
76 * The stepsize is fixed, with the step size given by 'h'.
77 * Integrates ODE starting values y[0 to 6].
78 * Outputs yout[] and its estimated error yerr[].
79 * @param[in] y Starting values array of integration variables.
80 * @param[in] dydx Derivatives array.
81 * @param[in] h The given step size.
82 * @param[out] yout Integration output.
83 * @param[out] yerr The estimated error.
84 */
85 void Stepper( const G4double y[],
86 const G4double dydx[],
87 G4double h,
88 G4double yout[],
89 G4double yerr[] ) override;
90
91 /**
92 * Setup all coefficients for interpolation.
93 */
94 void SetupInterpolation( /* const G4double yInput[],
95 const G4double dydx[],
96 const G4double Step */ );
97
98 /**
99 * Calculates the output at the tau fraction of step.
100 * @param[in] yInput Starting values array of integration variables.
101 * @param[in] dydx Derivatives array.
102 * @param[in] Step The given step size.
103 * @param[out] yOut Interpolation output.
104 * @param[in] tau The tau fraction of the step.
105 */
106 void Interpolate( const G4double yInput[],
107 const G4double dydx[],
108 const G4double Step,
109 G4double yOut[],
110 G4double tau );
111 void interpolate( const G4double yInput[],
112 const G4double dydx[],
113 G4double yOut[],
114 G4double Step,
115 G4double tau);
116
117 /**
118 * Returns the distance from chord line.
119 */
120 G4double DistChord() const override;
121
122 /**
123 * Returns the order, 4, of integration.
124 */
125 inline G4int IntegratorOrder() const override { return 4; }
126
127 /**
128 * Returns the stepper type-ID, "kTsitourasRK45".
129 */
130 inline G4StepperType StepperType() const override { return kTsitourasRK45; }
131
132 private :
133
134 G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *ak8, *yTemp, *yIn;
135
136 G4double fLastStepLength = 0.0;
137 G4double *fLastInitialVector, *fLastFinalVector,
138 *fLastDyDx, *fMidVector, *fMidError;
139 // For DistChord calculations
140
141 G4TsitourasRK45* fAuxStepper = nullptr;
142};
143
144#endif
G4StepperType
G4StepperType defines the available integrator of particle's equation of motion in Geant4.
@ kTsitourasRK45
G4TsitourasRK45.
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4EquationOfMotion is the abstract base class for the right hand size of the equation of motion of a ...
G4MagIntegratorStepper(G4EquationOfMotion *Equation, G4int numIntegrationVariables, G4int numStateVariables=12, G4bool isFSAL=false)
G4TsitourasRK45 is an implementation of the 5(4) Runge-Kutta stepper (non-FSAL version).
void Stepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[]) override
G4int IntegratorOrder() const override
G4TsitourasRK45 & operator=(const G4TsitourasRK45 &)=delete
G4TsitourasRK45(const G4TsitourasRK45 &)=delete
void Interpolate(const G4double yInput[], const G4double dydx[], const G4double Step, G4double yOut[], G4double tau)
G4TsitourasRK45(G4EquationOfMotion *EqRhs, G4int numberOfVariables=6, G4bool primary=true)
G4StepperType StepperType() const override
~G4TsitourasRK45() override
void interpolate(const G4double yInput[], const G4double dydx[], G4double yOut[], G4double Step, G4double tau)
G4double DistChord() const override