C/C++ example for variable equation user subroutine

 

#include "stdafx.h"

#include "DllFunc.h"

 

Variable_API void __cdecl variable_usub

           (double time, double upar[], int npar, int jflag, int iflag, double* result)

{

           using namespace rd_syscall;

           // Parameter Information

           //   time   : Simulation time of RD/Solver. (Input)

           //   upar   : Parameters defined by user. (Input)

           //   npar   : Number of user parameters. (Input)

           //   jflag  : When RD/Solver evaluates a Jacobian, the flag is true. (Input)

           //   iflag  : When RD/Solver initializes arrays, the flag is true. (Input)

           //   result : Returned value. (Output)

 

           // User Statement

           double value, velo, stime;

           int iord, errflg;

 

           stime = 1.0;

           velo = 74.0;

           iord = 0;

 

           rd_step5(time,0.0,0.0,stime,velo,iord,&value,&errflg);

 

           *result = value;

}