OMSimulatorLib
The OMSimulator project is a FMI-based co-simulation environment that supports ordinary (i.e., non-delayed) and TLM connections.
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
oms::KinsolSolver Class Reference

#include <AlgLoop.h>

Collaboration diagram for oms::KinsolSolver:
Collaboration graph

Public Member Functions

 ~KinsolSolver ()
 Destroy the oms::KinsolSolver::KinsolSolver object. More...
 
oms_status_enu_t kinsolSolve (System &syst, DirectedGraph &graph)
 Solve algebraic system with KINSOL. More...
 

Static Public Member Functions

static KinsolSolverNewKinsolSolver (const int algLoopNum, const unsigned int size, double absoluteTolerance)
 Create new oms::KinsolSolver::KinsolSolver object. More...
 

Static Private Member Functions

static int nlsKinsolResiduals (N_Vector uu, N_Vector fval, void *userData)
 Residual function for KINSOL. More...
 
static void sundialsErrorHandlerFunction (int error_code, const char *module, const char *function, char *msg, void *userData)
 Error handler function given to KINSOL. More...
 
static void sundialsInfoHandlerFunction (const char *module, const char *function, char *msg, void *userData)
 Info handler function given to KINSOL. More...
 

Private Attributes

double fnormtol
 
N_Vector initialGuess
 
N_Vector uScale
 
N_Vector fScale
 
N_Vector fTmp
 
void * kinsolMemory
 
void * userData
 
int size
 
SUNLinearSolver linSol
 
N_Vector y
 
SUNMatrix J
 

Constructor & Destructor Documentation

◆ ~KinsolSolver()

oms::KinsolSolver::~KinsolSolver ( )

Destroy the oms::KinsolSolver::KinsolSolver object.

Member Function Documentation

◆ kinsolSolve()

oms_status_enu_t oms::KinsolSolver::kinsolSolve ( System syst,
DirectedGraph graph 
)

Solve algebraic system with KINSOL.

Parameters
systReference to System object
graphReference to graph opbject
Returns
oms_status_enu_t Return oms_status_ok on success, oms_status_warning if solving was computed, but solution is not within tolerance and oms_status_error if an error occured.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NewKinsolSolver()

oms::KinsolSolver * oms::KinsolSolver::NewKinsolSolver ( const int  algLoopNum,
const unsigned int  size,
double  absoluteTolerance 
)
static

Create new oms::KinsolSolver::KinsolSolver object.

Parameters
algLoopNumNumber of algebraic loop
sizeDimension of algebraic loop
absoluteToleranceTolerance used for solving the loop
Returns
oms::KinsolSolver* Retruns pointer to KinsolSolver object
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nlsKinsolResiduals()

int oms::KinsolSolver::nlsKinsolResiduals ( N_Vector  uu,
N_Vector  fval,
void *  userData 
)
staticprivate

Residual function for KINSOL.

Parameters
uuInput value
fvalContains residual at output
userDataPointer to user data to access System, AlgLoop, Directed Graph and CSS as well as getReal and setReal
Returns
int Return 0 on success, 1 if an recoverable error occured, -1 if a fatal error occured.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sundialsErrorHandlerFunction()

void oms::KinsolSolver::sundialsErrorHandlerFunction ( int  errorCode,
const char *  module,
const char *  function,
char *  msg,
void *  userData 
)
staticprivate

Error handler function given to KINSOL.

Parameters
errorCodeError code from KINSOL
moduleName of the module reporting the error.
functionName of the function in which the error occurred.
msgError Message.
userDataPointer to user data. Unused.
Here is the caller graph for this function:

◆ sundialsInfoHandlerFunction()

void oms::KinsolSolver::sundialsInfoHandlerFunction ( const char *  module,
const char *  function,
char *  msg,
void *  userData 
)
staticprivate

Info handler function given to KINSOL.

Will only print information when debug loging is active.

Parameters
moduleName of the module reporting the information.
functionName of the function reporting the information.
msgMessage.
userDataPointer to user data. Unused.
Here is the caller graph for this function:

Member Data Documentation

◆ fnormtol

double oms::KinsolSolver::fnormtol
private

◆ fScale

N_Vector oms::KinsolSolver::fScale
private

◆ fTmp

N_Vector oms::KinsolSolver::fTmp
private

◆ initialGuess

N_Vector oms::KinsolSolver::initialGuess
private

◆ J

SUNMatrix oms::KinsolSolver::J
private

◆ kinsolMemory

void* oms::KinsolSolver::kinsolMemory
private

◆ linSol

SUNLinearSolver oms::KinsolSolver::linSol
private

◆ size

int oms::KinsolSolver::size
private

◆ uScale

N_Vector oms::KinsolSolver::uScale
private

◆ userData

void* oms::KinsolSolver::userData
private

◆ y

N_Vector oms::KinsolSolver::y
private

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