Diana
0.8.3
|
Solver for parallel simulation. More...
#include <PARDASPKSolver.hpp>
Classes | |
struct | sExchangeStruct |
Public Member Functions | |
PARDASPKSolver (Numeric::Solvers::Model::ICapeNumericModel *model) throw (Common::Error::ECapeUnknown) | |
const Common::Types::CapeString & | GetComponentName () const throw (Common::Error::ECapeUnknown) |
void | SetComponentName (const Common::Types::CapeString &_name) throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument) |
const Common::Types::CapeString & | GetComponentDescription () const throw (Common::Error::ECapeUnknown) |
void | SetComponentDescription (const Common::Types::CapeString &_description) throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument) |
Common::Collection::ICapeCollection * | GetParameters () throw (Common::Error::ECapeUnknown, Common::Error::ECapeFailedInitialisation, Common::Error::ECapeNoImpl) |
void | SetSimulationContext (Common::Identification::ICapeIdentification *simContextManager) throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeFailedInitialisation, Common::Error::ECapeNoImpl) |
void | Initialize () throw (Common::Error::ECapeUnknown, Common::Error::ECapeFailedInitialisation, Common::Error::ECapeOutOfResources, Common::Error::ECapeLicenceError, Common::Error::ECapeBadInvOrder) |
void | Terminate () throw (Common::Error::ECapeUnknown, Common::Error::ECapeOutOfResources, Common::Error::ECapeBadInvOrder) |
Numeric::Solvers::Solver::SolveReturn | Solve () throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder, Common::Error::ECapeSolvingError, Common::Error::ECapeOutOfResources) |
Common::Types::CapeArrayDouble | GetSolution () throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder) |
void | Destroy () throw (Common::Error::ECapeUnknown) |
void | SetRelTolerance (const Common::Types::CapeArrayDouble &relTolValue) throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeOutOfBounds) |
Common::Types::CapeArrayDouble | GetRelTolerance () throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder) |
void | SetAbsTolerance (const Common::Types::CapeArrayDouble &absTolValues) throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeOutOfBounds) |
Common::Types::CapeArrayDouble | GetAbsTolerance () throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder) |
Numeric::Solvers::Model::CapeArrayNumericEventInfo * | AdvanceToNextEvent (Numeric::Solvers::Model::CapeArrayNumericEventInfo endConditions, Common::Types::CapeDouble &timeBefore, Common::Types::CapeDouble &timeAfter) throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeOutOfBounds, Common::Error::ECapeBadInvOrder, Common::Error::ECapeSolvingError, Common::Error::ECapeOutOfResources, Common::Error::ECapeNoImpl) |
void | setValuesFromESO () |
void | RecalculateIC () |
void | SolveWR () throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder, Common::Error::ECapeSolvingError, Common::Error::ECapeOutOfResources) |
Static Protected Member Functions | |
static void | calculateResiduals (double *T, double Y[], double YPrime[], double Delta[], int IPar[]) |
static void | calculateJacobian (int *NEQ, double *T, double Y[], double YPRIME[], double *CJ, int IPAR[], int *RECALC) |
static void | LinearSolver (int *NEQ, double B[], int IPar[]) |
static void | SaveInternalStates (double *X, int *NEQ, int *KOLD, double PHI[], double PSI[], int IPar[]) |
Protected Attributes | |
Common::Types::CapeString | strName |
Common::Types::CapeString | strDescription |
Numeric::Solvers::Model::ICapeNumericModel * | pModel |
simulated model | |
Numeric::Solvers::Eso::ICapeNumericDAESO * | pESO |
current model ESO | |
Diana::DianaCollection | collParameters |
collections of the exported parameters | |
Common::Types::CapeBoolean | m_bStartSimulation |
flag, indicates whether it is necessary to restart integration | |
Common::Types::CapeBoolean | m_bNeedToInitialize |
CapeBoolean | m_bNeedToRestoreState |
CapeBoolean | m_bNeedToSaveState |
Common::Types::CapeLong | m_lVarsQuantity |
current number of the state variables | |
Common::Types::CapeLong | m_lEquationsQuantity |
current number of the equations | |
Common::Types::CapeDouble | dblT |
is the current value of the independent variable | |
Common::Types::CapeDouble | dblT0 |
is the initial value of the independent variable | |
Common::Types::CapeDouble | dblTend |
the final value of the independent variable | |
Common::Types::CapeLong | nVerboseLevel |
reporting level | |
int | nDASKPStatus |
int | nDASKPStatus_old |
status of DASKP solver | |
CapeDouble | dblRTol |
CapeDouble | dblAbsTol |
double * | vecRelTol |
Array with values of relative tolerances. | |
double * | vecAbsTol |
Array with values of absolute tolerances. | |
int * | IPar |
this working array used by DASPK | |
CapeDouble | m_dLastInternalSolverStep |
The value of last internal solver step. | |
struct Diana::PARDASPKSolver::sExchangeStruct | Adresses |
int | nLRW |
int | nLIW |
length of RWORK and IWORK - working arrays in ddaspk.f | |
double * | RWORK |
[*]_old data on previous iteration | |
double * | RWORK_old |
real work array for daspk.f | |
int * | IWORK |
int * | IWORK_old |
integer work array for daspk.f | |
double * | Y |
double * | Y_old |
variables | |
double * | YP |
double * | YP_old |
derivatives | |
double | T0_old |
int | m_nInfo [30] |
int | m_nInfo_old [30] |
info arrays for DASPK algorithm | |
CapeDouble | m_dMaxStep |
Maximal value of solver step. | |
CapeDouble | m_bNeedToPrint |
CapeDouble | m_dInitialStepSize |
Solver for parallel simulation.
Advances the solution of the DAESO with respect to its independent variable until some Event(s) occurs, or an error occurs in the solution process.
Note:For dynamic problems, we cannot be certain that the Solver will be able to identify precisely the single Event which causes termination. Thus we allow it to provide a list of Event objects, together with independent variable values which "bracket" the termination point.
endConditions | the list of stopping conditions for this call |
timeBefore | the independent variable value at the beginning of the internal step |
timeAfter | the independent variable value at the end of the internal step |
Implements ICapeNumericDAESolver.
static void calculateJacobian | ( | int * | NEQ, |
double * | T, | ||
double | Y[], | ||
double | YPRIME[], | ||
double * | CJ, | ||
int | IPAR[], | ||
int * | RECALC | ||
) | [static, protected] |
Jacobian calculation function - called from daspk solver (daspk.f).
static void calculateResiduals | ( | double * | T, |
double | Y[], | ||
double | YPrime[], | ||
double | Delta[], | ||
int | IPar[] | ||
) | [static, protected] |
Residuals calculation function - called from daspk solver (daspk.f).
void Destroy | ( | ) | throw (Common::Error::ECapeUnknown) [virtual] |
Deletes the Solver Component and all the objects associated to this particular Solver Component.
Implements ICapeNumericSolver.
Common::Types::CapeArrayDouble GetAbsTolerance | ( | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder) [virtual] |
Gets information on the absolute tolerance to be used in performing local error tests while solving the DAE system. The precise interpretation of this parameter will depend on individual implementations; the exact nature of the error measure used (e.g. local truncation error, local error etc.), and the way in which this is estimated, are not defined by CAPE-OPEN.
Implements ICapeNumericDAESolver.
const Common::Types::CapeString& GetComponentDescription | ( | ) | const throw (Common::Error::ECapeUnknown) [virtual] |
gets the description of the component.
Implements ICapeIdentification.
const Common::Types::CapeString& GetComponentName | ( | ) | const throw (Common::Error::ECapeUnknown) [virtual] |
gets the name of the component.
Implements ICapeIdentification.
Common::Collection::ICapeCollection* GetParameters | ( | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeFailedInitialisation, Common::Error::ECapeNoImpl) [virtual] |
Returns an ICapeCollection interface. This interface will contain a collection of ICapeParameter interfaces. This method allows any client to access all the Cape Open Parameters exposed by a model component. If the model component does not support exposing its parameters, it should raise the ECapeNoImpl error, instead of returning a NULL reference or an empty Collection. But if the PMC supports parameters but has for this call no parameters, it should return a valid ICapeCollection reference exposing zero parameters.
Implements ICapeUtilities.
Common::Types::CapeArrayDouble GetRelTolerance | ( | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder) [virtual] |
Gets information on the relative tolerance to be used in performing local error tests while solving a DAE system, as well as its current value. The precise interpretation of this parameter will depend on individual implementations; the exact nature of the error measure used (e.g. local truncation error, local error etc.), and the way in which this is estimated, are not defined by CAPE-OPEN.
Implements ICapeNumericDAESolver.
Common::Types::CapeArrayDouble GetSolution | ( | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder) [virtual] |
Gets all the values of the variables that solve this System.
Implements ICapeNumericSolver.
The environment will order the component to get initialized through this method. Any initialisation that could fail must be placed here. Initialize is guaranteed to be the first method called by the client (except low level methods such as class constructors or initialization persistence methods). Initialize has to be called once when the component is instantiated in a particular flowsheet. When the initialization fails, before signalling an error, the component must free all the resources that were allocated before the failure occurred. When the environment receives this error, it may not use the component anymore. The method terminate of the current interface must not either be called. Hence, the environment may only release the component through the middleware native mechanisms.
Implements ICapeUtilities.
static void LinearSolver | ( | int * | NEQ, |
double | B[], | ||
int | IPar[] | ||
) | [static, protected] |
Linear solver - called from daspk solver (daspk.f).
void SetAbsTolerance | ( | const Common::Types::CapeArrayDouble & | absTolValues | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeOutOfBounds) [virtual] |
Sets the absolute tolerance to be used in performing local error tests while solving the DAE system. The precise interpretation of this parameter will depend on individual implementations; the exact nature of the error measure used (e.g. local truncation error, local error etc.), and the way in which this is estimated, are not defined by CAPE-OPEN.
Implements ICapeNumericDAESolver.
void SetComponentDescription | ( | const Common::Types::CapeString & | _description | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument) [virtual] |
sets the description of the component.
_description | the description of the component |
Implements ICapeIdentification.
void SetComponentName | ( | const Common::Types::CapeString & | _name | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument) [virtual] |
sets the name of the component.
_name | the name of the component |
Implements ICapeIdentification.
void SetRelTolerance | ( | const Common::Types::CapeArrayDouble & | relTolValue | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeOutOfBounds) [virtual] |
Sets the relative tolerance values to be used in performing local error tests while solving a DAE system. The precise interpretation of this parameter will depend on individual implementations; the exact nature of the error measure used (e.g. local truncation error, local error etc.) and the way in which this is estimated are not defined by CAPE-OPEN.
relTolValue | the relative tolerance values. |
Implements ICapeNumericDAESolver.
void SetSimulationContext | ( | Common::Identification::ICapeIdentification * | simContextManager | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeFailedInitialisation, Common::Error::ECapeNoImpl) [virtual] |
Allows the environment to convey the component a reference to the former's simulation context. The simulation context will be environment objects which will expose a given set of Cape Open interfaces. Each of these interfaces will allow the component to call back the environment in order to benefit from its exposed services (such as creation of material templates, diagnostics or measurement unit conversion). If the component does not support accessing the simulation context, it is recommended to raise the ECapeNoImpl error.
simContextManager | the reference to the environment's simulation context class. For the component to use this class, this reference will have to be converted to each of the defined Cape Open Simulation Context interfaces. |
Implements ICapeUtilities.
Numeric::Solvers::Solver::SolveReturn Solve | ( | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder, Common::Error::ECapeSolvingError, Common::Error::ECapeOutOfResources) [virtual] |
Attempts to solve the system of equations defined within the Model associated with this solver instance. Return will occur in different circumstances:
Notes:The initial guesses for this solution will be the current variable values of the Model.
Implements ICapeNumericSolver.
void Terminate | ( | ) | throw (Common::Error::ECapeUnknown, Common::Error::ECapeOutOfResources, Common::Error::ECapeBadInvOrder) [virtual] |
The environment will order the component to get destroyed through this method. Any uninitialization that could fail must be placed here. Terminate is guaranteed to be the last method called by the client (except low level methods such as class destructors). Terminate may be called at any time, but may be only called once. When this method returns an error, the environment should report the user. However, after that the environment is not allowed to use the component anymore.
Implements ICapeUtilities.