Geant4-11
Public Member Functions | Protected Member Functions | Private Attributes
G4ExplicitEuler Class Reference

#include <G4ExplicitEuler.hh>

Inheritance diagram for G4ExplicitEuler:
G4MagErrorStepper G4MagIntegratorStepper

Public Member Functions

G4double DistChord () const
 
void DumbStepper (const G4double y[], const G4double dydx[], G4double h, G4double yout[])
 
 G4ExplicitEuler (G4EquationOfMotion *EqRhs, G4int numberOfVariables=6)
 
G4EquationOfMotionGetEquationOfMotion ()
 
const G4EquationOfMotionGetEquationOfMotion () const
 
unsigned long GetfNoRHSCalls ()
 
G4int GetNumberOfStateVariables () const
 
G4int GetNumberOfVariables () const
 
G4int IntegrationOrder ()
 
G4int IntegratorOrder () const
 
G4bool IsFSAL () const
 
void NormalisePolarizationVector (G4double vec[12])
 
void NormaliseTangentVector (G4double vec[6])
 
void ResetfNORHSCalls ()
 
void RightHandSide (const G4double y[], G4double dydx[]) const
 
void RightHandSide (const G4double y[], G4double dydx[], G4double field[]) const
 
void SetEquationOfMotion (G4EquationOfMotion *newEquation)
 
