Hopsan
NumericalIntegrationSolver Class Reference

Public Types

typedef double(NumericalIntegrationSolver::*) callback_function(int)
 

Public Member Functions

 NumericalIntegrationSolver (Component *pParentComponent, std::vector< double > *pStateVars, double tolerance=1e-6, size_t maxIter=1000)
 Constructor for solver utility using numerical integration methods.
 
void solve (int solver)
 Solves a system using numerical integration.
 
void solveForwardEuler ()
 Solves a system using forward Euler method.
 
void solveMidpointMethod ()
 Solves a system using midpoint method.
 
void solveBackwardEuler ()
 Solves a system using implicit Euler.
 
void solveTrapezoidRule ()
 Solves a system using trapezoid rule of integration.
 
void solveRungeKutta ()
 Solves a system using Runge-Kutta (RK4)
 
void solveDormandPrince ()
 Solves a system using Dormand-Prince.
 
void solvevariableTimeStep ()
 Solves a system using trapezoid rule with variable step size (experimental, do not use)
 
double findRoot (int i)
 

Static Public Member Functions

static const std::vector< HStringgetAvailableSolverTypes ()
 Returns a list of available integration methods.
 

Constructor & Destructor Documentation

◆ NumericalIntegrationSolver()

NumericalIntegrationSolver ( Component * pParentComponent,
std::vector< double > * pStateVars,
double tolerance = 1e-6,
size_t maxIter = 1000 )

Constructor for solver utility using numerical integration methods.

Parameters
pParentComponentPointer to parent component
pStateVarsPointer to vector with state variables
toleranceTolerance (for Newton-Rhapson with implicit methods)
maxIterMaximum number of iterations with Newton-Rhapson

Member Function Documentation

◆ solve()

void solve ( int solver)

Solves a system using numerical integration.

Parameters
solverTypeIntegration method to use