DPsim
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
DPsim::ODESolver Class Reference

Solver class for ODE (Ordinary Differential Equation) systems. More...

#include <ODESolver.h>

Inheritance diagram for DPsim::ODESolver:
[legend]
Collaboration diagram for DPsim::ODESolver:
[legend]

Classes

class  SolveTask
 

Public Member Functions

 ODESolver (String name, const CPS::ODEInterface::Ptr &comp, bool implicit_integration, Real timestep)
 Create solve object with corresponding component and information on the integration type.
 
 ~ODESolver ()
 Deallocate all memory.
 
virtual CPS::Task::List getTasks ()
 Get tasks for scheduler.
 
void initialize ()
 Initialize ARKode-solve_environment.
 
Real step (Real initial_time)
 Solve system for the current time. More...
 
- Public Member Functions inherited from DPsim::Solver
 Solver (String name, CPS::Logger::Level logLevel)
 
void setTimeStep (Real timeStep)
 
void doFrequencyParallelization (Bool freqParallel)
 
virtual void setSystem (const CPS::SystemTopology &system)
 
void doSystemMatrixRecomputation (Bool value)
 
void doSteadyStateInit (Bool f)
 activate steady state initialization
 
void setSteadStIniTimeLimit (Real v)
 set steady state initialization time limit
 
void setSteadStIniAccLimit (Real v)
 set steady state initialization accuracy limit
 
virtual void setSolverAndComponentBehaviour (Solver::Behaviour behaviour)
 set solver and component to initialization or simulation behaviour
 
void doInitFromNodesAndTerminals (Bool f)
 activate powerflow initialization
 
virtual void setDirectLinearSolverConfiguration (DirectLinearSolverConfiguration &)
 set direct linear solver configuration (only available in MNA for now)
 
virtual void logLUTimes ()
 log LU decomposition times, if applicable
 
virtual void log (Real time, Int timeStepCount)
 Log results.
 
void setMaxNumberOfIterations (int maxIterations)
 

Protected Member Functions

int StateSpace (realtype t, N_Vector y, N_Vector ydot)
 
int Jacobian (realtype t, N_Vector y, N_Vector fy, SUNMatrix J, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
 
int check_flag (void *flagvalue, const std::string &funcname, int opt)
 ARKode- standard error detection function; in DAE-solver not detection function is used -> for efficiency purposes?
 

Static Protected Member Functions

static int StateSpaceWrapper (realtype t, N_Vector y, N_Vector ydot, void *user_data)
 use wrappers similar to DAE_Solver
 
static int JacobianWrapper (realtype t, N_Vector y, N_Vector fy, SUNMatrix J, void *user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
 

Protected Attributes

CPS::ODEInterface::Ptr mComponent
 Component to simulate, possible specialized component needed.
 
Int mProbDim
 Number of differential Variables (states)
 
void * mArkode_mem {nullptr}
 Memory block allocated by ARKode.
 
N_Vector mStates {nullptr}
 State vector.
 
bool mImplicitIntegration
 Indicates whether the ODE shall be solved using an implicit scheme.
 
SUNMatrix A {nullptr}
 Empty matrix for linear solve in each Newton step while solving the Jacobian Matrix.
 
SUNLinearSolver LS {nullptr}
 Empty linear solver object.
 
Real mTimestep
 Constant time step.
 
realtype reltol = RCONST(1.0e-6)
 Relative tolerance.
 
realtype abstol = RCONST(1.0e-10)
 Scalar absolute tolerance.
 
int mFlag {0}
 Template Jacobian Matrix (implicit solver) More...
 
CPS::ODEInterface::StSpFn mStSpFunction
 
CPS::ODEInterface::JacFn mJacFunction
 
- Protected Attributes inherited from DPsim::Solver
String mName
 Name for logging.
 
CPS::Logger::Level mLogLevel
 Logging level.
 
CPS::Logger::Log mSLog
 Logger.
 
Real mTimeStep
 Time step for fixed step solvers.
 
Bool mFrequencyParallel = false
 Activates parallelized computation of frequencies.
 
Real mSteadStIniTimeLimit = 10
 steady state initialization time limit
 
Real mSteadStIniAccLimit = 0.0001
 steady state initialization accuracy limit
 
Bool mSteadyStateInit = false
 Activates steady state initialization.
 
Bool mIsInInitialization = false
 Determines if solver is in initialization phase, which requires different behavior.
 
Bool mInitFromNodesAndTerminals = true
 
Bool mSystemMatrixRecomputation = false
 Enable recomputation of system matrix during simulation.
 
Behaviour mBehaviour = Solver::Behaviour::Simulation
 Solver behaviour initialization or simulation.
 

Additional Inherited Members

- Public Types inherited from DPsim::Solver
enum  Behaviour { Initialization , Simulation }
 
enum class  Type { MNA , DAE , NRP }
 
typedef std::shared_ptr< SolverPtr
 
typedef std::vector< Ptr > List
 
- Public Attributes inherited from DPsim::Solver
int mMaxIterations = 10
 

Detailed Description

Solver class for ODE (Ordinary Differential Equation) systems.

Definition at line 25 of file ODESolver.h.

Member Function Documentation

◆ step()

Real ODESolver::step ( Real  initial_time)

Solve system for the current time.

Number of integration steps

Number of error test fails

Definition at line 115 of file ODESolver.cpp.

Member Data Documentation

◆ mFlag

int DPsim::ODESolver::mFlag {0}
protected

Template Jacobian Matrix (implicit solver)

reusable error-checking flag

Definition at line 63 of file ODESolver.h.


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