void Stepper (const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
 
 ~G4ExplicitEuler ()
 

Protected Member Functions

void SetFSAL (G4bool flag=true)
 
void SetIntegrationOrder (G4int order)
 

Private Attributes

G4doubledydxMid
 
G4EquationOfMotionfEquation_Rhs = nullptr
 
G4ThreeVector fFinalPoint
 
G4ThreeVector fInitialPoint
 
G4int fIntegrationOrder = -1
 
G4bool fIsFSAL = false
 
G4ThreeVector fMidPoint
 
const G4int fNoIntegrationVariables = 0
 
unsigned long fNoRHSCalls = 0UL
 
const G4int fNoStateVariables = 0
 
G4doubleyInitial
 
G4doubleyMiddle
 
G4doubleyOneStep
 

Detailed Description

Definition at line 41 of file G4ExplicitEuler.hh.

Constructor & Destructor Documentation

◆ G4ExplicitEuler()

G4ExplicitEuler::G4ExplicitEuler ( G4EquationOfMotion EqRhs,
G4int  numberOfVariables = 6 
)

Definition at line 43 of file G4ExplicitEuler.cc.

45 : G4MagErrorStepper(EqRhs, numberOfVariables)
46{
47}
G4MagErrorStepper(G4EquationOfMotion *EqRhs, G4int numberOfVariables, G4int numStateVariables=12)

◆ ~G4ExplicitEuler()

G4ExplicitEuler::~G4ExplicitEuler ( )

Definition at line 54 of file G4ExplicitEuler.cc.

55{
56}

Member Function Documentation

◆ DistChord()

G4double G4MagErrorStepper::DistChord ( ) const
virtualinherited

Implements G4MagIntegratorStepper.

Definition at line 100 of file G4MagErrorStepper.cc.

101{
102 // Estimate the maximum distance from the curve to the chord
103 //
104 // We estimate this using the distance of the midpoint to
105 // chord (the line between
106 //
107 // Method below is good only for angle deviations < 2 pi,
108 // This restriction should not a problem for the Runge cutta methods,
109 // which generally cannot integrate accurately for large angle deviations.
110
111 G4double distLine, distChord;
112
114 {
116 // This is a class method that gives distance of Mid
117 // from the Chord between the Initial and Final points.
118
119 distChord = distLine;
120 }
121 else
122 {
123 distChord = (fMidPoint-fInitialPoint).mag();
124 }
125
126 return distChord;
127}
double G4double
Definition: G4Types.hh:83
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4ThreeVector fMidPoint
G4ThreeVector fFinalPoint
G4ThreeVector fInitialPoint

References G4LineSection::Distline(), G4MagErrorStepper::fFinalPoint, G4MagErrorStepper::fInitialPoint, and G4MagErrorStepper::fMidPoint.

◆ DumbStepper()

void G4ExplicitEuler::DumbStepper ( const G4double  y[],
const G4double  dydx[],
G4double  h,
G4double  yout[] 
)
virtual

Implements G4MagErrorStepper.

Definition at line 64 of file G4ExplicitEuler.cc.

68{
69 const G4int numberOfVariables = GetNumberOfVariables();
70
71 // Initialise time to t0, needed when it is not updated by the integration.
72
73 for(G4int i=0; i< numberOfVariables; ++i)
74 {
75 yOut[i] = yIn[i] + h*dydx[i] ; // 1st and only Step
76 }
77
78 return;
79}
int G4int
Definition: G4Types.hh:85
G4int GetNumberOfVariables() const

References G4MagIntegratorStepper::GetNumberOfVariables().

◆ GetEquationOfMotion() [1/2]

G4EquationOfMotion * G4MagIntegratorStepper::GetEquationOfMotion ( )
inlineinherited

◆ GetEquationOfMotion() [2/2]

const G4EquationOfMotion * G4MagIntegratorStepper::GetEquationOfMotion ( ) const
inlineinherited

◆ GetfNoRHSCalls()

unsigned long G4MagIntegratorStepper::GetfNoRHSCalls ( )
inlineinherited

◆ GetNumberOfStateVariables()

G4int G4MagIntegratorStepper::GetNumberOfStateVariables ( ) const
inlineinherited

◆ GetNumberOfVariables()

G4int G4MagIntegratorStepper::GetNumberOfVariables ( ) const
inlineinherited

◆ IntegrationOrder()

G4int G4MagIntegratorStepper::IntegrationOrder ( )
inlineinherited

◆ IntegratorOrder()

G4int G4ExplicitEuler::IntegratorOrder ( ) const
inlinevirtual

Implements G4MagIntegratorStepper.

Definition at line 56 of file G4ExplicitEuler.hh.

56{ return 1; }

◆ IsFSAL()

G4bool G4MagIntegratorStepper::IsFSAL ( ) const
inlineinherited

◆ NormalisePolarizationVector()

void G4MagIntegratorStepper::NormalisePolarizationVector ( G4double  vec[12])
inlineinherited

◆ NormaliseTangentVector()

void G4MagIntegratorStepper::NormaliseTangentVector ( G4double  vec[6])
inlineinherited

◆ ResetfNORHSCalls()

void G4MagIntegratorStepper::ResetfNORHSCalls ( )
inlineinherited

◆ RightHandSide() [1/2]

void G4MagIntegratorStepper::RightHandSide ( const G4double  y[],
G4double  dydx[] 
) const
inlineinherited

◆ RightHandSide() [2/2]

void G4MagIntegratorStepper::RightHandSide ( const G4double  y[],
G4double  dydx[],
G4double  field[] 
) const
inlineinherited

◆ SetEquationOfMotion()

void G4MagIntegratorStepper::SetEquationOfMotion ( G4EquationOfMotion newEquation)
inlineinherited

◆ SetFSAL()

void G4MagIntegratorStepper::SetFSAL ( G4bool  flag = true)
inlineprotectedinherited

◆ SetIntegrationOrder()

void G4MagIntegratorStepper::SetIntegrationOrder ( G4int  order)
inlineprotectedinherited

◆ Stepper()

void G4MagErrorStepper::Stepper ( const G4double  y[],
const G4double  dydx[],
G4double  h,
G4double  yout[],
G4double  yerr[] 
)
virtualinherited

Implements G4MagIntegratorStepper.

Definition at line 42 of file G4MagErrorStepper.cc.

47{
48 const G4int nvar = GetNumberOfVariables();
49 const G4int maxvar = GetNumberOfStateVariables();
50
51 // correction for Richardson Extrapolation.
52 //
53 G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
54
55 // Saving yInput because yInput and yOutput can be aliases for same array
56 //
57 for(G4int i=0; i<nvar; ++i)
58 {
59 yInitial[i]=yInput[i];
60 }
61 yInitial[7] = yInput[7]; // Copy the time in case...even if not really needed
62 yMiddle[7] = yInput[7]; // Copy the time from initial value
63 yOneStep[7] = yInput[7]; // As it contributes to final value of yOutput ?
64 // yOutput[7] = yInput[7]; // -> dumb stepper does it too for RK4
65
66 for(G4int i=nvar; i<maxvar; ++i)
67 {
68 yOutput[i]=yInput[i];
69 }
70 // yError[7] = 0.0;
71
72 G4double halfStep = hstep * 0.5;
73
74 // Do two half steps
75 //
76 DumbStepper (yInitial, dydx, halfStep, yMiddle);
78 DumbStepper (yMiddle, dydxMid, halfStep, yOutput);
79
80 // Store midpoint, chord calculation
81 //
83
84 // Do a full Step
85 //
86 DumbStepper(yInitial, dydx, hstep, yOneStep);
87 for(G4int i=0; i<nvar; ++i)
88 {
89 yError [i] = yOutput[i] - yOneStep[i] ;
90 yOutput[i] += yError[i]*correction ;
91 // Provides accuracy increased by 1 order via Richardson Extrapolation
92 }
93
95 fFinalPoint = G4ThreeVector( yOutput[0], yOutput[1], yOutput[2]);
96
97 return;
98}
CLHEP::Hep3Vector G4ThreeVector
virtual void DumbStepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[])=0
void RightHandSide(const G4double y[], G4double dydx[]) const
G4int GetNumberOfStateVariables() const
virtual G4int IntegratorOrder() const =0

