HQP  1.9.6
Omu_IntDASPK Class Reference

Solve differential-algebraic equation system using DASPK. More...

#include <Omu_IntDASPK.h>

Inheritance diagram for Omu_IntDASPK:
[legend]

Public Member Functions

 Omu_IntDASPK ()
 constructor
 
 ~Omu_IntDASPK ()
 destructor
 
Implementation of predefined methods.
const char * name ()
 Name of a specific integrator. More...
 
virtual void init (int k, const Omu_StateVec &xc, const Omu_Vec &q, const Omu_DependentVec &Fc, bool sa)
 Initialize integrator, like adaptation of array dimensions and test of pre-conditions, like explicit ODE. More...
 
virtual void solve (int kk, double tstart, double tend, Omu_StateVec &xc, Omu_StateVec &dxc, Omu_Vec &q, Omu_DependentVec &Fc)
 Solve differential equations over one sample period. More...
 
Callback routines for DASPK.
void res (freal *t, freal *x, freal *xprime, freal *delta, fint *ires, freal *rpar, fint *ipar, freal *senpar)
 
void jac (freal *t, freal *y, freal *yprime, freal *pd, freal *cj, freal *rpar, fint *ipar, freal *senpar, fint *ijac)
 
- Public Member Functions inherited from Omu_Integrator
 Omu_Integrator ()
 constructor
 
virtual ~Omu_Integrator ()
 destructor
 
virtual void setup_stages (const Omu_Program *sys)
 Setup stages for integrator. More...
 
virtual void setup_struct (int k, const Omu_VariableVec &x, const Omu_VariableVec &u, const Omu_DependentVec &Ft)
 Setup struct for one stage k. More...
 
virtual void init_stage (int k, const Omu_VariableVec &x, const Omu_VariableVec &u, const Omu_DependentVec &Ft, bool sa=false)
 Initialize solution of differential equations for stage k. More...
 
virtual void solve (int kk, double tstart, double tend, const Omu_VariableVec &x, const Omu_VariableVec &u, Omu_Program *sys, Omu_DependentVec &Ft, Omu_StateVec &xt)
 Solve differential equations over one sample period. More...
 
virtual void residual (int kk, double t, const Omu_StateVec &xc, const Omu_StateVec &dxc, const Omu_Vec &q, Omu_DependentVec &Fc)
 Callback to evaluate residuals of continuous-time equations. More...
 
int K () const
 get number of stages for which integrator has been set up
 

Protected Attributes

int _jac_sbw
 User given semi-bandwidth of Jacobian (default: -1). More...
 
bool _banded
 User specification to allow banded solver (default: true). More...
 
bool _banded_solver
 internal flag for using banded solver
 
bool _krylov
 User specification if Krylov iterative solver should be used instead of direct solver (default: false).
 
bool _krylov_prec
 User specification if a preconditioner should be used by the Krylov iterative solver (default: true). More...
 
bool _with_jac
 User specification if externally provided Jacobian should be used (default: true). More...
 
int _nsteps
 User defined fixed number of steps. More...
 
- Protected Attributes inherited from Omu_Integrator
Omu_Program_sys
 Pointer to problem definition that is valid during solve.
 
int _K
 number of stages for which integrator was set up
 
int _k
 index of current stage
 
int _kk
 index of current sample period
 
int _nxt
 total number of DAE states
 
int _nd
 number of discrete-time states
 
int _nv
 number of expansion variables
 
int _na
 number of algebraic states (no time derivative)
 
int _nx
 number of states treated by optimizer (nx=nxt-nv)
 
int _nu
 number of control parameters
 
int _nq
 number of sensitivity parameters (nq=nx+nu)
 
bool _sa
 Indicate if sensitivity analysis is required together with solution of differential equations.
 
bool _serr
 Boolean to indicate if sensitivities should be considered for error tolerance (default: false).
 
int _n
 Number of continuous-time states during integration (nxt-nd: total number minus discrete-time states).
 
int _m
 Number of control parameters during integration (nd+nu: discrete-time states and actual control parameters).
 
If_List _ifList
 container for interface elements
 
double _stepsize
 Constant stepsize to be taken by integator. More...
 
double _min_stepsize
 Minimal stepsize to be taken by integator. More...
 
double _rtol
 Relative integration error tolerance (only for variable stepsize).
 
double _atol
 Absolute integration error tolerance (only for variable stepsize).
 
int _res_evals
 number of residual evaluations
 
int _sen_evals
 number of sensitivity evaluations
 
int _jac_evals
 number of Jacobian evaluations
 

Additional Inherited Members

- Protected Member Functions inherited from Omu_Integrator
virtual void init_stage (int k, const Omu_States &x, const Omu_Vector &u, bool sa=false)
 Initialize solution of differential equations for stage k. More...
 
virtual void solve (int kk, double tstart, double tend, const Omu_States &x, const Omu_Vector &u, Omu_Program *sys, VECP xt, MATP Sx=MNULL, MATP Su=MNULL)
 Solve differential equations over sample period. More...
 

Detailed Description

Solve differential-algebraic equation system using DASPK.

Currently DASPK version 3.0 is supported (distribution file http://www.engineering.ucsb.edu/~cse/Software/ddaspk30.tar.gz).

Member Function Documentation

virtual void Omu_IntDASPK::init ( int  k,
const Omu_StateVec xc,
const Omu_Vec q,
const Omu_DependentVec Fc,
bool  sa 
)
virtual

Initialize integrator, like adaptation of array dimensions and test of pre-conditions, like explicit ODE.

An explicit ODE is present if Fc.Jdx.is_scalar() and Fc.Jdx[0][0] != 0.0. An algebraic state j, 0<=j<_n can be identified with Fc.Jdx.is_zero_column[j]. Note that the init method should not find consistent initial conditions of a DAE as parameters may jump between sample periods kk afterwards.

Parameters
kstage
xccontinuous-time states, dim(xc)=_n
qsensitivity parameters, dim(q)=_nq
Fcpre-initialized data structures for evaluating residuals, dim(Fc)=_n, including structurally analyzed Jacobians, dim(Fc.Jx)=_n._n, dim(Fc.Jxp)=_n._n, dim(Fc.Jq)=_n._nq
saindicates if sensitivity analysis is required

Reimplemented from Omu_Integrator.

const char* Omu_IntDASPK::name ( )
inlinevirtual

Name of a specific integrator.

Implements Omu_Integrator.

virtual void Omu_IntDASPK::solve ( int  kk,
double  tstart,
double  tend,
Omu_StateVec xc,
Omu_StateVec dxc,
Omu_Vec q,
Omu_DependentVec Fc 
)
virtual

Solve differential equations over one sample period.

Additionally solve sensitivity equations if _sa is true. The default implementation calls the depreciated solve method.

Parameters
kksample period
tstartstart time for integration
tendend time for integration
xccontinuous-time states at tstart, dim(xc)=_n; sensitivities xc.Sq at tstart, dim(xc.Sq)=_n._nq, if _sa is true
dxcpre-allocated time derivatives of continuous-time states, dim(dxc)=_n
qsensitivity parameters, dim(q)=_nq
Fcpre-allocated argument for residual calls, dim(Fc)=_n, including structurally analyzed Jacobians Fc.Jx, Fc.Jdx, Fc.Jq
Return values
xccontinuous-time states at tend; sensitivities xc.Sq at tend if _sa is true
Exceptions
E_CONVindicate that the integrator failed to converge; may be caught during optimization step length test

Reimplemented from Omu_Integrator.

Member Data Documentation

bool Omu_IntDASPK::_banded
protected

User specification to allow banded solver (default: true).

Banded solvers are used if _banded is true, _jac_sbw < 0, and if the automatic detection indicates that the problem can be solved more efficiently in this way.

int Omu_IntDASPK::_jac_sbw
protected

User given semi-bandwidth of Jacobian (default: -1).

If a value >= 0 is specified, then it is used instead of the automatic detection.

bool Omu_IntDASPK::_krylov_prec
protected

User specification if a preconditioner should be used by the Krylov iterative solver (default: true).

A banded preconditioner is used if the problem is treated banded. Otherwise an incomplete LU factorization is used.

int Omu_IntDASPK::_nsteps
protected

User defined fixed number of steps.

(default: 0, i.e. variable step size based on _rtol and _atol)

bool Omu_IntDASPK::_with_jac
protected

User specification if externally provided Jacobian should be used (default: true).

Otherwise DASPK approximates it internally, which is generally more efficient for not analytically given Jacobians.


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