References G4MagErrorStepper::DumbStepper(), G4MagErrorStepper::dydxMid, G4MagErrorStepper::fFinalPoint, G4MagErrorStepper::fInitialPoint, G4MagErrorStepper::fMidPoint, G4MagIntegratorStepper::GetNumberOfStateVariables(), G4MagIntegratorStepper::GetNumberOfVariables(), G4MagIntegratorStepper::IntegratorOrder(), G4MagIntegratorStepper::RightHandSide(), G4MagErrorStepper::yInitial, G4MagErrorStepper::yMiddle, and G4MagErrorStepper::yOneStep.

Field Documentation

◆ dydxMid

G4double * G4MagErrorStepper::dydxMid
privateinherited

◆ fEquation_Rhs

G4EquationOfMotion* G4MagIntegratorStepper::fEquation_Rhs = nullptr
privateinherited

Definition at line 124 of file G4MagIntegratorStepper.hh.

◆ fFinalPoint

G4ThreeVector G4MagErrorStepper::fFinalPoint
privateinherited

◆ fInitialPoint

G4ThreeVector G4MagErrorStepper::fInitialPoint
privateinherited

◆ fIntegrationOrder

G4int G4MagIntegratorStepper::fIntegrationOrder = -1
privateinherited

Definition at line 134 of file G4MagIntegratorStepper.hh.

◆ fIsFSAL

G4bool G4MagIntegratorStepper::fIsFSAL = false
privateinherited

Definition at line 136 of file G4MagIntegratorStepper.hh.

◆ fMidPoint

G4ThreeVector G4MagErrorStepper::fMidPoint
privateinherited

◆ fNoIntegrationVariables

const G4int G4MagIntegratorStepper::fNoIntegrationVariables = 0
privateinherited

Definition at line 125 of file G4MagIntegratorStepper.hh.

◆ fNoRHSCalls

unsigned long G4MagIntegratorStepper::fNoRHSCalls = 0UL
mutableprivateinherited

Definition at line 128 of file G4MagIntegratorStepper.hh.

◆ fNoStateVariables

const G4int G4MagIntegratorStepper::fNoStateVariables = 0
privateinherited

Definition at line 126 of file G4MagIntegratorStepper.hh.

◆ yInitial

G4double* G4MagErrorStepper::yInitial
privateinherited

◆ yMiddle

G4double * G4MagErrorStepper::yMiddle
privateinherited

◆ yOneStep

G4double * G4MagErrorStepper::yOneStep
privateinherited

The documentation for this class was generated from the following files: